palbank function

This commit is contained in:
Lokathor 2023-01-01 18:01:23 -07:00
parent 416f8a089c
commit be91260b33

View file

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