Carl
all lessons
The 6502, by doing Lesson 1 of 9

The registers

The 6502 has just three working registers — A, X, and Y — each one byte wide. Almost everything the chip does is shuffling bytes through them. Load them, copy between them, and watch every move in the CPU panel.

6502 assembly registers

The 6502 is small on purpose. For getting work done it has three registers — A (the accumulator), X, and Y — and each holds exactly one byte (0–255). That’s it. Almost every program you write is moving bytes into these three, doing a little arithmetic, and moving them back out to memory.

# keeps showing up: LDA #$0F means “put the number $0F into A.” The # says the value itself. Without it (next lesson) the number means an address instead — a distinction the whole instruction set hangs on.

CodeLab — Loading and copying registers
6502 source — stores to VIA Port B ($B000 = 8 LEDs)
loading…
assembler
VIA Port B — 8 LEDs (bit 7 … 0)
CPU
disassembly

Press Step and watch the CPU panel after each instruction. A becomes $0F. X becomes $80 — then TAX (“transfer A to X”) overwrites it with $0F. Y becomes $AA. Four instructions, four visible effects, nothing hidden.

Try this: add TYA before the park (transfer Y into A) and step through again — predict what A will be before you run it, then check. Guessing first, then verifying, is the whole game.

Next: those same numbers, but as addresses — and the byte shelf called memory.