diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/cpuaddr.h | 213 | ||||
-rw-r--r-- | source/cpumacro.h | 284 | ||||
-rw-r--r-- | source/cpuops.cpp | 1073 |
3 files changed, 643 insertions, 927 deletions
diff --git a/source/cpuaddr.h b/source/cpuaddr.h index 4f5febf..84ee45b 100644 --- a/source/cpuaddr.h +++ b/source/cpuaddr.h @@ -90,8 +90,6 @@ #ifndef _CPUADDR_H_ #define _CPUADDR_H_ -EXTERN_C long OpAddress; - typedef enum { NONE = 0, READ = 1, @@ -100,48 +98,74 @@ typedef enum { JUMP = 4 } AccessMode; -void Immediate8 (AccessMode a) +EXTERN_C long OpAddress; + +// The type for a function that can run after the addressing mode is resolved: +// void NAME (long Addr) {...} +typedef void (*InternalOp) (long); + +/* + * The addressing modes in this file do not update the OpAddress variable. + * Rather, they pass the address they calculate to the operation that needs to + * be done with it. If you need the calculated value, set a passthrough + * that gets the calculated address from the internal op and then updates the + * OpAddress variable. + * + * Not updating the OpAddress variable saves a few memory storage instructions + * per SNES instruction. + * Calling the operation at the end of the addressing mode calculation saves + * one return instruction per SNES instruction, because the code can just + * jump from one to the other. + */ + +static void Immediate8 (AccessMode a, InternalOp op) { - OpAddress = ICPU.ShiftedPB + CPU.PC - CPU.PCBase; + long Addr = ICPU.ShiftedPB + CPU.PC - CPU.PCBase; CPU.PC++; + (*op)(Addr); } -void Immediate16 (AccessMode a) +static void Immediate16 (AccessMode a, InternalOp op) { - OpAddress = ICPU.ShiftedPB + CPU.PC - CPU.PCBase; + long Addr = ICPU.ShiftedPB + CPU.PC - CPU.PCBase; CPU.PC += 2; + (*op)(Addr); } -void Relative (AccessMode a) +static void Relative (AccessMode a, InternalOp op) { Int8 = *CPU.PC++; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif - OpAddress = ((int) (CPU.PC - CPU.PCBase) + Int8) & 0xffff; + long Addr = ((int) (CPU.PC - CPU.PCBase) + Int8) & 0xffff; + (*op)(Addr); } -void RelativeLong (AccessMode a) +static void RelativeLong (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = *(uint16 *) CPU.PC; + Addr = *(uint16 *) CPU.PC; #else - OpAddress = *CPU.PC + (*(CPU.PC + 1) << 8); + Addr = *CPU.PC + (*(CPU.PC + 1) << 8); #endif #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeedx2 + ONE_CYCLE; #endif CPU.PC += 2; - OpAddress += (CPU.PC - CPU.PCBase); - OpAddress &= 0xffff; + Addr += (CPU.PC - CPU.PCBase); + Addr &= 0xffff; + (*op)(Addr); } -void AbsoluteIndexedIndirect (AccessMode a) +static void AbsoluteIndexedIndirect (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = (Registers.X.W + *(uint16 *) CPU.PC) & 0xffff; + Addr = (Registers.X.W + *(uint16 *) CPU.PC) & 0xffff; #else - OpAddress = (Registers.X.W + *CPU.PC + (*(CPU.PC + 1) << 8)) & 0xffff; + Addr = (Registers.X.W + *CPU.PC + (*(CPU.PC + 1) << 8)) & 0xffff; #endif #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeedx2; @@ -150,18 +174,20 @@ void AbsoluteIndexedIndirect (AccessMode a) OpenBus = *(CPU.PC + 1); #endif CPU.PC += 2; - OpAddress = S9xGetWord (ICPU.ShiftedPB + OpAddress); + Addr = S9xGetWord (ICPU.ShiftedPB + Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif + (*op)(Addr); } -void AbsoluteIndirectLong (AccessMode a) +static void AbsoluteIndirectLong (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = *(uint16 *) CPU.PC; + Addr = *(uint16 *) CPU.PC; #else - OpAddress = *CPU.PC + (*(CPU.PC + 1) << 8); + Addr = *CPU.PC + (*(CPU.PC + 1) << 8); #endif #ifndef SA1_OPCODES @@ -173,21 +199,23 @@ void AbsoluteIndirectLong (AccessMode a) CPU.PC += 2; #ifndef NO_OPEN_BUS if(a&READ) { - OpAddress = S9xGetWord (OpAddress) | ((OpenBus=S9xGetByte (OpAddress + 2)) << 16); + Addr = S9xGetWord (Addr) | ((OpenBus=S9xGetByte (Addr + 2)) << 16); } else { #endif - OpAddress = S9xGetWord (OpAddress) | (S9xGetByte (OpAddress + 2) << 16); + Addr = S9xGetWord (Addr) | (S9xGetByte (Addr + 2) << 16); #ifndef NO_OPEN_BUS } #endif + (*op)(Addr); } -void AbsoluteIndirect (AccessMode a) +static void AbsoluteIndirect (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = *(uint16 *) CPU.PC; + Addr = *(uint16 *) CPU.PC; #else - OpAddress = *CPU.PC + (*(CPU.PC + 1) << 8); + Addr = *CPU.PC + (*(CPU.PC + 1) << 8); #endif #ifndef SA1_OPCODES @@ -197,19 +225,21 @@ void AbsoluteIndirect (AccessMode a) OpenBus = *(CPU.PC + 1); #endif CPU.PC += 2; - OpAddress = S9xGetWord (OpAddress); + Addr = S9xGetWord (Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif - OpAddress += ICPU.ShiftedPB; + Addr += ICPU.ShiftedPB; + (*op)(Addr); } -void Absolute (AccessMode a) +static void Absolute (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = *(uint16 *) CPU.PC + ICPU.ShiftedDB; + Addr = *(uint16 *) CPU.PC + ICPU.ShiftedDB; #else - OpAddress = *CPU.PC + (*(CPU.PC + 1) << 8) + ICPU.ShiftedDB; + Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + ICPU.ShiftedDB; #endif #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *(CPU.PC+1); @@ -218,14 +248,16 @@ void Absolute (AccessMode a) #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeedx2; #endif + (*op)(Addr); } -void AbsoluteLong (AccessMode a) +static void AbsoluteLong (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = (*(uint32 *) CPU.PC) & 0xffffff; + Addr = (*(uint32 *) CPU.PC) & 0xffffff; #else - OpAddress = *CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16); + Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16); #endif #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *(CPU.PC+2); @@ -234,78 +266,82 @@ void AbsoluteLong (AccessMode a) #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeedx2 + CPU.MemSpeed; #endif + (*op)(Addr); } -void Direct(AccessMode a) +static void Direct(AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif // if (Registers.DL != 0) CPU.Cycles += ONE_CYCLE; + (*op)(Addr); } -void DirectIndirectIndexed (AccessMode a) +static void DirectIndirectIndexed (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif - OpAddress = S9xGetWord (OpAddress); + Addr = S9xGetWord (Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif - OpAddress += ICPU.ShiftedDB + Registers.Y.W; + Addr += ICPU.ShiftedDB + Registers.Y.W; // if (Registers.DL != 0) CPU.Cycles += ONE_CYCLE; // XXX: always add one if STA // XXX: else Add one cycle if crosses page boundary + (*op)(Addr); } -void DirectIndirectIndexedLong (AccessMode a) +static void DirectIndirectIndexedLong (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif #ifndef NO_OPEN_BUS if(a&READ){ - OpAddress = S9xGetWord (OpAddress) + ((OpenBus = S9xGetByte (OpAddress + 2)) << 16) + Registers.Y.W; + Addr = S9xGetWord (Addr) + ((OpenBus = S9xGetByte (Addr + 2)) << 16) + Registers.Y.W; } else { #endif - OpAddress = S9xGetWord (OpAddress) + (S9xGetByte (OpAddress + 2) << 16) + Registers.Y.W; + Addr = S9xGetWord (Addr) + (S9xGetByte (Addr + 2) << 16) + Registers.Y.W; #ifndef NO_OPEN_BUS } #endif // if (Registers.DL != 0) CPU.Cycles += ONE_CYCLE; + (*op)(Addr); } -void DirectIndexedIndirect(AccessMode a) +static void DirectIndexedIndirect(AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W + Registers.X.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W + Registers.X.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif - OpAddress = S9xGetWord (OpAddress); + Addr = S9xGetWord (Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif - OpAddress += ICPU.ShiftedDB; + Addr += ICPU.ShiftedDB; #ifndef SA1_OPCODES // if (Registers.DL != 0) @@ -313,15 +349,16 @@ void DirectIndexedIndirect(AccessMode a) // else CPU.Cycles += ONE_CYCLE; #endif + (*op)(Addr); } -void DirectIndexedX (AccessMode a) +static void DirectIndexedX (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W + Registers.X.W); - OpAddress &= CheckEmulation() ? 0xff : 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W + Registers.X.W); + Addr &= CheckEmulation() ? 0xff : 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; @@ -330,15 +367,16 @@ void DirectIndexedX (AccessMode a) // else // CPU.Cycles += ONE_CYCLE; #endif + (*op)(Addr); } -void DirectIndexedY (AccessMode a) +static void DirectIndexedY (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W + Registers.Y.W); - OpAddress &= CheckEmulation() ? 0xff : 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W + Registers.Y.W); + Addr &= CheckEmulation() ? 0xff : 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; // if (Registers.DL != 0) @@ -346,14 +384,16 @@ void DirectIndexedY (AccessMode a) // else // CPU.Cycles += ONE_CYCLE; #endif + (*op)(Addr); } -void AbsoluteIndexedX (AccessMode a) +static void AbsoluteIndexedX (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = ICPU.ShiftedDB + *(uint16 *) CPU.PC + Registers.X.W; + Addr = ICPU.ShiftedDB + *(uint16 *) CPU.PC + Registers.X.W; #else - OpAddress = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) + + Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) + Registers.X.W; #endif #ifndef NO_OPEN_BUS @@ -365,14 +405,16 @@ void AbsoluteIndexedX (AccessMode a) #endif // XXX: always add one cycle for ROL, LSR, etc // XXX: else is cross page boundary add one cycle + (*op)(Addr); } -void AbsoluteIndexedY (AccessMode a) +static void AbsoluteIndexedY (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = ICPU.ShiftedDB + *(uint16 *) CPU.PC + Registers.Y.W; + Addr = ICPU.ShiftedDB + *(uint16 *) CPU.PC + Registers.Y.W; #else - OpAddress = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) + + Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) + Registers.Y.W; #endif #ifndef NO_OPEN_BUS @@ -384,14 +426,16 @@ void AbsoluteIndexedY (AccessMode a) #endif // XXX: always add cycle for STA // XXX: else is cross page boundary add one cycle + (*op)(Addr); } -void AbsoluteLongIndexedX (AccessMode a) +static void AbsoluteLongIndexedX (AccessMode a, InternalOp op) { + long Addr; #ifdef FAST_LSB_WORD_ACCESS - OpAddress = (*(uint32 *) CPU.PC + Registers.X.W) & 0xffffff; + Addr = (*(uint32 *) CPU.PC + Registers.X.W) & 0xffffff; #else - OpAddress = (*CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16) + Registers.X.W) & 0xffffff; + Addr = (*CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16) + Registers.X.W) & 0xffffff; #endif #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *(CPU.PC+2); @@ -400,73 +444,78 @@ void AbsoluteLongIndexedX (AccessMode a) #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeedx2 + CPU.MemSpeed; #endif + (*op)(Addr); } -void DirectIndirect (AccessMode a) +static void DirectIndirect (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif - OpAddress = S9xGetWord (OpAddress); + Addr = S9xGetWord (Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif - OpAddress += ICPU.ShiftedDB; + Addr += ICPU.ShiftedDB; // if (Registers.DL != 0) CPU.Cycles += ONE_CYCLE; + (*op)(Addr); } -void DirectIndirectLong (AccessMode a) +static void DirectIndirectLong (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.D.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.D.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif #ifndef NO_OPEN_BUS if(a&READ){ - OpAddress = S9xGetWord (OpAddress) + ((OpenBus=S9xGetByte (OpAddress + 2)) << 16); + Addr = S9xGetWord (Addr) + ((OpenBus=S9xGetByte (Addr + 2)) << 16); } else { #endif - OpAddress = S9xGetWord (OpAddress) + (S9xGetByte (OpAddress + 2) << 16); + Addr = S9xGetWord (Addr) + (S9xGetByte (Addr + 2) << 16); #ifndef NO_OPEN_BUS } #endif // if (Registers.DL != 0) CPU.Cycles += ONE_CYCLE; + (*op)(Addr); } -void StackRelative (AccessMode a) +static void StackRelative (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS if(a&READ) OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.S.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.S.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; #endif + (*op)(Addr); } -void StackRelativeIndirectIndexed (AccessMode a) +static void StackRelativeIndirectIndexed (AccessMode a, InternalOp op) { #ifndef NO_OPEN_BUS OpenBus = *CPU.PC; #endif - OpAddress = (*CPU.PC++ + Registers.S.W) & 0xffff; + long Addr = (*CPU.PC++ + Registers.S.W) & 0xffff; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + TWO_CYCLES; #endif - OpAddress = S9xGetWord (OpAddress); + Addr = S9xGetWord (Addr); #ifndef NO_OPEN_BUS - if(a&READ) OpenBus = (uint8)(OpAddress>>8); + if(a&READ) OpenBus = (uint8)(Addr>>8); #endif - OpAddress = (OpAddress + ICPU.ShiftedDB + + Addr = (Addr + ICPU.ShiftedDB + Registers.Y.W) & 0xffffff; + (*op)(Addr); } #endif diff --git a/source/cpumacro.h b/source/cpumacro.h index 5b4e15b..335576a 100644 --- a/source/cpumacro.h +++ b/source/cpumacro.h @@ -90,21 +90,21 @@ #ifndef _CPUMACRO_H_ #define _CPUMACRO_H_ -void SetZN16 (uint16 Work) +static void SetZN16 (uint16 Work) { ICPU._Zero = Work != 0; ICPU._Negative = (uint8) (Work >> 8); } -void SetZN8 (uint8 Work) +static void SetZN8 (uint8 Work) { ICPU._Zero = Work; ICPU._Negative = Work; } -void ADC8 () +static void ADC8 (long Addr) { - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); if (CheckDecimal ()) { @@ -159,9 +159,9 @@ void ADC8 () } } -void ADC16 () +static void ADC16 (long Addr) { - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); if (CheckDecimal ()) { @@ -235,19 +235,19 @@ void ADC16 () } } -void AND16 () +static void AND16 (long Addr) { - Registers.A.W &= S9xGetWord (OpAddress); + Registers.A.W &= S9xGetWord (Addr); SetZN16 (Registers.A.W); } -void AND8 () +static void AND8 (long Addr) { - Registers.AL &= S9xGetByte (OpAddress); + Registers.AL &= S9xGetByte (Addr); SetZN8 (Registers.AL); } -void A_ASL16 () +static inline void A_ASL16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -257,7 +257,7 @@ void A_ASL16 () SetZN16 (Registers.A.W); } -void A_ASL8 () +static inline void A_ASL8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -267,97 +267,97 @@ void A_ASL8 () SetZN8 (Registers.AL); } -void ASL16 () +static void ASL16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); ICPU._Carry = (Work16 & 0x8000) != 0; Work16 <<= 1; - //S9xSetWord (Work16, OpAddress); - S9xSetByte(Work16>>8, OpAddress+1); - S9xSetByte(Work16&0xFF, OpAddress); + //S9xSetWord (Work16, Addr); + S9xSetByte(Work16>>8, Addr+1); + S9xSetByte(Work16&0xFF, Addr); SetZN16 (Work16); } -void ASL8 () +static void ASL8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); ICPU._Carry = (Work8 & 0x80) != 0; Work8 <<= 1; - S9xSetByte (Work8, OpAddress); + S9xSetByte (Work8, Addr); SetZN8 (Work8); } -void BIT16 () +static void BIT16 (long Addr) { - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); ICPU._Overflow = (Work16 & 0x4000) != 0; ICPU._Negative = (uint8) (Work16 >> 8); ICPU._Zero = (Work16 & Registers.A.W) != 0; } -void BIT8 () +static void BIT8 (long Addr) { - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); ICPU._Overflow = (Work8 & 0x40) != 0; ICPU._Negative = Work8; ICPU._Zero = Work8 & Registers.AL; } -void CMP16 () +static void CMP16 (long Addr) { Int32 = (long) Registers.A.W - - (long) S9xGetWord (OpAddress); + (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); } -void CMP8 () +static void CMP8 (long Addr) { Int16 = (short) Registers.AL - - (short) S9xGetByte (OpAddress); + (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); } -void CMX16 () +static void CMX16 (long Addr) { Int32 = (long) Registers.X.W - - (long) S9xGetWord (OpAddress); + (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); } -void CMX8 () +static void CMX8 (long Addr) { Int16 = (short) Registers.XL - - (short) S9xGetByte (OpAddress); + (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); } -void CMY16 () +static void CMY16 (long Addr) { Int32 = (long) Registers.Y.W - - (long) S9xGetWord (OpAddress); + (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); } -void CMY8 () +static void CMY8 (long Addr) { Int16 = (short) Registers.YL - - (short) S9xGetByte (OpAddress); + (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); } -void A_DEC16 () +static inline void A_DEC16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -370,7 +370,7 @@ void A_DEC16 () SetZN16 (Registers.A.W); } -void A_DEC8 () +static inline void A_DEC8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -383,7 +383,7 @@ void A_DEC8 () SetZN8 (Registers.AL); } -void DEC16 () +static void DEC16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -392,14 +392,14 @@ void DEC16 () CPU.WaitAddress = NULL; #endif - Work16 = S9xGetWord (OpAddress) - 1; - //S9xSetWord (Work16, OpAddress); - S9xSetByte (Work16>>8, OpAddress+1); - S9xSetByte (Work16&0xFF, OpAddress); + Work16 = S9xGetWord (Addr) - 1; + //S9xSetWord (Work16, Addr); + S9xSetByte (Work16>>8, Addr+1); + S9xSetByte (Work16&0xFF, Addr); SetZN16 (Work16); } -void DEC8 () +static void DEC8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -408,24 +408,24 @@ void DEC8 () CPU.WaitAddress = NULL; #endif - Work8 = S9xGetByte (OpAddress) - 1; - S9xSetByte (Work8, OpAddress); + Work8 = S9xGetByte (Addr) - 1; + S9xSetByte (Work8, Addr); SetZN8 (Work8); } -void EOR16 () +static void EOR16 (long Addr) { - Registers.A.W ^= S9xGetWord (OpAddress); + Registers.A.W ^= S9xGetWord (Addr); SetZN16 (Registers.A.W); } -void EOR8 () +static void EOR8 (long Addr) { - Registers.AL ^= S9xGetByte (OpAddress); + Registers.AL ^= S9xGetByte (Addr); SetZN8 (Registers.AL); } -void A_INC16 () +static inline void A_INC16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -438,7 +438,7 @@ void A_INC16 () SetZN16 (Registers.A.W); } -void A_INC8 () +static inline void A_INC8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -451,7 +451,7 @@ void A_INC8 () SetZN8 (Registers.AL); } -void INC16 () +static void INC16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -460,14 +460,14 @@ void INC16 () CPU.WaitAddress = NULL; #endif - Work16 = S9xGetWord (OpAddress) + 1; - //S9xSetWord (Work16, OpAddress); - S9xSetByte (Work16>>8, OpAddress+1); - S9xSetByte (Work16&0xFF, OpAddress); + Work16 = S9xGetWord (Addr) + 1; + //S9xSetWord (Work16, Addr); + S9xSetByte (Work16>>8, Addr+1); + S9xSetByte (Work16&0xFF, Addr); SetZN16 (Work16); } -void INC8 () +static void INC8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -476,48 +476,48 @@ void INC8 () CPU.WaitAddress = NULL; #endif - Work8 = S9xGetByte (OpAddress) + 1; - S9xSetByte (Work8, OpAddress); + Work8 = S9xGetByte (Addr) + 1; + S9xSetByte (Work8, Addr); SetZN8 (Work8); } -void LDA16 () +static void LDA16 (long Addr) { - Registers.A.W = S9xGetWord (OpAddress); + Registers.A.W = S9xGetWord (Addr); SetZN16 (Registers.A.W); } -void LDA8 () +static void LDA8 (long Addr) { - Registers.AL = S9xGetByte (OpAddress); + Registers.AL = S9xGetByte (Addr); SetZN8 (Registers.AL); } -void LDX16 () +static void LDX16 (long Addr) { - Registers.X.W = S9xGetWord (OpAddress); + Registers.X.W = S9xGetWord (Addr); SetZN16 (Registers.X.W); } -void LDX8 () +static void LDX8 (long Addr) { - Registers.XL = S9xGetByte (OpAddress); + Registers.XL = S9xGetByte (Addr); SetZN8 (Registers.XL); } -void LDY16 () +static void LDY16 (long Addr) { - Registers.Y.W = S9xGetWord (OpAddress); + Registers.Y.W = S9xGetWord (Addr); SetZN16 (Registers.Y.W); } -void LDY8 () +static void LDY8 (long Addr) { - Registers.YL = S9xGetByte (OpAddress); + Registers.YL = S9xGetByte (Addr); SetZN8 (Registers.YL); } -void A_LSR16 () +static inline void A_LSR16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -527,7 +527,7 @@ void A_LSR16 () SetZN16 (Registers.A.W); } -void A_LSR8 () +static inline void A_LSR8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -537,45 +537,45 @@ void A_LSR8 () SetZN8 (Registers.AL); } -void LSR16 () +static void LSR16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); ICPU._Carry = Work16 & 1; Work16 >>= 1; - //S9xSetWord (Work16, OpAddress); - S9xSetByte (Work16>>8, OpAddress+1); - S9xSetByte (Work16&0xFF, OpAddress); + //S9xSetWord (Work16, Addr); + S9xSetByte (Work16>>8, Addr+1); + S9xSetByte (Work16&0xFF, Addr); SetZN16 (Work16); } -void LSR8 () +static void LSR8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); ICPU._Carry = Work8 & 1; Work8 >>= 1; - S9xSetByte (Work8, OpAddress); + S9xSetByte (Work8, Addr); SetZN8 (Work8); } -void ORA16 () +static void ORA16 (long Addr) { - Registers.A.W |= S9xGetWord (OpAddress); + Registers.A.W |= S9xGetWord (Addr); SetZN16 (Registers.A.W); } -void ORA8 () +static void ORA8 (long Addr) { - Registers.AL |= S9xGetByte (OpAddress); + Registers.AL |= S9xGetByte (Addr); SetZN8 (Registers.AL); } -void A_ROL16 () +static inline void A_ROL16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -586,7 +586,7 @@ void A_ROL16 () SetZN16 ((uint16) Work32); } -void A_ROL8 () +static inline void A_ROL8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -599,35 +599,35 @@ void A_ROL8 () SetZN8 ((uint8) Work16); } -void ROL16 () +static void ROL16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = S9xGetWord (OpAddress); + Work32 = S9xGetWord (Addr); Work32 <<= 1; Work32 |= CheckCarry(); ICPU._Carry = Work32 >= 0x10000; - //S9xSetWord ((uint16) Work32, OpAddress); - S9xSetByte((Work32>>8)&0xFF, OpAddress+1); - S9xSetByte(Work32&0xFF, OpAddress); + //S9xSetWord ((uint16) Work32, Addr); + S9xSetByte((Work32>>8)&0xFF, Addr+1); + S9xSetByte(Work32&0xFF, Addr); SetZN16 ((uint16) Work32); } -void ROL8 () +static void ROL8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetByte (OpAddress); + Work16 = S9xGetByte (Addr); Work16 <<= 1; Work16 |= CheckCarry (); ICPU._Carry = Work16 >= 0x100; - S9xSetByte ((uint8) Work16, OpAddress); + S9xSetByte ((uint8) Work16, Addr); SetZN8 ((uint8) Work16); } -void A_ROR16 () +static inline void A_ROR16 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -640,7 +640,7 @@ void A_ROR16 () SetZN16 ((uint16) Work32); } -void A_ROR8 () +static inline void A_ROR8 () { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -652,37 +652,37 @@ void A_ROR8 () SetZN8 ((uint8) Work16); } -void ROR16 () +static void ROR16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = S9xGetWord (OpAddress); + Work32 = S9xGetWord (Addr); Work32 |= (int) CheckCarry() << 16; ICPU._Carry = (uint8) (Work32 & 1); Work32 >>= 1; - //S9xSetWord ((uint16) Work32, OpAddress); - S9xSetByte ( (Work32>>8)&0x00FF, OpAddress+1); - S9xSetByte (Work32&0x00FF, OpAddress); + //S9xSetWord ((uint16) Work32, Addr); + S9xSetByte ( (Work32>>8)&0x00FF, Addr+1); + S9xSetByte (Work32&0x00FF, Addr); SetZN16 ((uint16) Work32); } -void ROR8 () +static void ROR8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetByte (OpAddress); + Work16 = S9xGetByte (Addr); Work16 |= (int) CheckCarry () << 8; ICPU._Carry = (uint8) (Work16 & 1); Work16 >>= 1; - S9xSetByte ((uint8) Work16, OpAddress); + S9xSetByte ((uint8) Work16, Addr); SetZN8 ((uint8) Work16); } -void SBC16 () +static void SBC16 (long Addr) { - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); if (CheckDecimal ()) { @@ -750,9 +750,9 @@ void SBC16 () } } -void SBC8 () +static void SBC8 (long Addr) { - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); if (CheckDecimal ()) { A1 = (Registers.A.W) & 0xF; @@ -801,92 +801,92 @@ void SBC8 () } } -void STA16 () +static void STA16 (long Addr) { - S9xSetWord (Registers.A.W, OpAddress); + S9xSetWord (Registers.A.W, Addr); } -void STA8 () +static void STA8 (long Addr) { - S9xSetByte (Registers.AL, OpAddress); + S9xSetByte (Registers.AL, Addr); } -void STX16 () +static void STX16 (long Addr) { - S9xSetWord (Registers.X.W, OpAddress); + S9xSetWord (Registers.X.W, Addr); } -void STX8 () +static void STX8 (long Addr) { - S9xSetByte (Registers.XL, OpAddress); + S9xSetByte (Registers.XL, Addr); } -void STY16 () +static void STY16 (long Addr) { - S9xSetWord (Registers.Y.W, OpAddress); + S9xSetWord (Registers.Y.W, Addr); } -void STY8 () +static void STY8 (long Addr) { - S9xSetByte (Registers.YL, OpAddress); + S9xSetByte (Registers.YL, Addr); } -void STZ16 () +static void STZ16 (long Addr) { - S9xSetWord (0, OpAddress); + S9xSetWord (0, Addr); } -void STZ8 () +static void STZ8 (long Addr) { - S9xSetByte (0, OpAddress); + S9xSetByte (0, Addr); } -void TSB16 () +static void TSB16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); ICPU._Zero = (Work16 & Registers.A.W) != 0; Work16 |= Registers.A.W; - //S9xSetWord (Work16, OpAddress); - S9xSetByte (Work16>>8, OpAddress+1); - S9xSetByte (Work16&0xFF, OpAddress); + //S9xSetWord (Work16, Addr); + S9xSetByte (Work16>>8, Addr+1); + S9xSetByte (Work16&0xFF, Addr); } -void TSB8 () +static void TSB8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); ICPU._Zero = Work8 & Registers.AL; Work8 |= Registers.AL; - S9xSetByte (Work8, OpAddress); + S9xSetByte (Work8, Addr); } -void TRB16 () +static void TRB16 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (OpAddress); + Work16 = S9xGetWord (Addr); ICPU._Zero = (Work16 & Registers.A.W) != 0; Work16 &= ~Registers.A.W; - //S9xSetWord (Work16, OpAddress); - S9xSetByte (Work16>>8, OpAddress+1); - S9xSetByte (Work16&0xFF, OpAddress); + //S9xSetWord (Work16, Addr); + S9xSetByte (Work16>>8, Addr+1); + S9xSetByte (Work16&0xFF, Addr); } -void TRB8 () +static void TRB8 (long Addr) { #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (OpAddress); + Work8 = S9xGetByte (Addr); ICPU._Zero = Work8 & Registers.AL; Work8 &= ~Registers.AL; - S9xSetByte (Work8, OpAddress); + S9xSetByte (Work8, Addr); } #endif diff --git a/source/cpuops.cpp b/source/cpuops.cpp index 967ca9f..33a2005 100644 --- a/source/cpuops.cpp +++ b/source/cpuops.cpp @@ -119,185 +119,161 @@ END_EXTERN_C #include "cpumacro.h" #include "apu.h" +// For use with the opcodes whose functions here examine the OpAddress. +static void OpAddressPassthrough (long Addr) +{ + OpAddress = Addr; +} + /* ADC *************************************************************************************** */ static void Op69M1 (void) { - Immediate8 (READ); - ADC8 (); + Immediate8 (READ, ADC8); } static void Op69M0 (void) { - Immediate16 (READ); - ADC16 (); + Immediate16 (READ, ADC16); } static void Op65M1 (void) { - Direct (READ); - ADC8 (); + Direct (READ, ADC8); } static void Op65M0 (void) { - Direct (READ); - ADC16 (); + Direct (READ, ADC16); } static void Op75M1 (void) { - DirectIndexedX (READ); - ADC8 (); + DirectIndexedX (READ, ADC8); } static void Op75M0 (void) { - DirectIndexedX (READ); - ADC16 (); + DirectIndexedX (READ, ADC16); } static void Op72M1 (void) { - DirectIndirect (READ); - ADC8 (); + DirectIndirect (READ, ADC8); } static void Op72M0 (void) { - DirectIndirect (READ); - ADC16 (); + DirectIndirect (READ, ADC16); } static void Op61M1 (void) { - DirectIndexedIndirect (READ); - ADC8 (); + DirectIndexedIndirect (READ, ADC8); } static void Op61M0 (void) { - DirectIndexedIndirect (READ); - ADC16 (); + DirectIndexedIndirect (READ, ADC16); } static void Op71M1 (void) { - DirectIndirectIndexed (READ); - ADC8 (); + DirectIndirectIndexed (READ, ADC8); } static void Op71M0 (void) { - DirectIndirectIndexed (READ); - ADC16 (); + DirectIndirectIndexed (READ, ADC16); } static void Op67M1 (void) { - DirectIndirectLong (READ); - ADC8 (); + DirectIndirectLong (READ, ADC8); } static void Op67M0 (void) { - DirectIndirectLong (READ); - ADC16 (); + DirectIndirectLong (READ, ADC16); } static void Op77M1 (void) { - DirectIndirectIndexedLong (READ); - ADC8 (); + DirectIndirectIndexedLong (READ, ADC8); } static void Op77M0 (void) { - DirectIndirectIndexedLong (READ); - ADC16 (); + DirectIndirectIndexedLong (READ, ADC16); } static void Op6DM1 (void) { - Absolute (READ); - ADC8 (); + Absolute (READ, ADC8); } static void Op6DM0 (void) { - Absolute (READ); - ADC16 (); + Absolute (READ, ADC16); } static void Op7DM1 (void) { - AbsoluteIndexedX (READ); - ADC8 (); + AbsoluteIndexedX (READ, ADC8); } static void Op7DM0 (void) { - AbsoluteIndexedX (READ); - ADC16 (); + AbsoluteIndexedX (READ, ADC16); } static void Op79M1 (void) { - AbsoluteIndexedY (READ); - ADC8 (); + AbsoluteIndexedY (READ, ADC8); } static void Op79M0 (void) { - AbsoluteIndexedY (READ); - ADC16 (); + AbsoluteIndexedY (READ, ADC16); } static void Op6FM1 (void) { - AbsoluteLong (READ); - ADC8 (); + AbsoluteLong (READ, ADC8); } static void Op6FM0 (void) { - AbsoluteLong (READ); - ADC16 (); + AbsoluteLong (READ, ADC16); } static void Op7FM1 (void) { - AbsoluteLongIndexedX (READ); - ADC8 (); + AbsoluteLongIndexedX (READ, ADC8); } static void Op7FM0 (void) { - AbsoluteLongIndexedX (READ); - ADC16 (); + AbsoluteLongIndexedX (READ, ADC16); } static void Op63M1 (void) { - StackRelative (READ); - ADC8 (); + StackRelative (READ, ADC8); } static void Op63M0 (void) { - StackRelative (READ); - ADC16 (); + StackRelative (READ, ADC16); } static void Op73M1 (void) { - StackRelativeIndirectIndexed (READ); - ADC8 (); + StackRelativeIndirectIndexed (READ, ADC8); } static void Op73M0 (void) { - StackRelativeIndirectIndexed (READ); - ADC16 (); + StackRelativeIndirectIndexed (READ, ADC16); } /**********************************************************************************************/ @@ -328,170 +304,142 @@ static void Op29M0 (void) static void Op25M1 (void) { - Direct (READ); - AND8 (); + Direct (READ, AND8); } static void Op25M0 (void) { - Direct (READ); - AND16 (); + Direct (READ, AND16); } static void Op35M1 (void) { - DirectIndexedX (READ); - AND8 (); + DirectIndexedX (READ, AND8); } static void Op35M0 (void) { - DirectIndexedX (READ); - AND16 (); + DirectIndexedX (READ, AND16); } static void Op32M1 (void) { - DirectIndirect (READ); - AND8 (); + DirectIndirect (READ, AND8); } static void Op32M0 (void) { - DirectIndirect (READ); - AND16 (); + DirectIndirect (READ, AND16); } static void Op21M1 (void) { - DirectIndexedIndirect (READ); - AND8 (); + DirectIndexedIndirect (READ, AND8); } static void Op21M0 (void) { - DirectIndexedIndirect (READ); - AND16 (); + DirectIndexedIndirect (READ, AND16); } static void Op31M1 (void) { - DirectIndirectIndexed (READ); - AND8 (); + DirectIndirectIndexed (READ, AND8); } static void Op31M0 (void) { - DirectIndirectIndexed (READ); - AND16 (); + DirectIndirectIndexed (READ, AND16); } static void Op27M1 (void) { - DirectIndirectLong (READ); - AND8 (); + DirectIndirectLong (READ, AND8); } static void Op27M0 (void) { - DirectIndirectLong (READ); - AND16 (); + DirectIndirectLong (READ, AND16); } static void Op37M1 (void) { - DirectIndirectIndexedLong (READ); - AND8 (); + DirectIndirectIndexedLong (READ, AND8); } static void Op37M0 (void) { - DirectIndirectIndexedLong (READ); - AND16 (); + DirectIndirectIndexedLong (READ, AND16); } static void Op2DM1 (void) { - Absolute (READ); - AND8 (); + Absolute (READ, AND8); } static void Op2DM0 (void) { - Absolute (READ); - AND16 (); + Absolute (READ, AND16); } static void Op3DM1 (void) { - AbsoluteIndexedX (READ); - AND8 (); + AbsoluteIndexedX (READ, AND8); } static void Op3DM0 (void) { - AbsoluteIndexedX (READ); - AND16 (); + AbsoluteIndexedX (READ, AND16); } static void Op39M1 (void) { - AbsoluteIndexedY (READ); - AND8 (); + AbsoluteIndexedY (READ, AND8); } static void Op39M0 (void) { - AbsoluteIndexedY (READ); - AND16 (); + AbsoluteIndexedY (READ, AND16); } static void Op2FM1 (void) { - AbsoluteLong (READ); - AND8 (); + AbsoluteLong (READ, AND8); } static void Op2FM0 (void) { - AbsoluteLong (READ); - AND16 (); + AbsoluteLong (READ, AND16); } static void Op3FM1 (void) { - AbsoluteLongIndexedX (READ); - AND8 (); + AbsoluteLongIndexedX (READ, AND8); } static void Op3FM0 (void) { - AbsoluteLongIndexedX (READ); - AND16 (); + AbsoluteLongIndexedX (READ, AND16); } static void Op23M1 (void) { - StackRelative (READ); - AND8 (); + StackRelative (READ, AND8); } static void Op23M0 (void) { - StackRelative (READ); - AND16 (); + StackRelative (READ, AND16); } static void Op33M1 (void) { - StackRelativeIndirectIndexed (READ); - AND8 (); + StackRelativeIndirectIndexed (READ, AND8); } static void Op33M0 (void) { - StackRelativeIndirectIndexed (READ); - AND16 (); + StackRelativeIndirectIndexed (READ, AND16); } /**********************************************************************************************/ @@ -508,50 +456,42 @@ static void Op0AM0 (void) static void Op06M1 (void) { - Direct (MODIFY); - ASL8 (); + Direct (MODIFY, ASL8); } static void Op06M0 (void) { - Direct (MODIFY); - ASL16 (); + Direct (MODIFY, ASL16); } static void Op16M1 (void) { - DirectIndexedX (MODIFY); - ASL8 (); + DirectIndexedX (MODIFY, ASL8); } static void Op16M0 (void) { - DirectIndexedX (MODIFY); - ASL16 (); + DirectIndexedX (MODIFY, ASL16); } static void Op0EM1 (void) { - Absolute (MODIFY); - ASL8 (); + Absolute (MODIFY, ASL8); } static void Op0EM0 (void) { - Absolute (MODIFY); - ASL16 (); + Absolute (MODIFY, ASL16); } static void Op1EM1 (void) { - AbsoluteIndexedX (MODIFY); - ASL8 (); + AbsoluteIndexedX (MODIFY, ASL8); } static void Op1EM0 (void) { - AbsoluteIndexedX (MODIFY); - ASL16 (); + AbsoluteIndexedX (MODIFY, ASL16); } /**********************************************************************************************/ @@ -579,50 +519,42 @@ static void Op89M0 (void) static void Op24M1 (void) { - Direct (READ); - BIT8 (); + Direct (READ, BIT8); } static void Op24M0 (void) { - Direct (READ); - BIT16 (); + Direct (READ, BIT16); } static void Op34M1 (void) { - DirectIndexedX (READ); - BIT8 (); + DirectIndexedX (READ, BIT8); } static void Op34M0 (void) { - DirectIndexedX (READ); - BIT16 (); + DirectIndexedX (READ, BIT16); } static void Op2CM1 (void) { - Absolute (READ); - BIT8 (); + Absolute (READ, BIT8); } static void Op2CM0 (void) { - Absolute (READ); - BIT16 (); + Absolute (READ, BIT16); } static void Op3CM1 (void) { - AbsoluteIndexedX (READ); - BIT8 (); + AbsoluteIndexedX (READ, BIT8); } static void Op3CM0 (void) { - AbsoluteIndexedX (READ); - BIT16 (); + AbsoluteIndexedX (READ, BIT16); } /**********************************************************************************************/ @@ -655,170 +587,142 @@ static void OpC9M0 (void) static void OpC5M1 (void) { - Direct (READ); - CMP8 (); + Direct (READ, CMP8); } static void OpC5M0 (void) { - Direct (READ); - CMP16 (); + Direct (READ, CMP16); } static void OpD5M1 (void) { - DirectIndexedX (READ); - CMP8 (); + DirectIndexedX (READ, CMP8); } static void OpD5M0 (void) { - DirectIndexedX (READ); - CMP16 (); + DirectIndexedX (READ, CMP16); } static void OpD2M1 (void) { - DirectIndirect (READ); - CMP8 (); + DirectIndirect (READ, CMP8); } static void OpD2M0 (void) { - DirectIndirect (READ); - CMP16 (); + DirectIndirect (READ, CMP16); } static void OpC1M1 (void) { - DirectIndexedIndirect (READ); - CMP8 (); + DirectIndexedIndirect (READ, CMP8); } static void OpC1M0 (void) { - DirectIndexedIndirect (READ); - CMP16 (); + DirectIndexedIndirect (READ, CMP16); } static void OpD1M1 (void) { - DirectIndirectIndexed (READ); - CMP8 (); + DirectIndirectIndexed (READ, CMP8); } static void OpD1M0 (void) { - DirectIndirectIndexed (READ); - CMP16 (); + DirectIndirectIndexed (READ, CMP16); } static void OpC7M1 (void) { - DirectIndirectLong (READ); - CMP8 (); + DirectIndirectLong (READ, CMP8); } static void OpC7M0 (void) { - DirectIndirectLong (READ); - CMP16 (); + DirectIndirectLong (READ, CMP16); } static void OpD7M1 (void) { - DirectIndirectIndexedLong (READ); - CMP8 (); + DirectIndirectIndexedLong (READ, CMP8); } static void OpD7M0 (void) { - DirectIndirectIndexedLong (READ); - CMP16 (); + DirectIndirectIndexedLong (READ, CMP16); } static void OpCDM1 (void) { - Absolute (READ); - CMP8 (); + Absolute (READ, CMP8); } static void OpCDM0 (void) { - Absolute (READ); - CMP16 (); + Absolute (READ, CMP16); } static void OpDDM1 (void) { - AbsoluteIndexedX (READ); - CMP8 (); + AbsoluteIndexedX (READ, CMP8); } static void OpDDM0 (void) { - AbsoluteIndexedX (READ); - CMP16 (); + AbsoluteIndexedX (READ, CMP16); } static void OpD9M1 (void) { - AbsoluteIndexedY (READ); - CMP8 (); + AbsoluteIndexedY (READ, CMP8); } static void OpD9M0 (void) { - AbsoluteIndexedY (READ); - CMP16 (); + AbsoluteIndexedY (READ, CMP16); } static void OpCFM1 (void) { - AbsoluteLong (READ); - CMP8 (); + AbsoluteLong (READ, CMP8); } static void OpCFM0 (void) { - AbsoluteLong (READ); - CMP16 (); + AbsoluteLong (READ, CMP16); } static void OpDFM1 (void) { - AbsoluteLongIndexedX (READ); - CMP8 (); + AbsoluteLongIndexedX (READ, CMP8); } static void OpDFM0 (void) { - AbsoluteLongIndexedX (READ); - CMP16 (); + AbsoluteLongIndexedX (READ, CMP16); } static void OpC3M1 (void) { - StackRelative (READ); - CMP8 (); + StackRelative (READ, CMP8); } static void OpC3M0 (void) { - StackRelative (READ); - CMP16 (); + StackRelative (READ, CMP16); } static void OpD3M1 (void) { - StackRelativeIndirectIndexed (READ); - CMP8 (); + StackRelativeIndirectIndexed (READ, CMP8); } static void OpD3M0 (void) { - StackRelativeIndirectIndexed (READ); - CMP16 (); + StackRelativeIndirectIndexed (READ, CMP16); } /**********************************************************************************************/ @@ -852,26 +756,22 @@ static void OpE0X0 (void) static void OpE4X1 (void) { - Direct (READ); - CMX8 (); + Direct (READ, CMX8); } static void OpE4X0 (void) { - Direct (READ); - CMX16 (); + Direct (READ, CMX16); } static void OpECX1 (void) { - Absolute (READ); - CMX8 (); + Absolute (READ, CMX8); } static void OpECX0 (void) { - Absolute (READ); - CMX16 (); + Absolute (READ, CMX16); } /**********************************************************************************************/ @@ -905,26 +805,22 @@ static void OpC0X0 (void) static void OpC4X1 (void) { - Direct (READ); - CMY8 (); + Direct (READ, CMY8); } static void OpC4X0 (void) { - Direct (READ); - CMY16 (); + Direct (READ, CMY16); } static void OpCCX1 (void) { - Absolute (READ); - CMY8 (); + Absolute (READ, CMY8); } static void OpCCX0 (void) { - Absolute (READ); - CMY16 (); + Absolute (READ, CMY16); } /**********************************************************************************************/ @@ -942,50 +838,42 @@ static void Op3AM0 (void) static void OpC6M1 (void) { - Direct (MODIFY); - DEC8 (); + Direct (MODIFY, DEC8); } static void OpC6M0 (void) { - Direct (MODIFY); - DEC16 (); + Direct (MODIFY, DEC16); } static void OpD6M1 (void) { - DirectIndexedX (MODIFY); - DEC8 (); + DirectIndexedX (MODIFY, DEC8); } static void OpD6M0 (void) { - DirectIndexedX (MODIFY); - DEC16 (); + DirectIndexedX (MODIFY, DEC16); } static void OpCEM1 (void) { - Absolute (MODIFY); - DEC8 (); + Absolute (MODIFY, DEC8); } static void OpCEM0 (void) { - Absolute (MODIFY); - DEC16 (); + Absolute (MODIFY, DEC16); } static void OpDEM1 (void) { - AbsoluteIndexedX (MODIFY); - DEC8 (); + AbsoluteIndexedX (MODIFY, DEC8); } static void OpDEM0 (void) { - AbsoluteIndexedX (MODIFY); - DEC16 (); + AbsoluteIndexedX (MODIFY, DEC16); } /**********************************************************************************************/ @@ -1016,170 +904,142 @@ static void Op49M0 (void) static void Op45M1 (void) { - Direct (READ); - EOR8 (); + Direct (READ, EOR8); } static void Op45M0 (void) { - Direct (READ); - EOR16 (); + Direct (READ, EOR16); } static void Op55M1 (void) { - DirectIndexedX (READ); - EOR8 (); + DirectIndexedX (READ, EOR8); } static void Op55M0 (void) { - DirectIndexedX (READ); - EOR16 (); + DirectIndexedX (READ, EOR16); } static void Op52M1 (void) { - DirectIndirect (READ); - EOR8 (); + DirectIndirect (READ, EOR8); } static void Op52M0 (void) { - DirectIndirect (READ); - EOR16 (); + DirectIndirect (READ, EOR16); } static void Op41M1 (void) { - DirectIndexedIndirect (READ); - EOR8 (); + DirectIndexedIndirect (READ, EOR8); } static void Op41M0 (void) { - DirectIndexedIndirect (READ); - EOR16 (); + DirectIndexedIndirect (READ, EOR16); } static void Op51M1 (void) { - DirectIndirectIndexed (READ); - EOR8 (); + DirectIndirectIndexed (READ, EOR8); } static void Op51M0 (void) { - DirectIndirectIndexed (READ); - EOR16 (); + DirectIndirectIndexed (READ, EOR16); } static void Op47M1 (void) { - DirectIndirectLong (READ); - EOR8 (); + DirectIndirectLong (READ, EOR8); } static void Op47M0 (void) { - DirectIndirectLong (READ); - EOR16 (); + DirectIndirectLong (READ, EOR16); } static void Op57M1 (void) { - DirectIndirectIndexedLong (READ); - EOR8 (); + DirectIndirectIndexedLong (READ, EOR8); } static void Op57M0 (void) { - DirectIndirectIndexedLong (READ); - EOR16 (); + DirectIndirectIndexedLong (READ, EOR16); } static void Op4DM1 (void) { - Absolute (READ); - EOR8 (); + Absolute (READ, EOR8); } static void Op4DM0 (void) { - Absolute (READ); - EOR16 (); + Absolute (READ, EOR16); } static void Op5DM1 (void) { - AbsoluteIndexedX (READ); - EOR8 (); + AbsoluteIndexedX (READ, EOR8); } static void Op5DM0 (void) { - AbsoluteIndexedX (READ); - EOR16 (); + AbsoluteIndexedX (READ, EOR16); } static void Op59M1 (void) { - AbsoluteIndexedY (READ); - EOR8 (); + AbsoluteIndexedY (READ, EOR8); } static void Op59M0 (void) { - AbsoluteIndexedY (READ); - EOR16 (); + AbsoluteIndexedY (READ, EOR16); } static void Op4FM1 (void) { - AbsoluteLong (READ); - EOR8 (); + AbsoluteLong (READ, EOR8); } static void Op4FM0 (void) { - AbsoluteLong (READ); - EOR16 (); + AbsoluteLong (READ, EOR16); } static void Op5FM1 (void) { - AbsoluteLongIndexedX (READ); - EOR8 (); + AbsoluteLongIndexedX (READ, EOR8); } static void Op5FM0 (void) { - AbsoluteLongIndexedX (READ); - EOR16 (); + AbsoluteLongIndexedX (READ, EOR16); } static void Op43M1 (void) { - StackRelative (READ); - EOR8 (); + StackRelative (READ, EOR8); } static void Op43M0 (void) { - StackRelative (READ); - EOR16 (); + StackRelative (READ, EOR16); } static void Op53M1 (void) { - StackRelativeIndirectIndexed (READ); - EOR8 (); + StackRelativeIndirectIndexed (READ, EOR8); } static void Op53M0 (void) { - StackRelativeIndirectIndexed (READ); - EOR16 (); + StackRelativeIndirectIndexed (READ, EOR16); } /**********************************************************************************************/ @@ -1197,50 +1057,42 @@ static void Op1AM0 (void) static void OpE6M1 (void) { - Direct (MODIFY); - INC8 (); + Direct (MODIFY, INC8); } static void OpE6M0 (void) { - Direct (MODIFY); - INC16 (); + Direct (MODIFY, INC16); } static void OpF6M1 (void) { - DirectIndexedX (MODIFY); - INC8 (); + DirectIndexedX (MODIFY, INC8); } static void OpF6M0 (void) { - DirectIndexedX (MODIFY); - INC16 (); + DirectIndexedX (MODIFY, INC16); } static void OpEEM1 (void) { - Absolute (MODIFY); - INC8 (); + Absolute (MODIFY, INC8); } static void OpEEM0 (void) { - Absolute (MODIFY); - INC16 (); + Absolute (MODIFY, INC16); } static void OpFEM1 (void) { - AbsoluteIndexedX (MODIFY); - INC8 (); + AbsoluteIndexedX (MODIFY, INC8); } static void OpFEM0 (void) { - AbsoluteIndexedX (MODIFY); - INC16 (); + AbsoluteIndexedX (MODIFY, INC16); } /**********************************************************************************************/ @@ -1271,170 +1123,142 @@ static void OpA9M0 (void) static void OpA5M1 (void) { - Direct (READ); - LDA8 (); + Direct (READ, LDA8); } static void OpA5M0 (void) { - Direct (READ); - LDA16 (); + Direct (READ, LDA16); } static void OpB5M1 (void) { - DirectIndexedX (READ); - LDA8 (); + DirectIndexedX (READ, LDA8); } static void OpB5M0 (void) { - DirectIndexedX (READ); - LDA16 (); + DirectIndexedX (READ, LDA16); } static void OpB2M1 (void) { - DirectIndirect (READ); - LDA8 (); + DirectIndirect (READ, LDA8); } static void OpB2M0 (void) { - DirectIndirect (READ); - LDA16 (); + DirectIndirect (READ, LDA16); } static void OpA1M1 (void) { - DirectIndexedIndirect (READ); - LDA8 (); + DirectIndexedIndirect (READ, LDA8); } static void OpA1M0 (void) { - DirectIndexedIndirect (READ); - LDA16 (); + DirectIndexedIndirect (READ, LDA16); } static void OpB1M1 (void) { - DirectIndirectIndexed (READ); - LDA8 (); + DirectIndirectIndexed (READ, LDA8); } static void OpB1M0 (void) { - DirectIndirectIndexed (READ); - LDA16 (); + DirectIndirectIndexed (READ, LDA16); } static void OpA7M1 (void) { - DirectIndirectLong (READ); - LDA8 (); + DirectIndirectLong (READ, LDA8); } static void OpA7M0 (void) { - DirectIndirectLong (READ); - LDA16 (); + DirectIndirectLong (READ, LDA16); } static void OpB7M1 (void) { - DirectIndirectIndexedLong (READ); - LDA8 (); + DirectIndirectIndexedLong (READ, LDA8); } static void OpB7M0 (void) { - DirectIndirectIndexedLong (READ); - LDA16 (); + DirectIndirectIndexedLong (READ, LDA16); } static void OpADM1 (void) { - Absolute (READ); - LDA8 (); + Absolute (READ, LDA8); } static void OpADM0 (void) { - Absolute (READ); - LDA16 (); + Absolute (READ, LDA16); } static void OpBDM1 (void) { - AbsoluteIndexedX (READ); - LDA8 (); + AbsoluteIndexedX (READ, LDA8); } static void OpBDM0 (void) { - AbsoluteIndexedX (READ); - LDA16 (); + AbsoluteIndexedX (READ, LDA16); } static void OpB9M1 (void) { - AbsoluteIndexedY (READ); - LDA8 (); + AbsoluteIndexedY (READ, LDA8); } static void OpB9M0 (void) { - AbsoluteIndexedY (READ); - LDA16 (); + AbsoluteIndexedY (READ, LDA16); } static void OpAFM1 (void) { - AbsoluteLong (READ); - LDA8 (); + AbsoluteLong (READ, LDA8); } static void OpAFM0 (void) { - AbsoluteLong (READ); - LDA16 (); + AbsoluteLong (READ, LDA16); } static void OpBFM1 (void) { - AbsoluteLongIndexedX (READ); - LDA8 (); + AbsoluteLongIndexedX (READ, LDA8); } static void OpBFM0 (void) { - AbsoluteLongIndexedX (READ); - LDA16 (); + AbsoluteLongIndexedX (READ, LDA16); } static void OpA3M1 (void) { - StackRelative (READ); - LDA8 (); + StackRelative (READ, LDA8); } static void OpA3M0 (void) { - StackRelative (READ); - LDA16 (); + StackRelative (READ, LDA16); } static void OpB3M1 (void) { - StackRelativeIndirectIndexed (READ); - LDA8 (); + StackRelativeIndirectIndexed (READ, LDA8); } static void OpB3M0 (void) { - StackRelativeIndirectIndexed (READ); - LDA16 (); + StackRelativeIndirectIndexed (READ, LDA16); } /**********************************************************************************************/ @@ -1465,50 +1289,42 @@ static void OpA2X0 (void) static void OpA6X1 (void) { - Direct (READ); - LDX8 (); + Direct (READ, LDX8); } static void OpA6X0 (void) { - Direct (READ); - LDX16 (); + Direct (READ, LDX16); } static void OpB6X1 (void) { - DirectIndexedY (READ); - LDX8 (); + DirectIndexedY (READ, LDX8); } static void OpB6X0 (void) { - DirectIndexedY (READ); - LDX16 (); + DirectIndexedY (READ, LDX16); } static void OpAEX1 (void) { - Absolute (READ); - LDX8 (); + Absolute (READ, LDX8); } static void OpAEX0 (void) { - Absolute (READ); - LDX16 (); + Absolute (READ, LDX16); } static void OpBEX1 (void) { - AbsoluteIndexedY (READ); - LDX8 (); + AbsoluteIndexedY (READ, LDX8); } static void OpBEX0 (void) { - AbsoluteIndexedY (READ); - LDX16 (); + AbsoluteIndexedY (READ, LDX16); } /**********************************************************************************************/ @@ -1539,50 +1355,42 @@ static void OpA0X0 (void) static void OpA4X1 (void) { - Direct (READ); - LDY8 (); + Direct (READ, LDY8); } static void OpA4X0 (void) { - Direct (READ); - LDY16 (); + Direct (READ, LDY16); } static void OpB4X1 (void) { - DirectIndexedX (READ); - LDY8 (); + DirectIndexedX (READ, LDY8); } static void OpB4X0 (void) { - DirectIndexedX (READ); - LDY16 (); + DirectIndexedX (READ, LDY16); } static void OpACX1 (void) { - Absolute (READ); - LDY8 (); + Absolute (READ, LDY8); } static void OpACX0 (void) { - Absolute (READ); - LDY16 (); + Absolute (READ, LDY16); } static void OpBCX1 (void) { - AbsoluteIndexedX (READ); - LDY8 (); + AbsoluteIndexedX (READ, LDY8); } static void OpBCX0 (void) { - AbsoluteIndexedX (READ); - LDY16 (); + AbsoluteIndexedX (READ, LDY16); } /**********************************************************************************************/ @@ -1599,50 +1407,42 @@ static void Op4AM0 (void) static void Op46M1 (void) { - Direct (MODIFY); - LSR8 (); + Direct (MODIFY, LSR8); } static void Op46M0 (void) { - Direct (MODIFY); - LSR16 (); + Direct (MODIFY, LSR16); } static void Op56M1 (void) { - DirectIndexedX (MODIFY); - LSR8 (); + DirectIndexedX (MODIFY, LSR8); } static void Op56M0 (void) { - DirectIndexedX (MODIFY); - LSR16 (); + DirectIndexedX (MODIFY, LSR16); } static void Op4EM1 (void) { - Absolute (MODIFY); - LSR8 (); + Absolute (MODIFY, LSR8); } static void Op4EM0 (void) { - Absolute (MODIFY); - LSR16 (); + Absolute (MODIFY, LSR16); } static void Op5EM1 (void) { - AbsoluteIndexedX (MODIFY); - LSR8 (); + AbsoluteIndexedX (MODIFY, LSR8); } static void Op5EM0 (void) { - AbsoluteIndexedX (MODIFY); - LSR16 (); + AbsoluteIndexedX (MODIFY, LSR16); } /**********************************************************************************************/ @@ -1673,170 +1473,142 @@ static void Op09M0 (void) static void Op05M1 (void) { - Direct (READ); - ORA8 (); + Direct (READ, ORA8); } static void Op05M0 (void) { - Direct (READ); - ORA16 (); + Direct (READ, ORA16); } static void Op15M1 (void) { - DirectIndexedX (READ); - ORA8 (); + DirectIndexedX (READ, ORA8); } static void Op15M0 (void) { - DirectIndexedX (READ); - ORA16 (); + DirectIndexedX (READ, ORA16); } static void Op12M1 (void) { - DirectIndirect (READ); - ORA8 (); + DirectIndirect (READ, ORA8); } static void Op12M0 (void) { - DirectIndirect (READ); - ORA16 (); + DirectIndirect (READ, ORA16); } static void Op01M1 (void) { - DirectIndexedIndirect (READ); - ORA8 (); + DirectIndexedIndirect (READ, ORA8); } static void Op01M0 (void) { - DirectIndexedIndirect (READ); - ORA16 (); + DirectIndexedIndirect (READ, ORA16); } static void Op11M1 (void) { - DirectIndirectIndexed (READ); - ORA8 (); + DirectIndirectIndexed (READ, ORA8); } static void Op11M0 (void) { - DirectIndirectIndexed (READ); - ORA16 (); + DirectIndirectIndexed (READ, ORA16); } static void Op07M1 (void) { - DirectIndirectLong (READ); - ORA8 (); + DirectIndirectLong (READ, ORA8); } static void Op07M0 (void) { - DirectIndirectLong (READ); - ORA16 (); + DirectIndirectLong (READ, ORA16); } static void Op17M1 (void) { - DirectIndirectIndexedLong (READ); - ORA8 (); + DirectIndirectIndexedLong (READ, ORA8); } static void Op17M0 (void) { - DirectIndirectIndexedLong (READ); - ORA16 (); + DirectIndirectIndexedLong (READ, ORA16); } static void Op0DM1 (void) { - Absolute (READ); - ORA8 (); + Absolute (READ, ORA8); } static void Op0DM0 (void) { - Absolute (READ); - ORA16 (); + Absolute (READ, ORA16); } static void Op1DM1 (void) { - AbsoluteIndexedX (READ); - ORA8 (); + AbsoluteIndexedX (READ, ORA8); } static void Op1DM0 (void) { - AbsoluteIndexedX (READ); - ORA16 (); + AbsoluteIndexedX (READ, ORA16); } static void Op19M1 (void) { - AbsoluteIndexedY (READ); - ORA8 (); + AbsoluteIndexedY (READ, ORA8); } static void Op19M0 (void) { - AbsoluteIndexedY (READ); - ORA16 (); + AbsoluteIndexedY (READ, ORA16); } static void Op0FM1 (void) { - AbsoluteLong (READ); - ORA8 (); + AbsoluteLong (READ, ORA8); } static void Op0FM0 (void) { - AbsoluteLong (READ); - ORA16 (); + AbsoluteLong (READ, ORA16); } static void Op1FM1 (void) { - AbsoluteLongIndexedX (READ); - ORA8 (); + AbsoluteLongIndexedX (READ, ORA8); } static void Op1FM0 (void) { - AbsoluteLongIndexedX (READ); - ORA16 (); + AbsoluteLongIndexedX (READ, ORA16); } static void Op03M1 (void) { - StackRelative (READ); - ORA8 (); + StackRelative (READ, ORA8); } static void Op03M0 (void) { - StackRelative (READ); - ORA16 (); + StackRelative (READ, ORA16); } static void Op13M1 (void) { - StackRelativeIndirectIndexed (READ); - ORA8 (); + StackRelativeIndirectIndexed (READ, ORA8); } static void Op13M0 (void) { - StackRelativeIndirectIndexed (READ); - ORA16 (); + StackRelativeIndirectIndexed (READ, ORA16); } /**********************************************************************************************/ @@ -1854,50 +1626,42 @@ static void Op2AM0 (void) static void Op26M1 (void) { - Direct (MODIFY); - ROL8 (); + Direct (MODIFY, ROL8); } static void Op26M0 (void) { - Direct (MODIFY); - ROL16 (); + Direct (MODIFY, ROL16); } static void Op36M1 (void) { - DirectIndexedX (MODIFY); - ROL8 (); + DirectIndexedX (MODIFY, ROL8); } static void Op36M0 (void) { - DirectIndexedX (MODIFY); - ROL16 (); + DirectIndexedX (MODIFY, ROL16); } static void Op2EM1 (void) { - Absolute (MODIFY); - ROL8 (); + Absolute (MODIFY, ROL8); } static void Op2EM0 (void) { - Absolute (MODIFY); - ROL16 (); + Absolute (MODIFY, ROL16); } static void Op3EM1 (void) { - AbsoluteIndexedX (MODIFY); - ROL8 (); + AbsoluteIndexedX (MODIFY, ROL8); } static void Op3EM0 (void) { - AbsoluteIndexedX (MODIFY); - ROL16 (); + AbsoluteIndexedX (MODIFY, ROL16); } /**********************************************************************************************/ @@ -1914,276 +1678,231 @@ static void Op6AM0 (void) static void Op66M1 (void) { - Direct (MODIFY); - ROR8 (); + Direct (MODIFY, ROR8); } static void Op66M0 (void) { - Direct (MODIFY); - ROR16 (); + Direct (MODIFY, ROR16); } static void Op76M1 (void) { - DirectIndexedX (MODIFY); - ROR8 (); + DirectIndexedX (MODIFY, ROR8); } static void Op76M0 (void) { - DirectIndexedX (MODIFY); - ROR16 (); + DirectIndexedX (MODIFY, ROR16); } static void Op6EM1 (void) { - Absolute (MODIFY); - ROR8 (); + Absolute (MODIFY, ROR8); } static void Op6EM0 (void) { - Absolute (MODIFY); - ROR16 (); + Absolute (MODIFY, ROR16); } static void Op7EM1 (void) { - AbsoluteIndexedX (MODIFY); - ROR8 (); + AbsoluteIndexedX (MODIFY, ROR8); } static void Op7EM0 (void) { - AbsoluteIndexedX (MODIFY); - ROR16 (); + AbsoluteIndexedX (MODIFY, ROR16); } /**********************************************************************************************/ /* SBC *************************************************************************************** */ static void OpE9M1 (void) { - Immediate8 (READ); - SBC8 (); + Immediate8 (READ, SBC8); } static void OpE9M0 (void) { - Immediate16 (READ); - SBC16 (); + Immediate16 (READ, SBC16); } static void OpE5M1 (void) { - Direct (READ); - SBC8 (); + Direct (READ, SBC8); } static void OpE5M0 (void) { - Direct (READ); - SBC16 (); + Direct (READ, SBC16); } static void OpF5M1 (void) { - DirectIndexedX (READ); - SBC8 (); + DirectIndexedX (READ, SBC8); } static void OpF5M0 (void) { - DirectIndexedX (READ); - SBC16 (); + DirectIndexedX (READ, SBC16); } static void OpF2M1 (void) { - DirectIndirect (READ); - SBC8 (); + DirectIndirect (READ, SBC8); } static void OpF2M0 (void) { - DirectIndirect (READ); - SBC16 (); + DirectIndirect (READ, SBC16); } static void OpE1M1 (void) { - DirectIndexedIndirect (READ); - SBC8 (); + DirectIndexedIndirect (READ, SBC8); } static void OpE1M0 (void) { - DirectIndexedIndirect (READ); - SBC16 (); + DirectIndexedIndirect (READ, SBC16); } static void OpF1M1 (void) { - DirectIndirectIndexed (READ); - SBC8 (); + DirectIndirectIndexed (READ, SBC8); } static void OpF1M0 (void) { - DirectIndirectIndexed (READ); - SBC16 (); + DirectIndirectIndexed (READ, SBC16); } static void OpE7M1 (void) { - DirectIndirectLong (READ); - SBC8 (); + DirectIndirectLong (READ, SBC8); } static void OpE7M0 (void) { - DirectIndirectLong (READ); - SBC16 (); + DirectIndirectLong (READ, SBC16); } static void OpF7M1 (void) { - DirectIndirectIndexedLong (READ); - SBC8 (); + DirectIndirectIndexedLong (READ, SBC8); } static void OpF7M0 (void) { - DirectIndirectIndexedLong (READ); - SBC16 (); + DirectIndirectIndexedLong (READ, SBC16); } static void OpEDM1 (void) { - Absolute (READ); - SBC8 (); + Absolute (READ, SBC8); } static void OpEDM0 (void) { - Absolute (READ); - SBC16 (); + Absolute (READ, SBC16); } static void OpFDM1 (void) { - AbsoluteIndexedX (READ); - SBC8 (); + AbsoluteIndexedX (READ, SBC8); } static void OpFDM0 (void) { - AbsoluteIndexedX (READ); - SBC16 (); + AbsoluteIndexedX (READ, SBC16); } static void OpF9M1 (void) { - AbsoluteIndexedY (READ); - SBC8 (); + AbsoluteIndexedY (READ, SBC8); } static void OpF9M0 (void) { - AbsoluteIndexedY (READ); - SBC16 (); + AbsoluteIndexedY (READ, SBC16); } static void OpEFM1 (void) { - AbsoluteLong (READ); - SBC8 (); + AbsoluteLong (READ, SBC8); } static void OpEFM0 (void) { - AbsoluteLong (READ); - SBC16 (); + AbsoluteLong (READ, SBC16); } static void OpFFM1 (void) { - AbsoluteLongIndexedX (READ); - SBC8 (); + AbsoluteLongIndexedX (READ, SBC8); } static void OpFFM0 (void) { - AbsoluteLongIndexedX (READ); - SBC16 (); + AbsoluteLongIndexedX (READ, SBC16); } static void OpE3M1 (void) { - StackRelative (READ); - SBC8 (); + StackRelative (READ, SBC8); } static void OpE3M0 (void) { - StackRelative (READ); - SBC16 (); + StackRelative (READ, SBC16); } static void OpF3M1 (void) { - StackRelativeIndirectIndexed (READ); - SBC8 (); + StackRelativeIndirectIndexed (READ, SBC8); } static void OpF3M0 (void) { - StackRelativeIndirectIndexed (READ); - SBC16 (); + StackRelativeIndirectIndexed (READ, SBC16); } /**********************************************************************************************/ /* STA *************************************************************************************** */ static void Op85M1 (void) { - Direct (WRITE); - STA8 (); + Direct (WRITE, STA8); } static void Op85M0 (void) { - Direct (WRITE); - STA16 (); + Direct (WRITE, STA16); } static void Op95M1 (void) { - DirectIndexedX (WRITE); - STA8 (); + DirectIndexedX (WRITE, STA8); } static void Op95M0 (void) { - DirectIndexedX (WRITE); - STA16 (); + DirectIndexedX (WRITE, STA16); } static void Op92M1 (void) { - DirectIndirect (WRITE); - STA8 (); + DirectIndirect (WRITE, STA8); } static void Op92M0 (void) { - DirectIndirect (WRITE); - STA16 (); + DirectIndirect (WRITE, STA16); } static void Op81M1 (void) { - DirectIndexedIndirect (WRITE); - STA8 (); + DirectIndexedIndirect (WRITE, STA8); #ifdef noVAR_CYCLES if (CheckIndex ()) CPU.Cycles += ONE_CYCLE; @@ -2192,8 +1911,7 @@ static void Op81M1 (void) static void Op81M0 (void) { - DirectIndexedIndirect (WRITE); - STA16 (); + DirectIndexedIndirect (WRITE, STA16); #ifdef noVAR_CYCLES if (CheckIndex ()) CPU.Cycles += ONE_CYCLE; @@ -2202,248 +1920,208 @@ static void Op81M0 (void) static void Op91M1 (void) { - DirectIndirectIndexed (WRITE); - STA8 (); + DirectIndirectIndexed (WRITE, STA8); } static void Op91M0 (void) { - DirectIndirectIndexed (WRITE); - STA16 (); + DirectIndirectIndexed (WRITE, STA16); } static void Op87M1 (void) { - DirectIndirectLong (WRITE); - STA8 (); + DirectIndirectLong (WRITE, STA8); } static void Op87M0 (void) { - DirectIndirectLong (WRITE); - STA16 (); + DirectIndirectLong (WRITE, STA16); } static void Op97M1 (void) { - DirectIndirectIndexedLong (WRITE); - STA8 (); + DirectIndirectIndexedLong (WRITE, STA8); } static void Op97M0 (void) { - DirectIndirectIndexedLong (WRITE); - STA16 (); + DirectIndirectIndexedLong (WRITE, STA16); } static void Op8DM1 (void) { - Absolute (WRITE); - STA8 (); + Absolute (WRITE, STA8); } static void Op8DM0 (void) { - Absolute (WRITE); - STA16 (); + Absolute (WRITE, STA16); } static void Op9DM1 (void) { - AbsoluteIndexedX (WRITE); - STA8 (); + AbsoluteIndexedX (WRITE, STA8); } static void Op9DM0 (void) { - AbsoluteIndexedX (WRITE); - STA16 (); + AbsoluteIndexedX (WRITE, STA16); } static void Op99M1 (void) { - AbsoluteIndexedY (WRITE); - STA8 (); + AbsoluteIndexedY (WRITE, STA8); } static void Op99M0 (void) { - AbsoluteIndexedY (WRITE); - STA16 (); + AbsoluteIndexedY (WRITE, STA16); } static void Op8FM1 (void) { - AbsoluteLong (WRITE); - STA8 (); + AbsoluteLong (WRITE, STA8); } static void Op8FM0 (void) { - AbsoluteLong (WRITE); - STA16 (); + AbsoluteLong (WRITE, STA16); } static void Op9FM1 (void) { - AbsoluteLongIndexedX (WRITE); - STA8 (); + AbsoluteLongIndexedX (WRITE, STA8); } static void Op9FM0 (void) { - AbsoluteLongIndexedX (WRITE); - STA16 (); + AbsoluteLongIndexedX (WRITE, STA16); } static void Op83M1 (void) { - StackRelative (WRITE); - STA8 (); + StackRelative (WRITE, STA8); } static void Op83M0 (void) { - StackRelative (WRITE); - STA16 (); + StackRelative (WRITE, STA16); } static void Op93M1 (void) { - StackRelativeIndirectIndexed (WRITE); - STA8 (); + StackRelativeIndirectIndexed (WRITE, STA8); } static void Op93M0 (void) { - StackRelativeIndirectIndexed (WRITE); - STA16 (); + StackRelativeIndirectIndexed (WRITE, STA16); } /**********************************************************************************************/ /* STX *************************************************************************************** */ static void Op86X1 (void) { - Direct (WRITE); - STX8 (); + Direct (WRITE, STX8); } static void Op86X0 (void) { - Direct (WRITE); - STX16 (); + Direct (WRITE, STX16); } static void Op96X1 (void) { - DirectIndexedY (WRITE); - STX8 (); + DirectIndexedY (WRITE, STX8); } static void Op96X0 (void) { - DirectIndexedY (WRITE); - STX16 (); + DirectIndexedY (WRITE, STX16); } static void Op8EX1 (void) { - Absolute (WRITE); - STX8 (); + Absolute (WRITE, STX8); } static void Op8EX0 (void) { - Absolute (WRITE); - STX16 (); + Absolute (WRITE, STX16); } /**********************************************************************************************/ /* STY *************************************************************************************** */ static void Op84X1 (void) { - Direct (WRITE); - STY8 (); + Direct (WRITE, STY8); } static void Op84X0 (void) { - Direct (WRITE); - STY16 (); + Direct (WRITE, STY16); } static void Op94X1 (void) { - DirectIndexedX (WRITE); - STY8 (); + DirectIndexedX (WRITE, STY8); } static void Op94X0 (void) { - DirectIndexedX (WRITE); - STY16 (); + DirectIndexedX (WRITE, STY16); } static void Op8CX1 (void) { - Absolute (WRITE); - STY8 (); + Absolute (WRITE, STY8); } static void Op8CX0 (void) { - Absolute (WRITE); - STY16 (); + Absolute (WRITE, STY16); } /**********************************************************************************************/ /* STZ *************************************************************************************** */ static void Op64M1 (void) { - Direct (WRITE); - STZ8 (); + Direct (WRITE, STZ8); } static void Op64M0 (void) { - Direct (WRITE); - STZ16 (); + Direct (WRITE, STZ16); } static void Op74M1 (void) { - DirectIndexedX (WRITE); - STZ8 (); + DirectIndexedX (WRITE, STZ8); } static void Op74M0 (void) { - DirectIndexedX (WRITE); - STZ16 (); + DirectIndexedX (WRITE, STZ16); } static void Op9CM1 (void) { - Absolute (WRITE); - STZ8 (); + Absolute (WRITE, STZ8); } static void Op9CM0 (void) { - Absolute (WRITE); - STZ16 (); + Absolute (WRITE, STZ16); } static void Op9EM1 (void) { - AbsoluteIndexedX (WRITE); - STZ8 (); + AbsoluteIndexedX (WRITE, STZ8); } static void Op9EM0 (void) { - AbsoluteIndexedX (WRITE); - STZ16 (); + AbsoluteIndexedX (WRITE, STZ16); } /**********************************************************************************************/ @@ -2451,52 +2129,44 @@ static void Op9EM0 (void) /* TRB *************************************************************************************** */ static void Op14M1 (void) { - Direct (MODIFY); - TRB8 (); + Direct (MODIFY, TRB8); } static void Op14M0 (void) { - Direct (MODIFY); - TRB16 (); + Direct (MODIFY, TRB16); } static void Op1CM1 (void) { - Absolute (MODIFY); - TRB8 (); + Absolute (MODIFY, TRB8); } static void Op1CM0 (void) { - Absolute (MODIFY); - TRB16 (); + Absolute (MODIFY, TRB16); } /**********************************************************************************************/ /* TSB *************************************************************************************** */ static void Op04M1 (void) { - Direct (MODIFY); - TSB8 (); + Direct (MODIFY, TSB8); } static void Op04M0 (void) { - Direct (MODIFY); - TSB16 (); + Direct (MODIFY, TSB16); } static void Op0CM1 (void) { - Absolute (MODIFY); - TSB8 (); + Absolute (MODIFY, TSB8); } static void Op0CM0 (void) { - Absolute (MODIFY); - TSB16 (); + Absolute (MODIFY, TSB16); } /**********************************************************************************************/ @@ -2608,7 +2278,7 @@ inline void CPUShutdown() /* BCC */ static void Op90 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck0 (); if (!CheckCarry ()) { @@ -2616,14 +2286,14 @@ static void Op90 (void) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - CPUShutdown (); + CPUShutdown(); } } /* BCS */ static void OpB0 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck0 (); if (CheckCarry ()) { @@ -2638,7 +2308,7 @@ static void OpB0 (void) /* BEQ */ static void OpF0 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck2 (); if (CheckZero ()) { @@ -2653,7 +2323,7 @@ static void OpF0 (void) /* BMI */ static void Op30 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck1 (); if (CheckNegative ()) { @@ -2668,7 +2338,7 @@ static void Op30 (void) /* BNE */ static void OpD0 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck1 (); if (!CheckZero ()) { @@ -2684,7 +2354,7 @@ static void OpD0 (void) /* BPL */ static void Op10 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck1 (); if (!CheckNegative ()) { @@ -2699,7 +2369,7 @@ static void Op10 (void) /* BRA */ static void Op80 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); CPU.PC = CPU.PCBase + OpAddress; #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -2710,7 +2380,7 @@ static void Op80 (void) /* BVC */ static void Op50 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck0 (); if (!CheckOverflow ()) { @@ -2725,7 +2395,7 @@ static void Op50 (void) /* BVS */ static void Op70 (void) { - Relative (JUMP); + Relative (JUMP, OpAddressPassthrough); BranchCheck0 (); if (CheckOverflow ()) { @@ -2928,39 +2598,39 @@ static void OpEA (void) //PEA NL static void OpF4E1 (void) { - Absolute (NONE); + Absolute (NONE, OpAddressPassthrough); PushWENew ((unsigned short)OpAddress); } static void OpF4 (void) { - Absolute (NONE); + Absolute (NONE, OpAddressPassthrough); PushW ((unsigned short)OpAddress); } //PEI NL static void OpD4E1 (void) { - DirectIndirect (NONE); + DirectIndirect (NONE, OpAddressPassthrough); PushWENew ((unsigned short)OpAddress); } static void OpD4 (void) { - DirectIndirect (NONE); + DirectIndirect (NONE, OpAddressPassthrough); PushW ((unsigned short)OpAddress); } //PER NL static void Op62E1 (void) { - RelativeLong (NONE); + RelativeLong (NONE, OpAddressPassthrough); PushWENew ((unsigned short)OpAddress); } static void Op62 (void) { - RelativeLong (NONE); + RelativeLong (NONE, OpAddressPassthrough); PushW ((unsigned short)OpAddress); } @@ -3593,7 +3263,7 @@ static void Op00 (void) /* BRL ************************************************************************************** */ static void Op82 (void) { - RelativeLong (JUMP); + RelativeLong (JUMP, OpAddressPassthrough); S9xSetPCBase (ICPU.ShiftedPB + OpAddress); } /**********************************************************************************************/ @@ -3779,7 +3449,7 @@ static void Op02 (void) /* JML *************************************************************************************** */ static void OpDC (void) { - AbsoluteIndirectLong (JUMP); + AbsoluteIndirectLong (JUMP, OpAddressPassthrough); Registers.PB = (uint8) (OpAddress >> 16); ICPU.ShiftedPB = OpAddress & 0xff0000; S9xSetPCBase (OpAddress); @@ -3790,7 +3460,7 @@ static void OpDC (void) static void Op5C (void) { - AbsoluteLong (JUMP); + AbsoluteLong (JUMP, OpAddressPassthrough); Registers.PB = (uint8) (OpAddress >> 16); ICPU.ShiftedPB = OpAddress & 0xff0000; S9xSetPCBase (OpAddress); @@ -3800,7 +3470,7 @@ static void Op5C (void) /* JMP *************************************************************************************** */ static void Op4C (void) { - Absolute (JUMP); + Absolute (JUMP, OpAddressPassthrough); S9xSetPCBase (ICPU.ShiftedPB + (OpAddress & 0xffff)); #if defined(CPU_SHUTDOWN) && defined(SA1_OPCODES) CPUShutdown (); @@ -3809,13 +3479,13 @@ static void Op4C (void) static void Op6C (void) { - AbsoluteIndirect (JUMP); + AbsoluteIndirect (JUMP, OpAddressPassthrough); S9xSetPCBase (ICPU.ShiftedPB + (OpAddress & 0xffff)); } static void Op7C (void) { - AbsoluteIndexedIndirect (JUMP); + AbsoluteIndexedIndirect (JUMP, OpAddressPassthrough); S9xSetPCBase (ICPU.ShiftedPB + OpAddress); #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; @@ -3826,7 +3496,7 @@ static void Op7C (void) /* JSL/RTL *********************************************************************************** */ static void Op22E1 (void) { - AbsoluteLong (JUMP); + AbsoluteLong (JUMP, OpAddressPassthrough); PushB (Registers.PB); PushWENew (CPU.PC - CPU.PCBase - 1); Registers.PB = (uint8) (OpAddress >> 16); @@ -3836,7 +3506,7 @@ static void Op22E1 (void) static void Op22 (void) { - AbsoluteLong (JUMP); + AbsoluteLong (JUMP, OpAddressPassthrough); PushB (Registers.PB); PushW (CPU.PC - CPU.PCBase - 1); Registers.PB = (uint8) (OpAddress >> 16); @@ -3870,7 +3540,7 @@ static void Op6B (void) /* JSR/RTS *********************************************************************************** */ static void Op20 (void) { - Absolute (JUMP); + Absolute (JUMP, OpAddressPassthrough); PushW (CPU.PC - CPU.PCBase - 1); S9xSetPCBase (ICPU.ShiftedPB + (OpAddress & 0xffff)); #ifndef SA1_OPCODES @@ -3881,7 +3551,7 @@ static void Op20 (void) //JSR a,x static void OpFCE1 (void) { - AbsoluteIndexedIndirect (JUMP); + AbsoluteIndexedIndirect (JUMP, OpAddressPassthrough); PushWENew (CPU.PC - CPU.PCBase - 1); S9xSetPCBase (ICPU.ShiftedPB + OpAddress); #ifndef SA1_OPCODES @@ -3891,7 +3561,7 @@ static void OpFCE1 (void) static void OpFC (void) { - AbsoluteIndexedIndirect (JUMP); + AbsoluteIndexedIndirect (JUMP, OpAddressPassthrough); PushW (CPU.PC - CPU.PCBase - 1); S9xSetPCBase (ICPU.ShiftedPB + OpAddress); #ifndef SA1_OPCODES @@ -4093,7 +3763,6 @@ static void Op40 (void) missing.emulate6502 = 1; } S9xSetPCBase (ICPU.ShiftedPB + Registers.PC); - if (CheckIndex ()) { Registers.XH = 0; @@ -4126,9 +3795,7 @@ static void OpCB (void) SA1.Executing = FALSE; do { - APU_EXECUTE1 (); - } while (APU.Cycles < SA1.NextEvent); - SA1.Executing = TRUE; + APU_EXECUTE1 (, } while (APU.Cycles < SA1.NextEvent, SA1.Executing = TRUE; } } #endif |