下面的代码是我按照课本给的控制扬声器发声程序写的代码,运行没有报错,但是扬声器一直没有声音。win7系统,masm2011
DATAS SEGMENT
fre dw 1000h
;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
;此处输入代码段代码
mov ax,fre
call speaker
call speakon
mov ah,1
int 21h
call speakoff
speaker proc
push ax
mov al,0b6h
out 43h,al
pop ax
out 42h,al
mov al,ah
out 42h,al
ret
speaker endp
speakon proc
push ax
in al,61h
or al,03h
out 61h,al
pop ax
ret
speakon endp
speakoff proc
push ax
in al,61h
and al,0fch
out 61h,al
pop ax
ret
speakoff endp
MOV AH,4CH
INT 21H
CODES ENDS
END START