better vram, still not the best

This commit is contained in:
Lokathor 2018-12-27 11:51:35 -07:00
parent e10491eb8c
commit 147a2bc45c

View file

@ -27,8 +27,10 @@ pub mod text;
/// being the correct thing. /// being the correct thing.
pub const VRAM_BASE_USIZE: usize = 0x600_0000; pub const VRAM_BASE_USIZE: usize = 0x600_0000;
/// The character base blocks.
pub const CHAR_BASE_BLOCKS: VolAddressBlock<[u8; 0x4000]> = unsafe { VolAddressBlock::new_unchecked(VolAddress::new_unchecked(VRAM_BASE_USIZE), 6) }; pub const CHAR_BASE_BLOCKS: VolAddressBlock<[u8; 0x4000]> = unsafe { VolAddressBlock::new_unchecked(VolAddress::new_unchecked(VRAM_BASE_USIZE), 6) };
/// The screen entry base blocks.
pub const SCREEN_BASE_BLOCKS: VolAddressBlock<[u8; 0x800]> = pub const SCREEN_BASE_BLOCKS: VolAddressBlock<[u8; 0x800]> =
unsafe { VolAddressBlock::new_unchecked(VolAddress::new_unchecked(VRAM_BASE_USIZE), 32) }; unsafe { VolAddressBlock::new_unchecked(VolAddress::new_unchecked(VRAM_BASE_USIZE), 32) };
@ -44,16 +46,12 @@ newtype! {
Tile8bpp, pub [u32; 16], no frills Tile8bpp, pub [u32; 16], no frills
} }
/* /// Gives the specified charblock in 4bpp view.
newtype! { pub fn get_4bpp_character_block(slot: usize) -> VolAddressBlock<Tile4bpp> {
/// A 4bpp charblock has 512 tiles in it unsafe { VolAddressBlock::new_unchecked(CHAR_BASE_BLOCKS.index(slot).cast::<Tile4bpp>(), 512) }
#[derive(Clone, Copy)]
Charblock4bpp, pub [Tile4bpp; 512], no frills
} }
newtype! { /// Gives the specified charblock in 8bpp view.
/// An 8bpp charblock has 256 tiles in it pub fn get_8bpp_character_block(slot: usize) -> VolAddressBlock<Tile8bpp> {
#[derive(Clone, Copy)] unsafe { VolAddressBlock::new_unchecked(CHAR_BASE_BLOCKS.index(slot).cast::<Tile8bpp>(), 256) }
Charblock8bpp, pub [Tile4bpp; 256], no frills
} }
*/