summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-05-24 15:45:54 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-05-24 15:45:54 +0200
commita8e0c141b0184d629504b9f0ee8dbc4fefb90934 (patch)
treecff0f7e64ce58dc8f1e4ff4501743d9b94449c94 /cpu.c
parente28ad1546509de31b706f0fd300a906e5bc55199 (diff)
3011fps
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/cpu.c b/cpu.c
index 74d253d..23825aa 100644
--- a/cpu.c
+++ b/cpu.c
@@ -5,12 +5,10 @@
// DO NOT ENABLE FOR NES!!!!!
// #define ENABLE_DECIMAL_MODE
-__attribute__((hot))
static inline uint8_t pack_flags(struct cpu_state *cpu) {
return (cpu->n << 7) | (cpu->v << 6) | (1 << 5) | (cpu->d << 3) | (cpu->i << 2) | (cpu->z << 1) | cpu->c;
}
-__attribute__((hot))
static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) {
cpu->n = (value >> 7) & 1;
cpu->v = (value >> 6) & 1;
@@ -20,7 +18,6 @@ static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) {
cpu->c = value & 1;
}
-__attribute__((hot))
static inline void update_zn(struct cpu_state *cpu, uint8_t result) {
cpu->z = (result == 0);
cpu->n = (result & 0x80) != 0;
@@ -31,8 +28,7 @@ static void (*opcode_lut[256*2])(struct nes_state *) __attribute__((aligned(4096
#include "cpu_opcodes.c"
#include "cpu_opcodes_ud.c"
-__attribute__((hot))
-static inline void do_nmi(struct nes_state * restrict state) {
+static inline void do_nmi(struct nes_state *state) {
struct cpu_state * restrict cpu = &state->cpu;
memory_read_dummy(state, cpu->pc); // T1: dummy read (fetch suppressed)
@@ -51,8 +47,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) {
+static inline void do_irq(struct nes_state *state) {
struct cpu_state * restrict cpu = &state->cpu;
memory_read_dummy(state, cpu->pc); // T1: dummy read (fetch suppressed)
@@ -71,8 +66,7 @@ static inline void do_irq(struct nes_state * restrict state) {
cpu->i = 1;
}
-__attribute__((always_inline, hot))
-static inline void check_interrupts(struct nes_state * restrict state) {
+static inline void check_interrupts(struct nes_state *state) {
struct cpu_state * restrict cpu = &state->cpu;
if(state->cpu.nmi_pending) {
@@ -84,8 +78,7 @@ static inline void check_interrupts(struct nes_state * restrict state) {
}
}
-__attribute__((hot))
-static void cpu_tick(struct nes_state *state) {
+static inline void cpu_tick(struct nes_state *state) {
struct cpu_state * restrict cpu = &state->cpu;
check_interrupts(state);