NEC PD17062 Manuale Utente

Pagina di 296
26
µ
PD17062
4.  STACK
The stack is a register used to save an address returned by a program or the contents of the system register,
described later, when a subroutine call occurs or an interrupt is accepted.
4.1   COMPONENTS
The stack consists of a stack pointer (SP), which is a 4-bit binary counter, six 13-bit address stack registers
(ASRs), and two 3-bit interrupt stack registers.
4.2   STACK POINTER (SP)
The stack pointer is located at address 01H in the register file, and specifies an address stack register.  The
contents of the stack pointer are decremented by 1 whenever a push operation (CALL, MOVT, or PUSH
instruction or interrupt acceptance) is performed, or incremented by 1 whenever a pop operation (RET, RETSK,
RETI, MOVT, or POP instruction) is performed.
The high-order bit of the stack pointer is always set to 0.  The stack pointer can indicate any of eight different
values, 0H to 7H.  However, 6H and 7H are not assigned to the stack.
Fig. 4-1   Structure of Stack Pointer
Table 4-1   Behavior of Stack Pointer
0
(SPb
2
)
(SPb
1
)
(SPb
0
)
MSB
LSB
         Instruction
Stack pointer value
CALL addr
CALL @AR
MOVT DBF, @AR
SP – 1
PUSH AR
Interrupt acceptance
RET
RETSK
MOVT DBF, @AR
SP + 1
POP AR
RETI