
Instruction Set
4-32
CLI
CLI
Examples
This example of an interrupt-service routine: enables interrupts so that interrupt nesting
can occur, resets a device, disables interrupts until the interrupted procedure is resumed,
and then clears the in-service bits in the In-Service (INSERV) register by writing to the End-
Of-Interrupt (EOI) register.
T ips
When the Interrupt-Enable Flag (IF) is cleared to 0 so that all maskable interrupts are
disabled, you can still use INT to generate an interrupt, even if it is masked by its interrupt
control register.
Software interrupts and traps, and nonmaskable interrupts are not affected by the IF flag.
The IRET instruction restores the value of the Processor Status Flags register from the
value pushed onto the stack when the interrupt was taken. Modifying the Processor Status
Flags register via the STI, CLI or other instruction will not affect the flags after the IRET.
If you disable maskable interrupts using CLI, the microcontroller does not recognize
maskable interrupt requests until the instruction that follows STI is executed.
After using CLI to disable maskable interrupts, use STI to enable them as soon as possible
to reduce the possibility of missing maskable interrupt requests.
Related Instruc tions
If you want to
Enable maskable interrupts that are not masked by their interrupt control registers STI
See
; the microcontroller pushes the flags onto
; the stack before executing this routine
; enable interrupt nesting during routine
ISR1
PROC
FAR
PUSHA
STI
; save general registers
; enable unmasked maskable interrupts
mRESET_DEVICE1
CLI
; perform operation (macro)
; disable maskable interrupts until IRET
; reset in-service bits by writing to EOI register
MOV
DX,INT_EOI_ADDR
MOV
AX,8000h
OUT
DX,AX
; address of EOI register
; non-specific EOI
; write to EOI register
POPA
IRET
; restore general registers
ISR1
ENDP
; the microcontroller pops the flags from the stack
; before returning to the interrupted procedure