diff --git a/src/mmio_addresses.rs b/src/mmio_addresses.rs index 315ce34..dd75600 100644 --- a/src/mmio_addresses.rs +++ b/src/mmio_addresses.rs @@ -287,3 +287,21 @@ pub const INTR_WAIT_ACKNOWLEDGE: VolAddress = unsa // refer to that value instead. VolAddress::new(0x0300_FFF8) }; + +pub const BACKDROP_COLOR: VolAddress = unsafe { VolAddress::new(0x0500_0000) }; + +pub const BG_PALETTE: VolBlock = unsafe { VolBlock::new(0x0500_0000) }; + +pub const OBJ_PALETTE: VolBlock = unsafe { VolBlock::new(0x0500_0200) }; + +pub const OAM_ATTR0: VolSeries = + unsafe { VolSeries::new(0x0700_0000) }; +pub const OAM_ATTR1: VolSeries = + unsafe { VolSeries::new(0x0700_0002) }; +pub const OAM_ATTR2: VolSeries = + unsafe { VolSeries::new(0x0700_0004) }; + +pub const OAM_PA: VolSeries = unsafe { VolSeries::new(0x0700_0006) }; +pub const OAM_PB: VolSeries = unsafe { VolSeries::new(0x0700_000E) }; +pub const OAM_PC: VolSeries = unsafe { VolSeries::new(0x0700_0016) }; +pub const OAM_PD: VolSeries = unsafe { VolSeries::new(0x0700_001E) }; diff --git a/src/mmio_types.rs b/src/mmio_types.rs index 9a98578..beb4393 100644 --- a/src/mmio_types.rs +++ b/src/mmio_types.rs @@ -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::*; diff --git a/src/mmio_types/obj_attr0.rs b/src/mmio_types/obj_attr0.rs new file mode 100644 index 0000000..89f1fcb --- /dev/null +++ b/src/mmio_types/obj_attr0.rs @@ -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); +} diff --git a/src/mmio_types/obj_attr1.rs b/src/mmio_types/obj_attr1.rs new file mode 100644 index 0000000..033c721 --- /dev/null +++ b/src/mmio_types/obj_attr1.rs @@ -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); +} diff --git a/src/mmio_types/obj_attr2.rs b/src/mmio_types/obj_attr2.rs new file mode 100644 index 0000000..9258d15 --- /dev/null +++ b/src/mmio_types/obj_attr2.rs @@ -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); +}