Fig. 5 Stack Registers (Sks) Structure; Fig. 6 Example Of Operation At Subroutine Call - Renesas 4513 User Manual

4500 series 4-bit single-chip microcomputer
Table of Contents

Advertisement

HARDWARE
FUNCTION BLOCK OPERATIONS
(5) Stack registers (SK
Stack registers (SKs) are used to temporarily store the contents of
program counter (PC) just before branching until returning to the
original routine when;
• branching to an interrupt service routine (referred to as an inter-
rupt service routine),
• performing a subroutine call, or
• executing the table reference instruction (TABP p).
Stack registers (SKs) are eight identical registers, so that subrou-
tines can be nested up to 8 levels. However, one of stack registers
is used respectively when using an interrupt service routine and
when executing a table reference instruction. Accordingly, be care-
ful not to over the stack when performing these operations
together. The contents of registers SKs are destroyed when 8 lev-
els are exceeded.
The register SK nesting level is pointed automatically by 3-bit
stack pointer (SP). The contents of the stack pointer (SP) can be
transferred to register A with the TASP instruction.
Figure 5 shows the stack registers (SKs) structure.
Figure 6 shows the example of operation at subroutine call.
(6) Interrupt stack register (SDP)
Interrupt stack register (SDP) is a 1-stage register. When an inter-
rupt occurs, this register (SDP) is used to temporarily store the
contents of data pointer, carry flag, skip flag, register A, and regis-
ter B just before an interrupt until returning to the original routine.
Unlike the stack registers (SKs), this register (SDP) is not used
when executing the subroutine call instruction and the table refer-
ence instruction.
(7) Skip flag
Skip flag controls skip decision for the conditional skip instructions
and continuous described skip instructions. When an interrupt oc-
curs, the contents of skip flag is stored automatically in the interrupt
stack register (SDP) and the skip condition is retained.
1-18
) and stack pointer (SP)
S
4513/4514 Group User's Manual
Program counter (PC)
Executing BM
instruction
SK
SK
SK
SK
SK
SK
SK
SK
Stack pointer (SP) points "7" at reset or
returning from RAM back-up mode. It points "0"
by executing the first BM instruction, and the
contents of program counter is stored in SK
When the BM instruction is executed after eight
stack registers are used ((SP) = 7), (SP) = 0
and the contents of SK

Fig. 5 Stack registers (SKs) structure

(SP)
(SK
(PC)
Main program
Address
0000
NOP
16
0001
BM SUB1
16
0002
NOP
16
(PC)
(SP)
Returning to the BM instruction execution
Note :
address with the RT instruction, and the BM
instruction becomes the NOP instruction.

Fig. 6 Example of operation at subroutine call

Executing RT
instruction
(SP) = 0
0
(SP) = 1
1
(SP) = 2
2
(SP) = 3
3
(SP) = 4
4
(SP) = 5
5
(SP) = 6
6
(SP) = 7
7
.
0
is destroyed.
0
0
)
0001
0
16
SUB1
Subroutine
SUB1 :
NOP
·
·
·
RT
(SK
)
0
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

4514

Table of Contents