首页 > 其他 > 详细

汇编钢琴

时间:2016-06-06 23:46:44      阅读:157      评论:0      收藏:0      [点我收藏+]
;电子琴

data segment
    note dw 262,294,330,349,392,440,494,523,578,659,698
data ends

code segment
    assume ds:data , cs:code
main proc far
    mov ax,data
    mov ds,ax
    
begin:
    call input
    call sound
    cmp si,80h    
    jnz begin
    
    mov ah,4ch
    int 21h
main endp

input proc near
    push ax
    push bx    
    mov ah,01
    int 21h 
    sub al,30h
    mov bl,2
    mul bl
    sub al,2
    mov si,al
    mov di,note[si]
    pop bx
    pop ax
    ret
input endp


sound proc near
    mov al,0b6h
    out 43,al
    mov dx,12h
    mov ax,348ch
    div di
    out 42h,al
    mov al,ah
    out 42h,al
    in al,61h
    mov ah,al
    or al,3
    out 61h,al
wait1:
    mov cx,15
delay:
    loop delay
    dec bx
    jnz wait1
    mov al,ah
    out 61h,al
    ret
sound endp

code ends
    end main

 

汇编钢琴

原文:http://www.cnblogs.com/da-peng/p/5565440.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!