057. Adc absolute
Connect ADC absolute (opcode $6D) to CPU dispatch.
Lesson 57 of 356 · tests/chapter_01_cpu/test_057_ADC_absolute.py
File to update
emulator/cpu/opcodes.pySymbols to create/update
opcodes.adc_absolute
OPCODE_TABLE[$6D]Why this step exists
Absolute mode expands ADC to a little-endian 16-bit operand address. The existing absolute helper consumes that word; the opcode handler reads the addressed byte and delegates arithmetic to adc.
Complete example implementation
# emulator/cpu/opcodes.py
def adc_absolute(cpu):
addr = absolute(cpu)
value = cpu.bus.read(addr)
adc(cpu, value)
OPCODE_TABLE = {
# ...existing entries...
0x6D: adc_absolute,
}Important invariants
absolutecombines the low operand byte before the high operand byte- the handler reads from the resulting 16-bit address
- PC advances by three bytes total
adcremains the sole owner of arithmetic and flag behavior
Common misconception
Do not pass the fetched 16-bit address to adc; first read the byte stored at that address.
Out of scope
- absolute,X and absolute,Y ADC modes
- page-crossing timing
- changes to
absoluteoradc
Run this lesson
uv run pytest tests/chapter_01_cpu/test_057_ADC_absolute.py -v