059. Adc absolute y
Connect ADC absolute,Y (opcode $79) to CPU dispatch.
Lesson 59 of 356 · tests/chapter_01_cpu/test_059_ADC_absolute_y.py
File to update
emulator/cpu/opcodes.pySymbols to create/update
opcodes.adc_absolute_y
OPCODE_TABLE[$79]Why this step exists
This is the Y-indexed counterpart to test 058. absolute_y consumes the two-byte base address and applies Y; the handler reads the resulting location and delegates the value to adc.
Complete example implementation
# emulator/cpu/opcodes.py
def adc_absolute_y(cpu):
addr = absolute_y(cpu)
value = cpu.bus.read(addr)
adc(cpu, value)
OPCODE_TABLE = {
# ...existing entries...
0x79: adc_absolute_y,
}Important invariants
- Y is applied exactly once by
absolute_y - the effective address is not constrained to page zero
- PC advances by three bytes total
- the addressed value is passed to
adc
Common misconception
Do not copy the absolute,X handler and leave it using X; opcode $79 indexes the base address with Y.
Out of scope
- indirect ADC modes
- page-crossing timing penalties
- changes to the addressing or arithmetic helpers
Run this lesson
uv run pytest tests/chapter_01_cpu/test_059_ADC_absolute_y.py -v