RETI

Operation

Return from Interrupt

Mnemonic

RETI

Operands

none

b7b6b5b4b3b2b1b0
1 1 1 0 1 1 0 1$ED
0 1 0 0 1 1 0 1$4D

Description

This instruction is used at the end of a maskable interrupt service routine to:

Condition Bits Affected

None

Example

Assume that there are two interrupting devices, A and B, connected in a daisy-chain configuration, with A having a higher priority than B.

            A                   B
   +n---------------m   n--------------m
  | |               |   |              |
  v---- IEI   IEO --------- IEI   IEO  |
    |       |       |   |              |
 ___v-------|-------u   v----------|---u
 INt        0                      |
 ----------------------------------u

B generates an interrupt and is acknowledged. The interrupt enable out, IEO, of B goes Low, blocking any lower priority devices from interrupting while B is being serviced. Then A generates an interrupt, suspending service of B. The IEO of A goes Low, indicating that a higher priority device is being serviced. The A routine is completed and a RETI is issued resetting the IEO of A, allowing the B routine to continue. A second RETI is issued on completion of the B routine and the IE0 of B is reset (High), allowing lower-priority devices interrupt access.