diff options
-rw-r--r-- | source/cpuaddr.h | 2 | ||||
-rw-r--r-- | source/cpumacro.h | 128 | ||||
-rw-r--r-- | source/cpuops.cpp | 32 | ||||
-rw-r--r-- | source/globals.cpp | 2 | ||||
-rw-r--r-- | source/spc700.cpp | 229 |
5 files changed, 187 insertions, 206 deletions
diff --git a/source/cpuaddr.h b/source/cpuaddr.h index 84ee45b..09f5788 100644 --- a/source/cpuaddr.h +++ b/source/cpuaddr.h @@ -134,7 +134,7 @@ static void Immediate16 (AccessMode a, InternalOp op) static void Relative (AccessMode a, InternalOp op) { - Int8 = *CPU.PC++; + int8 Int8 = *CPU.PC++; #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed; #endif diff --git a/source/cpumacro.h b/source/cpumacro.h index 335576a..1bd5d2f 100644 --- a/source/cpumacro.h +++ b/source/cpumacro.h @@ -104,14 +104,14 @@ static void SetZN8 (uint8 Work) static void ADC8 (long Addr) { - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); if (CheckDecimal ()) { - A1 = (Registers.A.W) & 0xF; - A2 = (Registers.A.W >> 4) & 0xF; - W1 = Work8 & 0xF; - W2 = (Work8 >> 4) & 0xF; + uint8 A1 = (Registers.A.W) & 0xF; + uint8 A2 = (Registers.A.W >> 4) & 0xF; + uint8 W1 = Work8 & 0xF; + uint8 W2 = (Work8 >> 4) & 0xF; A1 += W1 + CheckCarry(); if (A1 > 9) @@ -133,7 +133,7 @@ static void ADC8 (long Addr) ClearCarry (); } - Ans8 = (A2 << 4) | A1; + int8 Ans8 = (A2 << 4) | A1; if (~(Registers.AL ^ Work8) & (Work8 ^ Ans8) & 0x80) SetOverflow(); @@ -144,7 +144,7 @@ static void ADC8 (long Addr) } else { - Ans16 = Registers.AL + Work8 + CheckCarry(); + int16 Ans16 = Registers.AL + Work8 + CheckCarry(); ICPU._Carry = Ans16 >= 0x100; @@ -161,18 +161,18 @@ static void ADC8 (long Addr) static void ADC16 (long Addr) { - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); if (CheckDecimal ()) { - A1 = (Registers.A.W) & 0xF; - A2 = (Registers.A.W >> 4) & 0xF; - A3 = (Registers.A.W >> 8) & 0xF; - A4 = (Registers.A.W >> 12) & 0xF; - W1 = Work16 & 0xF; - W2 = (Work16 >> 4) & 0xF; - W3 = (Work16 >> 8) & 0xF; - W4 = (Work16 >> 12) & 0xF; + uint8 A1 = (Registers.A.W) & 0xF; + uint8 A2 = (Registers.A.W >> 4) & 0xF; + uint8 A3 = (Registers.A.W >> 8) & 0xF; + uint8 A4 = (Registers.A.W >> 12) & 0xF; + uint8 W1 = Work16 & 0xF; + uint8 W2 = (Work16 >> 4) & 0xF; + uint8 W3 = (Work16 >> 8) & 0xF; + uint8 W4 = (Work16 >> 12) & 0xF; A1 += W1 + CheckCarry (); if (A1 > 9) @@ -210,7 +210,7 @@ static void ADC16 (long Addr) ClearCarry (); } - Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1); + uint16 Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1); if (~(Registers.A.W ^ Work16) & (Work16 ^ Ans16) & 0x8000) SetOverflow(); @@ -221,7 +221,7 @@ static void ADC16 (long Addr) } else { - Ans32 = Registers.A.W + Work16 + CheckCarry(); + uint32 Ans32 = Registers.A.W + Work16 + CheckCarry(); ICPU._Carry = Ans32 >= 0x10000; @@ -272,7 +272,7 @@ static void ASL16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); ICPU._Carry = (Work16 & 0x8000) != 0; Work16 <<= 1; //S9xSetWord (Work16, Addr); @@ -286,7 +286,7 @@ static void ASL8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); ICPU._Carry = (Work8 & 0x80) != 0; Work8 <<= 1; S9xSetByte (Work8, Addr); @@ -295,7 +295,7 @@ static void ASL8 (long Addr) static void BIT16 (long Addr) { - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); ICPU._Overflow = (Work16 & 0x4000) != 0; ICPU._Negative = (uint8) (Work16 >> 8); ICPU._Zero = (Work16 & Registers.A.W) != 0; @@ -303,7 +303,7 @@ static void BIT16 (long Addr) static void BIT8 (long Addr) { - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); ICPU._Overflow = (Work8 & 0x40) != 0; ICPU._Negative = Work8; ICPU._Zero = Work8 & Registers.AL; @@ -311,7 +311,7 @@ static void BIT8 (long Addr) static void CMP16 (long Addr) { - Int32 = (long) Registers.A.W - + int32 Int32 = (long) Registers.A.W - (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); @@ -319,7 +319,7 @@ static void CMP16 (long Addr) static void CMP8 (long Addr) { - Int16 = (short) Registers.AL - + int16 Int16 = (short) Registers.AL - (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); @@ -327,7 +327,7 @@ static void CMP8 (long Addr) static void CMX16 (long Addr) { - Int32 = (long) Registers.X.W - + int32 Int32 = (long) Registers.X.W - (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); @@ -335,7 +335,7 @@ static void CMX16 (long Addr) static void CMX8 (long Addr) { - Int16 = (short) Registers.XL - + int16 Int16 = (short) Registers.XL - (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); @@ -343,7 +343,7 @@ static void CMX8 (long Addr) static void CMY16 (long Addr) { - Int32 = (long) Registers.Y.W - + int32 Int32 = (long) Registers.Y.W - (long) S9xGetWord (Addr); ICPU._Carry = Int32 >= 0; SetZN16 ((uint16) Int32); @@ -351,7 +351,7 @@ static void CMY16 (long Addr) static void CMY8 (long Addr) { - Int16 = (short) Registers.YL - + int16 Int16 = (short) Registers.YL - (short) S9xGetByte (Addr); ICPU._Carry = Int16 >= 0; SetZN8 ((uint8) Int16); @@ -392,7 +392,7 @@ static void DEC16 (long Addr) CPU.WaitAddress = NULL; #endif - Work16 = S9xGetWord (Addr) - 1; + uint16 Work16 = S9xGetWord (Addr) - 1; //S9xSetWord (Work16, Addr); S9xSetByte (Work16>>8, Addr+1); S9xSetByte (Work16&0xFF, Addr); @@ -408,7 +408,7 @@ static void DEC8 (long Addr) CPU.WaitAddress = NULL; #endif - Work8 = S9xGetByte (Addr) - 1; + uint8 Work8 = S9xGetByte (Addr) - 1; S9xSetByte (Work8, Addr); SetZN8 (Work8); } @@ -460,7 +460,7 @@ static void INC16 (long Addr) CPU.WaitAddress = NULL; #endif - Work16 = S9xGetWord (Addr) + 1; + uint16 Work16 = S9xGetWord (Addr) + 1; //S9xSetWord (Work16, Addr); S9xSetByte (Work16>>8, Addr+1); S9xSetByte (Work16&0xFF, Addr); @@ -476,7 +476,7 @@ static void INC8 (long Addr) CPU.WaitAddress = NULL; #endif - Work8 = S9xGetByte (Addr) + 1; + uint8 Work8 = S9xGetByte (Addr) + 1; S9xSetByte (Work8, Addr); SetZN8 (Work8); } @@ -542,7 +542,7 @@ static void LSR16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); ICPU._Carry = Work16 & 1; Work16 >>= 1; //S9xSetWord (Work16, Addr); @@ -556,7 +556,7 @@ static void LSR8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); ICPU._Carry = Work8 & 1; Work8 >>= 1; S9xSetByte (Work8, Addr); @@ -580,7 +580,7 @@ static inline void A_ROL16 () #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = (Registers.A.W << 1) | CheckCarry(); + uint32 Work32 = (Registers.A.W << 1) | CheckCarry(); ICPU._Carry = Work32 >= 0x10000; Registers.A.W = (uint16) Work32; SetZN16 ((uint16) Work32); @@ -591,7 +591,7 @@ static inline void A_ROL8 () #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = Registers.AL; + uint16 Work16 = Registers.AL; Work16 <<= 1; Work16 |= CheckCarry(); ICPU._Carry = Work16 >= 0x100; @@ -604,7 +604,7 @@ static void ROL16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = S9xGetWord (Addr); + uint32 Work32 = S9xGetWord (Addr); Work32 <<= 1; Work32 |= CheckCarry(); ICPU._Carry = Work32 >= 0x10000; @@ -619,7 +619,7 @@ static void ROL8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetByte (Addr); + uint16 Work16 = S9xGetByte (Addr); Work16 <<= 1; Work16 |= CheckCarry (); ICPU._Carry = Work16 >= 0x100; @@ -632,7 +632,7 @@ static inline void A_ROR16 () #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = Registers.A.W; + uint32 Work32 = Registers.A.W; Work32 |= (int) CheckCarry() << 16; ICPU._Carry = (uint8) (Work32 & 1); Work32 >>= 1; @@ -645,7 +645,7 @@ static inline void A_ROR8 () #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = Registers.AL | ((uint16) CheckCarry() << 8); + uint16 Work16 = Registers.AL | ((uint16) CheckCarry() << 8); ICPU._Carry = (uint8) Work16 & 1; Work16 >>= 1; Registers.AL = (uint8) Work16; @@ -657,7 +657,7 @@ static void ROR16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work32 = S9xGetWord (Addr); + uint32 Work32 = S9xGetWord (Addr); Work32 |= (int) CheckCarry() << 16; ICPU._Carry = (uint8) (Work32 & 1); Work32 >>= 1; @@ -672,7 +672,7 @@ static void ROR8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetByte (Addr); + uint16 Work16 = S9xGetByte (Addr); Work16 |= (int) CheckCarry () << 8; ICPU._Carry = (uint8) (Work16 & 1); Work16 >>= 1; @@ -682,18 +682,18 @@ static void ROR8 (long Addr) static void SBC16 (long Addr) { - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); if (CheckDecimal ()) { - A1 = (Registers.A.W) & 0xF; - A2 = (Registers.A.W >> 4) & 0xF; - A3 = (Registers.A.W >> 8) & 0xF; - A4 = (Registers.A.W >> 12) & 0xF; - W1 = Work16 & 0xF; - W2 = (Work16 >> 4) & 0xF; - W3 = (Work16 >> 8) & 0xF; - W4 = (Work16 >> 12) & 0xF; + uint8 A1 = (Registers.A.W) & 0xF; + uint8 A2 = (Registers.A.W >> 4) & 0xF; + uint8 A3 = (Registers.A.W >> 8) & 0xF; + uint8 A4 = (Registers.A.W >> 12) & 0xF; + uint8 W1 = Work16 & 0xF; + uint8 W2 = (Work16 >> 4) & 0xF; + uint8 W3 = (Work16 >> 8) & 0xF; + uint8 W4 = (Work16 >> 12) & 0xF; A1 -= W1 + !CheckCarry (); A2 -= W2; @@ -724,7 +724,7 @@ static void SBC16 (long Addr) SetCarry (); } - Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1); + uint16 Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1); if ((Registers.A.W ^ Work16) & (Registers.A.W ^ Ans16) & 0x8000) SetOverflow(); @@ -736,7 +736,7 @@ static void SBC16 (long Addr) else { - Int32 = (long) Registers.A.W - (long) Work16 + (long) CheckCarry() - 1; + int32 Int32 = (long) Registers.A.W - (long) Work16 + (long) CheckCarry() - 1; ICPU._Carry = Int32 >= 0; @@ -752,13 +752,13 @@ static void SBC16 (long Addr) static void SBC8 (long Addr) { - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); if (CheckDecimal ()) { - A1 = (Registers.A.W) & 0xF; - A2 = (Registers.A.W >> 4) & 0xF; - W1 = Work8 & 0xF; - W2 = (Work8 >> 4) & 0xF; + uint8 A1 = (Registers.A.W) & 0xF; + uint8 A2 = (Registers.A.W >> 4) & 0xF; + uint8 W1 = Work8 & 0xF; + uint8 W2 = (Work8 >> 4) & 0xF; A1 -= W1 + !CheckCarry (); A2 -= W2; @@ -777,7 +777,7 @@ static void SBC8 (long Addr) SetCarry (); } - Ans8 = (A2 << 4) | A1; + uint8 Ans8 = (A2 << 4) | A1; if ((Registers.AL ^ Work8) & (Registers.AL ^ Ans8) & 0x80) SetOverflow (); @@ -788,7 +788,7 @@ static void SBC8 (long Addr) } else { - Int16 = (short) Registers.AL - (short) Work8 + (short) CheckCarry() - 1; + int16 Int16 = (short) Registers.AL - (short) Work8 + (short) CheckCarry() - 1; ICPU._Carry = Int16 >= 0; if ((Registers.AL ^ Work8) & @@ -846,7 +846,7 @@ static void TSB16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); ICPU._Zero = (Work16 & Registers.A.W) != 0; Work16 |= Registers.A.W; //S9xSetWord (Work16, Addr); @@ -859,7 +859,7 @@ static void TSB8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); ICPU._Zero = Work8 & Registers.AL; Work8 |= Registers.AL; S9xSetByte (Work8, Addr); @@ -870,7 +870,7 @@ static void TRB16 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work16 = S9xGetWord (Addr); + uint16 Work16 = S9xGetWord (Addr); ICPU._Zero = (Work16 & Registers.A.W) != 0; Work16 &= ~Registers.A.W; //S9xSetWord (Work16, Addr); @@ -883,7 +883,7 @@ static void TRB8 (long Addr) #ifndef SA1_OPCODES CPU.Cycles += ONE_CYCLE; #endif - Work8 = S9xGetByte (Addr); + uint8 Work8 = S9xGetByte (Addr); ICPU._Zero = Work8 & Registers.AL; Work8 &= ~Registers.AL; S9xSetByte (Work8, Addr); diff --git a/source/cpuops.cpp b/source/cpuops.cpp index 33a2005..719465e 100644 --- a/source/cpuops.cpp +++ b/source/cpuops.cpp @@ -100,19 +100,6 @@ #include "sa1.h" #include "spc7110.h" -START_EXTERN_C -extern uint8 A1, A2, A3, A4, W1, W2, W3, W4; -extern uint8 Ans8; -extern uint16 Ans16; -extern uint32 Ans32; -extern uint8 Work8; -extern uint16 Work16; -extern uint32 Work32; -extern signed char Int8; -extern short Int16; -extern long Int32; -END_EXTERN_C - #include "cpuexec.h" #include "cpuaddr.h" #include "cpuops.h" @@ -561,7 +548,7 @@ static void Op3CM0 (void) /* CMP *************************************************************************************** */ static void OpC9M1 (void) { - Int32 = (int) Registers.AL - (int) *CPU.PC++; + int32 Int32 = (int) Registers.AL - (int) *CPU.PC++; ICPU._Carry = Int32 >= 0; SetZN8 ((uint8) Int32); #ifndef SA1_OPCODES @@ -571,6 +558,7 @@ static void OpC9M1 (void) static void OpC9M0 (void) { + int32 Int32; #ifdef FAST_LSB_WORD_ACCESS Int32 = (long) Registers.A.W - (long) *(uint16 *) CPU.PC; #else @@ -730,7 +718,7 @@ static void OpD3M0 (void) /* CMX *************************************************************************************** */ static void OpE0X1 (void) { - Int32 = (int) Registers.XL - (int) *CPU.PC++; + int32 Int32 = (int) Registers.XL - (int) *CPU.PC++; ICPU._Carry = Int32 >= 0; SetZN8 ((uint8) Int32); #ifndef SA1_OPCODES @@ -740,6 +728,7 @@ static void OpE0X1 (void) static void OpE0X0 (void) { + int32 Int32; #ifdef FAST_LSB_WORD_ACCESS Int32 = (long) Registers.X.W - (long) *(uint16 *) CPU.PC; #else @@ -779,7 +768,7 @@ static void OpECX0 (void) /* CMY *************************************************************************************** */ static void OpC0X1 (void) { - Int32 = (int) Registers.YL - (int) *CPU.PC++; + int32 Int32 = (int) Registers.YL - (int) *CPU.PC++; ICPU._Carry = Int32 >= 0; SetZN8 ((uint8) Int32); #ifndef SA1_OPCODES @@ -789,6 +778,7 @@ static void OpC0X1 (void) static void OpC0X0 (void) { + int32 Int32; #ifdef FAST_LSB_WORD_ACCESS Int32 = (long) Registers.Y.W - (long) *(uint16 *) CPU.PC; #else @@ -3188,8 +3178,8 @@ static void OpFB (void) CPU.Cycles += ONE_CYCLE; #endif - A1 = ICPU._Carry; - A2 = Registers.PH; + uint8 A1 = ICPU._Carry; + uint8 A2 = Registers.PH; ICPU._Carry = A2 & 1; Registers.PH = A1; @@ -3682,7 +3672,7 @@ static void Op44X0 (void) /* REP/SEP *********************************************************************************** */ static void OpC2 (void) { - Work8 = ~*CPU.PC++; + uint8 Work8 = ~*CPU.PC++; Registers.PL &= Work8; ICPU._Carry &= Work8; ICPU._Overflow &= (Work8 >> 6); @@ -3708,7 +3698,7 @@ static void OpC2 (void) static void OpE2 (void) { - Work8 = *CPU.PC++; + uint8 Work8 = *CPU.PC++; Registers.PL |= Work8; ICPU._Carry |= Work8 & 1; ICPU._Overflow |= (Work8 >> 6) & 1; @@ -3735,7 +3725,7 @@ static void OpE2 (void) /* XBA *************************************************************************************** */ static void OpEB (void) { - Work8 = Registers.AL; + uint8 Work8 = Registers.AL; Registers.AL = Registers.AH; Registers.AH = Work8; diff --git a/source/globals.cpp b/source/globals.cpp index f00a621..ca2b12b 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -147,6 +147,7 @@ CMemory Memory; struct SSNESGameFixes SNESGameFixes; +#if 0 uint8 A1 = 0, A2 = 0, A3 = 0, A4 = 0, W1 = 0, W2 = 0, W3 = 0, W4 = 0; uint8 Ans8 = 0; uint16 Ans16 = 0; @@ -157,6 +158,7 @@ uint32 Work32 = 0; signed char Int8 = 0; short Int16 = 0; long Int32 = 0; +#endif #ifndef NO_OPEN_BUS uint8 OpenBus = 0; #endif diff --git a/source/spc700.cpp b/source/spc700.cpp index fe13ae8..1cd27d3 100644 --- a/source/spc700.cpp +++ b/source/spc700.cpp @@ -107,19 +107,6 @@ void S9xAPUSetByte (uint8, uint32 address); #include "apumem.h" #endif -START_EXTERN_C -extern uint8 Work8; -extern uint16 Work16; -extern uint32 Work32; -extern signed char Int8; -extern short Int16; -extern long Int32; -extern short Int16; -extern uint8 W1; -extern uint8 W2; - -END_EXTERN_C - #define OP1 (*(IAPU.PC + 1)) #define OP2 (*(IAPU.PC + 2)) @@ -179,7 +166,7 @@ void STOP (char *s) // XXX: HalfCarry - BJ fixed? #define SBC(a,b)\ -Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\ +int16 Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\ IAPU._Carry = Int16 >= 0;\ if ((((a) ^ (b)) & 0x80) && (((a) ^ (uint8) Int16) & 0x80))\ APUSetOverflow ();\ @@ -192,21 +179,22 @@ if(((a) ^ (b) ^ (uint8) Int16) & 0x10)\ APUSetZN8 ((uint8) Int16); // XXX: HalfCarry - BJ fixed? +// XXX: HalfCarry used Int16 before; trying to fix it with Work16 [Neb] #define ADC(a,b)\ -Work16 = (a) + (b) + APUCheckCarry();\ +uint16 Work16 = (a) + (b) + APUCheckCarry();\ IAPU._Carry = Work16 >= 0x100; \ if (~((a) ^ (b)) & ((b) ^ (uint8) Work16) & 0x80)\ APUSetOverflow ();\ else \ APUClearOverflow (); \ APUClearHalfCarry ();\ -if(((a) ^ (b) ^ (uint8) Int16) & 0x10)\ +if(((a) ^ (b) ^ (uint8) Work16) & 0x10)\ APUSetHalfCarry ();\ (a) = (uint8) Work16;\ APUSetZN8 ((uint8) Work16); #define CMP(a,b)\ -Int16 = (short) (a) - (short) (b);\ +int16 Int16 = (short) (a) - (short) (b);\ IAPU._Carry = Int16 >= 0;\ APUSetZN8 ((uint8) Int16); @@ -219,12 +207,12 @@ APUSetZN8 ((uint8) Int16); (b) >>= 1;\ APUSetZN8 (b); #define ROL(b)\ - Work16 = ((b) << 1) | APUCheckCarry (); \ + uint16 Work16 = ((b) << 1) | APUCheckCarry (); \ IAPU._Carry = Work16 >= 0x100; \ (b) = (uint8) Work16; \ APUSetZN8 (b); #define ROR(b)\ - Work16 = (b) | ((uint16) APUCheckCarry () << 8); \ + uint16 Work16 = (b) | ((uint16) APUCheckCarry () << 8); \ IAPU._Carry = (uint8) Work16 & 1; \ Work16 >>= 1; \ (b) = (uint8) Work16; \ @@ -256,12 +244,12 @@ APUSetZN8 ((uint8) Int16); #endif #define Relative()\ - Int8 = OP1;\ - Int16 = (int) (IAPU.PC + 2 - IAPU.RAM) + Int8; + int8 Int8 = OP1;\ + int16 Int16 = (int) (IAPU.PC + 2 - IAPU.RAM) + Int8; #define Relative2()\ - Int8 = OP2;\ - Int16 = (int) (IAPU.PC + 3 - IAPU.RAM) + Int8; + int8 Int8 = OP2;\ + int16 Int16 = (int) (IAPU.PC + 3 - IAPU.RAM) + Int8; #ifdef FAST_LSB_WORD_ACCESS #define IndexedXIndirect()\ @@ -355,7 +343,7 @@ void Apu3F () // CALL absolute void Apu4F () // PCALL $XX { - Work8 = OP1; + uint8 Work8 = OP1; PushW (IAPU.PC + 2 - IAPU.RAM); IAPU.PC = IAPU.RAM + 0xff00 + Work8; } @@ -449,7 +437,7 @@ void ApuF2 () } #define BBS(b) \ -Work8 = OP1; \ +uint8 Work8 = OP1; \ Relative2 (); \ if (S9xAPUGetByteZ (Work8) & (1 << (b))) \ { \ @@ -500,7 +488,7 @@ void ApuE3 () } #define BBC(b) \ -Work8 = OP1; \ +uint8 Work8 = OP1; \ Relative2 (); \ if (!(S9xAPUGetByteZ (Work8) & (1 << (b)))) \ { \ @@ -595,7 +583,7 @@ void Apu08 () void Apu09 () { // OR dp(dest),dp(src) - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); Work8 |= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -640,7 +628,7 @@ void Apu17 () void Apu18 () { // OR dp,#00 - Work8 = OP1; + uint8 Work8 = OP1; Work8 |= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -650,7 +638,7 @@ void Apu18 () void Apu19 () { // OR (X),(Y) - Work8 = S9xAPUGetByteZ (APURegisters.X) | S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X) | S9xAPUGetByteZ (APURegisters.YA.B.Y); APUSetZN8 (Work8); S9xAPUSetByteZ (Work8, APURegisters.X); IAPU.PC++; @@ -758,7 +746,7 @@ void ApuEA () void Apu0B () { // ASL dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); ASL (Work8); S9xAPUSetByteZ (Work8, OP1); IAPU.PC += 2; @@ -768,7 +756,7 @@ void Apu0C () { // ASL abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ASL (Work8); S9xAPUSetByte (Work8, IAPU.Address); IAPU.PC += 3; @@ -777,7 +765,7 @@ void Apu0C () void Apu1B () { // ASL dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); ASL (Work8); S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); IAPU.PC += 2; @@ -856,7 +844,7 @@ void Apu0E () { // TSET1 abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); S9xAPUSetByte (Work8 | APURegisters.YA.B.A, IAPU.Address); Work8 &= APURegisters.YA.B.A; APUSetZN8 (Work8); @@ -867,7 +855,7 @@ void Apu4E () { // TCLR1 abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); S9xAPUSetByte (Work8 & ~APURegisters.YA.B.A, IAPU.Address); Work8 &= APURegisters.YA.B.A; APUSetZN8 (Work8); @@ -1050,7 +1038,7 @@ void Apu40 () void Apu1A () { // DECW dp - Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); + uint16 Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); Work16--; S9xAPUSetByteZ ((uint8) Work16, OP1); S9xAPUSetByteZ (Work16 >> 8, OP1 + 1); @@ -1061,8 +1049,8 @@ void Apu1A () void Apu5A () { // CMPW YA,dp - Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); - Int32 = (long) APURegisters.YA.W - (long) Work16; + uint16 Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); + int32 Int32 = (long) APURegisters.YA.W - (long) Work16; IAPU._Carry = Int32 >= 0; APUSetZN16 ((uint16) Int32); IAPU.PC += 2; @@ -1071,7 +1059,7 @@ void Apu5A () void Apu3A () { // INCW dp - Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); + uint16 Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); Work16++; S9xAPUSetByteZ ((uint8) Work16, OP1); S9xAPUSetByteZ (Work16 >> 8, OP1 + 1); @@ -1083,8 +1071,8 @@ void Apu3A () void Apu7A () { // ADDW YA,dp - Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); - Work32 = (uint32) APURegisters.YA.W + Work16; + uint16 Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); + uint32 Work32 = (uint32) APURegisters.YA.W + Work16; IAPU._Carry = Work32 >= 0x10000; if (~(APURegisters.YA.W ^ Work16) & (Work16 ^ (uint16) Work32) & 0x8000) APUSetOverflow (); @@ -1100,11 +1088,12 @@ void Apu7A () // XXX: BJ: i think the old HalfCarry behavior was wrong... // XXX: Or is it between bits 7 and 8 for ADDW/SUBW? +// XXX: Used Work32 instead of Int32 before. Fixed? [Neb] void Apu9A () { // SUBW YA,dp - Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); - Int32 = (long) APURegisters.YA.W - (long) Work16; + uint16 Work16 = S9xAPUGetByteZ (OP1) + (S9xAPUGetByteZ (OP1 + 1) << 8); + int32 Int32 = (long) APURegisters.YA.W - (long) Work16; APUClearHalfCarry (); IAPU._Carry = Int32 >= 0; if (((APURegisters.YA.W ^ Work16) & 0x8000) && @@ -1116,7 +1105,7 @@ void Apu9A () ((APURegisters.YA.W ^ (uint16) Int32) & 0x0080)) APUSetHalfCarry (); APUSetHalfCarry (); - if((APURegisters.YA.W ^ Work16 ^ (uint16) Work32) & 0x10) + if((APURegisters.YA.W ^ Work16 ^ (uint16) Int32) & 0x10) APUClearHalfCarry (); APURegisters.YA.W = (uint16) Int32; APUSetZN16 (APURegisters.YA.W); @@ -1143,7 +1132,7 @@ void ApuDA () void Apu64 () { // CMP A,dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1152,7 +1141,7 @@ void Apu65 () { // CMP A,abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -1160,7 +1149,7 @@ void Apu65 () void Apu66 () { // CMP A,(X) - Work8 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X); CMP (APURegisters.YA.B.A, Work8); IAPU.PC++; } @@ -1169,7 +1158,7 @@ void Apu67 () { // CMP A,(dp+X) IndexedXIndirect (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1177,7 +1166,7 @@ void Apu67 () void Apu68 () { // CMP A,#00 - Work8 = OP1; + uint8 Work8 = OP1; CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1185,8 +1174,8 @@ void Apu68 () void Apu69 () { // CMP dp(dest), dp(src) - W1 = S9xAPUGetByteZ (OP1); - Work8 = S9xAPUGetByteZ (OP2); + uint8 W1 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP2); CMP (Work8, W1); IAPU.PC += 3; } @@ -1194,7 +1183,7 @@ void Apu69 () void Apu74 () { // CMP A, dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1203,7 +1192,7 @@ void Apu75 () { // CMP A,abs+X AbsoluteX (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -1212,7 +1201,7 @@ void Apu76 () { // CMP A, abs+Y AbsoluteY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -1221,7 +1210,7 @@ void Apu77 () { // CMP A,(dp)+Y IndirectIndexedY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1229,8 +1218,8 @@ void Apu77 () void Apu78 () { // CMP dp,#00 - Work8 = OP1; - W1 = S9xAPUGetByteZ (OP2); + uint8 Work8 = OP1; + uint8 W1 = S9xAPUGetByteZ (OP2); CMP (W1, Work8); IAPU.PC += 3; } @@ -1238,8 +1227,8 @@ void Apu78 () void Apu79 () { // CMP (X),(Y) - W1 = S9xAPUGetByteZ (APURegisters.X); - Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 W1 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); CMP (W1, Work8); IAPU.PC++; } @@ -1248,7 +1237,7 @@ void Apu1E () { // CMP X,abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.X, Work8); IAPU.PC += 3; } @@ -1256,7 +1245,7 @@ void Apu1E () void Apu3E () { // CMP X,dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); CMP (APURegisters.X, Work8); IAPU.PC += 2; } @@ -1272,7 +1261,7 @@ void Apu5E () { // CMP Y,abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); CMP (APURegisters.YA.B.Y, Work8); IAPU.PC += 3; } @@ -1280,7 +1269,7 @@ void Apu5E () void Apu7E () { // CMP Y,dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); CMP (APURegisters.YA.B.Y, Work8); IAPU.PC += 2; } @@ -1288,7 +1277,7 @@ void Apu7E () void ApuAD () { // CMP Y,#00 - Work8 = OP1; + uint8 Work8 = OP1; CMP (APURegisters.YA.B.Y, Work8); IAPU.PC += 2; } @@ -1378,7 +1367,7 @@ void Apu28 () void Apu29 () { // AND dp(dest),dp(src) - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); Work8 &= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -1423,7 +1412,7 @@ void Apu37 () void Apu38 () { // AND dp,#00 - Work8 = OP1; + uint8 Work8 = OP1; Work8 &= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -1433,7 +1422,7 @@ void Apu38 () void Apu39 () { // AND (X),(Y) - Work8 = S9xAPUGetByteZ (APURegisters.X) & S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X) & S9xAPUGetByteZ (APURegisters.YA.B.Y); APUSetZN8 (Work8); S9xAPUSetByteZ (Work8, APURegisters.X); IAPU.PC++; @@ -1442,7 +1431,7 @@ void Apu39 () void Apu2B () { // ROL dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); ROL (Work8); S9xAPUSetByteZ (Work8, OP1); IAPU.PC += 2; @@ -1452,7 +1441,7 @@ void Apu2C () { // ROL abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ROL (Work8); S9xAPUSetByte (Work8, IAPU.Address); IAPU.PC += 3; @@ -1461,7 +1450,7 @@ void Apu2C () void Apu3B () { // ROL dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); ROL (Work8); S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); IAPU.PC += 2; @@ -1477,7 +1466,7 @@ void Apu3C () void Apu2E () { // CBNE dp,rel - Work8 = OP1; + uint8 Work8 = OP1; Relative2 (); if (S9xAPUGetByteZ (Work8) != APURegisters.YA.B.A) @@ -1493,7 +1482,7 @@ void Apu2E () void ApuDE () { // CBNE dp+X,rel - Work8 = OP1 + APURegisters.X; + uint8 Work8 = OP1 + APURegisters.X; Relative2 (); if (S9xAPUGetByteZ (Work8) != APURegisters.YA.B.A) @@ -1561,7 +1550,7 @@ void ApuDC () void ApuAB () { // INC dp - Work8 = S9xAPUGetByteZ (OP1) + 1; + uint8 Work8 = S9xAPUGetByteZ (OP1) + 1; S9xAPUSetByteZ (Work8, OP1); APUSetZN8 (Work8); @@ -1576,7 +1565,7 @@ void ApuAC () { // INC abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address) + 1; + uint8 Work8 = S9xAPUGetByte (IAPU.Address) + 1; S9xAPUSetByte (Work8, IAPU.Address); APUSetZN8 (Work8); @@ -1590,7 +1579,7 @@ void ApuAC () void ApuBB () { // INC dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X) + 1; + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X) + 1; S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); APUSetZN8 (Work8); @@ -1617,7 +1606,7 @@ void ApuBC () void Apu8B () { // DEC dp - Work8 = S9xAPUGetByteZ (OP1) - 1; + uint8 Work8 = S9xAPUGetByteZ (OP1) - 1; S9xAPUSetByteZ (Work8, OP1); APUSetZN8 (Work8); @@ -1632,7 +1621,7 @@ void Apu8C () { // DEC abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address) - 1; + uint8 Work8 = S9xAPUGetByte (IAPU.Address) - 1; S9xAPUSetByte (Work8, IAPU.Address); APUSetZN8 (Work8); @@ -1646,7 +1635,7 @@ void Apu8C () void Apu9B () { // DEC dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X) - 1; + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X) - 1; S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); APUSetZN8 (Work8); @@ -1715,7 +1704,7 @@ void Apu48 () void Apu49 () { // EOR dp(dest),dp(src) - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); Work8 ^= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -1760,7 +1749,7 @@ void Apu57 () void Apu58 () { // EOR dp,#00 - Work8 = OP1; + uint8 Work8 = OP1; Work8 ^= S9xAPUGetByteZ (OP2); S9xAPUSetByteZ (Work8, OP2); APUSetZN8 (Work8); @@ -1770,7 +1759,7 @@ void Apu58 () void Apu59 () { // EOR (X),(Y) - Work8 = S9xAPUGetByteZ (APURegisters.X) ^ S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X) ^ S9xAPUGetByteZ (APURegisters.YA.B.Y); APUSetZN8 (Work8); S9xAPUSetByteZ (Work8, APURegisters.X); IAPU.PC++; @@ -1779,7 +1768,7 @@ void Apu59 () void Apu4B () { // LSR dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); LSR (Work8); S9xAPUSetByteZ (Work8, OP1); IAPU.PC += 2; @@ -1789,7 +1778,7 @@ void Apu4C () { // LSR abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); LSR (Work8); S9xAPUSetByte (Work8, IAPU.Address); IAPU.PC += 3; @@ -1798,7 +1787,7 @@ void Apu4C () void Apu5B () { // LSR dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); LSR (Work8); S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); IAPU.PC += 2; @@ -1861,7 +1850,7 @@ void ApuBD () void Apu6B () { // ROR dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); ROR (Work8); S9xAPUSetByteZ (Work8, OP1); IAPU.PC += 2; @@ -1871,7 +1860,7 @@ void Apu6C () { // ROR abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ROR (Work8); S9xAPUSetByte (Work8, IAPU.Address); IAPU.PC += 3; @@ -1880,7 +1869,7 @@ void Apu6C () void Apu7B () { // ROR dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); ROR (Work8); S9xAPUSetByteZ (Work8, OP1 + APURegisters.X); IAPU.PC += 2; @@ -1896,9 +1885,9 @@ void Apu7C () void Apu6E () { // DBNZ dp,rel - Work8 = OP1; + uint8 Work8 = OP1; Relative2 (); - W1 = S9xAPUGetByteZ (Work8) - 1; + uint8 W1 = S9xAPUGetByteZ (Work8) - 1; S9xAPUSetByteZ (W1, Work8); if (W1 != 0) { @@ -1943,7 +1932,7 @@ void Apu7F () void Apu84 () { // ADC A,dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1952,7 +1941,7 @@ void Apu85 () { // ADC A, abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -1960,7 +1949,7 @@ void Apu85 () void Apu86 () { // ADC A,(X) - Work8 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X); ADC (APURegisters.YA.B.A, Work8); IAPU.PC++; } @@ -1969,7 +1958,7 @@ void Apu87 () { // ADC A,(dp+X) IndexedXIndirect (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1977,7 +1966,7 @@ void Apu87 () void Apu88 () { // ADC A,#00 - Work8 = OP1; + uint8 Work8 = OP1; ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -1985,8 +1974,8 @@ void Apu88 () void Apu89 () { // ADC dp(dest),dp(src) - Work8 = S9xAPUGetByteZ (OP1); - W1 = S9xAPUGetByteZ (OP2); + uint8 Work8 = S9xAPUGetByteZ (OP1); + uint8 W1 = S9xAPUGetByteZ (OP2); ADC (W1, Work8); S9xAPUSetByteZ (W1, OP2); IAPU.PC += 3; @@ -1995,7 +1984,7 @@ void Apu89 () void Apu94 () { // ADC A,dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2004,7 +1993,7 @@ void Apu95 () { // ADC A, abs+X AbsoluteX (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -2013,7 +2002,7 @@ void Apu96 () { // ADC A, abs+Y AbsoluteY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -2022,7 +2011,7 @@ void Apu97 () { // ADC A, (dp)+Y IndirectIndexedY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); ADC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2030,8 +2019,8 @@ void Apu97 () void Apu98 () { // ADC dp,#00 - Work8 = OP1; - W1 = S9xAPUGetByteZ (OP2); + uint8 Work8 = OP1; + uint8 W1 = S9xAPUGetByteZ (OP2); ADC (W1, Work8); S9xAPUSetByteZ (W1, OP2); IAPU.PC += 3; @@ -2040,8 +2029,8 @@ void Apu98 () void Apu99 () { // ADC (X),(Y) - W1 = S9xAPUGetByteZ (APURegisters.X); - Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 W1 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); ADC (W1, Work8); S9xAPUSetByteZ (W1, APURegisters.X); IAPU.PC++; @@ -2058,7 +2047,7 @@ void Apu8D () void Apu8F () { // MOV dp,#00 - Work8 = OP1; + uint8 Work8 = OP1; S9xAPUSetByteZ (Work8, OP2); IAPU.PC += 3; } @@ -2075,7 +2064,7 @@ void Apu9E () else { APUClearOverflow (); - Work8 = APURegisters.YA.W / APURegisters.X; + uint8 Work8 = APURegisters.YA.W / APURegisters.X; APURegisters.YA.B.Y = APURegisters.YA.W % APURegisters.X; APURegisters.YA.B.A = Work8; } @@ -2096,7 +2085,7 @@ void Apu9F () void ApuA4 () { // SBC A, dp - Work8 = S9xAPUGetByteZ (OP1); + uint8 Work8 = S9xAPUGetByteZ (OP1); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2105,7 +2094,7 @@ void ApuA5 () { // SBC A, abs Absolute (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -2113,7 +2102,7 @@ void ApuA5 () void ApuA6 () { // SBC A, (X) - Work8 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.X); SBC (APURegisters.YA.B.A, Work8); IAPU.PC++; } @@ -2122,7 +2111,7 @@ void ApuA7 () { // SBC A,(dp+X) IndexedXIndirect (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2130,7 +2119,7 @@ void ApuA7 () void ApuA8 () { // SBC A,#00 - Work8 = OP1; + uint8 Work8 = OP1; SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2138,8 +2127,8 @@ void ApuA8 () void ApuA9 () { // SBC dp(dest), dp(src) - Work8 = S9xAPUGetByteZ (OP1); - W1 = S9xAPUGetByteZ (OP2); + uint8 Work8 = S9xAPUGetByteZ (OP1); + uint8 W1 = S9xAPUGetByteZ (OP2); SBC (W1, Work8); S9xAPUSetByteZ (W1, OP2); IAPU.PC += 3; @@ -2148,7 +2137,7 @@ void ApuA9 () void ApuB4 () { // SBC A, dp+X - Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (OP1 + APURegisters.X); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2157,7 +2146,7 @@ void ApuB5 () { // SBC A,abs+X AbsoluteX (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -2166,7 +2155,7 @@ void ApuB6 () { // SBC A,abs+Y AbsoluteY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 3; } @@ -2175,7 +2164,7 @@ void ApuB7 () { // SBC A,(dp)+Y IndirectIndexedY (); - Work8 = S9xAPUGetByte (IAPU.Address); + uint8 Work8 = S9xAPUGetByte (IAPU.Address); SBC (APURegisters.YA.B.A, Work8); IAPU.PC += 2; } @@ -2183,8 +2172,8 @@ void ApuB7 () void ApuB8 () { // SBC dp,#00 - Work8 = OP1; - W1 = S9xAPUGetByteZ (OP2); + uint8 Work8 = OP1; + uint8 W1 = S9xAPUGetByteZ (OP2); SBC (W1, Work8); S9xAPUSetByteZ (W1, OP2); IAPU.PC += 3; @@ -2193,8 +2182,8 @@ void ApuB8 () void ApuB9 () { // SBC (X),(Y) - W1 = S9xAPUGetByteZ (APURegisters.X); - Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); + uint8 W1 = S9xAPUGetByteZ (APURegisters.X); + uint8 Work8 = S9xAPUGetByteZ (APURegisters.YA.B.Y); SBC (W1, Work8); S9xAPUSetByteZ (W1, APURegisters.X); IAPU.PC++; |