|

- UID
- 64132
- 帖子
- 57
- 积分
- 602
- 威望
- 36 点
- A币
- 404 元
- 阅读权限
- 25
- 最后登录
- 2007-5-29
|
1#
发表于 2007-5-10 13:33
| 只看该作者
跪求改一个汇编语言源程序。有报酬!感激不尽啊!!!
各位电脑爱好者好友们:
大家好!
{请管理员和斑竹给我多点参考答案啊,不要那么早关闭回复啊,谢谢啊……}
我在学习过程中遇到一个难题,请知道的帮我一下好吗?我将会有酬谢的。我的QQ是:692005(感谢大家)
请帮我改个汇编语言源程序:
问题:利用键盘和扬声器实现电子琴功能:按不同的按键发出不同频率的声音。键可以设置是1,2,3……如此等等都可以。我有报酬的,不管改多了只要改了就好。(顺便加点注释,谢谢)我的QQ是:692005,汇编程序如下:
.model small
.386
.stack 20h
.code
start: mov ah,6
mov dl,0ffh
int 21h
je start
.if al!=0dh
call beep
jmp start
.endif
nop
.exit
ep proc near
mov al,0b6h ;the control word is moved to 43h
out 43h,al
mov cx,0fffh ;the count value is 0fffh
mov al,cl ;the low byte is moved to 42h
out 42h,al ;
mov al,ch ;the high byte is moved to 42h
out 42h,al ;
in al,61h ;read port 61h
or al,3 ;set b1 and b0
out 61h,al ;drive the speaker
mov ecx,0fffffffh ;move the value for delay into ecx
lay: loopd delay ;delay
in al,61h ;read port 61h
and al,0fch ;clear b1 and b0
out 61h,al ;close the speaker
ret
ep endp
end start
|
|