diff --git a/examples/sdl/src/main.rs b/examples/sdl/src/main.rs index c4a537d856085148d554395415eec6a2071053f6..ee72ba0bccece8204053b4af7b3c0dda044783b5 100644 --- a/examples/sdl/src/main.rs +++ b/examples/sdl/src/main.rs @@ -81,7 +81,7 @@ fn main() { // creates a new Game Boy instance and loads both the boot ROM // and the initial game ROM to "start the engine" let mut game_boy = GameBoy::new(); - game_boy.load_boot_sgb(); + game_boy.load_boot_dmg_bootix(); //game_boy.load_rom_file("../../res/roms.prop/tetris.gb"); //game_boy.load_rom_file("../../res/roms.prop/alleyway.gb"); diff --git a/src/data.rs b/src/data.rs index c86c3e34e7b278756548c11dcf35dba949039363..ff50d1488682dc41c43751e679eaad67f5303065 100644 --- a/src/data.rs +++ b/src/data.rs @@ -29,3 +29,33 @@ pub const SGB_BOOT: [u8; 256] = [ 32, 245, 34, 35, 34, 35, 201, 60, 66, 185, 165, 185, 165, 66, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 1, 224, 80, ]; + +pub const DMG_BOOTIX: [u8; 256] = [ + 49, 254, 255, 33, 255, 159, 175, 50, 203, 124, 32, 250, 14, 17, 33, 38, 255, 62, 128, 50, 226, + 12, 62, 243, 50, 226, 12, 62, 119, 50, 226, 17, 4, 1, 33, 16, 128, 26, 205, 184, 0, 26, 203, + 55, 205, 184, 0, 19, 123, 254, 52, 32, 240, 17, 204, 0, 6, 8, 26, 19, 34, 35, 5, 32, 249, 33, + 4, 153, 1, 12, 1, 205, 177, 0, 62, 25, 119, 33, 36, 153, 14, 12, 205, 177, 0, 62, 145, 224, 64, + 6, 16, 17, 212, 0, 120, 224, 67, 5, 123, 254, 216, 40, 4, 26, 224, 71, 19, 14, 28, 205, 167, 0, + 175, 144, 224, 67, 5, 14, 28, 205, 167, 0, 175, 176, 32, 224, 224, 67, 62, 131, 205, 159, 0, + 14, 39, 205, 167, 0, 62, 193, 205, 159, 0, 17, 138, 1, 240, 68, 254, 144, 32, 250, 27, 122, + 179, 32, 245, 24, 73, 14, 19, 226, 12, 62, 135, 226, 201, 240, 68, 254, 144, 32, 250, 13, 32, + 247, 201, 120, 34, 4, 13, 32, 250, 201, 71, 14, 4, 175, 197, 203, 16, 23, 193, 203, 16, 23, 13, + 32, 245, 34, 35, 34, 35, 201, 60, 66, 185, 165, 185, 165, 66, 60, 0, 84, 168, 252, 66, 79, 79, + 84, 73, 88, 46, 68, 77, 71, 32, 118, 49, 46, 50, 0, 62, 255, 198, 1, 11, 30, 216, 33, 77, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 1, 224, 80, +]; + +pub const MGB_BOOTIX: [u8; 256] = [ + 49, 254, 255, 33, 255, 159, 175, 50, 203, 124, 32, 250, 14, 17, 33, 38, 255, 62, 128, 50, 226, + 12, 62, 243, 50, 226, 12, 62, 119, 50, 226, 17, 4, 1, 33, 16, 128, 26, 205, 184, 0, 26, 203, + 55, 205, 184, 0, 19, 123, 254, 52, 32, 240, 17, 204, 0, 6, 8, 26, 19, 34, 35, 5, 32, 249, 33, + 4, 153, 1, 12, 1, 205, 177, 0, 62, 25, 119, 33, 36, 153, 14, 12, 205, 177, 0, 62, 145, 224, 64, + 6, 16, 17, 212, 0, 120, 224, 67, 5, 123, 254, 216, 40, 4, 26, 224, 71, 19, 14, 30, 205, 167, 0, + 175, 144, 224, 67, 5, 14, 30, 205, 167, 0, 175, 176, 32, 224, 224, 67, 62, 131, 205, 159, 0, + 14, 30, 205, 167, 0, 62, 193, 205, 159, 0, 17, 242, 1, 240, 68, 254, 144, 32, 250, 27, 122, + 179, 32, 245, 24, 73, 14, 19, 226, 12, 62, 135, 226, 201, 240, 68, 254, 144, 32, 250, 13, 32, + 247, 201, 120, 34, 4, 13, 32, 250, 201, 71, 14, 4, 175, 197, 203, 16, 23, 193, 203, 16, 23, 13, + 32, 245, 34, 35, 34, 35, 201, 60, 66, 185, 165, 185, 165, 66, 60, 0, 84, 168, 252, 66, 79, 79, + 84, 73, 88, 46, 68, 77, 71, 32, 118, 49, 46, 50, 0, 62, 255, 198, 1, 11, 30, 216, 33, 77, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 255, 224, 80, +]; diff --git a/src/gb.rs b/src/gb.rs index 2910563a3f5ab95b83ab5362d925280fb4ba85cd..d81ea62b5eced164f10a34c0fe7acea8314efccb 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -1,6 +1,6 @@ use crate::{ cpu::Cpu, - data::{DMG_BOOT, SGB_BOOT}, + data::{DMG_BOOT, DMG_BOOTIX, MGB_BOOTIX, SGB_BOOT}, mmu::Mmu, pad::Pad, ppu::{Ppu, FRAME_BUFFER_SIZE}, @@ -62,7 +62,6 @@ impl GameBoy { pub fn load_boot_file(&mut self, path: &str) { let data = read_file(path); - println!("{:?}", data); self.load_boot(&data); } @@ -74,6 +73,14 @@ impl GameBoy { self.load_boot_file("./res/boot/sgb_boot.bin"); } + pub fn load_boot_dmg_bootix_f(&mut self) { + self.load_boot_file("./res/boot/dmg_bootix.bin"); + } + + pub fn load_boot_mgb_bootix_f(&mut self) { + self.load_boot_file("./res/boot/mgb_bootix.bin"); + } + pub fn load_boot_default(&mut self) { self.load_boot_dmg_f(); } @@ -86,6 +93,14 @@ impl GameBoy { self.load_boot(&SGB_BOOT); } + pub fn load_boot_dmg_bootix(&mut self) { + self.load_boot(&DMG_BOOTIX); + } + + pub fn load_boot_mgb_bootix(&mut self) { + self.load_boot(&MGB_BOOTIX); + } + pub fn frame_buffer_eager(&mut self) -> Vec<u8> { self.frame_buffer().to_vec() }