Skip to content

Commit

Permalink
Restore the boot vector on warm boot #12
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanizag committed Jun 19, 2024
1 parent 5f648df commit 6933396
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/bdos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ impl Bdos {
}
}

pub fn reset(&mut self, machine: &mut CpmMachine) {
self.state.reset();

// Setup BOOT entrypoint
pub fn warm_reset(&mut self, machine: &mut CpmMachine) {
// Setup/Restore BOOT entrypoint
machine.poke( BDOS_ENTRY_ADDRESS, 0xc3 /* jp BDOS_BASE_ADDRESS */);
machine.poke16(BDOS_ENTRY_ADDRESS+1, BDOS_BASE_ADDRESS);
}

pub fn reset(&mut self, machine: &mut CpmMachine) {
self.state.reset();
self.warm_reset(machine);

// Reset IOBYTE
machine.poke(IOBYTE_ADDRESS, 0);
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ fn main() {
print!("[[Warm boot]]");
}
if use_tpa {
bdos.warm_reset(&mut machine);
for i in 0..binary_size {
machine.poke(binary_address + i as u16, binary[i]);
}
Expand Down

0 comments on commit 6933396

Please sign in to comment.