KS57C2308/P2308/C2316/P2316 ADDRESS SPACES
2-13
PUSH OPERATIONS
Three kinds of push operations reference the stack pointer (SP) to write data from the source register to the
stack: PUSH instructions, CALL instructions, and interrupts. In each case, the SP is decreased by a number
determined by the type of push operation and then points to the next available stack location.
PUSH Instructions
A PUSH instruction references the SP to write two 4-bit data nibbles to the stack. Two 4-bit stack addresses are
referenced by the stack pointer: one for the upper register value and another for the lower register. After the
PUSH has executed, the SP is decreased by two and points to the next available stack location.
CALL Instructions
When a subroutine call is issued, the CALL instruction references the SP to write the PC's contents to six 4-bit
stack locations. Current values for the enable memory bank (EMB) flag and the enable register bank (ERB) flag
are also pushed to the stack. Since six 4-bit stack locations are used per CALL, you may nest subroutine calls up
to the number of levels permitted in the stack.
Interrupt Routines
An interrupt routine references the SP to push the contents of the PC and the program status word (PSW) to the
stack. Six 4-bit stack locations are used to store this data. After the interrupt has executed, the SP is decreased
by six and points to the next available stack location. During an interrupt sequence, subroutines may be nested
up to the number of levels which are permitted in the stack area.
SP - 2
SP - 1
SP
LOWER
UPPER
PUSH
(After PUSH, SP SP - 2)
SP - 6
SP - 5
SP - 4
SP - 3
SP - 2
SP - 1
SP
CALL
(After CALL, SP SP - 6)
0 0
PC3 - PC0
PC7 - PC4
0 0 EMB ERB
0 0 0 0
PC11- PC8
INTERRUP
(When INT is acknowledged,
SP SP - 6)
SP - 6
SP - 5
SP - 4
SP - 3
SP - 2
SP - 1
SP
0 0
PC3 - PC0
PC7 - PC4
IS1 IS0 EMB ERB
PSW
CSC2 SC1 SC0
PC11 - PC8
PSW
PC13 PC12 PC13 PC12
NOTE:PC13 is used for KS57C2316/P2316 microcontroller
Figure 2-7. Push-Type Stack Operations