From 0ceba17139543b5a17db04136b6f69b82fdd7196 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Thu, 3 Mar 2022 01:36:40 -0400 Subject: [PATCH] chore: add some type definitions for sprites --- src/ppu.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/ppu.zig b/src/ppu.zig index 33a669e..6c8784c 100644 --- a/src/ppu.zig +++ b/src/ppu.zig @@ -366,3 +366,28 @@ const ScreenEntry = extern union { palette_bank: Bitfield(u16, 12, 4), raw: u16, }; + +const Attr0 = extern union { + y: Bitfield(u16, 0, 8), + rot_scaling: Bit(u16, 8), // This SBZ + disabled: Bit(u16, 9), + mode: Bitfield(u16, 10, 2), + mosaic: Bit(u16, 12), + is_8bpp: Bit(u16, 13), + shape: Bit(u16, 14, 2), + raw: u16, +}; + +const Attr1 = extern union { + x: Bitfield(u16, 0, 9), + h_flip: Bit(u16, 12), + v_flip: Bit(u16, 13), + size: Bitfield(u16, 14, 2), + raw: u16, +}; + +const Attr2 = extern union { + tile_id: Bitfield(u16, 0, 10), + rel_prio: Bitfield(u16, 10, 2), + pal_id: Bitfield(u16, 12, 3), +};