diff --git a/lib/src/processor/memory/mmio/gpu.rs b/lib/src/processor/memory/mmio/gpu.rs index edba562..fa7c987 100644 --- a/lib/src/processor/memory/mmio/gpu.rs +++ b/lib/src/processor/memory/mmio/gpu.rs @@ -534,8 +534,11 @@ where }; let tiledata_offset = tile_px_y * 2; - let tile_addr = (self.lcdc.tile_area.get_addr(self.vram.get(tilemap_addr)) - + tiledata_offset as u16) + let tile_addr = (self.lcdc.tile_area.get_addr( + self.vram + .get_with_bank(tilemap_addr, VramBank::Bank0) + .unwrap(), + ) + tiledata_offset as u16) .unwrap(); let lsbs = self diff --git a/lib/src/processor/memory/mmio/gpu/types.rs b/lib/src/processor/memory/mmio/gpu/types.rs index 39ad746..e7e3eb6 100644 --- a/lib/src/processor/memory/mmio/gpu/types.rs +++ b/lib/src/processor/memory/mmio/gpu/types.rs @@ -267,7 +267,7 @@ impl Default for Stat { } } -#[derive(Serialize, Deserialize, Clone, Copy)] +#[derive(Serialize, Deserialize, Clone, Copy, Debug)] pub enum VramBank { Bank0 = 0, Bank1 = 1, @@ -386,6 +386,7 @@ pub struct GpuInterrupts { pub vblank: bool, } +#[derive(Debug)] pub(super) struct BgAttributes { pub(super) bg_priority: bool, pub(super) flip_v: bool, @@ -397,11 +398,11 @@ pub(super) struct BgAttributes { impl Default for BgAttributes { fn default() -> Self { Self { - bg_priority: Default::default(), - flip_v: Default::default(), - flip_h: Default::default(), + bg_priority: false, + flip_v: false, + flip_h: false, tile_bank: VramBank::Bank0, - palette: Default::default(), + palette: 0, } } }