📄 twotiger.asm
字号:
data segment
freq dw 262,294,330,262,262,294,330,262,330,349,392,330,349,392
dw 392,440,392,349,330,262,392,440,392,349,330,262,262,196,262,262,196,262
dw -1
time dw 200,200,200,200,200,200,200,200,200,200,400,200,200,400
dw 150,50,150,50,200,200,150,50,150,50,200,200,200,200,400,200,200,400
data ends
code segment
assume cs:code,ds:data
main proc far
start:mov ax,data
mov ds,ax
mov si,offset freq
mov di,offset time
l1: mov cx,[si]
cmp cx,-1
je exit
mov bx,[di]
call gensound
add si,2
add di,2
jmp l1
exit:mov ax,4c00h
int 21h
main endp
gensound proc near
push dx
mov al,0b6h
out 43h,al
mov dx,08h
mov ax,3208h
div cx
out 42h,al
mov al,ah
out 42h,al
in al,61h
mov ah,al
or al,3
out 61h,al
wait1: mov cx,663
call waitf
dec bx
jnz wait1
mov al,ah
out 61h,al
pop dx
ret
gensound endp
waitf proc near
push ax
waitf1:
in al,61h
and al,10h
cmp al,ah
je waitf1
mov ah,al
loop waitf1
pop ax
ret
waitf endp
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -