diff options
Diffstat (limited to 'mknes.h')
| -rw-r--r-- | mknes.h | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -1,17 +1,27 @@ -#define PPU_CTRL_BG_TILE_SELECT 0x10 -#define PPU_CTRL_SPRITE_TILE_SELECT 0x08 - -// Define constants for PPU control and mask bits +// Define constants for PPU control register bits ($2000) #define PPU_CTRL_NMI 0x80 #define PPU_CTRL_SPRITE_HEIGHT 0x20 +#define PPU_CTRL_BG_TILE_SELECT 0x10 #define PPU_CTRL_SPRITE_TILE 0x08 #define PPU_CTRL_VRAM_INCREMENT 0x04 -#define PPU_MASK_SHOW_BG 0x08 +// Define constants for PPU mask register bits ($2001) #define PPU_MASK_SHOW_SPRITES 0x10 +#define PPU_MASK_SHOW_BG 0x08 + +// Define constants for PPU status register bits ($2002) +#define PPU_STATUS_VBLANK 0x80 +#define PPU_STATUS_SPRITE_ZERO_HIT 0x40 +#define PPU_STATUS_SPRITE_OVERFLOW 0x20 + +// Define constants for sprite attribute bits +#define SPRITE_ATTR_FLIP_VERTICAL 0x80 +#define SPRITE_ATTR_FLIP_HORIZONTAL 0x40 +#define SPRITE_ATTR_PRIORITY 0x20 +#define SPRITE_ATTR_PALETTE_MASK 0x03 // Define mirroring modes #define MIRROR_HORIZONTAL 0 @@ -45,13 +55,11 @@ struct ppu_state { uint8_t vram_read_buffer; // 28 uint8_t open_bus; // 29 - uint8_t sprite_count; // 30 - uint8_t overflow_scheduled_dot; // 31 - uint8_t palette[32]; // 32 + uint8_t sprite_count; // 30 - Number of sprites in secondary OAM (0-8) + uint8_t palette[32]; // 31 // NOTE(peter): CACHELINE 2 uint8_t secondary_oam[32] __attribute__((aligned(64))); - uint8_t temp_secondary_oam[32]; // NOTE(peter): CACHELINE 3 struct sprite_data { @@ -68,8 +76,6 @@ struct ppu_state { uint8_t input_strobe; // 46 - Control bit (0 or 1) uint8_t frame_ready; // 47 uint8_t sprite_zero_in_range; // 48 - Boolean: is sprite 0 in range (will always be slot 0 if true) - uint8_t sprite_count_next; // 49 - Sprite count for next scanline - // 15 bytes left. // NOTE(peter): CACHELINE 4 uint8_t oam[256] __attribute__((aligned(64))); |
