SX Embedded Controller Instruction

PushPC (DW $04B)

Description: Push the contents of MW onto the "PCstack"
Operation: PCstack[PSP++] = M : W
Flags affected: ?
Registers affected: PCstack
Sources referenced: W
Cycles: 1
Opcode: $04B
Details: Secret Instructions Page
Microchip PIC syntax: n/a
Notes:

The PCstack is only two levels deep and is used by both the interrupt and the debug system. If you don't set a breakpoint or happen to break into debug while in an ISR, you can use one level without concern. If you don't use interrupts or debug, you can use both levels.

When the RETI or RETIW instructions are executed, each of the shadow stacks is "popped" so pushing a new PC value prior to one of these returns will set the actual PC to the value that was in M : W when you did the PushPC.

To use this instruction, first define the following macro.

PushPC macro
 DW $04B
 endm