Application Note
Stack Pointer
AN1218 Rev. 2
13
requirements are also reduced. Significant C code efficiency can be
gained when utilizing these new stack pointer addressing modes.
If interrupts are disabled, the stack pointer can be used as a second
16-bit index register with 8- or 16-bit offsets.
Nine New Stack
Manipulation
Instructions, Detail
All the new CPU08 instructions that affect the stack pointer are listed
below. Examplesfortheseinstructionsaregivenin
Appendix C — New
CPU08 Stack Pointer Instructions
.
AIS
Add Immediate to Stack Pointer
SP
←
(SP) + (M)
Description: Adds the immediate operand to the stack
pointer SP. The immediate value is an 8-bit
two's complement signed operand. Prior to
addition to the SP, the operand is sign
extended to 16 bits. This instruction can be
used to create and remove a stack frame
buffer which is used to store temporary
variables.
Operation:
PSHA
Push Accumulator onto Stack
(A); SP
←
(SP-$01)
Description: The contents of the accumulator are pushed
onto the stack at the address contained in
the stack pointer. The stack pointer is then
decremented to point at the next available
location in the stack. The contents of the
accumulator remain unchanged.
Operation:
PSHH
Push Index Register H onto Stack
(H); SP
←
(SP-$01)
Description: The contents of the 8-bit high order index
register H are pushed onto the stack at the
address contained in the stack pointer. The
stack pointer is then decremented to point at
the next available location in the stack. The
contents of the H register remain
unchanged.
Operation:
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.