diff --git a/src/gb.rs b/src/gb.rs index 1dcc81e3eaf03debe35595f7277d3d4c43a290e4..70234c9c3d8ec0306a15548230019b3d278c8d95 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -124,7 +124,11 @@ impl GameBoy { } pub fn load_boot_default(&mut self) { - self.load_boot_static(BootRom::DmgBootix); + self.load_boot_dmg(); + } + + pub fn load_boot_dmg(&mut self) { + self.load_boot_static(BootRom::Cgb); } pub fn load_boot_cgb(&mut self) { diff --git a/src/mmu.rs b/src/mmu.rs index abe5aa46282a0995cd38699b8b9e7947baccc711..be0c48b60fd3d803cd79d1a527ffaa8ec2519b64 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -1,6 +1,6 @@ use crate::{debugln, pad::Pad, ppu::Ppu, rom::Cartridge, timer::Timer}; -pub const BOOT_SIZE: usize = 256; +pub const BOOT_SIZE: usize = 2304; pub const RAM_SIZE: usize = 8192; pub struct Mmu { @@ -30,7 +30,16 @@ pub struct Mmu { /// the boot sequence has been finished. boot_active: bool, + /// Buffer to be used to store the boot ROM, this is the code + /// that is going to be executed at the beginning of the Game + /// Boy execution. The buffer effectively used is of 256 bytes + /// for the "normal" Game Boy (MGB) and 2308 bytes for the + /// Game Boy Color (CGB). Note that in the case of the CGB + /// the bios which is 2308 bytes long is in fact only 2048 bytes + /// as the 256 bytes in range 0x100-0x1FF are meant to be + /// overwritten byte the cartridge header. boot: [u8; BOOT_SIZE], + ram: [u8; RAM_SIZE], }