mirror of
https://github.com/italicsjenga/gba.git
synced 2025-01-10 02:51:31 +11:00
palbank function
This commit is contained in:
parent
416f8a089c
commit
be91260b33
13
src/mmio.rs
13
src/mmio.rs
|
@ -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_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.");
|
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)
|
// Video RAM (VRAM)
|
||||||
|
|
||||||
/// The VRAM byte offset per screenblock index.
|
/// The VRAM byte offset per screenblock index.
|
||||||
|
|
Loading…
Reference in a new issue