aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/ppu.c17
-rw-r--r--source/sa1.c7
-rw-r--r--source/sdd1.c6
-rw-r--r--source/seta010.c132
-rw-r--r--source/seta011.c3
-rw-r--r--source/snaporig.c4
6 files changed, 90 insertions, 79 deletions
diff --git a/source/ppu.c b/source/ppu.c
index 3820ce3..631039b 100644
--- a/source/ppu.c
+++ b/source/ppu.c
@@ -195,7 +195,8 @@ void S9xUpdateHTimer ()
void S9xFixColourBrightness ()
{
IPPU.XB = mul_brightness [PPU.Brightness];
- for (int i = 0; i < 256; i++)
+ int i;
+ for (i = 0; i < 256; i++)
{
IPPU.Red [i] = IPPU.XB [PPU.CGDATA [i] & 0x1f];
IPPU.Green [i] = IPPU.XB [(PPU.CGDATA [i] >> 5) & 0x1f];
@@ -1531,7 +1532,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
}
else CPU.FastROMSpeed = SLOW_ONE_CYCLE;
- Memory.FixROMSpeed ();
+ FixROMSpeed ();
}
break;
@@ -2141,7 +2142,8 @@ static void CommonPPUReset ()
PPU.VMA.FullGraphicCount = 0;
PPU.VMA.Shift = 0;
- for (uint8 B = 0; B != 4; B++)
+ uint8 B;
+ for (B = 0; B != 4; B++)
{
PPU.BG[B].SCBase = 0;
PPU.BG[B].VOffset = 0;
@@ -2179,7 +2181,8 @@ static void CommonPPUReset ()
PPU.FirstSprite = 0;
PPU.LastSprite = 127;
- for (int Sprite = 0; Sprite < 128; Sprite++)
+ int Sprite;
+ for (Sprite = 0; Sprite < 128; Sprite++)
{
PPU.OBJ[Sprite].HPos = 0;
PPU.OBJ[Sprite].VPos = 0;
@@ -2309,7 +2312,8 @@ void S9xResetPPU ()
IPPU.PrevMouseX[0] = IPPU.PrevMouseX[1] = 256 / 2;
IPPU.PrevMouseY[0] = IPPU.PrevMouseY[1] = 224 / 2;
- for (int c = 0; c < 0x8000; c += 0x100)
+ int c;
+ for (c = 0; c < 0x8000; c += 0x100)
{
if ( !Settings.SuperFX )
{
@@ -2347,7 +2351,8 @@ void S9xSoftResetPPU ()
// IPPU.PrevMouseX[0] = IPPU.PrevMouseX[1] = 256 / 2;
// IPPU.PrevMouseY[0] = IPPU.PrevMouseY[1] = 224 / 2;
- for (int c = 0; c < 0x8000; c += 0x100)
+ int c;
+ for (c = 0; c < 0x8000; c += 0x100)
memset (&Memory.FillRAM [c], c >> 8, 0x100);
ZeroMemory (&Memory.FillRAM [0x2100], 0x100);
diff --git a/source/sa1.c b/source/sa1.c
index 224fa44..18207eb 100644
--- a/source/sa1.c
+++ b/source/sa1.c
@@ -804,6 +804,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
static void S9xSA1CharConv2 ()
{
+ int l,b;
uint32 dest = Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8);
uint32 offset = (SA1.in_char_dma & 7) ? 0 : 1;
int depth = (Memory.FillRAM [0x2231] & 3) == 0 ? 8 :
@@ -818,10 +819,10 @@ static void S9xSA1CharConv2 ()
break;
case 4:
break;
- case 8:
- for (int l = 0; l < 8; l++, q += 8)
+ case 8:
+ for (l = 0; l < 8; l++, q += 8)
{
- for (int b = 0; b < 8; b++)
+ for (b = 0; b < 8; b++)
{
uint8 r = *(q + b);
*(p + 0) = (*(p + 0) << 1) | ((r >> 0) & 1);
diff --git a/source/sdd1.c b/source/sdd1.c
index 7dc6f4a..1ba8187 100644
--- a/source/sdd1.c
+++ b/source/sdd1.c
@@ -117,7 +117,8 @@ void S9xSetSDD1MemoryMap (uint32 bank, uint32 value)
void S9xResetSDD1 ()
{
memset (&Memory.FillRAM [0x4800], 0, 4);
- for (int i = 0; i < 4; i++)
+ int i;
+ for (i = 0; i < 4; i++)
{
Memory.FillRAM [0x4804 + i] = i;
S9xSetSDD1MemoryMap (i, i);
@@ -126,7 +127,8 @@ void S9xResetSDD1 ()
void S9xSDD1PostLoadState ()
{
- for (int i = 0; i < 4; i++)
+ int i;
+ for (i = 0; i < 4; i++)
S9xSetSDD1MemoryMap (i, Memory.FillRAM [0x4804 + i]);
}
diff --git a/source/seta010.c b/source/seta010.c
index 13eab8a..926f615 100644
--- a/source/seta010.c
+++ b/source/seta010.c
@@ -249,66 +249,66 @@ short ST010_Cos(short Theta)
return ST010_SinTable[((Theta + 0x4000) >> 8) & 0xff];
}
-void ST010_OP01(short x0, short y0, short &x1, short &y1, short &Quadrant, short &Theta)
+void ST010_OP01(short x0, short y0, short* x1, short* y1, short* Quadrant, short* Theta)
{
if ((x0 < 0) && (y0 < 0))
{
- x1 = -x0;
- y1 = -y0;
- Quadrant = -0x8000;
+ *x1 = -x0;
+ *y1 = -y0;
+ *Quadrant = -0x8000;
}
else if (x0 < 0)
{
- x1 = y0;
- y1 = -x0;
- Quadrant = -0x4000;
+ *x1 = y0;
+ *y1 = -x0;
+ *Quadrant = -0x4000;
}
else if (y0 < 0)
{
- x1 = -y0;
- y1 = x0;
- Quadrant = 0x4000;
+ *x1 = -y0;
+ *y1 = x0;
+ *Quadrant = 0x4000;
}
else
{
- x1 = x0;
- y1 = y0;
- Quadrant = 0x0000;
+ *x1 = x0;
+ *y1 = y0;
+ *Quadrant = 0x0000;
}
- while ((x1 > 0x1f) || (y1 > 0x1f))
+ while ((*x1 > 0x1f) || (*y1 > 0x1f))
{
- if (x1 > 1) x1 >>= 1;
- if (y1 > 1) y1 >>= 1;
+ if (*x1 > 1) *x1 >>= 1;
+ if (*y1 > 1) *y1 >>= 1;
}
- if (y1 == 0) Quadrant += 0x4000;
+ if (*y1 == 0) *Quadrant += 0x4000;
- Theta = (ST010_ArcTan[y1][x1] << 8) ^ Quadrant;
+ *Theta = (ST010_ArcTan[*y1][*x1] << 8) ^ *Quadrant;
}
-void ST010_Scale(short Multiplier, short X0, short Y0, int &X1, int &Y1)
+void ST010_Scale(short Multiplier, short X0, short Y0, int* X1, int* Y1)
{
- X1 = X0 * Multiplier << 1;
- Y1 = Y0 * Multiplier << 1;
+ *X1 = X0 * Multiplier << 1;
+ *Y1 = Y0 * Multiplier << 1;
}
-void ST010_Multiply(short Multiplicand, short Multiplier, int &Product)
+void ST010_Multiply(short Multiplicand, short Multiplier, int *Product)
{
- Product = Multiplicand * Multiplier << 1;
+ *Product = Multiplicand * Multiplier << 1;
}
-void ST010_Rotate(short Theta, short X0, short Y0, short &X1, short &Y1)
+void ST010_Rotate(short Theta, short X0, short Y0, short *X1, short *Y1)
{
- X1 = (Y0 * ST010_Sin(Theta) >> 15) + (X0 * ST010_Cos(Theta) >> 15);
- Y1 = (Y0 * ST010_Cos(Theta) >> 15) - (X0 * ST010_Sin(Theta) >> 15);
+ *X1 = (Y0 * ST010_Sin(Theta) >> 15) + (X0 * ST010_Cos(Theta) >> 15);
+ *Y1 = (Y0 * ST010_Cos(Theta) >> 15) - (X0 * ST010_Sin(Theta) >> 15);
}
-void SETA_Distance(short Y0, short X0, short &Distance)
+void SETA_Distance(short Y0, short X0, short *Distance)
{
if (X0 < 0) X0 = -X0;
if (Y0 < 0) Y0 = -Y0;
- Distance = ((X0 * 0x7af0) + 0x4000) >> 15;
+ *Distance = ((X0 * 0x7af0) + 0x4000) >> 15;
}
void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
@@ -319,7 +319,8 @@ void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
if (Positions > 1)
do {
Sorted = true;
- for (int i = 0; i < Positions - 1; i++)
+ int i;
+ for (i = 0; i < Positions - 1; i++)
if (Places[i] < Places[i + 1])
{
Temp = Places[i + 1];
@@ -384,14 +385,14 @@ void S9xSetST010(uint32 Address, uint8 Byte)
Offset += 2;
}
- ST010_SortDrivers(Positions, Places, (uint16*) (SRAM + 0x0080));
+ ST010_SortDrivers(Positions, Places, (uint16*) (Memory.SRAM + 0x0080));
Offset = 0;
for (Pos = 0; Pos < Positions; Pos++)
{
- SRAM[0x0040 + Offset]=(uint8)(Places[Pos]);
- SRAM[0x0041 + Offset]=(uint8)(Places[Pos] >> 8);
+ Memory.SRAM[0x0040 + Offset]=(uint8)(Places[Pos]);
+ Memory.SRAM[0x0041 + Offset]=(uint8)(Places[Pos] >> 8);
Offset += 2;
}
#endif
@@ -417,7 +418,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
#else
int x1, y1;
- ST010_Scale(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), x1, y1);
+ ST010_Scale(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), &x1, &y1);
Memory.SRAM[0x0010]=(uint8)(x1);
Memory.SRAM[0x0011]=(uint8)(x1 >> 8);
@@ -446,7 +447,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
#else
int Product;
- ST010_Multiply(ST010_WORD(0x0000), ST010_WORD(0x0002), Product);
+ ST010_Multiply(ST010_WORD(0x0000), ST010_WORD(0x0002), &Product);
Memory.SRAM[0x0010]=(uint8)(Product);
Memory.SRAM[0x0011]=(uint8)(Product >> 8);
@@ -472,7 +473,8 @@ void S9xSetST010(uint32 Address, uint8 Byte)
int32 offset = 0;
int16 Theta = ST010_WORD(0x0000);
- for (int32 line = 0; line < 176; line++)
+ int32 line;
+ for (line = 0; line < 176; line++)
{
// Calculate Mode 7 Matrix A/D data
data = ST010_M7Scale[line] * ST010_Cos(Theta) >> 15;
@@ -521,7 +523,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
#else
short x1, y1;
- ST010_Rotate(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), x1, y1);
+ ST010_Rotate(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), &x1, &y1);
Memory.SRAM[0x0010]=(uint8)(x1);
Memory.SRAM[0x0011]=(uint8)(x1 >> 8);
@@ -544,12 +546,12 @@ void S9xSetST010(uint32 Address, uint8 Byte)
#ifdef FAST_LSB_WORD_ACCESS
ST010_OP01(*(short*)&Memory.SRAM[0x0000], *(short*)&Memory.SRAM[0x0002],
- (short&) Memory.SRAM[0x0000], (short&) Memory.SRAM[0x0002],
- (short&) Memory.SRAM[0x0004], (short&) Memory.SRAM[0x0010]);
+ (short*) &Memory.SRAM[0x0000], (short*) &Memory.SRAM[0x0002],
+ (short*) &Memory.SRAM[0x0004], (short*) &Memory.SRAM[0x0010]);
#else
short x1, y1, Quadrant, Theta;
- ST010_OP01(ST010_WORD(0x0000), ST010_WORD(0x0002), x1, y1, Quadrant, Theta);
+ ST010_OP01(ST010_WORD(0x0000), ST010_WORD(0x0002), &x1, &y1, &Quadrant, &Theta);
Memory.SRAM[0x0000]=(uint8)(x1);
Memory.SRAM[0x0001]=(uint8)(x1 >> 8);
@@ -600,9 +602,9 @@ void S9xSetST010(uint32 Address, uint8 Byte)
int16 xpos_max = ST010_WORD(0x00C2);
// current coordinates and direction
- int32 ypos = SRAM[0xC4]|(SRAM[0xC5]<<8)|(SRAM[0xC6]<<16)|(SRAM[0xC7]<<24);
- int32 xpos = SRAM[0xC8]|(SRAM[0xC9]<<8)|(SRAM[0xCA]<<16)|(SRAM[0xCB]<<24);
- uint16 rot = SRAM[0xCC]|(SRAM[0xCD]<<8);
+ int32 ypos = Memory.SRAM[0xC4]|(Memory.SRAM[0xC5]<<8)|(Memory.SRAM[0xC6]<<16)|(Memory.SRAM[0xC7]<<24);
+ int32 xpos = Memory.SRAM[0xC8]|(Memory.SRAM[0xC9]<<8)|(Memory.SRAM[0xCA]<<16)|(Memory.SRAM[0xCB]<<24);
+ uint16 rot = Memory.SRAM[0xCC]|(Memory.SRAM[0xCD]<<8);
// physics
uint16 speed = ST010_WORD(0x00D4);
@@ -625,13 +627,13 @@ void S9xSetST010(uint32 Address, uint8 Byte)
dy = ypos_max-(ypos>>16);
// quirk: clear and move in9
- SRAM[0xD2]=0xFF;
- SRAM[0xD3]=0xFF;
- SRAM[0xDA]=0;
- SRAM[0xDB]=0;
+ Memory.SRAM[0xD2]=0xFF;
+ Memory.SRAM[0xD3]=0xFF;
+ Memory.SRAM[0xDA]=0;
+ Memory.SRAM[0xDB]=0;
// grab the target angle
- ST010_OP01(dy,dx,a1,b1,c1,(int16 &)o1);
+ ST010_OP01(dy,dx,&a1,&b1,&c1,(int16*)&o1);
// check for wrapping
//if((o1<0x6000 && rot>0xA000) ||
@@ -715,24 +717,24 @@ void S9xSetST010(uint32 Address, uint8 Byte)
xpos &= 0x1FFFFFFF;
ypos &= 0x1FFFFFFF;
- SRAM[0x00C0]=(uint8)(ypos_max);
- SRAM[0x00C1]=(uint8)(ypos_max >> 8);
- SRAM[0x00C2]=(uint8)(xpos_max);
- SRAM[0x00C3]=(uint8)(xpos_max >> 8);
- SRAM[0x00C4]=(uint8)(ypos);
- SRAM[0x00C5]=(uint8)(ypos >> 8);
- SRAM[0x00C6]=(uint8)(ypos >> 16);
- SRAM[0x00C7]=(uint8)(ypos >> 24);
- SRAM[0x00C8]=(uint8)(xpos);
- SRAM[0x00C9]=(uint8)(xpos >> 8);
- SRAM[0x00CA]=(uint8)(xpos >> 16);
- SRAM[0x00CB]=(uint8)(xpos >> 24);
- SRAM[0x00CC]=(uint8)(rot);
- SRAM[0x00CD]=(uint8)(rot >> 8);
- SRAM[0x00D4]=(uint8)(speed);
- SRAM[0x00D5]=(uint8)(speed >> 8);
- SRAM[0x00DC]=(uint8)(flags);
- SRAM[0x00DD]=(uint8)(flags >> 8);
+ Memory.SRAM[0x00C0]=(uint8)(ypos_max);
+ Memory.SRAM[0x00C1]=(uint8)(ypos_max >> 8);
+ Memory.SRAM[0x00C2]=(uint8)(xpos_max);
+ Memory.SRAM[0x00C3]=(uint8)(xpos_max >> 8);
+ Memory.SRAM[0x00C4]=(uint8)(ypos);
+ Memory.SRAM[0x00C5]=(uint8)(ypos >> 8);
+ Memory.SRAM[0x00C6]=(uint8)(ypos >> 16);
+ Memory.SRAM[0x00C7]=(uint8)(ypos >> 24);
+ Memory.SRAM[0x00C8]=(uint8)(xpos);
+ Memory.SRAM[0x00C9]=(uint8)(xpos >> 8);
+ Memory.SRAM[0x00CA]=(uint8)(xpos >> 16);
+ Memory.SRAM[0x00CB]=(uint8)(xpos >> 24);
+ Memory.SRAM[0x00CC]=(uint8)(rot);
+ Memory.SRAM[0x00CD]=(uint8)(rot >> 8);
+ Memory.SRAM[0x00D4]=(uint8)(speed);
+ Memory.SRAM[0x00D5]=(uint8)(speed >> 8);
+ Memory.SRAM[0x00DC]=(uint8)(flags);
+ Memory.SRAM[0x00DD]=(uint8)(flags >> 8);
break;
}
diff --git a/source/seta011.c b/source/seta011.c
index b8fd213..5137098 100644
--- a/source/seta011.c
+++ b/source/seta011.c
@@ -186,7 +186,8 @@ void S9xSetST011(uint32 Address, uint8 Byte)
{
// 9x9 board data: top to bottom, left to right
// Values represent piece types and ownership
- for( int lcv=0; lcv<9; lcv++ )
+ int lcv;
+ for(lcv=0; lcv<9; lcv++ )
memcpy( board[lcv], ST011.parameters+lcv*10, 9*1 );
}
break;
diff --git a/source/snaporig.c b/source/snaporig.c
index add1c09..2c77818 100644
--- a/source/snaporig.c
+++ b/source/snaporig.c
@@ -204,7 +204,7 @@ static int ReadOrigSnapshot (STREAM snap)
if ((result = ReadBlock ("CPU:", &OrigCPU, sizeof (OrigCPU), snap)) != SUCCESS)
return (result);
OrigCPU.FastROMSpeed = OrigCPU.FastROMSpeed_old;
- Memory.FixROMSpeed ();
+ FixROMSpeed ();
if (version == 3)
{
OrigCPU.Cycles = OrigCPU.Cycles_old;
@@ -370,7 +370,7 @@ static int ReadOrigSnapshot (STREAM snap)
return (result);
if ((result = ReadBlock ("RAM:", Memory.RAM, 0x20000, snap)) != SUCCESS)
return (result);
- if ((result = ReadBlock ("SRA:", ::SRAM, 0x10000, snap)) != SUCCESS)
+ if ((result = ReadBlock ("SRA:", SRAM_g, 0x10000, snap)) != SUCCESS)
return (result);
if ((result = ReadBlock ("FIL:", Memory.FillRAM, 0x8000, snap)) != SUCCESS)
return (result);