diff options
Diffstat (limited to 'cpu_opcodes.c')
| -rw-r--r-- | cpu_opcodes.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cpu_opcodes.c b/cpu_opcodes.c index b879015..7e174be 100644 --- a/cpu_opcodes.c +++ b/cpu_opcodes.c @@ -1,7 +1,7 @@ // ADC - +__attribute__((always_inline, hot)) static inline void adc(struct cpu_state * restrict cpu, uint8_t value) { #ifdef ENABLE_DECIMAL_MODE if(cpu->d) { @@ -407,7 +407,7 @@ static void opcode_brk(struct nes_state * restrict state) { // BRANCHES - +__attribute__((always_inline, hot)) static inline int page_crossed(uint16_t a, uint16_t b) { return (a & 0xff00) != (b & 0xff00); } @@ -583,6 +583,7 @@ static void opcode_sei(struct nes_state * restrict state) { // CMP +__attribute__((always_inline, hot)) static inline void cmp(struct cpu_state * restrict cpu, uint8_t value) { uint8_t result = cpu->a - value; cpu->c = (cpu->a >= value); @@ -695,7 +696,7 @@ static void opcode_cmp_absx(struct nes_state * restrict state) { // CPX - +__attribute__((always_inline, hot)) static inline void cpx(struct cpu_state * restrict cpu, uint8_t value) { uint8_t result = cpu->x - value; cpu->c = (cpu->x >= value); @@ -731,7 +732,7 @@ static void opcode_cpx_abs(struct nes_state * restrict state) { // CPY - +__attribute__((always_inline, hot)) static inline void cpy(struct cpu_state * restrict cpu, uint8_t value) { uint8_t result = cpu->y - value; cpu->c = (cpu->y >= value); @@ -1752,7 +1753,7 @@ static void opcode_ror_absx(struct nes_state * restrict state) { // SBC - +__attribute__((always_inline, hot)) static inline void sbc(struct cpu_state * restrict cpu, uint8_t value) { #ifdef ENABLE_DECIMAL_MODE if(cpu->d) { @@ -2123,6 +2124,9 @@ static void opcode_sty_zpx(struct nes_state * restrict state) { __attribute__((noinline)) static void init_opcode_lut(void) { + for(uint32_t i = 0; i < 256; ++i) { + opcode_lut[i] = opcode_nop; // make sure erroneous opcodes just do "NOP", this might change in the future! + } opcode_lut[0x00] = opcode_brk; opcode_lut[0x01] = opcode_ora_indx; opcode_lut[0x05] = opcode_ora_zp; |
