First page Back Continue Last page Overview Graphics

Stack Instructions


Here, “PSH” stands for “Push” and “PUL” stands for “Pull”. (The pull instruction is also called a pop instruction and known as “POP” on some processors.) The PSHc instruction saves the contents of the indicated register to memory and the PULc instruction retrieves the contents of the register. A push instruction is used to temporarily save the value contained in a register so that that register can be used for another purpose. For example, if you need to use the X register, but do not want to lose its current contents, perform a pshx and then use the X register. After the X register is no longer needed, perform a pulx to restore the original value to X. For every push instruction there should be a corresponding pull instruction. The stack pointer must be properly loaded for these instructions to work.
To load the stack pointer:
lds #$c00