/// Represents the various addressing modes of the 6502 CPU. #[derive(PartialEq, Debug, Copy, Clone)] pub enum AddressMode { /// Implied /// /// No operand is needed; the instruction implicitly operates on a register or flag. /// Example: `CLC` (Clear Carry Flag) Implied, /// Accumulator /// /// Operates directly on the accumulator register. /// Example: `ASL A` (Arithmetic Shift Left on Accumulator) Accumulator, /// Immediate /// /// Operand is a constant 8-bit value. /// Example: `LDA #$01` loads the value 0x01 into the accumulator. Immediate, /// Zero Page /// /// Operand is an address in the first 256 bytes of memory (0x0000–0x00FF). /// Example: `LDA $10` reads from address 0x0010. ZeroPage, /// Zero Page X /// /// Zero page address offset by the X register. /// Example: If X = 0x10, `LDA $23,X` reads from 0x33. ZeroPageX, /// Zero Page Y /// /// Zero page address offset by the Y register. /// Used only by a few instructions like `LDX` and `STX`. /// Example: If Y = 0x10, `LDX $23,Y` reads from 0x33. ZeroPageY, /// Absolute /// /// Full 16-bit address is provided as the operand. /// Example: `LDA $1234` reads from address 0x1234. Absolute, /// Absolute X /// /// Absolute address offset by the X register. /// Example: If X = 0x10, `LDA $1234,X` reads from 0x1244. AbsoluteX, /// Absolute Y /// /// Absolute address offset by the Y register. /// Example: If Y = 0x10, `LDA $1234,Y` reads from 0x1244. AbsoluteY, /// Indirect /// /// Only used by `JMP`. Operand is a 16-bit address pointing to another 16-bit address. /// Example: `JMP ($1234)` jumps to the address stored at 0x1234/0x1235. Indirect, /// Indirect X (Indexed Indirect) /// /// Operand is a zero-page address. Add X to it, then fetch the 16-bit address from that location. /// Example: If X = 0x04 and operand = $20, `LDA ($20,X)` reads from the address at $24/$25. IndirectX, /// Indirect Y (Indirect Indexed) /// /// Operand is a zero-page address. Fetch the 16-bit address from that location, then add Y. /// Example: If Y = 0x10 and ($20) = $3000, `LDA ($20),Y` reads from $3010. IndirectY, }