diff options
| author | Peter Fors <peter.fors@mindkiller.com> | 2025-04-06 12:27:12 +0200 |
|---|---|---|
| committer | Peter Fors <peter.fors@mindkiller.com> | 2025-04-06 12:27:12 +0200 |
| commit | 39715ca6bf65d2e2dd889cdef4b39d584464d9e7 (patch) | |
| tree | 39390f6fadd0ddbe913ae66e11847b8b3e7b16bb /cpu.c | |
| parent | dabd7a5848e6aa55e91cf4c804f6236b4f7fe30e (diff) | |
added more mappers (buggy)
Diffstat (limited to 'cpu.c')
| -rw-r--r-- | cpu.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -20,7 +20,6 @@ static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) { cpu->c = value & 1; } - static inline void update_zn(struct cpu_state *cpu, uint8_t result) { cpu->z = (result == 0); cpu->n = (result & 0x80) != 0; @@ -35,6 +34,7 @@ struct addr_result { #include "cpu_opcodes.c" #include "cpu_opcodes_ud.c" +__attribute__((hot)) static inline void do_nmi(struct nes_state * restrict state) { struct cpu_state * restrict cpu = &state->cpu; @@ -54,6 +54,7 @@ static inline void do_nmi(struct nes_state * restrict state) { cpu->i = 1; } +__attribute__((hot)) static inline void do_irq(struct nes_state * restrict state) { struct cpu_state * restrict cpu = &state->cpu; @@ -73,6 +74,7 @@ static inline void do_irq(struct nes_state * restrict state) { cpu->i = 1; } +__attribute__((hot)) static inline void check_interrupts(struct nes_state * restrict state) { struct cpu_state * restrict cpu = &state->cpu; @@ -85,6 +87,7 @@ static inline void check_interrupts(struct nes_state * restrict state) { } } +__attribute__((hot)) static void cpu_tick(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; @@ -92,7 +95,7 @@ static void cpu_tick(struct nes_state *state) { uint8_t opcode; - // printf("%5.5d %4.4x: ", line++, cpu->pc); + // printf("%4.4x: ", cpu->pc); opcode = memory_read(state, cpu->pc++); // printf("%2.2x a:%2.2x x:%2.2x y:%2.2x p:%2.2x sp:%2.2x cycle: %ld\n", opcode, cpu->a, cpu->x, cpu->y, pack_flags(cpu), cpu->sp, state->cycles); opcode_lut[opcode](state); |
