码迷,mamicode.com
首页 > 其他好文 > 详细

汇编钢琴

时间:2016-06-06 23:47:49      阅读:208      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!