diff --git a/src/cartridge.rs b/src/cartridge.rs index c446f3f..05b8da1 100644 --- a/src/cartridge.rs +++ b/src/cartridge.rs @@ -21,9 +21,12 @@ impl Cartridge { let mut rom = File::open(path)?; rom.read_to_end(&mut memory)?; + let title = Self::find_title(&memory); + eprintln!("Cartridge Title: {:?}", title); + Ok(Self { mbc: Self::detect_mbc(&memory), - title: Self::find_title(&memory), + title, memory, }) } @@ -34,6 +37,10 @@ impl Cartridge { let mbc_kind = Self::find_mbc(memory); let ram_byte_count = ram_size.len(); + eprintln!("Cartridge Ram Size: {} bytes", ram_size.len()); + eprintln!("Cartridge ROM Size: {} bytes", bank_count.size()); + eprintln!("MBC Type: {:?}", mbc_kind); + match mbc_kind { MbcKind::None => Box::new(NoMbc {}), MbcKind::Mbc1 => { @@ -478,7 +485,7 @@ impl Default for BankCount { impl BankCount { // https://hacktix.github.io/GBEDG/mbcs/#rom-size - fn to_byte_count(self) -> u32 { + fn size(self) -> u32 { use BankCount::*; match self { diff --git a/src/emu.rs b/src/emu.rs index c75d6c2..3d0aee2 100644 --- a/src/emu.rs +++ b/src/emu.rs @@ -17,6 +17,8 @@ pub fn init(boot_path: Option<&str>, rom_path: &str) -> Result { None => SM83::new(), }; + eprintln!("Initialized GB Emulator"); + cpu.load_cartridge(rom_path)?; Ok(cpu) }