mirror of
https://github.com/italicsjenga/gba.git
synced 2024-12-23 10:51:30 +11:00
palettes and oam (#137)
This commit is contained in:
parent
d93facbaf4
commit
9e8349c82e
|
@ -287,3 +287,21 @@ pub const INTR_WAIT_ACKNOWLEDGE: VolAddress<InterruptFlags, Safe, Unsafe> = unsa
|
|||
// refer to that value instead.
|
||||
VolAddress::new(0x0300_FFF8)
|
||||
};
|
||||
|
||||
pub const BACKDROP_COLOR: VolAddress<Color, Safe, Safe> = unsafe { VolAddress::new(0x0500_0000) };
|
||||
|
||||
pub const BG_PALETTE: VolBlock<Color, Safe, Safe, 256> = unsafe { VolBlock::new(0x0500_0000) };
|
||||
|
||||
pub const OBJ_PALETTE: VolBlock<Color, Safe, Safe, 256> = unsafe { VolBlock::new(0x0500_0200) };
|
||||
|
||||
pub const OAM_ATTR0: VolSeries<ObjAttr0, Safe, Safe, 128, 8> =
|
||||
unsafe { VolSeries::new(0x0700_0000) };
|
||||
pub const OAM_ATTR1: VolSeries<ObjAttr1, Safe, Safe, 128, 8> =
|
||||
unsafe { VolSeries::new(0x0700_0002) };
|
||||
pub const OAM_ATTR2: VolSeries<ObjAttr2, Safe, Safe, 128, 8> =
|
||||
unsafe { VolSeries::new(0x0700_0004) };
|
||||
|
||||
pub const OAM_PA: VolSeries<i16, Safe, Safe, 32, 0x20> = unsafe { VolSeries::new(0x0700_0006) };
|
||||
pub const OAM_PB: VolSeries<i16, Safe, Safe, 32, 0x20> = unsafe { VolSeries::new(0x0700_000E) };
|
||||
pub const OAM_PC: VolSeries<i16, Safe, Safe, 32, 0x20> = unsafe { VolSeries::new(0x0700_0016) };
|
||||
pub const OAM_PD: VolSeries<i16, Safe, Safe, 32, 0x20> = unsafe { VolSeries::new(0x0700_001E) };
|
||||
|
|
|
@ -209,3 +209,12 @@ pub use noise_len_env::*;
|
|||
|
||||
mod noise_frequency_control;
|
||||
pub use noise_frequency_control::*;
|
||||
|
||||
mod obj_attr0;
|
||||
pub use obj_attr0::*;
|
||||
|
||||
mod obj_attr1;
|
||||
pub use obj_attr1::*;
|
||||
|
||||
mod obj_attr2;
|
||||
pub use obj_attr2::*;
|
||||
|
|
15
src/mmio_types/obj_attr0.rs
Normal file
15
src/mmio_types/obj_attr0.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
#[repr(transparent)]
|
||||
pub struct ObjAttr0(u16);
|
||||
impl ObjAttr0 {
|
||||
const_new!();
|
||||
bitfield_int!(u16; 0..=7: u16, y_pos, with_y_pos, set_y_pos);
|
||||
bitfield_bool!(u16; 8, affine, with_affine, set_affine);
|
||||
bitfield_bool!(u16; 9, double_disabled, with_double_disabled, set_double_disabled);
|
||||
bitfield_int!(u16; 10..=11: u16, obj_mode, with_obj_mode, set_obj_mode);
|
||||
bitfield_bool!(u16; 12, mosaic, with_mosaic, set_mosaic);
|
||||
bitfield_bool!(u16; 13, use_palbank, with_use_palbank, set_use_palbank);
|
||||
bitfield_int!(u16; 14..=15: u16, obj_shape, with_obj_shape, set_obj_shape);
|
||||
}
|
13
src/mmio_types/obj_attr1.rs
Normal file
13
src/mmio_types/obj_attr1.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
#[repr(transparent)]
|
||||
pub struct ObjAttr1(u16);
|
||||
impl ObjAttr1 {
|
||||
const_new!();
|
||||
bitfield_int!(u16; 0..=8: u16, x_pos, with_x_pos, set_x_pos);
|
||||
bitfield_int!(u16; 9..=13: u16, affine_index, with_affine_index, set_affine_index);
|
||||
bitfield_bool!(u16; 12, hflip, with_hflip, set_hflip);
|
||||
bitfield_bool!(u16; 13, vflip, with_vflip, set_vflip);
|
||||
bitfield_int!(u16; 14..=15: u16, obj_size, with_obj_size, set_obj_size);
|
||||
}
|
11
src/mmio_types/obj_attr2.rs
Normal file
11
src/mmio_types/obj_attr2.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
#[repr(transparent)]
|
||||
pub struct ObjAttr2(u16);
|
||||
impl ObjAttr2 {
|
||||
const_new!();
|
||||
bitfield_int!(u16; 0..=9: u16, tile_index, with_tile_index, set_tile_index);
|
||||
bitfield_int!(u16; 10..=11: u16, priority, with_priority, set_priority);
|
||||
bitfield_int!(u16; 12..=15: u16, palbank_index, with_palbank_index, set_palbank_index);
|
||||
}
|
Loading…
Reference in a new issue