中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > 综合其它
使用8253实现使用1到8弹奏歌曲
作者:未知 时间:2005-07-27 23:20 出处:CSDN 责编:chinaitpower
              摘要:使用8253实现使用1到8弹奏歌曲

;使用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


关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有