PC机扬声器发声程序的调试....
dseg segment
freg dw 262, 294,330,349,392,440,494
times dw 7 dup(65535)
num db ?
num1 db 3
count db 7
mess db '*musci1.exe*','$'
dseg ends
stack segment para stack 'stack'
dw 100 dup(?)
stack ends
cseg segment
assume cs:cseg,ds:dseg,ss:stack
main proc far
start: push ds
sub ax,ax
push ax
mov ax,dseg
mov ds,ax
mov es,ax
mov al,1ch
mov ah,35h
int 21h
push es
push bx
push ds
mov dx,offset musc
mov ax,seg musc
mov ds,ax
mov al,1ch
mov ah,25h
int 21h
pop ds
in al,21h
and al,0feh
out 21h,al
sti
mov cl,0
mov byte ptr num,cl
lp1: mov cl,byte ptr num
mov al,cl
inc al
cmp al,1bh
jnz lp2
mov al,1
lp2: mov cl,al
mov byte ptr num,cl
add al,40h
mov dl,al
mov ah,2
int 21h
mov dh,10
lp4: mov cx,0
lp3: loop lp3
dec dh
jnz lp4
mov al,byte ptr num1
xor al,0
jnz lp1
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
in al,21h
or al,1
out 21h,al
cli
ret
main endp
musc proc near
push ds
push ax
push cx
push dx
mov ax,dseg
mov ds,ax
dec count
jnz exit
mov dx, offset mess
mov ah, 9
int 21h
mov si, offset freg
mov bp, offset times
loop1:mov di,[si]
cmp di,0
je exit1
mov bx,ds:[bp]
call sound
add si,2
add bp,2
jmp loop1
exit1: mov byte ptr count,7
dec byte ptr num1
exit: sti
pop dx
pop cx
pop ax
pop ds
iret
musc endp
sound proc near
push ax
push bx
push cx
push dx
push di
mov al,0b2h
out 43h,al
mov dx,12h
mov ax,3280h
div di
out 42h,al
mov al,ah
out 42h,al
in al,61h
mov ah,al
or al,3
out 61h,al
delay: mov cx,20000
loop2: loop loop2
dec bx
jne delay
mov al,ah
out 61h,al
pop ax
pop bx
pop cx
pop dx
pop di
ret
sound endp
cseg ends
end main
调试不通,求大神//
[解决办法]
能 调过。masm 5.0过了。。。