I know the rules and that you don't give the complete solution. I have found a way to send signal to 61H,43H and 42H and defining the desired frequency but I'm not sure it is giving me the frequency correctly because I saw in some sites that it had done many calculations before setting the frequency...
well, I can send u the code and u check it for me, thanks.
CODE
.model small
.stack 32
.data
freq dw ?
.code
;The macro which generates the sound of specific frequency.
sound proc ;freq is the frequency
which is gonna be generated.
mov al,0b6h ;load control word
out 43h,al ;send it
mov ax,freq ;tone frequency into AX
out 42h,al ;send LSB
mov al,ah ;move MSB to AL
out 42h,al ;send it
in al,61h ;get port 61 state
or al,03h ;turn on speaker
out 61h,al ;speaker on now
mov bx, 3000
pause3: mov cx, 65535
pause4: dec cx
jne pause4
dec bx
jne pause3
in al,61h ;get port 61 state
and al,0fch ;turn off speaker
out 61h,al ;speaker off now
sound endp
main proc far
mov ax,@data
mov ds,ax
next: mov ah,07
int 21h
cmp al,'a'
je beepA
cmp al,'A'
je beepA
cmp al,'s'
je beepS
cmp al,'S'
je beepS
cmp al,'d'
je beepD
cmp al,'D'
je beepD
cmp al,'f'
je beepF
cmp al,'F'
je beepF
cmp al,'g'
je beepG
cmp al,'G'
je beepG
cmp al,'h'
je beepH
cmp al,'H'
je beepH
cmp al,'j'
je beepJ
cmp al,'J'
je beepJ
cmp al,'k'
je beepK
cmp al,'K'
je beepK
cmp al,27
je exit
jmp exit
beepA: mov freq,400
call sound
jmp next
beepS: mov freq,450
call sound
jmp next
beepD: mov freq,506
call sound
jmp next
beepF: mov freq,537
call sound
jmp next
beepG: mov freq,604
call sound
jmp next
beepH: mov freq,679
call sound
jmp next
beepJ: mov freq,763
call sound
jmp next
beepK: mov freq,810
call sound
jmp next
exit: mov ah,4ch
int 21h
main endp
end main