Changes

Jump to: navigation, search

6502 Instructions - Introduction

7 bytes added, 12:18, 19 January 2022
Push/Pull on the Stack
=== Push/Pull on the Stack ===
When a value is pushed to the stack, the stack pointer register (SP) is decremented and the selected register is written to memory location $0100+SP.
When a value is pulled from the stack, the stack pointer register (SP) is incremented and the selected register is loaded from memory location $0100+SP.
There are two instructions to push data onto the stack:
<code> PHA ; push the accumulator PHP ; push the processor status register</code>
And two matching instructions to pull data from the stack:
<code> PLA ; pull the accumulator PLP ; pull the processor status registerI've been swamped!  </code>register
Note that some other operations, such as JSR, interrupts, RTI, and RTS, cause data to be pushed to or pulled from the stack.

Navigation menu