diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/vnf/src/lib.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/vnf/src/lib.rs b/lib/vnf/src/lib.rs index 61f117d..c9ae1a0 100644 --- a/lib/vnf/src/lib.rs +++ b/lib/vnf/src/lib.rs @@ -378,6 +378,10 @@ pub struct Machine { /// The status of both Joypads. joypads: [Joypad; 2], + + /// Whether execution should be halted _after_ a 'brk' instruction no matter + /// what. The break mark will be set accordingly. + pub halt_on_brk: bool, } // Returns a vector of MemoryCell representing the RAM for a Machine, which @@ -487,6 +491,7 @@ impl Machine { should_report_ppu: false, policy, joypads: [Joypad::default(), Joypad::default()], + halt_on_brk: true, }) } @@ -1220,6 +1225,10 @@ impl Machine { let low = &(self.prg_rom[len - 2] as usize); self.pc = high + low; self.skip_pc = true; + + if self.halt_on_brk { + self.active = false; + } } InstructionIdentifier::Rti => { self.pop_status_register()?; |
