Skip to content

Commit

Permalink
emu: Print result of example code
Browse files Browse the repository at this point in the history
  • Loading branch information
Granddave committed Jan 1, 2024
1 parent fbfd1db commit ef6d918
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/emulator/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,12 @@ impl Cpu {
self.pc += instruction.size() as u16;
self.cycle = self.execute_instruction(instruction, memory);
self.cycle -= 1;

// if break command
if self.status.break_command {
println!("Memory address 0x0000: {:#04x}", memory.read_byte(0x0000));
std::process::exit(0);
}
}

/// Steps the CPU by one instruction.
Expand Down

0 comments on commit ef6d918

Please sign in to comment.