其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
使用8253实现使用1到8弹奏歌曲

作者:未知 来源:月光软件站 加入时间:2005-5-13 月光软件站

;使用8253实现使用1到8弹奏歌曲

;其他键退出

data segment
 message  db 'Use 1 ... 8 to play the music','$'
 frequ dw 262, 294, 330, 347, 392, 440, 494, 524
data ends
code segment
 assume cs:code, ds:data
start:
 mov ax, data
 mov ds, ax
 
 lea dx, message
 mov ah, 09h
 int 21h
 
 mov al, 10110110b
 out 43h, al  ;set the control
 
next: mov ah, 7
 int 21h
 
 cmp al, '1'
 jb  exit
 cmp al, '8'
 ja  exit
 ;get the frequency of the number
 sub al, 30h
 mov ah, 0
 mov bx, ax
 sub bx, 1
 shl bx, 1
 mov cx, frequ[bx]
 ;get the counter
 mov ax, 34dch
        mov dx, 12h  ;DX:AX=1234DCH=1193180D
        div cx
 mov bx, ax   ;set the counter
 
 mov ax, bx
        out 42h, al  ;send the lower
        mov al, ah
        out 42h, al  ;send th  higner       
 
 in  al, 61h  ;set the 0 and 1 as '1'
 or  al, 03h
 out 61h, al
 
 mov cx, 0ffffh
delay:  mov dx, 100h
dec_dx: dec dx
        jnz dec_dx
        loop delay
       
        in  al, 61h
        and al, 11111100b
        out 61h, al  ;open the voice     
 jmp next
exit:
 mov ah, 4ch
 int 21h 
code ends
end start




相关文章

相关软件