diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs index d1fdf4a0c1e8f883318eadc7e23c42d08aba3c0c..3f4013e29cb696f2928559b7ff464225cf8bab28 100644 --- a/frontends/sdl/src/main.rs +++ b/frontends/sdl/src/main.rs @@ -465,6 +465,15 @@ struct Args { #[arg(short, long, default_value_t = String::from("printer"))] device: String, + #[arg(long, default_value_t = false)] + no_ppu: bool, + + #[arg(long, default_value_t = false)] + no_apu: bool, + + #[arg(long, default_value_t = false)] + no_timer: bool, + // TODO: change this to emulator.load_rom(Some("../../res/roms/demo/pocket.gb")); #[arg(short, long, default_value_t = String::from("../../res/roms.prop/tetris_dx.gbc"))] rom_path: String, @@ -480,6 +489,9 @@ fn main() { // and the initial game ROM to "start the engine" let mut game_boy = GameBoy::new(mode); let device = build_device(&args.device); + game_boy.set_ppu_enabled(!args.no_ppu); + game_boy.set_apu_enabled(!args.no_apu); + game_boy.set_timer_enabled(!args.no_timer); game_boy.attach_serial(device); game_boy.load(true); diff --git a/frontends/web/ts/gb.ts b/frontends/web/ts/gb.ts index e887b2844f663040dcc284632eb4ec09793b7746..9de4879c589f94c56648d0ce07522d6fdd8016de 100644 --- a/frontends/web/ts/gb.ts +++ b/frontends/web/ts/gb.ts @@ -391,7 +391,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { // and builds a new instance of it switch (engine) { case "neo": - this.gameBoy = new GameBoy(GameBoyMode.Dmg); + this.gameBoy = new GameBoy(GameBoyMode.Cgb); break; default: if (!this.gameBoy) { diff --git a/src/mmu.rs b/src/mmu.rs index 2483ae1b95eec8b75cb771b1afdae06357752716..b1967f337b7eb9fc5f80b70b1c361967f9f0e0da 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -240,9 +240,18 @@ impl Mmu { | if self.pad.int_pad() { 0x10 } else { 0x00 }) } + // 0xFF4C - KEY0 (CGB only) + 0x4c => todo!("Need to see what to do with KEY0"), + + // 0xFF4D - KEY1 (CGB only) + 0x4d => todo!("CGB speed switch"), + // 0xFF50 - Boot active flag 0x50 => u8::from(self.boot_active), + // 0xFF70 - SVBK: WRAM bank (CGB only) + 0x70 => self.ram_bank & 0x07, + // 0xFF80-0xFFFE - High RAM (HRAM) 0x80..=0xfe => self.ppu.read(addr), diff --git a/src/ppu.rs b/src/ppu.rs index e2863f5f91bfd079f1c245c49ad3e7ba68e6f612..24bdf3f3be154e5e10459de2297463112230da31 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -959,7 +959,7 @@ impl Ppu { &mut self.bg_map_attrs_0 }; let tile_data: &mut TileData = bg_map_attrs[tile_index as usize].borrow_mut(); - tile_data.palette = value & 0x03; + tile_data.palette = value & 0x07; tile_data.vram_bank = (value & 0x08) >> 4; tile_data.vram_bank = (value & 0x08) >> 4; tile_data.xflip = value & 0x20 == 0x20;