DATA SEGMENT
BAK DB ?
TMP DB ?
MUSIC1 DB 33H, 33H, 3DH, 33H, 26H, 26H, 26H, 26H, 2DH, 2DH, 26H, 2DH, 33H
DB 33H, 33H, 33H, 33H, 33H, 4DH, 45H, 3DH, 3DH, 3DH, 45H, 4DH, 45H
DB 45H, 45H, 45H, 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H
DB 26H, 28H, 2DH, 2DH, 26H, 26H, 33H, 33H, 33H, 33H, 45H, 3DH, 39H
DB 39H, 39H, 52H, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 2DH, 2DH
DB 26H, 26H, 26H, 26H, 26H, 26H, 28H, 28H, 2DH, 28H, 26H, 26H, 26H
DB 26H, 2DH, 28H, 26H, 2DH, 2DH, 33H, 3DH, 4DH, 45H, 45H, 45H, 45H
DB 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H, 26H, 28H, 2DH
DB 2DH, 26H, 2DH, 33H, 33H, 33H, 33H, 33H, 33H, 45H, 3DH, 39H, 39H
DB 39H, 52H, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 00H
MUSIC2 DB 2DH, 26H, 2DH, 33H, 33H, 33H, 33H, 33H, 33H, 45H, 3DH, 39H, 39H
DB 45H, 45H, 45H, 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H
DB 26H, 28H, 2DH, 2DH, 26H, 26H, 33H, 33H, 33H, 33H, 45H, 3DH, 39H
DB 39H, 39H, 52H, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 2DH, 2DH
DB 26H, 26H, 26H, 26H, 26H, 26H, 28H, 28H, 2DH, 28H, 26H, 26H, 26H
DB 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H, 26H, 28H, 2DH
DB 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H, 26H, 28H, 2DH
DB 45H, 45H, 45H, 45H, 45H, 45H, 45H, 33H, 33H, 3DH, 33H, 26H, 26H
DB 39H, 52H, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 4DH, 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
;8255_init a:output b:input c:output
MOV AL,82H
OUT 63H,AL
;8253_init 设置计数器2工作在方式3 cplck---1.1625mhz
MOV AL,0B7H
OUT 43H,AL
GET_KEY:
IN AL,60H ;读按键的值 确定要播放的歌曲
CMP AL,0
JZ GET_KEY
CMP AL,01H
JZ A1 ;第一首
JMP A2 ;第二首
A1:
MOV BX,OFFSET MUSIC1
MOV TMP,1
MOV AL,[BX]
MOV AH,00H
JMP DO