Beep() under Windows Me, 98 and 95
Posted: Mon Sep 05, 2005 12:31 pm
Code updated for 5.20+
The API call Beep_() does nothing particularly useful under Windows Me, 98 and 95 as it's two parameters are ignored.
Below is a procedure (and short test program) which honours the parameters.
IT WILL NOT WORK under WINDOWS XP and 2000. In these cases use Beep_() instead.
The API call Beep_() does nothing particularly useful under Windows Me, 98 and 95 as it's two parameters are ignored.
Below is a procedure (and short test program) which honours the parameters.
IT WILL NOT WORK under WINDOWS XP and 2000. In these cases use Beep_() instead.
Code: Select all
; Beep AKJ 05-Sep-05
Procedure Beep(freq, dur)
; The frequency is in Hertz
; The duration is in milliseconds
; Out($43,$B6)
! mov dx, $43
! mov al, $B6
! out dx, al
; al = Inp($61)
! mov dx, $61
! in al, dx
; Out($61,al Or 3)
! or al, $3
! out dx, al
; Period=1193180/freq
! mov dx, $12
! mov ax, $34DC
! mov bx, word[ESP]
! div bx ; Period is in ax
; Out($42,al) ; Period lo
! mov dx, $42
! out dx,al
; Out($42,ah) ; Period hi
! mov al, ah
! out dx, al ; This plays the sound
Delay(dur)
; Now stop the sound
; Out($43,$B6)
! mov dx, $43
! mov al, $B6
! out dx, al
; al = Inp($61)
! mov dx, $61
! in al, dx
; Out($61,al And $FC)
! and al, $FC
! out dx, al
EndProcedure
; Test program
dur=50 ; Experiment by changing the duration to 350 or even to 5
For i=1 To 4
For j=1 To 8
Beep(523, dur)
Beep(659, dur)
Next j
If i<>4: Delay(600): EndIf
Next i
End