diff options
| author | Peter Fors <peter.fors@mindkiller.com> | 2025-04-08 02:26:58 +0200 |
|---|---|---|
| committer | Peter Fors <peter.fors@mindkiller.com> | 2025-04-08 02:26:58 +0200 |
| commit | 205dc47111125aa2f7458be948cd9cd434d0344c (patch) | |
| tree | dc9c44d9bc431449b478a5a5bc72a6a4d7c36c37 /mknes.h | |
| parent | d45fbf8d2e1adcb35043dfc9e06eae3ccfdf596e (diff) | |
Back at 2618fps
Diffstat (limited to 'mknes.h')
| -rw-r--r-- | mknes.h | 45 |
1 files changed, 23 insertions, 22 deletions
@@ -21,12 +21,16 @@ #define MIRROR_FOURSCREEN 2 struct ppu_state { + uint16_t bg_shift_pattern_low; + uint16_t bg_shift_pattern_high; + uint16_t bg_shift_attrib_low; + uint16_t bg_shift_attrib_high; + uint32_t scanline; uint32_t dot; - uint32_t bg_shift_pattern_low; - uint32_t bg_shift_pattern_high; - uint32_t bg_shift_attrib_low; - uint32_t bg_shift_attrib_high; + uint32_t vram_addr; + uint32_t temp_addr; + uint32_t fine_x; uint8_t bg_next_tile_id; uint8_t bg_next_tile_attrib; uint8_t bg_next_tile_lsb; @@ -35,26 +39,13 @@ struct ppu_state { uint8_t oam_data; uint8_t even_frame; - uint8_t oam[256]; - uint8_t secondary_oam[32]; - uint8_t palette[0x20]; - uint8_t sprite_indexes[8]; - uint32_t sprite_patterns[8]; - uint8_t sprite_positions[8]; - uint8_t sprite_priorities[8]; - uint8_t sprite_shift_lo[8]; - uint8_t sprite_shift_hi[8]; - uint8_t reg_ctrl; uint8_t reg_mask; uint8_t reg_status; - uint32_t vram_addr; - uint32_t temp_addr; - uint32_t fine_x; + uint8_t write_latch; uint8_t vram_read_buffer; - uint8_t write_latch; uint8_t open_bus; @@ -62,7 +53,17 @@ struct ppu_state { uint8_t sprite_zero_hit_possible; uint8_t sprite_count; -} __attribute__((aligned(64))); + + uint8_t sprite_indexes[8]; + uint8_t sprite_positions[8]; + uint8_t sprite_priorities[8]; + uint8_t sprite_shift_lo[8]; + uint8_t sprite_shift_hi[8]; + uint8_t palette[32]; + uint8_t secondary_oam[32]; + uint8_t oam[256]; + +} __attribute__((packed, aligned(64))); struct cpu_state { uint32_t pc; // Program Counter @@ -80,7 +81,7 @@ struct cpu_state { uint8_t c; // Carry Flag // -- uint8_t die; // KIL instruction found! -} __attribute__((aligned(64))); +};// __attribute__((aligned(64))); struct ines_state { @@ -93,18 +94,18 @@ struct ines_state { struct nes_state { size_t cycles; - struct ines_state ines; struct cpu_state cpu; uint8_t irq_pending; uint8_t nmi_pending; uint8_t input[2]; // Controller 1 & 2 uint8_t input_latch[2]; // Latched inputs after strobe - uint8_t input_strobe; // Control bit (0 or 1) uint8_t input_bit[2]; // Current bit position being shifted out + uint8_t input_strobe; // Control bit (0 or 1) struct ppu_state ppu; struct mapper_entry mapper; union mapper_data map; + struct ines_state ines; uint8_t *pixels; uint8_t *ram; |
