beautypg.com

I/o direct, Relative program addressing, rjmp and rcall, Subroutine and interrupt hardware stack – Rainbow Electronics AT90S1200 User Manual

Page 8

background image

8

AT90S1200

0838H–AVR–03/02

Operands are contained in register r (Rr) and d (Rd). The result is stored in register d
(Rd).

I/O Direct

Figure 9. I/O Direct Addressing

Operand address is contained in 6 bits of the instruction word. n is the destination or
source register address.

Relative Program Addressing,
RJMP and RCALL

Figure 10. Relative Program Memory Addressing

Program execution continues at address PC + k + 1. The relative address k is -2048 to
2047.

Subroutine and Interrupt
Hardware Stack

The AT90S1200 uses a 3 level deep hardware stack for subroutines and interrupts. The
hardware stack is 9 bits wide and stores the Program Counter (PC) return address while
subroutines and interrupts are executed.

RCALL instructions and interrupts push the PC return address onto stack level 0, and
the data in the other stack levels 1 - 2 are pushed one level deeper in the stack. When a
RET or RETI instruction is executed the returning PC is fetched from stack level 0, and
the data in the other stack levels 1 - 2 are popped one level in the stack.

If more than three subsequent subroutine calls or interrupts are executed, the first val-
ues written to the stack are overwritten.