diff --git a/examples/functional.rs b/examples/functional.rs index 83b2d70..87ab0f3 100644 --- a/examples/functional.rs +++ b/examples/functional.rs @@ -21,6 +21,12 @@ fn main() { // run step-by-step let mut old_pc = cpu.registers.program_counter; while cpu.registers.program_counter != 0x3468 { + // Use `fetch_next_and_decode` instead of + // `single_step` to see the decoded instruction + if let Some(decoded_instr) = cpu.fetch_next_and_decode() { + println!("{decoded_instr:?}"); + cpu.execute_instruction(decoded_instr); + } cpu.single_step(); println!("{cpu:?}"); diff --git a/src/instruction.rs b/src/instruction.rs index 885452e..c80396e 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -105,7 +105,7 @@ pub enum Instruction { TYA, // Transfer Y to Accumulator..... | N. ...Z. A = Y } -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub enum OpInput { UseImplied, UseImmediate(u8),