硬件课程设计报告 - 电子琴 - 图文 下载本文

中国矿业大学计算机学院信息安全10-4班硬件课程设计——电子琴

OUT DX, AL CALL DELAY JMP GG

LED DB 07H,66H,06H,3FH DB 00H,00H,00H,00H DB 7FH,6DH,5BH,71H

DB 00H,00H,00H,00H DB 00H,00H,00H,00H DB 00H,00H,00H,00H DB 00H,00H,00H,00H

DB 00H,00H,00H,00H DB 6FH,7DH,4FH,79H DB 00H,00H,00H,00H DB 77H,7CH,39H,5EH

DB 00H,00H,00H,00H DB 00H,00H,00H,00H DB 00H,00H,00H,00H DB 00H,00H,00H,00H DB 00H,00H,00H,00H

DELAY PROC NEAR MOV DX, 200H MOV AL, 80H OUT DX, AL PUSH CX MOV CX, 60000D LOOP $ MOV DX, 200H MOV AL, 00H OUT DX, AL POP CX RET

DELAY ENDP

CODE ENDS END START

预置音乐程序:

- 33 -

中国矿业大学计算机学院信息安全10-4班硬件课程设计——电子琴

Z8279 EQU 212H D8279 EQU 210H

LEDMOD EQU 00H ;左边输入,八位显示外部译码八位显示 LEDFEQ EQU 38H

CODE SEGMENT ASSUME CS: CODE START:MOV DX, Z8279 MOV AL, 00H OUT DX, AL MOV AL, 38H OUT DX, AL

MOV DX, 20BH MOV AL, 00110111B OUT DX, AL

PD: MOV DX, 200H MOV AL, 00H OUT DX, AL MOV AL, 00H MOV DX, Z8279 MOV AL, 0C2H OUT DX, AL

WAIIT: NOP IN AL, DX MOV BL, AL AND AL, 80H CMP AL, 80H JE WAIIT 跳转等待 MOV AL, BL AND AL, 0FH CMP AL, 00H JE WAIIT MOV AL, 00H

MOV DX, D8279 CMP AL, 28H JE GAO

CMP AL, 28H JE ZHONG CMP AL, 28H JE DIY

;扫描频率 ;8279初始化 ;8253初始化 ;置空FIFO寄存器 ;FIFO正在清除期间则 ;无键按下则等待 ;判断是哪个键 - 34 -

中国矿业大学计算机学院信息安全10-4班硬件课程设计——电子琴

GAO:CALL GAOYIN JMP PD

ZHONG:CALL ZHONGYIN JMP PD

DIY:CALL DIYIN JMP PD

ZHONGYIN PROC NEAR MOV CX,02H

WW1:MOV DX, 208H ;1 MOV AL, 24H OUT DX, AL MOV AL, 38H OUT DX, AL

CALL DELAY2 MOV DX, 208H ;2 MOV AL, 07H OUT DX, AL MOV AL, 34H OUT DX, AL

CALL DELAY2 MOV DX, 208H ;3 MOV AL, 34H OUT DX, AL MOV AL, 30H OUT DX, AL

CALL DELAY2 ;1 MOV DX, 208H MOV AL, 24H OUT DX, AL MOV AL, 38H OUT DX, AL CALL DELAY2 LOOP WW1

MOV CX,02H WW3:

MOV DX, 208H MOV AL, 34H OUT DX, AL MOV AL, 30H OUT DX, AL

CALL DELAY2 MOV DX, 208H

- 35 -

中国矿业大学计算机学院信息安全10-4班硬件课程设计——电子琴

MOV AL, 65H OUT DX, AL MOV AL, 28H OUT DX, AL

CALL DELAY2 MOV DX, 208H MOV AL, 51H OUT DX, AL MOV AL, 25H OUT DX, AL CALL DELAY2

MOV DX, 208H MOV AL, 51H OUT DX, AL MOV AL, 25H OUT DX, AL

CALL DELAY2 LOOP WW3 MOV CX,02H WW5:

MOV DX, 208H MOV AL, 51H OUT DX, AL MOV AL, 25H OUT DX, AL

CALL DELAY MOV DX, 208H MOV AL, 72H OUT DX, AL MOV AL, 22H OUT DX, AL

CALL DELAY ; MOV DX, 208H MOV AL, 51H OUT DX, AL MOV AL, 25H OUT DX, AL CALL DELAY MOV DX, 208H MOV AL, 65H OUT DX, AL MOV AL, 28H OUT DX, AL CALL DELAY

- 36 -