From 39715ca6bf65d2e2dd889cdef4b39d584464d9e7 Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Sun, 6 Apr 2025 12:27:12 +0200 Subject: added more mappers (buggy) --- cpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpu.c') diff --git a/cpu.c b/cpu.c index 263ee6e..34d5bed 100644 --- a/cpu.c +++ b/cpu.c @@ -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); -- cgit v1.2.3