MASM宏汇编程序,利用扬声器发声,利用键盘模拟电子琴键,当在键盘上按下1、2、3、4、5、6、7、8时,分别让扬声器发出1、2、3、4、5、6、
7、i的声音,按0作为结束标志。
1.data segment
notesdw 9108,8116,7231,6818,6088,5423,4831,4554
data ends
code segment
assumecs:code,ds:data
begin: movax,data
movds,ax
next: mov ah,0
int 16h
cmp al,30h
jz exit
sub al,31h
mov cl,2
mul cl
movsi,ax
movdx,notes[si]
in al,61h
or al,3
out 61h,al
mov al,0b6h;10110110B
out 43h,al
moval,dl
out 42h,al
moval,dh
out 42h,al
jmp next
exit: in al,61h
and al,0fch
out 61h,al
mov ah,4ch
int 21h
code ends
end begin