Skip to content

Commit

Permalink
Map More CGB PPU Registers
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Feb 2, 2024
1 parent 0a58524 commit 73bb30b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/mmu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ impl Memory for MMU {
0xFF04..=0xFF07 => self.timer.read(a),
0xFF10..=0xFF3F => self.apu.read(a),
0xFF0F => self.intf.bits(),
0xFF51..=0xFF6F => self.ppu.read(a),
0xFF70 => self.wram_bank as u8,
0xFEA0..=0xFEFF => 0xFF,
0xFFFF => self.inte.bits(),
Expand Down Expand Up @@ -166,7 +167,7 @@ impl Memory for MMU {
0xFF10..=0xFF3F => self.apu.write(a, v),
0xFF0F => self.intf = Interrupts::from_bits_truncate(v),
0xFF50 => self.boot_rom_enabled = false,
0xFF51..=0xFF6F => {}
0xFF51..=0xFF6F => self.ppu.write(a, v),
0xFF70 => {
self.wram_bank = match v & 0x07 {
0 => 1,
Expand Down
8 changes: 8 additions & 0 deletions src/components/ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ impl Memory for PPU {
0xFF4B => self.wx,
0xFF4D => 0x00,
0xFF4F => 0xFE | self.ram_bank as u8,
// TODO: DMA
0xFF51..=0xFF55 => 0x00,
0xFF68 => self.bcps.read(),
0xFF69 => {
let r = self.bcps.i as usize >> 3;
Expand Down Expand Up @@ -586,6 +588,8 @@ impl Memory for PPU {
a | b
}
}
// TODO: Object Priority Mode
0xFF6C => 0x00,
_ => panic!("Read to unsupported PPU address ({:#06x})!", a),
}
}
Expand Down Expand Up @@ -631,6 +635,8 @@ impl Memory for PPU {
// TODO: Handle PPU speed switching
0xFF4D => {}
0xFF4F => self.ram_bank = (v & 0x01) as usize,
// TODO: DMA
0xFF51..=0xFF55 => {}
0xFF68 => self.bcps.write(v),
0xFF69 => {
let r = self.bcps.i as usize >> 3;
Expand Down Expand Up @@ -665,6 +671,8 @@ impl Memory for PPU {
self.ocps.i &= 0x3F;
}
}
// TODO: Object Priority Mode
0xFF6C => {}
_ => panic!("Write to unsupported PPU address ({:#06x})!", a),
}
}
Expand Down

0 comments on commit 73bb30b

Please sign in to comment.