094. Asl absolute x
Add ASL Absolute,X.
Lesson 94 of 356 · tests/chapter_01_cpu/test_094_ASL_absolute_x.py
In this step, complete the ASL addressing sequence with Absolute,X.
File and symbols
emulator/cpu/opcodes.py: asl_absolute_x, OPCODE_TABLE[0x1E]Why this step exists
This is the final ASL addressing transition. It composes the existing absolute_x resolver with the memory asl implementation introduced earlier.
Suggested implementation for this step
# emulator/cpu/opcodes.py
def asl_absolute_x(cpu: CPU):
addr = absolute_x(cpu)
asl(cpu, addr)
OPCODE_TABLE = {
# existing entries unchanged
0x1E: asl_absolute_x,
}Important invariants
- decode the little-endian 16-bit base before adding X
- the instruction remains three bytes; X is a register, not another operand
aslowns read/modify/write and flag updates at the effective address- the accumulator is unchanged
Common misconception
For 1E 00 02 with X=0x04, add X to $0200, not to either operand byte.
Out of scope
- LSR introduced by Tests 095-101
- modifying
absolute_xorasl - page-cross and read/modify/write cycle timing
Run this lesson
uv run pytest tests/chapter_01_cpu/test_094_ASL_absolute_x.py -v