1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-28 07:49:19 +00:00

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 // run step-by-step
let mut old_pc = cpu.registers.program_counter; let mut old_pc = cpu.registers.program_counter;
while cpu.registers.program_counter != 0x3468 { 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(); cpu.single_step();
println!("{cpu:?}"); println!("{cpu:?}");

View File

@ -105,7 +105,7 @@ pub enum Instruction {
TYA, // Transfer Y to Accumulator..... | N. ...Z. A = Y TYA, // Transfer Y to Accumulator..... | N. ...Z. A = Y
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone, Debug)]
pub enum OpInput { pub enum OpInput {
UseImplied, UseImplied,
UseImmediate(u8), UseImmediate(u8),