087. Dey 隐含寻址

接入 DEY 隐含寻址操作码。

87 / 356 · tests/chapter_01_cpu/test_087_DEY_implied.py

在这一步中,使用测试 086 中的 instructions.dey,仅添加其操作码接入。

生产代码位置与符号

emulator/cpu/opcodes.py: imported `dey` and `OPCODE_TABLE[0x88]`

本步骤存在的原因

DEY 的 Y 寄存器操作数是隐含的,可以直接进行表分发,无需寻址模式包装器。

本步骤的实现建议

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

OPCODE_TABLE = {
    # ... existing entries ...
    0x88: dey,
}

重要不变量

  • 操作码 0x88 分发到精确的 dey(cpu) 函数
  • 不消耗操作数,PC 推进一个字节
  • Y 的回绕及 Z/N 更新仍由测试 086 的 dey 负责

常见误解

不要围绕 dec 构建一个内存递减包装器;DEY 修改的是寄存器,不进行任何总线读或写。

不在本步骤范围内

  • 测试 084-085 中此前的 INY 行为/映射
  • 从测试 088 开始的 ASL 行为及操作码
  • 周期计时

运行本课

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