Print decoded instruction

This commit is contained in:
Matthias 2023-06-19 13:41:13 +02:00
parent 23ddc109ee
commit cb49e5e5a6
2 changed files with 7 additions and 1 deletions

View File

@ -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:?}");

View File

@ -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),