diff --git a/src/mmio.rs b/src/mmio.rs index 6690c30..23a31d1 100644 --- a/src/mmio.rs +++ b/src/mmio.rs @@ -201,6 +201,19 @@ def_mmio!(0x0500_0000 = BACKDROP_COLOR: VolAddress; "Color th def_mmio!(0x0500_0000 = BG_PALETTE: VolBlock; "Background tile palette entries."); def_mmio!(0x0500_0200 = OBJ_PALETTE: VolBlock; "Object tile palette entries."); +#[inline] +#[must_use] +pub const fn bg_palbank(bank: usize) -> VolBlock { + let u = BG_PALETTE.index(bank * 16).as_usize(); + unsafe { VolBlock::new(u) } +} +#[inline] +#[must_use] +pub const fn obj_palbank(bank: usize) -> VolBlock { + let u = OBJ_PALETTE.index(bank * 16).as_usize(); + unsafe { VolBlock::new(u) } +} + // Video RAM (VRAM) /// The VRAM byte offset per screenblock index.