Skip to content
Snippets Groups Projects
Verified Commit a175ba8d authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new test rom and initial speed support

The double speed mode is still not available.
parent c9d0c501
No related branches found
No related tags found
1 merge request!16Support for Game Boy Color (CGB) 😎🖍️
Pipeline #2627 failed
File added
......@@ -82,6 +82,13 @@ impl Display for GameBoyMode {
}
}
#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum GameBoySpeed {
Normal = 0,
Double = 1,
}
#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct GameBoyConfig {
......
use crate::{
apu::Apu,
debugln,
gb::{GameBoyConfig, GameBoyMode},
gb::{GameBoyConfig, GameBoyMode, GameBoySpeed},
pad::Pad,
ppu::Ppu,
rom::Cartridge,
......@@ -29,6 +29,8 @@ pub struct Mmu {
/// (CGB only).
pub key0: u8,
pub speed: GameBoySpeed,
/// Reference to the PPU (Pixel Processing Unit) that is going
/// to be used both for VRAM reading/writing and to forward
/// some of the access operations.
......@@ -110,6 +112,7 @@ impl Mmu {
ram_offset: 0x1000,
ie: 0x0,
key0: 0x0,
speed: GameBoySpeed::Normal,
mode,
gbc,
}
......@@ -253,7 +256,7 @@ impl Mmu {
0x4c => self.key0,
// 0xFF4D - KEY1 (CGB only)
0x4d => todo!("CGB speed switch"),
0x4d => (false as u8) | ((self.speed as u8) << 7),
// 0xFF50 - Boot active flag
0x50 => u8::from(self.boot_active),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment