利用8259的IRO 引脚做为中断请求的输入端,实现两个连续的亮点从左至右(L1L2→L2L3..→L7L8)依次点亮。
例程:
CODE SEGMENT
ASSUME CS:CODE
ORG 12DOH
START:JMP STARTO
BUF DB 11111100B,11111001B,11110011B,11100111B
DB 11001111B,10011111B, 00111111B
TO EQU 0040H
T1 EQU 0041H
CN EQU 0043H
STARTO:
MOV AL,00110110B
MOV DX,CN
OUT DX,AL
MOV AX,50000
MOV DX,TO
OUT DX,AL
MOV AL,AH
OUT DX,AL
MOV AL,01110110B
MOV DX,CN
OUT DX,AL
MOV DX,T1
MOV AX,20
OUT DX,AL
MOV AL,AH
OUT DX,AL ;8253
MOV AL, 13H
MOV DX, 0FF80H
OUT DX, AL ;ICW1
MOV AL,08H
MOV DX,0FF81H
OUT DX, AL ;ICW2
MOV AL,01H
OUT DX, AL ;ICW4
MOV AL,OFEH
OUT DX,AL ;OCW1
LEA AX, LED1
MOV SI, 0020H
MOV [SI],AX
MOV[SI+2],0000H
MOV DX, OFF90H
MOV AL, OFFH
OUT DX, AL
LEAI DI, BUF
MOV BX, O00OH
STI
LOP:
JMP LOP
LED1 PROC NEAR
CLI
MOV DX, OFF90H
MOV AL,[DI]
OUT DX,AL
INC DI
INC BX
CMP BX,7
JNZ FIN
LEA DI, BUF
MOV BX, 0
FIN: MOV AL, 20H
MOV DX, OFF80H
OUT DX, AL
STI
IRET
LED1 ENDP
CODE ENDS
END START

类似文章