我的课程设计,上传供大家参考
DATA SEGMENT
TAB DB 06H,5BH,4FH,66H,6DH,7CH,07H,7FH,67H ;1~9的段码;
BZ DB 00H
DATA ENDS
STACK SEGMENT PARA STACK 'STACK'
DB 100H DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START: MOV AX,DATA
MOV DS,AX ;8259A初始化
MOV AL,13H ;初始化8259A的ICW1
OUT 20H,AL
MOV AL,08H ;送中断类型码基值,8259A的ICW2
OUT 21H,AL
MOV AL,0DH ;一般中断结束方式,8259A的ICW4
OUT 21H,AL ;8255A初始化
MOV AL,98H ;置8255A工作方式
OUT 83H,AL
XOR AL,AL ;B口、C口初始化
OUT 81H,AL
OUT 82H,AL ;8253初始化
MOV AL,37H ;置8253通道0控制字
OUT 43H,AL
MOV AL,00H ;置8253通道0计数初值为4000
OUT 40H,AL
MOV AL,40H
OUT 40H,AL
MOV AL,73H ;置8253 通道1控制字
OUT 43H,AL
MOV AL,00H ;置8253通道1计数初值为3000 OUT 41H,AL
MOV AL,30H
OUT 41H,AL
MOV AL,0B7H ;置8253通道2控制字
OUT 43H,AL
MOV AL,00H ;置8253通道2控制字
OUT 42H,AL
MOV AL,00H ;置8253通道2计数初值为0
OUT 42H,AL
MOV AL,00H
OUT 42H,AL ;中断设置
MOV AH,25H ;设置抢答按键中断向量
MOV AL,0AH ;中断类型号为入口参数
MOV BX,SEG KEYINT ;DS:DX指向4字节地址
MOV DS,BX
MOV DX,OFFSET KEYINT
INT 21H
STI ;使IF置1,开放可屏蔽中断
;主循环
1