diff options
Diffstat (limited to 'cpu_opcodes.c')
| -rw-r--r-- | cpu_opcodes.c | 310 |
1 files changed, 152 insertions, 158 deletions
diff --git a/cpu_opcodes.c b/cpu_opcodes.c index 7e174be..b401910 100644 --- a/cpu_opcodes.c +++ b/cpu_opcodes.c @@ -1,8 +1,7 @@ // ADC -__attribute__((always_inline, hot)) -static inline void adc(struct cpu_state * restrict cpu, uint8_t value) { +static inline void adc(struct cpu_state *cpu, uint8_t value) { #ifdef ENABLE_DECIMAL_MODE if(cpu->d) { uint8_t al = (cpu->a & 0x0f) + (value & 0x0f) + cpu->c; @@ -32,7 +31,7 @@ static inline void adc(struct cpu_state * restrict cpu, uint8_t value) { // ADC ($nn,X) -static void opcode_adc_indx(struct nes_state * restrict state) { +static void opcode_adc_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -49,7 +48,7 @@ static void opcode_adc_indx(struct nes_state * restrict state) { } // ADC $nn -static void opcode_adc_zp(struct nes_state * restrict state) { +static void opcode_adc_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -59,7 +58,7 @@ static void opcode_adc_zp(struct nes_state * restrict state) { } // ADC #$nn -static void opcode_adc_imm(struct nes_state * restrict state) { +static void opcode_adc_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 @@ -67,7 +66,7 @@ static void opcode_adc_imm(struct nes_state * restrict state) { } // ADC $nnnn -static void opcode_adc_abs(struct nes_state * restrict state) { +static void opcode_adc_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -79,7 +78,7 @@ static void opcode_adc_abs(struct nes_state * restrict state) { } // ADC ($nn),Y -static void opcode_adc_indy(struct nes_state * restrict state) { +static void opcode_adc_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -98,7 +97,7 @@ static void opcode_adc_indy(struct nes_state * restrict state) { } // ADC $nn,X -static void opcode_adc_zpx(struct nes_state * restrict state) { +static void opcode_adc_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -110,7 +109,7 @@ static void opcode_adc_zpx(struct nes_state * restrict state) { } // ADC $nnnn,Y -static void opcode_adc_absy(struct nes_state * restrict state) { +static void opcode_adc_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -127,7 +126,7 @@ static void opcode_adc_absy(struct nes_state * restrict state) { } // ADC $nnnn,X -static void opcode_adc_absx(struct nes_state * restrict state) { +static void opcode_adc_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -145,7 +144,7 @@ static void opcode_adc_absx(struct nes_state * restrict state) { // AND ($nn,X) -static void opcode_and_indx(struct nes_state * restrict state) { +static void opcode_and_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -163,7 +162,7 @@ static void opcode_and_indx(struct nes_state * restrict state) { } // AND $nn -static void opcode_and_zp(struct nes_state * restrict state) { +static void opcode_and_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -174,7 +173,7 @@ static void opcode_and_zp(struct nes_state * restrict state) { } // AND #$nn -static void opcode_and_imm(struct nes_state * restrict state) { +static void opcode_and_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 @@ -183,7 +182,7 @@ static void opcode_and_imm(struct nes_state * restrict state) { } // AND $nnnn -static void opcode_and_abs(struct nes_state * restrict state) { +static void opcode_and_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -196,7 +195,7 @@ static void opcode_and_abs(struct nes_state * restrict state) { } // AND ($nn),Y -static void opcode_and_indy(struct nes_state * restrict state) { +static void opcode_and_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -216,7 +215,7 @@ static void opcode_and_indy(struct nes_state * restrict state) { } // AND $nn,X -static void opcode_and_zpx(struct nes_state * restrict state) { +static void opcode_and_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -229,7 +228,7 @@ static void opcode_and_zpx(struct nes_state * restrict state) { } // AND $nnnn,Y -static void opcode_and_absy(struct nes_state * restrict state) { +static void opcode_and_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -247,7 +246,7 @@ static void opcode_and_absy(struct nes_state * restrict state) { } // AND $nnnn,X -static void opcode_and_absx(struct nes_state * restrict state) { +static void opcode_and_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -268,7 +267,7 @@ static void opcode_and_absx(struct nes_state * restrict state) { // ASL // ASL $nn -static void opcode_asl_zp(struct nes_state * restrict state) { +static void opcode_asl_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -284,7 +283,7 @@ static void opcode_asl_zp(struct nes_state * restrict state) { } // ASL A -static void opcode_asl_acc(struct nes_state * restrict state) { +static void opcode_asl_acc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 (dummy read at PC) @@ -296,7 +295,7 @@ static void opcode_asl_acc(struct nes_state * restrict state) { } // ASL $nnnn -static void opcode_asl_abs(struct nes_state * restrict state) { +static void opcode_asl_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -314,7 +313,7 @@ static void opcode_asl_abs(struct nes_state * restrict state) { } // ASL $nn,X -static void opcode_asl_zpx(struct nes_state * restrict state) { +static void opcode_asl_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -332,7 +331,7 @@ static void opcode_asl_zpx(struct nes_state * restrict state) { } // ASL $nnnn,X -static void opcode_asl_absx(struct nes_state * restrict state) { +static void opcode_asl_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -356,7 +355,7 @@ static void opcode_asl_absx(struct nes_state * restrict state) { // BIT // BIT $nn -static void opcode_bit_zp(struct nes_state * restrict state) { +static void opcode_bit_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -368,7 +367,7 @@ static void opcode_bit_zp(struct nes_state * restrict state) { } // BIT $nnnn -static void opcode_bit_abs(struct nes_state * restrict state) { +static void opcode_bit_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -384,7 +383,7 @@ static void opcode_bit_abs(struct nes_state * restrict state) { // BRK -static void opcode_brk(struct nes_state * restrict state) { +static void opcode_brk(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; cpu->pc++; // BRK is 1 byte, skip padding byte @@ -407,12 +406,11 @@ 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); } -static void opcode_bpl(struct nes_state * restrict state) { +static void opcode_bpl(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); // T1 @@ -427,7 +425,7 @@ static void opcode_bpl(struct nes_state * restrict state) { } } -static void opcode_bmi(struct nes_state * restrict state) { +static void opcode_bmi(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -442,7 +440,7 @@ static void opcode_bmi(struct nes_state * restrict state) { } } -static void opcode_bvc(struct nes_state * restrict state) { +static void opcode_bvc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -457,7 +455,7 @@ static void opcode_bvc(struct nes_state * restrict state) { } } -static void opcode_bvs(struct nes_state * restrict state) { +static void opcode_bvs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -472,7 +470,7 @@ static void opcode_bvs(struct nes_state * restrict state) { } } -static void opcode_bcc(struct nes_state * restrict state) { +static void opcode_bcc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -487,7 +485,7 @@ static void opcode_bcc(struct nes_state * restrict state) { } } -static void opcode_bcs(struct nes_state * restrict state) { +static void opcode_bcs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -502,7 +500,7 @@ static void opcode_bcs(struct nes_state * restrict state) { } } -static void opcode_bne(struct nes_state * restrict state) { +static void opcode_bne(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -517,7 +515,7 @@ static void opcode_bne(struct nes_state * restrict state) { } } -static void opcode_beq(struct nes_state * restrict state) { +static void opcode_beq(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t offset = memory_read(state, cpu->pc++); @@ -535,13 +533,13 @@ static void opcode_beq(struct nes_state * restrict state) { // SET/CLEAR flags -static void opcode_clc(struct nes_state * restrict state) { +static void opcode_clc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); cpu->c = 0; } -static void opcode_cld(struct nes_state * restrict state) { +static void opcode_cld(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); #ifdef ENABLE_DECIMAL_MODE @@ -549,25 +547,25 @@ static void opcode_cld(struct nes_state * restrict state) { #endif } -static void opcode_cli(struct nes_state * restrict state) { +static void opcode_cli(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); cpu->i = 0; } -static void opcode_clv(struct nes_state * restrict state) { +static void opcode_clv(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); cpu->v = 0; } -static void opcode_sec(struct nes_state * restrict state) { +static void opcode_sec(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); cpu->c = 1; } -static void opcode_sed(struct nes_state * restrict state) { +static void opcode_sed(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); #ifdef ENABLE_DECIMAL_MODE @@ -575,7 +573,7 @@ static void opcode_sed(struct nes_state * restrict state) { #endif } -static void opcode_sei(struct nes_state * restrict state) { +static void opcode_sei(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); cpu->i = 1; @@ -583,14 +581,13 @@ 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); update_zn(cpu, result); } -static void opcode_cmp_indx(struct nes_state * restrict state) { +static void opcode_cmp_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -606,7 +603,7 @@ static void opcode_cmp_indx(struct nes_state * restrict state) { cmp(cpu, value); // T6 } -static void opcode_cmp_zp(struct nes_state * restrict state) { +static void opcode_cmp_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -615,14 +612,14 @@ static void opcode_cmp_zp(struct nes_state * restrict state) { cmp(cpu, value); // T3 } -static void opcode_cmp_imm(struct nes_state * restrict state) { +static void opcode_cmp_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 cmp(cpu, value); // T2 } -static void opcode_cmp_abs(struct nes_state * restrict state) { +static void opcode_cmp_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -633,7 +630,7 @@ static void opcode_cmp_abs(struct nes_state * restrict state) { cmp(cpu, value); // T4 } -static void opcode_cmp_indy(struct nes_state * restrict state) { +static void opcode_cmp_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -651,7 +648,7 @@ static void opcode_cmp_indy(struct nes_state * restrict state) { cmp(cpu, value); // T5 or T6 } -static void opcode_cmp_zpx(struct nes_state * restrict state) { +static void opcode_cmp_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -662,7 +659,7 @@ static void opcode_cmp_zpx(struct nes_state * restrict state) { cmp(cpu, value); // T4 } -static void opcode_cmp_absy(struct nes_state * restrict state) { +static void opcode_cmp_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -678,7 +675,7 @@ static void opcode_cmp_absy(struct nes_state * restrict state) { cmp(cpu, value); // T4 or T5 } -static void opcode_cmp_absx(struct nes_state * restrict state) { +static void opcode_cmp_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -696,21 +693,20 @@ 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); update_zn(cpu, result); } -static void opcode_cpx_imm(struct nes_state * restrict state) { +static void opcode_cpx_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 cpx(cpu, value); // T2 } -static void opcode_cpx_zp(struct nes_state * restrict state) { +static void opcode_cpx_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -719,7 +715,7 @@ static void opcode_cpx_zp(struct nes_state * restrict state) { cpx(cpu, value); // T3 } -static void opcode_cpx_abs(struct nes_state * restrict state) { +static void opcode_cpx_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -732,21 +728,20 @@ 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); update_zn(cpu, result); } -static void opcode_cpy_imm(struct nes_state * restrict state) { +static void opcode_cpy_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 cpy(cpu, value); // T2 } -static void opcode_cpy_zp(struct nes_state * restrict state) { +static void opcode_cpy_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -755,7 +750,7 @@ static void opcode_cpy_zp(struct nes_state * restrict state) { cpy(cpu, value); // T3 } -static void opcode_cpy_abs(struct nes_state * restrict state) { +static void opcode_cpy_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -769,7 +764,7 @@ static void opcode_cpy_abs(struct nes_state * restrict state) { // DEC -static void opcode_dec_zp(struct nes_state * restrict state) { +static void opcode_dec_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -782,7 +777,7 @@ static void opcode_dec_zp(struct nes_state * restrict state) { update_zn(cpu, value); // T5 } -static void opcode_dec_zpx(struct nes_state * restrict state) { +static void opcode_dec_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -797,7 +792,7 @@ static void opcode_dec_zpx(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_dec_abs(struct nes_state * restrict state) { +static void opcode_dec_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -812,7 +807,7 @@ static void opcode_dec_abs(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_dec_absx(struct nes_state * restrict state) { +static void opcode_dec_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -833,7 +828,7 @@ static void opcode_dec_absx(struct nes_state * restrict state) { // EOR -static void opcode_eor_indx(struct nes_state * restrict state) { +static void opcode_eor_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -850,7 +845,7 @@ static void opcode_eor_indx(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_zp(struct nes_state * restrict state) { +static void opcode_eor_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -860,7 +855,7 @@ static void opcode_eor_zp(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_imm(struct nes_state * restrict state) { +static void opcode_eor_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 @@ -868,7 +863,7 @@ static void opcode_eor_imm(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_abs(struct nes_state * restrict state) { +static void opcode_eor_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -880,7 +875,7 @@ static void opcode_eor_abs(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_indy(struct nes_state * restrict state) { +static void opcode_eor_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -899,7 +894,7 @@ static void opcode_eor_indy(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_zpx(struct nes_state * restrict state) { +static void opcode_eor_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -911,7 +906,7 @@ static void opcode_eor_zpx(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_absy(struct nes_state * restrict state) { +static void opcode_eor_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -928,7 +923,7 @@ static void opcode_eor_absy(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_eor_absx(struct nes_state * restrict state) { +static void opcode_eor_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -948,7 +943,7 @@ static void opcode_eor_absx(struct nes_state * restrict state) { // INC -static void opcode_inc_zp(struct nes_state * restrict state) { +static void opcode_inc_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -961,7 +956,7 @@ static void opcode_inc_zp(struct nes_state * restrict state) { update_zn(cpu, value); // T5 } -static void opcode_inc_zpx(struct nes_state * restrict state) { +static void opcode_inc_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -976,7 +971,7 @@ static void opcode_inc_zpx(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_inc_abs(struct nes_state * restrict state) { +static void opcode_inc_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -991,7 +986,7 @@ static void opcode_inc_abs(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_inc_absx(struct nes_state * restrict state) { +static void opcode_inc_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1012,7 +1007,7 @@ static void opcode_inc_absx(struct nes_state * restrict state) { // JMP/JSR -static void opcode_jmp_abs(struct nes_state * restrict state) { +static void opcode_jmp_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1020,7 +1015,7 @@ static void opcode_jmp_abs(struct nes_state * restrict state) { cpu->pc = lo | (hi << 8); // T3 } -static void opcode_jmp_ind(struct nes_state * restrict state) { +static void opcode_jmp_ind(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t ptr_lo = memory_read(state, cpu->pc++); // T1 @@ -1038,7 +1033,7 @@ static void opcode_jmp_ind(struct nes_state * restrict state) { cpu->pc = lo | (hi << 8); // T5 } -static void opcode_jsr(struct nes_state * restrict state) { +static void opcode_jsr(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1057,7 +1052,7 @@ static void opcode_jsr(struct nes_state * restrict state) { // LDA -static void opcode_lda_indx(struct nes_state * restrict state) { +static void opcode_lda_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -1073,7 +1068,7 @@ static void opcode_lda_indx(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_zp(struct nes_state * restrict state) { +static void opcode_lda_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -1083,7 +1078,7 @@ static void opcode_lda_zp(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_imm(struct nes_state * restrict state) { +static void opcode_lda_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); // T1 @@ -1091,7 +1086,7 @@ static void opcode_lda_imm(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_abs(struct nes_state * restrict state) { +static void opcode_lda_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1103,7 +1098,7 @@ static void opcode_lda_abs(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_indy(struct nes_state * restrict state) { +static void opcode_lda_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -1122,7 +1117,7 @@ static void opcode_lda_indy(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_zpx(struct nes_state * restrict state) { +static void opcode_lda_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -1134,7 +1129,7 @@ static void opcode_lda_zpx(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_absy(struct nes_state * restrict state) { +static void opcode_lda_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1151,7 +1146,7 @@ static void opcode_lda_absy(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_lda_absx(struct nes_state * restrict state) { +static void opcode_lda_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1171,7 +1166,7 @@ static void opcode_lda_absx(struct nes_state * restrict state) { // LDX -static void opcode_ldx_imm(struct nes_state * restrict state) { +static void opcode_ldx_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); @@ -1179,7 +1174,7 @@ static void opcode_ldx_imm(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldx_zp(struct nes_state * restrict state) { +static void opcode_ldx_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1189,7 +1184,7 @@ static void opcode_ldx_zp(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldx_zpy(struct nes_state * restrict state) { +static void opcode_ldx_zpy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1201,7 +1196,7 @@ static void opcode_ldx_zpy(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldx_abs(struct nes_state * restrict state) { +static void opcode_ldx_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1213,7 +1208,7 @@ static void opcode_ldx_abs(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldx_absy(struct nes_state * restrict state) { +static void opcode_ldx_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1233,7 +1228,7 @@ static void opcode_ldx_absy(struct nes_state * restrict state) { // LDY -static void opcode_ldy_imm(struct nes_state * restrict state) { +static void opcode_ldy_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); @@ -1241,7 +1236,7 @@ static void opcode_ldy_imm(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldy_zp(struct nes_state * restrict state) { +static void opcode_ldy_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1251,7 +1246,7 @@ static void opcode_ldy_zp(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldy_zpx(struct nes_state * restrict state) { +static void opcode_ldy_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1263,7 +1258,7 @@ static void opcode_ldy_zpx(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldy_abs(struct nes_state * restrict state) { +static void opcode_ldy_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1275,7 +1270,7 @@ static void opcode_ldy_abs(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ldy_absx(struct nes_state * restrict state) { +static void opcode_ldy_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1296,7 +1291,7 @@ static void opcode_ldy_absx(struct nes_state * restrict state) { // LSR -static void opcode_lsr_zp(struct nes_state * restrict state) { +static void opcode_lsr_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); // T1 @@ -1310,7 +1305,7 @@ static void opcode_lsr_zp(struct nes_state * restrict state) { update_zn(cpu, value); // T5 } -static void opcode_lsr_acc(struct nes_state * restrict state) { +static void opcode_lsr_acc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 @@ -1319,7 +1314,7 @@ static void opcode_lsr_acc(struct nes_state * restrict state) { update_zn(cpu, cpu->a); // T2 } -static void opcode_lsr_abs(struct nes_state * restrict state) { +static void opcode_lsr_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1336,7 +1331,7 @@ static void opcode_lsr_abs(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_lsr_zpx(struct nes_state * restrict state) { +static void opcode_lsr_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); // T1 @@ -1353,7 +1348,7 @@ static void opcode_lsr_zpx(struct nes_state * restrict state) { update_zn(cpu, value); // T6 } -static void opcode_lsr_absx(struct nes_state * restrict state) { +static void opcode_lsr_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -1376,7 +1371,7 @@ static void opcode_lsr_absx(struct nes_state * restrict state) { // NOP -static void opcode_nop(struct nes_state * restrict state) { +static void opcode_nop(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1: dummy read // T2: nothing changes @@ -1385,7 +1380,7 @@ static void opcode_nop(struct nes_state * restrict state) { // ORA -static void opcode_ora_indx(struct nes_state * restrict state) { +static void opcode_ora_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -1401,7 +1396,7 @@ static void opcode_ora_indx(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_zp(struct nes_state * restrict state) { +static void opcode_ora_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1411,7 +1406,7 @@ static void opcode_ora_zp(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_imm(struct nes_state * restrict state) { +static void opcode_ora_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); @@ -1419,7 +1414,7 @@ static void opcode_ora_imm(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_abs(struct nes_state * restrict state) { +static void opcode_ora_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1431,7 +1426,7 @@ static void opcode_ora_abs(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_indy(struct nes_state * restrict state) { +static void opcode_ora_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); @@ -1450,7 +1445,7 @@ static void opcode_ora_indy(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_zpx(struct nes_state * restrict state) { +static void opcode_ora_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1462,7 +1457,7 @@ static void opcode_ora_zpx(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_absy(struct nes_state * restrict state) { +static void opcode_ora_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1479,7 +1474,7 @@ static void opcode_ora_absy(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ora_absx(struct nes_state * restrict state) { +static void opcode_ora_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1498,7 +1493,7 @@ static void opcode_ora_absx(struct nes_state * restrict state) { // PHA -static void opcode_pha(struct nes_state * restrict state) { +static void opcode_pha(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 memory_write(state, 0x0100 + cpu->sp--, cpu->a); // T2 @@ -1507,7 +1502,7 @@ static void opcode_pha(struct nes_state * restrict state) { // PHP -static void opcode_php(struct nes_state * restrict state) { +static void opcode_php(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 memory_write(state, 0x0100 + cpu->sp--, pack_flags(cpu) | 0x10); @@ -1516,7 +1511,7 @@ static void opcode_php(struct nes_state * restrict state) { // PLA -static void opcode_pla(struct nes_state * restrict state) { +static void opcode_pla(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 @@ -1530,7 +1525,7 @@ static void opcode_pla(struct nes_state * restrict state) { // PLP -static void opcode_plp(struct nes_state * restrict state) { +static void opcode_plp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 @@ -1543,7 +1538,7 @@ static void opcode_plp(struct nes_state * restrict state) { // RTI -static void opcode_rti(struct nes_state * restrict state) { +static void opcode_rti(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 @@ -1563,7 +1558,7 @@ static void opcode_rti(struct nes_state * restrict state) { // RTS -static void opcode_rts(struct nes_state * restrict state) { +static void opcode_rts(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); // T1 @@ -1578,7 +1573,7 @@ static void opcode_rts(struct nes_state * restrict state) { // ROL -static void opcode_rol_zp(struct nes_state * restrict state) { +static void opcode_rol_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1594,7 +1589,7 @@ static void opcode_rol_zp(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_rol_acc(struct nes_state * restrict state) { +static void opcode_rol_acc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1606,7 +1601,7 @@ static void opcode_rol_acc(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_rol_abs(struct nes_state * restrict state) { +static void opcode_rol_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1624,7 +1619,7 @@ static void opcode_rol_abs(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_rol_zpx(struct nes_state * restrict state) { +static void opcode_rol_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1642,7 +1637,7 @@ static void opcode_rol_zpx(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_rol_absx(struct nes_state * restrict state) { +static void opcode_rol_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1666,7 +1661,7 @@ static void opcode_rol_absx(struct nes_state * restrict state) { // ROR -static void opcode_ror_zp(struct nes_state * restrict state) { +static void opcode_ror_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1682,7 +1677,7 @@ static void opcode_ror_zp(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ror_acc(struct nes_state * restrict state) { +static void opcode_ror_acc(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1694,7 +1689,7 @@ static void opcode_ror_acc(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_ror_abs(struct nes_state * restrict state) { +static void opcode_ror_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1712,7 +1707,7 @@ static void opcode_ror_abs(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ror_zpx(struct nes_state * restrict state) { +static void opcode_ror_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1730,7 +1725,7 @@ static void opcode_ror_zpx(struct nes_state * restrict state) { update_zn(cpu, value); } -static void opcode_ror_absx(struct nes_state * restrict state) { +static void opcode_ror_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1753,7 +1748,6 @@ 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) { @@ -1782,7 +1776,7 @@ static inline void sbc(struct cpu_state * restrict cpu, uint8_t value) { } -static void opcode_sbc_indx(struct nes_state * restrict state) { +static void opcode_sbc_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); @@ -1797,7 +1791,7 @@ static void opcode_sbc_indx(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_zp(struct nes_state * restrict state) { +static void opcode_sbc_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); @@ -1806,14 +1800,14 @@ static void opcode_sbc_zp(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_imm(struct nes_state * restrict state) { +static void opcode_sbc_imm(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t value = memory_read(state, cpu->pc++); sbc(cpu, value); } -static void opcode_sbc_abs(struct nes_state * restrict state) { +static void opcode_sbc_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1824,7 +1818,7 @@ static void opcode_sbc_abs(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_indy(struct nes_state * restrict state) { +static void opcode_sbc_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); @@ -1842,7 +1836,7 @@ static void opcode_sbc_indy(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_zpx(struct nes_state * restrict state) { +static void opcode_sbc_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -1853,7 +1847,7 @@ static void opcode_sbc_zpx(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_absy(struct nes_state * restrict state) { +static void opcode_sbc_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1869,7 +1863,7 @@ static void opcode_sbc_absy(struct nes_state * restrict state) { sbc(cpu, value); } -static void opcode_sbc_absx(struct nes_state * restrict state) { +static void opcode_sbc_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -1888,7 +1882,7 @@ static void opcode_sbc_absx(struct nes_state * restrict state) { // TAX -static void opcode_tax(struct nes_state * restrict state) { +static void opcode_tax(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1896,7 +1890,7 @@ static void opcode_tax(struct nes_state * restrict state) { update_zn(cpu, cpu->x); } -static void opcode_tay(struct nes_state * restrict state) { +static void opcode_tay(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1904,7 +1898,7 @@ static void opcode_tay(struct nes_state * restrict state) { update_zn(cpu, cpu->y); } -static void opcode_txa(struct nes_state * restrict state) { +static void opcode_txa(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1912,7 +1906,7 @@ static void opcode_txa(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_tya(struct nes_state * restrict state) { +static void opcode_tya(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1920,7 +1914,7 @@ static void opcode_tya(struct nes_state * restrict state) { update_zn(cpu, cpu->a); } -static void opcode_tsx(struct nes_state * restrict state) { +static void opcode_tsx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1928,7 +1922,7 @@ static void opcode_tsx(struct nes_state * restrict state) { update_zn(cpu, cpu->x); } -static void opcode_txs(struct nes_state * restrict state) { +static void opcode_txs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1938,7 +1932,7 @@ static void opcode_txs(struct nes_state * restrict state) { // INX -static void opcode_inx(struct nes_state * restrict state) { +static void opcode_inx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1949,7 +1943,7 @@ static void opcode_inx(struct nes_state * restrict state) { // INY -static void opcode_iny(struct nes_state * restrict state) { +static void opcode_iny(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1960,7 +1954,7 @@ static void opcode_iny(struct nes_state * restrict state) { // DEX -static void opcode_dex(struct nes_state * restrict state) { +static void opcode_dex(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1971,7 +1965,7 @@ static void opcode_dex(struct nes_state * restrict state) { // DEY -static void opcode_dey(struct nes_state * restrict state) { +static void opcode_dey(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; memory_read_dummy(state, cpu->pc); @@ -1982,7 +1976,7 @@ static void opcode_dey(struct nes_state * restrict state) { // STA -static void opcode_sta_indx(struct nes_state * restrict state) { +static void opcode_sta_indx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); @@ -1996,14 +1990,14 @@ static void opcode_sta_indx(struct nes_state * restrict state) { memory_write(state, addr, cpu->a); } -static void opcode_sta_zp(struct nes_state * restrict state) { +static void opcode_sta_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); memory_write(state, addr, cpu->a); } -static void opcode_sta_abs(struct nes_state * restrict state) { +static void opcode_sta_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -2013,7 +2007,7 @@ static void opcode_sta_abs(struct nes_state * restrict state) { memory_write(state, addr, cpu->a); } -static void opcode_sta_indy(struct nes_state * restrict state) { +static void opcode_sta_indy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t zp = memory_read(state, cpu->pc++); // T1 @@ -2027,7 +2021,7 @@ static void opcode_sta_indy(struct nes_state * restrict state) { memory_write(state, addr, cpu->a); // T5 } -static void opcode_sta_zpx(struct nes_state * restrict state) { +static void opcode_sta_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -2037,7 +2031,7 @@ static void opcode_sta_zpx(struct nes_state * restrict state) { memory_write(state, addr, cpu->a); } -static void opcode_sta_absy(struct nes_state * restrict state) { +static void opcode_sta_absy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -2049,7 +2043,7 @@ static void opcode_sta_absy(struct nes_state * restrict state) { memory_write(state, addr, cpu->a); } -static void opcode_sta_absx(struct nes_state * restrict state) { +static void opcode_sta_absx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); // T1 @@ -2064,14 +2058,14 @@ static void opcode_sta_absx(struct nes_state * restrict state) { // STX -static void opcode_stx_zp(struct nes_state * restrict state) { +static void opcode_stx_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); memory_write(state, addr, cpu->x); } -static void opcode_stx_abs(struct nes_state * restrict state) { +static void opcode_stx_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -2081,7 +2075,7 @@ static void opcode_stx_abs(struct nes_state * restrict state) { memory_write(state, addr, cpu->x); } -static void opcode_stx_zpy(struct nes_state * restrict state) { +static void opcode_stx_zpy(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); @@ -2094,14 +2088,14 @@ static void opcode_stx_zpy(struct nes_state * restrict state) { // STY -static void opcode_sty_zp(struct nes_state * restrict state) { +static void opcode_sty_zp(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t addr = memory_read(state, cpu->pc++); memory_write(state, addr, cpu->y); } -static void opcode_sty_abs(struct nes_state * restrict state) { +static void opcode_sty_abs(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t lo = memory_read(state, cpu->pc++); @@ -2111,7 +2105,7 @@ static void opcode_sty_abs(struct nes_state * restrict state) { memory_write(state, addr, cpu->y); } -static void opcode_sty_zpx(struct nes_state * restrict state) { +static void opcode_sty_zpx(struct nes_state *state) { struct cpu_state * restrict cpu = &state->cpu; uint8_t base = memory_read(state, cpu->pc++); |
