wire / wire-format / r6502-instruction
The MOS 6502 is an 8-bit microprocessor (1975) used in the Apple II, Commodore 64, NES, and Atari 2600. Instructions are 1-3 bytes. Addressing modes: immediate (#), zero page (zp), zero page X/Y (zp,X/Y), absolute (abs), absolute X/Y (abs,X/Y), indirect (ind), indirect X/Y ((ind,X), (ind),Y), relative (rel, for branches). 3 registers: A (accumulator), X, Y (index). Status flags: N (negative), V (overflow), B (break), D (decimal), I (interrupt disable), Z (zero), C (carry).
aka: MOS 6502 instruction encoding
spec: MOS 6502
The MOS 6502 is an 8-bit microprocessor (1975) used in the Apple II, Commodore 64, NES, and Atari 2600. Instructions are 1-3 bytes. Addressing modes: immediate (#), zero page (zp), zero page X/Y (zp,X/Y), absolute (abs), absolute X/Y (abs,X/Y), indirect (ind), indirect X/Y ((ind,X), (ind),Y), relative (rel, for branches). 3 registers: A (accumulator), X, Y (index). Status flags: N (negative), V (overflow), B (break), D (decimal), I (interrupt disable), Z (zero), C (carry).
| field | size | meaning |
|---|---|---|
| Instruction format | 1-3 bytes | Opcode (1 byte) + optional operand (0, 1, or 2 bytes). No prefixes, no ModR/M. |
| Addressing modes | various | Immediate (#imm), Zero Page (zp), Zero Page X (zp,X), Zero Page Y (zp,Y), Absolute (abs), Absolute X (abs,X), Absolute Y (abs,Y), Indirect (ind), Indirect X ((ind,X)), Indirect Y ((ind),Y), Relative (rel, for branches). |
| Registers | 3 | A (accumulator), X (index), Y (index). Plus SP (stack pointer, 8-bit, page 1: 0x0100-0x01FF), PC (program counter, 16-bit), P (status register, 8 bits). |
| Status flags (P) | 8 bits | Bit 7 N (negative), 6 V (overflow), 5 (unused, always 1), 4 B (break), 3 D (decimal mode), 2 I (interrupt disable), 1 Z (zero), 0 C (carry). |
| Memory | 64KB | 16-bit address space (0x0000-0xFFFF). Zero page (0x00-0xFF) for fast access. |
| Stack | 256 bytes | Page 1 (0x0100-0x01FF). SP is 8-bit (stack depth max 256). |
example:
a9 00
6502: LDA #$00 (load accumulator with 0)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/r6502-instruction
or /wire-format/r6502-instruction.json