summaryrefslogtreecommitdiff
path: root/mknes.h
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-11-14 22:17:03 +0100
committerPeter Fors <peter.fors@mindkiller.com>2025-11-14 22:17:03 +0100
commit2174b3f369e59286ccd10348117a16e08c412508 (patch)
tree8ff6c7d02da221aad45fcdb03b22f09080a9c9aa /mknes.h
parent46d0f6aeb1588b85852487e581a8b4c9c2401646 (diff)
Rearranged the ppu_state to be even more cacheline aware, gained another 1% performance
Diffstat (limited to 'mknes.h')
-rw-r--r--mknes.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/mknes.h b/mknes.h
index b6739d3..944f762 100644
--- a/mknes.h
+++ b/mknes.h
@@ -56,7 +56,6 @@ struct ppu_state {
uint8_t open_bus; // 29
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)));
@@ -68,16 +67,18 @@ struct ppu_state {
uint8_t position;
uint8_t priority;
uint8_t palette;
- } __attribute__((packed)) sprites[8];
+ } __attribute__((packed)) sprites[8]; // 32 -> +40
- uint8_t input[2]; // 40 - Controller 1 & 2
- uint8_t input_latch[2]; // 42 - Latched inputs after strobe
- uint8_t input_bit[2]; // 44 - Current bit position being shifted out
- 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 input_strobe; // 76 - Control bit (0 or 1)
+ uint8_t input[2]; // 73 - Controller 1 & 2
+ uint8_t input_latch[2]; // 74 - Latched inputs after strobe
+ uint8_t input_bit[2]; // 75 - Current bit position being shifted out
+ uint8_t frame_ready; // 77
+ uint8_t sprite_zero_in_range; // 78 - Boolean: is sprite 0 in range (will always be slot 0 if true)
- // NOTE(peter): CACHELINE 4
+ uint8_t palette[32]; // 79
+
+ // NOTE(peter): CACHELINE 5
uint8_t oam[256] __attribute__((aligned(64)));
} __attribute__((packed));