diff --git a/src/mmu.rs b/src/mmu.rs index 9010d9e6f2fd304cd6c40ba80b1def5df6c1084c..acfb3abad6e48cafb5cec0baf1802dd701a4ecc9 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -4,7 +4,6 @@ pub const BIOS_SIZE: usize = 256; pub const ROM_SIZE: usize = 32768; pub const RAM_SIZE: usize = 8192; pub const ERAM_SIZE: usize = 8192; -pub const HRAM_SIZE: usize = 128; pub struct Mmu { ppu: Ppu, @@ -13,7 +12,6 @@ pub struct Mmu { rom: [u8; ROM_SIZE], ram: [u8; RAM_SIZE], eram: [u8; RAM_SIZE], - hram: [u8; HRAM_SIZE], } impl Mmu { @@ -25,7 +23,6 @@ impl Mmu { rom: [0u8; ROM_SIZE], ram: [0u8; RAM_SIZE], eram: [0u8; ERAM_SIZE], - hram: [0u8; HRAM_SIZE], } } @@ -81,7 +78,7 @@ impl Mmu { } 0xf00 => { if addr >= 0xff80 { - self.hram[(addr & 0x7f) as usize] + self.ppu.hram[(addr & 0x7f) as usize] } else { println!("WRITING TO IO control"); 0x00 @@ -137,7 +134,7 @@ impl Mmu { } 0xf00 => { if addr >= 0xff80 { - self.hram[(addr & 0x7f) as usize] = value; + self.ppu.hram[(addr & 0x7f) as usize] = value; } else { println!("WRITING TO IO control"); } diff --git a/src/ppu.rs b/src/ppu.rs index ba7680edf0cb9ba7b8a05dabd425c88519e76cae..7e1d7e351ffdcd8bc35dcbdbca266926802ef872 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -1,13 +1,16 @@ pub const VRAM_SIZE: usize = 8192; +pub const HRAM_SIZE: usize = 128; pub struct Ppu { pub vram: [u8; VRAM_SIZE], + pub hram: [u8; HRAM_SIZE], } impl Ppu { pub fn new() -> Ppu { Ppu { vram: [0u8; VRAM_SIZE], + hram: [0u8; HRAM_SIZE], } } }