diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs index 3343e38b15526fecbe0945eaf45b6d66686d3461..f64569e10b7a26941ee616389fc2c73d6c701c46 100644 --- a/frontends/sdl/src/main.rs +++ b/frontends/sdl/src/main.rs @@ -971,6 +971,9 @@ fn main() { game_boy.set_timer_enabled(!args.no_timer); game_boy.attach_serial(device); game_boy.load(!args.no_boot && args.boot_rom_path.is_empty()); + if args.no_boot { + game_boy.load_boot_state(); + } if !args.boot_rom_path.is_empty() { game_boy.load_boot_path(&args.boot_rom_path).unwrap(); } diff --git a/src/gb.rs b/src/gb.rs index fc55f9ae6c2479b6e1292bf745e9c9b09fa8f2be..f3058852b87c963650a75946279ec2d8da0c2f7a 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -578,8 +578,11 @@ impl GameBoy { self.ppu().frame_index() } + /// Direct boot method that immediately jumps the machine + /// to the post boot state, this will effectively skip the + /// boot sequence and jump to the cartridge execution. pub fn boot(&mut self) { - self.cpu.boot(); + self.load_boot_state(); } pub fn load(&mut self, boot: bool) { @@ -631,6 +634,15 @@ impl GameBoy { self.load_boot_static(BootRom::Cgb); } + /// Loads the boot machine state and sets the Program Counter + /// (PC) to the post boot address. + /// + /// Should allow the machine to jump to the cartridge execution + /// skipping the boot sequence. + pub fn load_boot_state(&mut self) { + self.cpu.boot(); + } + pub fn vram_eager(&mut self) -> Vec<u8> { self.ppu().vram().to_vec() }