Skip to content

6502

The 6502 processor is an 8-bit CPU that was used in many computers and consoles, including the NES and SNES.

Specifications

  • Address bus: 16 bit

Emulation

Component C++
Memory struct

Memory

The first 256B of memory is referred to as the ($0000-$00FF).

Memory range Description
0x0000-0x00FF Zero Page
0x0100-0x01FF Stack

Registers

# Register Size Description
PC Program Counter 16 bit pointer to the next instruction
SP Stack pointer 8 bit holds low 8 bits of the next free location on the stack
A Accumulator 8 bit used for all arithmetic operations (except for incrementation and decrementation)
X X register 8 bit available for holding counter or offset values for memory access. It also has the special function of copying or changing the value of SP.
Y Y register 8 bits available for holding counter or offset values for memory access.

Opcodes

All opcodes are 1 byte in size, and their operands are 0, 1, or 2 bytes

Opcode Code Description
CMP (src)
LDA Load from ZP to A
STA $85 Store accumulator in memory (src)

LDA

LDA #$33 ; Load 69 into A

STA

Exapunks

Instruction Description
LINK Move
GRAB
COPY