[net.micro.pc] How to make PC beeps - Again

shangc@azure.UUCP (02/24/84)

Sorry about posting this again.  I did not make my self clear last time.
I have a Tecmar graphics board. The software I am writing uses the high-res
graphics mode. I like to make the PC beeps without using either putchar('^G')
or printf("^G") because I don't want to include all the printf related runtime
routines if I don't have to.  Beside, they may not work in the graphics mode
either ( I have not tried them yet). I would appreciate if anyone has experience 
in writing something to the sound port to make the PC beeps in C or assembly
code.  Thanks.
						Shang Chyou

jim@randvax.ARPA (Jim Gillogly) (02/28/84)

----------
There's a beep routine in the ROM at location E666.  It produces a beep
at 896 Hz (by my computations) (as opposed to the 1000 Hz that the
comments claim).  It reads as follows:

BEEP    PROC    NEAR
	MOV     AL,10110110B    ;SEL TIM 2,LSB,MSB,BINARY
	OUT     TIMER+3,AL      ;WRITE THE TIMER MODE REG
	MOV     AX,533H         ;DIVISOR FOR 896 HZ
	OUT     TIMER+2,AL      ;WRITE TIMER 2 CNT - LSB
	MOV     AL,AH
	OUT     TIMER+2,AL      ;WRITE TIMER 2 CNT - MSB
	IN      AL,PORT_B       ;GET CURRENT SETTING OF PORT
	MOV     AH,AL           ;SAVE THAT SETTING1