PIC18 cheatsheet

PUSH

Detailed reference for the PUSH instruction in PIC18 ISA.

Description

Push the contents of the top-of-return-stack (TOS) onto the user stack.

  • PUSH has no operands or addressing modes.
  • It simply copies the value in TOS into the stack pointer register, thereby increasing the stack pointer.
  • The instruction is useful for saving the current return address or for manipulating the user stack.

Examples

; Push TOS onto the user stack
PUSH ; TOS value is pushed onto the stack
; Save the current return address before a subroutine call
PUSH ; TOS is saved on the stack
; Restore TOS after a subroutine completes
POP ; TOS is restored from the stack