From 6512dd599d13035f6a90b2009344e02c488f5aae Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Thu, 23 Jan 2025 19:37:32 +0100 Subject: initial working version --- src/nes/cpu.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/nes/cpu.cc') diff --git a/src/nes/cpu.cc b/src/nes/cpu.cc index b488a08..9060e72 100644 --- a/src/nes/cpu.cc +++ b/src/nes/cpu.cc @@ -45,14 +45,6 @@ namespace nes nmi_pending_ = true; } - auto cpu::step_to(cycle_count const target) -> void - { - while (current_cycles_ < target) - { - step(); - } - } - auto cpu::step() -> void { // See https://www.nesdev.org/wiki/CPU_unofficial_opcodes @@ -400,8 +392,10 @@ namespace nes auto cpu::run_anc() -> void { // ANC: AND #i + copy N to C - // TODO - std::abort(); + auto operand = fetch_operand(); + eval_and(operand.read()); + registers_.c = registers_.n; + current_cycles_ += operand.get_cycles(); } template @@ -539,8 +533,10 @@ namespace nes auto cpu::run_alr() -> void { // ALR: AND #i + LSR A - // TODO - std::abort(); + auto operand = fetch_operand(); + eval_and(operand.read()); + registers_.a = eval_lsr(registers_.a); + current_cycles_ += operand.get_cycles(); } auto cpu::run_pha() -> void -- cgit v1.3.1