diff options
Diffstat (limited to 'source/spc700.c')
-rw-r--r-- | source/spc700.c | 324 |
1 files changed, 162 insertions, 162 deletions
diff --git a/source/spc700.c b/source/spc700.c index 4483267..4e68ebe 100644 --- a/source/spc700.c +++ b/source/spc700.c @@ -99,10 +99,10 @@ // SPC700/Sound DSP chips have a 24.57MHz crystal on their PCB. #ifdef NO_INLINE_SET_GET -uint8 S9xAPUGetByteZ(uint8 address); -uint8 S9xAPUGetByte(uint32 address); -void S9xAPUSetByteZ(uint8, uint8 address); -void S9xAPUSetByte(uint8, uint32 address); +uint8_t S9xAPUGetByteZ(uint8_t address); +uint8_t S9xAPUGetByte(uint32_t address); +void S9xAPUSetByteZ(uint8_t, uint8_t address); +void S9xAPUSetByte(uint8_t, uint32_t address); #else #undef INLINE @@ -122,7 +122,7 @@ void S9xAPUSetByte(uint8, uint32 address); if (!ICPU.CPUExecuting) \ APU.Cycles = CPU.Cycles = CPU.NextEvent; \ else \ - IAPU.APUExecuting = FALSE; \ + IAPU.APUExecuting = false; \ } \ else \ if (IAPU.WaitCounter >= 2) \ @@ -149,37 +149,37 @@ void S9xAPUSetByte(uint8, uint32 address); // XXX: HalfCarry - BJ fixed? #define SBC(a,b)\ -int16 Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\ +int16_t Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\ IAPU._Carry = Int16 >= 0;\ -if ((((a) ^ (b)) & 0x80) && (((a) ^ (uint8) Int16) & 0x80))\ +if ((((a) ^ (b)) & 0x80) && (((a) ^ (uint8_t) Int16) & 0x80))\ APUSetOverflow ();\ else \ APUClearOverflow (); \ APUSetHalfCarry ();\ -if(((a) ^ (b) ^ (uint8) Int16) & 0x10)\ +if(((a) ^ (b) ^ (uint8_t) Int16) & 0x10)\ APUClearHalfCarry ();\ -(a) = (uint8) Int16;\ -APUSetZN8 ((uint8) Int16); +(a) = (uint8_t) Int16;\ +APUSetZN8 ((uint8_t) Int16); // XXX: HalfCarry - BJ fixed? // XXX: HalfCarry used Int16 before; trying to fix it with Work16 [Neb] #define ADC(a,b)\ -uint16 Work16 = (a) + (b) + APUCheckCarry();\ +uint16_t Work16 = (a) + (b) + APUCheckCarry();\ IAPU._Carry = Work16 >= 0x100; \ -if (~((a) ^ (b)) & ((b) ^ (uint8) Work16) & 0x80)\ +if (~((a) ^ (b)) & ((b) ^ (uint8_t) Work16) & 0x80)\ APUSetOverflow ();\ else \ APUClearOverflow (); \ APUClearHalfCarry ();\ -if(((a) ^ (b) ^ (uint8) Work16) & 0x10)\ +if(((a) ^ (b) ^ (uint8_t) Work16) & 0x10)\ APUSetHalfCarry ();\ -(a) = (uint8) Work16;\ -APUSetZN8 ((uint8) Work16); +(a) = (uint8_t) Work16;\ +APUSetZN8 ((uint8_t) Work16); #define CMP(a,b)\ -int16 Int16 = (short) (a) - (short) (b);\ +int16_t Int16 = (short) (a) - (short) (b);\ IAPU._Carry = Int16 >= 0;\ -APUSetZN8 ((uint8) Int16); +APUSetZN8 ((uint8_t) Int16); #define ASL(b)\ IAPU._Carry = ((b) & 0x80) != 0; \ @@ -190,15 +190,15 @@ APUSetZN8 ((uint8) Int16); (b) >>= 1;\ APUSetZN8 (b); #define ROL(b)\ - uint16 Work16 = ((b) << 1) | APUCheckCarry (); \ + uint16_t Work16 = ((b) << 1) | APUCheckCarry (); \ IAPU._Carry = Work16 >= 0x100; \ - (b) = (uint8) Work16; \ + (b) = (uint8_t) Work16; \ APUSetZN8 (b); #define ROR(b)\ - uint16 Work16 = (b) | ((uint16) APUCheckCarry () << 8); \ - IAPU._Carry = (uint8) Work16 & 1; \ + uint16_t Work16 = (b) | ((uint16_t) APUCheckCarry () << 8); \ + IAPU._Carry = (uint8_t) Work16 & 1; \ Work16 >>= 1; \ - (b) = (uint8) Work16; \ + (b) = (uint8_t) Work16; \ APUSetZN8 (b); #define Push(b)\ @@ -211,11 +211,11 @@ APUSetZN8 ((uint8) Int16); #ifdef FAST_LSB_WORD_ACCESS #define SPC700_PushW(w)\ - *(uint16 *) (IAPU.RAM + 0xff + IAPU.Registers.S) = w;\ + *(uint16_t *) (IAPU.RAM + 0xff + IAPU.Registers.S) = w;\ IAPU.Registers.S -= 2; #define PopW(w)\ IAPU.Registers.S += 2;\ - w = *(uint16 *) (IAPU.RAM + 0xff + IAPU.Registers.S); + w = *(uint16_t *) (IAPU.RAM + 0xff + IAPU.Registers.S); #else #define SPC700_PushW(w)\ *(IAPU.RAM + 0xff + IAPU.Registers.S) = w;\ @@ -227,33 +227,33 @@ APUSetZN8 ((uint8) Int16); #endif #define Relative()\ - int8 Int8 = OP1;\ - int16 Int16 = (intptr_t) (IAPU.PC + 2 - IAPU.RAM) + Int8; + int8_t Int8 = OP1;\ + int16_t Int16 = (intptr_t) (IAPU.PC + 2 - IAPU.RAM) + Int8; #define Relative2()\ - int8 Int8 = OP2;\ - int16 Int16 = (intptr_t) (IAPU.PC + 3 - IAPU.RAM) + Int8; + int8_t Int8 = OP2;\ + int16_t Int16 = (intptr_t) (IAPU.PC + 3 - IAPU.RAM) + Int8; #ifdef FAST_LSB_WORD_ACCESS #define IndexedXIndirect()\ - IAPU.Address = *(uint16 *) (IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff)); + IAPU.Address = *(uint16_t *) (IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff)); #define Absolute()\ - IAPU.Address = *(uint16 *) (IAPU.PC + 1); + IAPU.Address = *(uint16_t *) (IAPU.PC + 1); #define AbsoluteX()\ - IAPU.Address = *(uint16 *) (IAPU.PC + 1) + IAPU.Registers.X; + IAPU.Address = *(uint16_t *) (IAPU.PC + 1) + IAPU.Registers.X; #define AbsoluteY()\ - IAPU.Address = *(uint16 *) (IAPU.PC + 1) + IAPU.Registers.YA.B.Y; + IAPU.Address = *(uint16_t *) (IAPU.PC + 1) + IAPU.Registers.YA.B.Y; #define MemBit()\ - IAPU.Address = *(uint16 *) (IAPU.PC + 1);\ - IAPU.Bit = (uint8)(IAPU.Address >> 13);\ + IAPU.Address = *(uint16_t *) (IAPU.PC + 1);\ + IAPU.Bit = (uint8_t)(IAPU.Address >> 13);\ IAPU.Address &= 0x1fff; #define IndirectIndexedY()\ - IAPU.Address = *(uint16 *) (IAPU.DirectPage + OP1) + IAPU.Registers.YA.B.Y; + IAPU.Address = *(uint16_t *) (IAPU.DirectPage + OP1) + IAPU.Registers.YA.B.Y; #else #define IndexedXIndirect()\ IAPU.Address = *(IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff)) + \ @@ -269,7 +269,7 @@ APUSetZN8 ((uint8) Int16); #define MemBit()\ IAPU.Address = OP1 + (OP2 << 8);\ - IAPU.Bit = (int8) (IAPU.Address >> 13);\ + IAPU.Bit = (int8_t) (IAPU.Address >> 13);\ IAPU.Address &= 0x1fff; #define IndirectIndexedY()\ @@ -374,13 +374,13 @@ void Apu3F() // CALL absolute void Apu4F() // PCALL $XX { - uint8 Work8 = OP1; + uint8_t Work8 = OP1; SPC700_PushW(IAPU.PC + 2 - IAPU.RAM); IAPU.PC = IAPU.RAM + 0xff00 + Work8; } #define SET(b) \ -S9xAPUSetByteZ ((uint8) (S9xAPUGetByteZ (OP1 ) | (1 << (b))), OP1); \ +S9xAPUSetByteZ ((uint8_t) (S9xAPUGetByteZ (OP1 ) | (1 << (b))), OP1); \ IAPU.PC += 2 void Apu02() @@ -424,7 +424,7 @@ void ApuE2() } #define CLR(b) \ -S9xAPUSetByteZ ((uint8) (S9xAPUGetByteZ (OP1) & ~(1 << (b))), OP1); \ +S9xAPUSetByteZ ((uint8_t) (S9xAPUGetByteZ (OP1) & ~(1 << (b))), OP1); \ IAPU.PC += 2; void Apu12() @@ -468,11 +468,11 @@ void ApuF2() } #define BBS(b) \ -uint8 Work8 = OP1; \ +uint8_t Work8 = OP1; \ Relative2 (); \ if (S9xAPUGetByteZ (Work8) & (1 << (b))) \ { \ - IAPU.PC = IAPU.RAM + (uint16) Int16; \ + IAPU.PC = IAPU.RAM + (uint16_t) Int16; \ APU.Cycles += IAPU.TwoCycles; \ } \ else \ @@ -519,11 +519,11 @@ void ApuE3() } #define BBC(b) \ -uint8 Work8 = OP1; \ +uint8_t Work8 = OP1; \ Relative2 (); \ if (!(S9xAPUGetByteZ (Work8) & (1 << (b)))) \ { \ - IAPU.PC = IAPU.RAM + (uint16) Int16; \ + IAPU.PC = IAPU.RAM + (uint16_t) Int16; \ APU.Cycles += IAPU.TwoCycles; \ } \ else \ @@ -614,7 +614,7 @@ void Apu08() void Apu09() { // OR dp(dest),dp(src) - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); Work8 |= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -659,7 +659,7 @@ void Apu17() void Apu18() { // OR dp,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; Work8 |= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -669,7 +669,7 @@ void Apu18() void Apu19() { // OR (X),(Y) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) | S9xAPUGetByteZ( + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) | S9xAPUGetByteZ( IAPU.Registers.YA.B.Y); APUSetZN8(Work8); S9xAPUSetByteZ(Work8, IAPU.Registers.X); @@ -774,7 +774,7 @@ void ApuEA() void Apu0B() { // ASL dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); ASL(Work8); S9xAPUSetByteZ(Work8, OP1); IAPU.PC += 2; @@ -784,7 +784,7 @@ void Apu0C() { // ASL abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ASL(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; @@ -793,7 +793,7 @@ void Apu0C() void Apu1B() { // ASL dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); ASL(Work8); S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); IAPU.PC += 2; @@ -872,7 +872,7 @@ void Apu0E() { // TSET1 abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); S9xAPUSetByte(Work8 | IAPU.Registers.YA.B.A, IAPU.Address); Work8 &= IAPU.Registers.YA.B.A; APUSetZN8(Work8); @@ -883,7 +883,7 @@ void Apu4E() { // TCLR1 abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); S9xAPUSetByte(Work8 & ~IAPU.Registers.YA.B.A, IAPU.Address); Work8 &= IAPU.Registers.YA.B.A; APUSetZN8(Work8); @@ -907,14 +907,14 @@ void ApuEF() { // SLEEP // XXX: sleep - IAPU.APUExecuting = FALSE; + IAPU.APUExecuting = false; IAPU.PC++; } void ApuFF() { // STOP - IAPU.APUExecuting = FALSE; + IAPU.APUExecuting = false; IAPU.PC++; } @@ -924,7 +924,7 @@ void Apu10() Relative(); if (!APUCheckNegative()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -938,7 +938,7 @@ void Apu30() Relative(); if (APUCheckNegative()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -952,7 +952,7 @@ void Apu90() Relative(); if (!APUCheckCarry()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -966,7 +966,7 @@ void ApuB0() Relative(); if (APUCheckCarry()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -980,7 +980,7 @@ void ApuD0() Relative(); if (!APUCheckZero()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -994,7 +994,7 @@ void ApuF0() Relative(); if (APUCheckZero()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -1008,7 +1008,7 @@ void Apu50() Relative(); if (!APUCheckOverflow()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; } else @@ -1021,7 +1021,7 @@ void Apu70() Relative(); if (APUCheckOverflow()) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; } else @@ -1032,7 +1032,7 @@ void Apu2F() { // BRA Relative(); - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; } void Apu80() @@ -1060,9 +1060,9 @@ void Apu40() void Apu1A() { // DECW dp - uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); + uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); Work16--; - S9xAPUSetByteZ((uint8) Work16, OP1); + S9xAPUSetByteZ((uint8_t) Work16, OP1); S9xAPUSetByteZ(Work16 >> 8, OP1 + 1); APUSetZN16(Work16); IAPU.PC += 2; @@ -1071,19 +1071,19 @@ void Apu1A() void Apu5A() { // CMPW YA,dp - uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); - int32 Int32 = (long) IAPU.Registers.YA.W - (long) Work16; + uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); + int32_t Int32 = (long) IAPU.Registers.YA.W - (long) Work16; IAPU._Carry = Int32 >= 0; - APUSetZN16((uint16) Int32); + APUSetZN16((uint16_t) Int32); IAPU.PC += 2; } void Apu3A() { // INCW dp - uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); + uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); Work16++; - S9xAPUSetByteZ((uint8) Work16, OP1); + S9xAPUSetByteZ((uint8_t) Work16, OP1); S9xAPUSetByteZ(Work16 >> 8, OP1 + 1); APUSetZN16(Work16); IAPU.PC += 2; @@ -1093,17 +1093,17 @@ void Apu3A() void Apu7A() { // ADDW YA,dp - uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); - uint32 Work32 = (uint32) IAPU.Registers.YA.W + Work16; + uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); + uint32_t Work32 = (uint32_t) IAPU.Registers.YA.W + Work16; IAPU._Carry = Work32 >= 0x10000; - if (~(IAPU.Registers.YA.W ^ Work16) & (Work16 ^ (uint16) Work32) & 0x8000) + if (~(IAPU.Registers.YA.W ^ Work16) & (Work16 ^ (uint16_t) Work32) & 0x8000) APUSetOverflow(); else APUClearOverflow(); APUClearHalfCarry(); - if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16) Work32) & 0x10) + if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Work32) & 0x10) APUSetHalfCarry(); - IAPU.Registers.YA.W = (uint16) Work32; + IAPU.Registers.YA.W = (uint16_t) Work32; APUSetZN16(IAPU.Registers.YA.W); IAPU.PC += 2; } @@ -1114,22 +1114,22 @@ void Apu7A() void Apu9A() { // SUBW YA,dp - uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); - int32 Int32 = (long) IAPU.Registers.YA.W - (long) Work16; + uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8); + int32_t Int32 = (long) IAPU.Registers.YA.W - (long) Work16; APUClearHalfCarry(); IAPU._Carry = Int32 >= 0; if (((IAPU.Registers.YA.W ^ Work16) & 0x8000) && - ((IAPU.Registers.YA.W ^ (uint16) Int32) & 0x8000)) + ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x8000)) APUSetOverflow(); else APUClearOverflow(); if (((IAPU.Registers.YA.W ^ Work16) & 0x0080) && - ((IAPU.Registers.YA.W ^ (uint16) Int32) & 0x0080)) + ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x0080)) APUSetHalfCarry(); APUSetHalfCarry(); - if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16) Int32) & 0x10) + if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Int32) & 0x10) APUClearHalfCarry(); - IAPU.Registers.YA.W = (uint16) Int32; + IAPU.Registers.YA.W = (uint16_t) Int32; APUSetZN16(IAPU.Registers.YA.W); IAPU.PC += 2; } @@ -1154,7 +1154,7 @@ void ApuDA() void Apu64() { // CMP A,dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1163,7 +1163,7 @@ void Apu65() { // CMP A,abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -1171,7 +1171,7 @@ void Apu65() void Apu66() { // CMP A,(X) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC++; } @@ -1180,7 +1180,7 @@ void Apu67() { // CMP A,(dp+X) IndexedXIndirect(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1188,7 +1188,7 @@ void Apu67() void Apu68() { // CMP A,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1196,8 +1196,8 @@ void Apu68() void Apu69() { // CMP dp(dest), dp(src) - uint8 W1 = S9xAPUGetByteZ(OP1); - uint8 Work8 = S9xAPUGetByteZ(OP2); + uint8_t W1 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP2); CMP(Work8, W1); IAPU.PC += 3; } @@ -1205,7 +1205,7 @@ void Apu69() void Apu74() { // CMP A, dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1214,7 +1214,7 @@ void Apu75() { // CMP A,abs+X AbsoluteX(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -1223,7 +1223,7 @@ void Apu76() { // CMP A, abs+Y AbsoluteY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -1232,7 +1232,7 @@ void Apu77() { // CMP A,(dp)+Y IndirectIndexedY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1240,8 +1240,8 @@ void Apu77() void Apu78() { // CMP dp,#00 - uint8 Work8 = OP1; - uint8 W1 = S9xAPUGetByteZ(OP2); + uint8_t Work8 = OP1; + uint8_t W1 = S9xAPUGetByteZ(OP2); CMP(W1, Work8); IAPU.PC += 3; } @@ -1249,8 +1249,8 @@ void Apu78() void Apu79() { // CMP (X),(Y) - uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X); - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); + uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); CMP(W1, Work8); IAPU.PC++; } @@ -1259,7 +1259,7 @@ void Apu1E() { // CMP X,abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.X, Work8); IAPU.PC += 3; } @@ -1267,7 +1267,7 @@ void Apu1E() void Apu3E() { // CMP X,dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); CMP(IAPU.Registers.X, Work8); IAPU.PC += 2; } @@ -1283,7 +1283,7 @@ void Apu5E() { // CMP Y,abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); CMP(IAPU.Registers.YA.B.Y, Work8); IAPU.PC += 3; } @@ -1291,7 +1291,7 @@ void Apu5E() void Apu7E() { // CMP Y,dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); CMP(IAPU.Registers.YA.B.Y, Work8); IAPU.PC += 2; } @@ -1299,7 +1299,7 @@ void Apu7E() void ApuAD() { // CMP Y,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; CMP(IAPU.Registers.YA.B.Y, Work8); IAPU.PC += 2; } @@ -1389,7 +1389,7 @@ void Apu28() void Apu29() { // AND dp(dest),dp(src) - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); Work8 &= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -1434,7 +1434,7 @@ void Apu37() void Apu38() { // AND dp,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; Work8 &= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -1444,7 +1444,7 @@ void Apu38() void Apu39() { // AND (X),(Y) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) & S9xAPUGetByteZ( + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) & S9xAPUGetByteZ( IAPU.Registers.YA.B.Y); APUSetZN8(Work8); S9xAPUSetByteZ(Work8, IAPU.Registers.X); @@ -1454,7 +1454,7 @@ void Apu39() void Apu2B() { // ROL dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); ROL(Work8); S9xAPUSetByteZ(Work8, OP1); IAPU.PC += 2; @@ -1464,7 +1464,7 @@ void Apu2C() { // ROL abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ROL(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; @@ -1473,7 +1473,7 @@ void Apu2C() void Apu3B() { // ROL dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); ROL(Work8); S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); IAPU.PC += 2; @@ -1489,12 +1489,12 @@ void Apu3C() void Apu2E() { // CBNE dp,rel - uint8 Work8 = OP1; + uint8_t Work8 = OP1; Relative2(); if (S9xAPUGetByteZ(Work8) != IAPU.Registers.YA.B.A) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -1505,12 +1505,12 @@ void Apu2E() void ApuDE() { // CBNE dp+X,rel - uint8 Work8 = OP1 + IAPU.Registers.X; + uint8_t Work8 = OP1 + IAPU.Registers.X; Relative2(); if (S9xAPUGetByteZ(Work8) != IAPU.Registers.YA.B.A) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; APUShutdown(); } @@ -1573,7 +1573,7 @@ void ApuDC() void ApuAB() { // INC dp - uint8 Work8 = S9xAPUGetByteZ(OP1) + 1; + uint8_t Work8 = S9xAPUGetByteZ(OP1) + 1; S9xAPUSetByteZ(Work8, OP1); APUSetZN8(Work8); @@ -1588,7 +1588,7 @@ void ApuAC() { // INC abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address) + 1; + uint8_t Work8 = S9xAPUGetByte(IAPU.Address) + 1; S9xAPUSetByte(Work8, IAPU.Address); APUSetZN8(Work8); @@ -1602,7 +1602,7 @@ void ApuAC() void ApuBB() { // INC dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) + 1; + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) + 1; S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); APUSetZN8(Work8); @@ -1629,7 +1629,7 @@ void ApuBC() void Apu8B() { // DEC dp - uint8 Work8 = S9xAPUGetByteZ(OP1) - 1; + uint8_t Work8 = S9xAPUGetByteZ(OP1) - 1; S9xAPUSetByteZ(Work8, OP1); APUSetZN8(Work8); @@ -1644,7 +1644,7 @@ void Apu8C() { // DEC abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address) - 1; + uint8_t Work8 = S9xAPUGetByte(IAPU.Address) - 1; S9xAPUSetByte(Work8, IAPU.Address); APUSetZN8(Work8); @@ -1658,7 +1658,7 @@ void Apu8C() void Apu9B() { // DEC dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) - 1; + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) - 1; S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); APUSetZN8(Work8); @@ -1727,7 +1727,7 @@ void Apu48() void Apu49() { // EOR dp(dest),dp(src) - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); Work8 ^= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -1772,7 +1772,7 @@ void Apu57() void Apu58() { // EOR dp,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; Work8 ^= S9xAPUGetByteZ(OP2); S9xAPUSetByteZ(Work8, OP2); APUSetZN8(Work8); @@ -1782,7 +1782,7 @@ void Apu58() void Apu59() { // EOR (X),(Y) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) ^ S9xAPUGetByteZ( + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) ^ S9xAPUGetByteZ( IAPU.Registers.YA.B.Y); APUSetZN8(Work8); S9xAPUSetByteZ(Work8, IAPU.Registers.X); @@ -1792,7 +1792,7 @@ void Apu59() void Apu4B() { // LSR dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); LSR(Work8); S9xAPUSetByteZ(Work8, OP1); IAPU.PC += 2; @@ -1802,7 +1802,7 @@ void Apu4C() { // LSR abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); LSR(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; @@ -1811,7 +1811,7 @@ void Apu4C() void Apu5B() { // LSR dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); LSR(Work8); S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); IAPU.PC += 2; @@ -1874,7 +1874,7 @@ void ApuBD() void Apu6B() { // ROR dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); ROR(Work8); S9xAPUSetByteZ(Work8, OP1); IAPU.PC += 2; @@ -1884,7 +1884,7 @@ void Apu6C() { // ROR abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ROR(Work8); S9xAPUSetByte(Work8, IAPU.Address); IAPU.PC += 3; @@ -1893,7 +1893,7 @@ void Apu6C() void Apu7B() { // ROR dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); ROR(Work8); S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X); IAPU.PC += 2; @@ -1909,13 +1909,13 @@ void Apu7C() void Apu6E() { // DBNZ dp,rel - uint8 Work8 = OP1; + uint8_t Work8 = OP1; Relative2(); - uint8 W1 = S9xAPUGetByteZ(Work8) - 1; + uint8_t W1 = S9xAPUGetByteZ(Work8) - 1; S9xAPUSetByteZ(W1, Work8); if (W1 != 0) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; } else @@ -1929,7 +1929,7 @@ void ApuFE() IAPU.Registers.YA.B.Y--; if (IAPU.Registers.YA.B.Y != 0) { - IAPU.PC = IAPU.RAM + (uint16) Int16; + IAPU.PC = IAPU.RAM + (uint16_t) Int16; APU.Cycles += IAPU.TwoCycles; } else @@ -1955,7 +1955,7 @@ void Apu7F() void Apu84() { // ADC A,dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1964,7 +1964,7 @@ void Apu85() { // ADC A, abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -1972,7 +1972,7 @@ void Apu85() void Apu86() { // ADC A,(X) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC++; } @@ -1981,7 +1981,7 @@ void Apu87() { // ADC A,(dp+X) IndexedXIndirect(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1989,7 +1989,7 @@ void Apu87() void Apu88() { // ADC A,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -1997,8 +1997,8 @@ void Apu88() void Apu89() { // ADC dp(dest),dp(src) - uint8 Work8 = S9xAPUGetByteZ(OP1); - uint8 W1 = S9xAPUGetByteZ(OP2); + uint8_t Work8 = S9xAPUGetByteZ(OP1); + uint8_t W1 = S9xAPUGetByteZ(OP2); ADC(W1, Work8); S9xAPUSetByteZ(W1, OP2); IAPU.PC += 3; @@ -2007,7 +2007,7 @@ void Apu89() void Apu94() { // ADC A,dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2016,7 +2016,7 @@ void Apu95() { // ADC A, abs+X AbsoluteX(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -2025,7 +2025,7 @@ void Apu96() { // ADC A, abs+Y AbsoluteY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -2034,7 +2034,7 @@ void Apu97() { // ADC A, (dp)+Y IndirectIndexedY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); ADC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2042,8 +2042,8 @@ void Apu97() void Apu98() { // ADC dp,#00 - uint8 Work8 = OP1; - uint8 W1 = S9xAPUGetByteZ(OP2); + uint8_t Work8 = OP1; + uint8_t W1 = S9xAPUGetByteZ(OP2); ADC(W1, Work8); S9xAPUSetByteZ(W1, OP2); IAPU.PC += 3; @@ -2052,8 +2052,8 @@ void Apu98() void Apu99() { // ADC (X),(Y) - uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X); - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); + uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); ADC(W1, Work8); S9xAPUSetByteZ(W1, IAPU.Registers.X); IAPU.PC++; @@ -2070,7 +2070,7 @@ void Apu8D() void Apu8F() { // MOV dp,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; S9xAPUSetByteZ(Work8, OP2); IAPU.PC += 3; } @@ -2087,7 +2087,7 @@ void Apu9E() else { APUClearOverflow(); - uint8 Work8 = IAPU.Registers.YA.W / IAPU.Registers.X; + uint8_t Work8 = IAPU.Registers.YA.W / IAPU.Registers.X; IAPU.Registers.YA.B.Y = IAPU.Registers.YA.W % IAPU.Registers.X; IAPU.Registers.YA.B.A = Work8; } @@ -2109,7 +2109,7 @@ void Apu9F() void ApuA4() { // SBC A, dp - uint8 Work8 = S9xAPUGetByteZ(OP1); + uint8_t Work8 = S9xAPUGetByteZ(OP1); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2118,7 +2118,7 @@ void ApuA5() { // SBC A, abs Absolute(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -2126,7 +2126,7 @@ void ApuA5() void ApuA6() { // SBC A, (X) - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC++; } @@ -2135,7 +2135,7 @@ void ApuA7() { // SBC A,(dp+X) IndexedXIndirect(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2143,7 +2143,7 @@ void ApuA7() void ApuA8() { // SBC A,#00 - uint8 Work8 = OP1; + uint8_t Work8 = OP1; SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2151,8 +2151,8 @@ void ApuA8() void ApuA9() { // SBC dp(dest), dp(src) - uint8 Work8 = S9xAPUGetByteZ(OP1); - uint8 W1 = S9xAPUGetByteZ(OP2); + uint8_t Work8 = S9xAPUGetByteZ(OP1); + uint8_t W1 = S9xAPUGetByteZ(OP2); SBC(W1, Work8); S9xAPUSetByteZ(W1, OP2); IAPU.PC += 3; @@ -2161,7 +2161,7 @@ void ApuA9() void ApuB4() { // SBC A, dp+X - uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2170,7 +2170,7 @@ void ApuB5() { // SBC A,abs+X AbsoluteX(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -2179,7 +2179,7 @@ void ApuB6() { // SBC A,abs+Y AbsoluteY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 3; } @@ -2188,7 +2188,7 @@ void ApuB7() { // SBC A,(dp)+Y IndirectIndexedY(); - uint8 Work8 = S9xAPUGetByte(IAPU.Address); + uint8_t Work8 = S9xAPUGetByte(IAPU.Address); SBC(IAPU.Registers.YA.B.A, Work8); IAPU.PC += 2; } @@ -2196,8 +2196,8 @@ void ApuB7() void ApuB8() { // SBC dp,#00 - uint8 Work8 = OP1; - uint8 W1 = S9xAPUGetByteZ(OP2); + uint8_t Work8 = OP1; + uint8_t W1 = S9xAPUGetByteZ(OP2); SBC(W1, Work8); S9xAPUSetByteZ(W1, OP2); IAPU.PC += 3; @@ -2206,8 +2206,8 @@ void ApuB8() void ApuB9() { // SBC (X),(Y) - uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X); - uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); + uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X); + uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y); SBC(W1, Work8); S9xAPUSetByteZ(W1, IAPU.Registers.X); IAPU.PC++; @@ -2322,7 +2322,7 @@ void ApuCD() void ApuCF() { // MUL YA - IAPU.Registers.YA.W = (uint16) IAPU.Registers.YA.B.A * IAPU.Registers.YA.B.Y; + IAPU.Registers.YA.W = (uint16_t) IAPU.Registers.YA.B.A * IAPU.Registers.YA.B.Y; APUSetZN16(IAPU.Registers.YA.W); IAPU.PC++; } |