ASP
6-52
ASP Align Stack Pointer
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
ASP 0111 0110 0001 1011 X − 1
Operands None
Description Ensure that the stack pointer (SP) is aligned to an even address. If the least
significant bit of SP is 1, SP points to an odd address and must be moved by
incrementing SP by 1. The SPA bit is set as a record of this alignment. If
instead the ASP instruction finds that the SP already points to an even
address, SP is left unchanged and the SPA bit is cleared to indicate that no
alignment has taken place. In either case, the change to the SPA bit is made in
the decode 2 phase of the pipeline.
if(SP = odd)
SP = SP + 1;
SPA = 1;else
SPA = 0;
If you wish to undo a previous alignment by the ASP instruction, use the NASP
instruction.
Flags and
Modes
SPA
If SP holds an odd address before the operation, SPA is set; otherwise, SPA is
cleared.
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example ; Alignment of stack pointer in interrupt service routine:
; Vector table:
INTx: .long INTxService ; INTx interrupt vector
.
.
INTxService:
ASP ; Align stack pointer
.
.
.
NASP ; Re-align stack pointer
IRET ; Return from interrupt.