COUNT1 EQU 209H COUNT2 EQU 20AH Z8255 EQU 203H D8255A EQU 200H D8255B EQU 201H D8255C EQU 202H DATA SEGMENT SEC DB 1 DUP(?) SIGN1 DB 1 DUP(?) DATA ENDS
CODE SEGMENT ASSUME CS:CODE START:
;8255初始化
MOV DX,Z8255 ;控制端口8255 MOV AL,10000010B ;B口输入,A口输出 OUT DX,AL
MOV DX,D8255A
MOV AL,0FFH ;清零 OUT DX,AL ;8253初始化
MOV AL, 00110101B ; 计数器0,先读/写低字节,后高字节,方式2,BCD
MOV DX, Z8253 OUT DX, AL
MOV Al, 00H MOV DX, COUNT0
OUT DX, AL ; 计数器低字节 MOV AL, 50H
OUT DX, AL ; 计数器高字节
MOV AL, 01110111B ; 计数器1,先读/写低字节,后高字节,方式3,BCD
MOV DX, Z8253 OUT DX, AL MOV AL, 00H
MOV DX, COUNT1
OUT DX, AL ; 计数器低字节 MOV AL, 04H OUT DX, AL MOV DX,Z8279
MOV AL,00H ;设置8279的工作方式,8个字符显示,右入口 OUT DX,AL