090. Asl accumulator

Wire the ASL accumulator opcode.

Lesson 90 of 356 · tests/chapter_01_cpu/test_090_ASL_accumulator.py

In this step, use asl_a from Test 089 and add only accumulator dispatch. Tests 091-094 add the memory forms.

Production location and symbols

emulator/cpu/opcodes.py: imported `asl_a` and `OPCODE_TABLE[0x0A]`

Why this step exists

Opcode 0x0A selects the accumulator itself, so dispatch can call asl_a(cpu) directly rather than resolving a memory address.

Suggested implementation for this step

# emulator/cpu/opcodes.py
from emulator.cpu.instructions import asl_a  # alongside existing imports

OPCODE_TABLE = {
    # ... existing entries ...
    0x0A: asl_a,
}

Important invariants

  • opcode 0x0A maps to the exact asl_a(cpu) function
  • no addressing helper or memory read/write occurs
  • this one-byte instruction advances PC by exactly one
  • test 089's function owns A masking and C/Z/N updates

Common misconception

ASL A is not zero-page ASL with an omitted operand; it is a distinct accumulator form and therefore needs no asl_* addressing wrapper.

Out of scope

  • asl_zero_page, asl_zero_page_x, asl_absolute, and asl_absolute_x
  • mappings 0x06, 0x16, 0x0E, and 0x1E from tests 091-094
  • cycle timing and bus-accurate read-modify-write behavior

Run this lesson

uv run pytest tests/chapter_01_cpu/test_090_ASL_accumulator.py -v