Z8
®
CPU
User Manual
UM001604-0108
Instruction Description
187
Interrupt Return
Syntax
IRET
Instruction Format
Operation
FLAGS
←
@SP
SP
←
SP + 1
PC
←
@SP
SP
←
SP + 2
IMR (7)
←
1
This instruction is issued at the end of an interrupt service routine. It restores the Flag Reg-
ister (Control Register
FCh
) and the PC. It also re-enables any interrupts that are poten-
tially enabled.
Example
If Stack Pointer Low Register
FFh
currently contains the value
45h
, Register
45h
contains
the value
00h
, Register
46h
contains
6Fh
, and Register 47 contains
E4h
, the statement:
IRET
Op Code: BF
restores the FLAG Register
FCh
with the value
00h
, restores the PC with the value 6FE4h,
re-enables the interrupts, and sets the Stack Pointer Low to 48h. The next instruction to be
executed is at location 6FE4h.
Cycles
OPC
(Hex)
OPC
16
8F
Flag
Description
C
Restored to original setting before the interrupt occurred.
Z
Restored to original setting before the interrupt occurred.
S
Restored to original setting before the interrupt occurred.
V
Restored to original setting before the interrupt occurred.
D
Restored to original setting before the interrupt occurred.
H
Restored to original setting before the interrupt occurred.