KS57C2308/P2308/C2316/P2316
SAM47 INSTRUCTION SET
5-55
IRET
— Return From Interrupt
IRET
Operation:
Operand
Operation Summary
Bytes
Cycles
–
Return from interrupt
1
3
Description:
IRET is used at the end of an interrupt service routine. It pops the PC values successively from
the stack and restores them to the program counter. The stack pointer is incremented by six and
the PSW, enable memory bank (EMB) bit, and enable register bank (ERB) bit are also
automatically restored to their pre-interrupt values. Program execution continues from the
resulting address, which is generally the instruction immediately after the point at which the
interrupt request was detected. If a lower-level or same-level interrupt was pending when the
IRET was executed, IRET will be executed before the pending interrupt is processed.
Since the “a14” bit of an interrupt return address is not stored in the stack, this bit location is
always interpreted as a logic zero. The starting address in the ROM must for this reason be
located in 0000H–3FFFH.
Operand
Binary Code
Operation Notation
–
1
1
0
1
0
1
0
1
PC13–8
←
(SP + 1) (SP)
PC7–0
←
SP + 2) (SP + 3)
PSW
←
(SP + 4) (SP + 5)
SP
←
SP + 6
Example:
The stack pointer contains the value 0FAH. An interrupt is detected in the instruction at location
0122H. RAM locations 0FDH, 0FCH, and 0FAH contain the values 2H, 3H, and 1H, respectively.
The instruction
IRET
leaves the stack pointer with the value 00H and the program returns to continue execution at
location 123H.
During a return from interrupt, data is popped from the stack to the program counter. The data in
stack locations 0FFH–0FAH is organized as follows:
SP
→
(0FAH)
PC11–PC8
SP + 1 (0FBH)
0
0
PC13
PC12
SP + 2(0FCH)
PC3–PC0
SP + 3(0FDH)
PC7–PC4
SP + 4(0FEH)
IS1
IS0
EMB
ERB
SP + 5(0FFH)
C
SC2
SC1
SC0
SP + 6(00H)
Содержание C2316
Страница 30: ...ADDRESS SPACES KS57C2308 P2308 C2316 P2316 2 22 NOTES ...
Страница 168: ...SAM47 INSTRUCTION SET KS57C2308 P2308 C2316 P2316 5 94 NOTES ...
Страница 170: ......
Страница 206: ...POWER DOWN KS57C2308 P2308 C2316 P2316 8 8 NOTES ...
Страница 210: ...RESET KS57C2308 P2308 C2316 P2316 9 4 NOTES ...
Страница 222: ...I O PORTS KS57C2308 P2308 C2316 P2316 10 12 NOTES ...
Страница 272: ...LCD CONTROLLER DRIVER KS57C2308 P2308 C2316 P2316 12 24 NOTES ...
Страница 280: ...SERIAL I O INTERFACE KS57C2308 P2308 C2316 P2316 13 8 NOTES ...
Страница 294: ...MECHANICAL DATA KS57C2308 P2308 C2316 P2316 15 2 NOTES ...
Страница 310: ...KS57P2308 P2316 OTP KS57C2308 P2308 C2316 P2316 16 16 NOTES ...
Страница 318: ......
Страница 320: ......
Страница 322: ......
Страница 325: ......
Страница 327: ......