Iret Interrupt Return - Samsung S3C84I8 User Manual

Table of Contents

Advertisement

INSTRUCTION SET
IRET
— Interrupt Return
IRET (Normal)
IRET
FLAGS ← @SP
Operation:
SP ← SP + 1
PC ← @SP
SP ← SP + 2
SYM(0) ← 1
This instruction is used at the end of an interrupt service routine. It restores the flag register and
the program counter. It also re-enables global interrupts. A "normal IRET" is executed only if the
fast interrupt status bit (FIS, bit one of the FLAGS register, 0D5H) is cleared (= "0"). If a fast
interrupt occurred, IRET clears the FIS bit that was set at the beginning of the service routine.
All flags are restored to their original settings (that is, the settings before the interrupt occurred).
Flags:
Format:
IRET
(Normal)
IRET
(Fast)
In the figure below, the instruction pointer is initially loaded with 100H in the main program before
Example:
interrupt are enabled. When an interrupt occurs, the program counter and the instruction pointer
are swapped. This causes the PC to jump to the address 100H and the IP to keep the return
address. The last instruction in the service routine is normally a jump to IRET at the address
FFH.
This loads the instruction pointer with 100H "again" and causes the program counter to jump
back to the main program. Now, the next interrupt can occur and the IP is still correct at 100H.
0H
FFH
100H
FFFFH
In the fast interrupt example above, if the last instruction is not a jump to IRET, you must pay attention to the
NOTE:
order of the last tow instruction. The IRET cannot be immediately proceeded by an instruction which clears
the interrupt status (as with a reset of the IPR register).
6-46
RET (Fast)
PC ↔ IP
FLAGS ← FLAGS'
FIS ← 0
opc
opc
IRET
Interrupt
Service
Routine
JP to FFH
Bytes
Cycles
Opcode
1
12
Bytes
Cycles
Opcode
1
6
S3C84I8/F84I8/C84I9/F84I9
(Hex)
BF
(Hex)
BF

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3c84i9S3f84i8S3f84i9

Table of Contents