求用汇编语言编写两首以上音乐的程序
要求:1、程序中提供一个音乐菜单2、用键盘数字键选择相应的音乐后,便开始播放原先编好的音乐程序3、输入错误时要有适当提示,并允许重新输入。...
要求:1、程序中提供一个音乐菜单
2、用键盘数字键选择相应的音乐后,便开始播放原先编好的音乐程序
3、输入错误时要有适当提示,并允许重新输入。 展开
2、用键盘数字键选择相应的音乐后,便开始播放原先编好的音乐程序
3、输入错误时要有适当提示,并允许重新输入。 展开
展开全部
自己看看,个好编。
PP EQU 30H
YF EQU 31H
JP EQU 32H
ORG 0000H
AJMP MAIN
ORG 000BH
JMP TIM0
MAIN: ORG 0050H
MOV TMOD, #01H
MOV IE, #82H
;SETB P3.5
SATR0: MOV PP,#0
NEXT: MOV A, PP
MOV DPTR,#QPM ;查曲谱码送
MOVC A,@A+DPTR
MOV R2, A
MOV A,R2
JZ END0
MOV A,R2
ANL A,#0FH ; 算出节拍
MOV JP,A
MOV A,R2
SWAP A
ANL A,#0FH ;算出音调值
MOV YF,A
MOV A,YF
JNZ SING
CLR TR0
AJMP D1
SING: MOV A,YF ;找出对应音调频率值,并送T0。
MOV DPTR,#TH
; MOV A,YF
MOVC A, @A+DPTR
MOV R7,A
MOV TH0,R7
MOV A,YF
MOV DPTR,#TL
MOVC A,@A+DPTR
MOV R0,A
MOV TL0,R0
SETB TR0
D1: LCALL DELAY
INC PP
LJMP NEXT
END0: CLR TR0
LJMP SATR0
TIM0: MOV TH0,R7
MOV TL0,R0
CPL P3.5
RETI
DELAY: MOV R6,#2
D2: MOV R5,#120
D3: MOV R4,#248
DJNZ R4,$
DJNZ R5,D3
DJNZ R6,D2
DJNZ JP,DELAY
RET
TH: DB 02H, 0FCH, 0FCH, 0FDH, 0FDH, 0FDH, 0FDH, 0FEH, 0FBH, 0FBH, 0FCH, 0FEH, 0FEH, 0FEH, 0FEH, 0FEH
TL: DB 02H, 44H, 0ACH, 09H, 34H, 82H, 0C8H, 06H , 04H, 90H, 0CH, 22H, 56H, 65H, 9AH, 0C1H
;康定情歌
QPM: DB 34H,52H,63H,62H,52H,64H,32H,28H
DB 33H,32H,52H,63H,62H,52H,63H,32H,37H
DB 34H,52H,63H,62H,52H,63H,32H,28H
DB 53H,52H,32H,22H,32H,22H,12H,24H,98H
DB 93H,22H,28H,53H,32H,38H,22H,12H,98H, 53H,52H,32H,22H,32H,22H,12H,23H,98H
DB 93H,22H,28H,53H,32H,38H,23H,12H,98H, 53H,52H,32H,22H,32H,22H,12H,22H,65H
DB 00H
END
PP EQU 30H
YF EQU 31H
JP EQU 32H
ORG 0000H
AJMP MAIN
ORG 000BH
JMP TIM0
MAIN: ORG 0050H
MOV TMOD, #01H
MOV IE, #82H
;SETB P3.5
SATR0: MOV PP,#0
NEXT: MOV A, PP
MOV DPTR,#QPM ;查曲谱码送
MOVC A,@A+DPTR
MOV R2, A
MOV A,R2
JZ END0
MOV A,R2
ANL A,#0FH ; 算出节拍
MOV JP,A
MOV A,R2
SWAP A
ANL A,#0FH ;算出音调值
MOV YF,A
MOV A,YF
JNZ SING
CLR TR0
AJMP D1
SING: MOV A,YF ;找出对应音调频率值,并送T0。
MOV DPTR,#TH
; MOV A,YF
MOVC A, @A+DPTR
MOV R7,A
MOV TH0,R7
MOV A,YF
MOV DPTR,#TL
MOVC A,@A+DPTR
MOV R0,A
MOV TL0,R0
SETB TR0
D1: LCALL DELAY
INC PP
LJMP NEXT
END0: CLR TR0
LJMP SATR0
TIM0: MOV TH0,R7
MOV TL0,R0
CPL P3.5
RETI
DELAY: MOV R6,#2
D2: MOV R5,#120
D3: MOV R4,#248
DJNZ R4,$
DJNZ R5,D3
DJNZ R6,D2
DJNZ JP,DELAY
RET
TH: DB 02H, 0FCH, 0FCH, 0FDH, 0FDH, 0FDH, 0FDH, 0FEH, 0FBH, 0FBH, 0FCH, 0FEH, 0FEH, 0FEH, 0FEH, 0FEH
TL: DB 02H, 44H, 0ACH, 09H, 34H, 82H, 0C8H, 06H , 04H, 90H, 0CH, 22H, 56H, 65H, 9AH, 0C1H
;康定情歌
QPM: DB 34H,52H,63H,62H,52H,64H,32H,28H
DB 33H,32H,52H,63H,62H,52H,63H,32H,37H
DB 34H,52H,63H,62H,52H,63H,32H,28H
DB 53H,52H,32H,22H,32H,22H,12H,24H,98H
DB 93H,22H,28H,53H,32H,38H,22H,12H,98H, 53H,52H,32H,22H,32H,22H,12H,23H,98H
DB 93H,22H,28H,53H,32H,38H,23H,12H,98H, 53H,52H,32H,22H,32H,22H,12H,22H,65H
DB 00H
END
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |