|
Post by whathim on Apr 21, 2023 21:51:30 GMT 1
Jos I came across this – it’s hardly an issue but I though it might be mildly interesting. When the attached program is run, there is a several second delay between calling SoundAlert and returning (like 5 – 6 second). Even if I comment out the DELAY statement, there is a noticeable delay but mainly between the return from SoundAlert and program exit. Keith ' Sounds an alert sound - more pleasant than beep.
'
SUB SoundAlert ()
SOUND 300, 1.0 '300 Hertz for 1.0 clock ticks
DELAY 0.3 'Delay for 0.3 second
SOUND 100, 0.7 '100 Hertz for 0.7 clock ticks
END SUB
' PowerBasic Documentation Fragments:
'
' [SOUND second argument] ...specifies the length of the tone as measured in
' clock ticks. Clock ticks occur at the rate of 18.2 times per second, ...
'
' SOUND doesn't hold up program execution. When SOUND is encountered, the
' requested tone is begun and execution proceeds normally. [If a second SOUND
' is encountered] ...PowerBasic waits until the first sound completes before
' executing the new SOUND statement.
'
' [DELAY argument] ...indicating the number seconds PowerBasic should pause ...
' DELAY accepts both integer and floating-point arguments, so that fractional
' delays may be specified.
PRINT
PRINT "CALL SoundAlert() "
CALL SoundAlert()
PRINT "...returned "
END
Attachments:TEST04.EXE (24.87 KB)
|
|
|
Post by Jos on Apr 22, 2023 8:47:17 GMT 1
The pause at the end is caused by the program loop: 1AD5 FB STI 1AD6 2EF606EE2620 TEST BYTE PTR CS:[26EE],20 1ADC 75F7 JNZ 1AD5 So it’s waiting for bit 5 to become 0. That would be done by the timer tick routine INT 08h. Attached the code of PB for that. Seems the PIT is programmed to increase the frequency of the timer tick. And that is ignored by vDos, too obscure and the timer ticks essentially come from Windows API. Jos Attachments:tick08.asm (1.97 KB)
|
|
|
Post by whathim on Apr 22, 2023 12:36:45 GMT 1
Thanks for looking at that and the explanation – much appreciated.
Keith
|
|