-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Although the code sets the "default" value of 0FFh to AH, that will not get written to INT_LAST i
INT_IRQ PROC
ASSUME DS:_BDA
PUSH AX ; save registers
PUSH BX
MOV BX, SEG _BDA ; set up for DS to BDA
MOV AX, DBW <0FFH, OCW3 <,,,,11B>> ; AL = OCW3 (Read ISR reg on next pulse)
; AH = default return 0xFF in INT_LAST <-- default value
OUT INT_P0, AL ; write to PIC port 0 (20h)
PUSH DS ; save DS and delay for PIC at least 1 clock pulse
IN AL, INT_P0 ; get In-Service Register (ISR)
TEST AL, AL ; is there an active hardware interrupt?
JZ INT_IRQ_DONE ; jump and exit if not <-- if there is no active interrupt, it will exit without writing 0FFh to INT_LAST
MOV AH, AL ; Save ISR in AH
IN AL, INT_IMR ; get current Interrupt Mask Register (IMR)
MOV DS, BX ; set DS to BDA
MOV INT_LAST, AH ; save last interrupt to BDA and delay for PIC <-- not reached if there is no active interrupt
OR AL, AH ; apply IMR mask to ISR
OUT INT_IMR, AL ; write AL to PIC port 1 (21h)
MOV AL, INT_EOI ; End of Interrupt OCW
OUT INT_P0, AL ; write EOI to PIC port 0 (20h)
INT_IRQ_DONE:
POP DS
POP BX
POP AX
IRETINT_IRQ ENDP