aboutsummaryrefslogtreecommitdiff
path: root/source/c4emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/c4emu.c')
-rw-r--r--source/c4emu.c208
1 files changed, 104 insertions, 104 deletions
diff --git a/source/c4emu.c b/source/c4emu.c
index 0b87bfe..517df2e 100644
--- a/source/c4emu.c
+++ b/source/c4emu.c
@@ -104,12 +104,12 @@ void S9xInitC4()
memset(Memory.C4RAM, 0, 0x2000);
}
-uint8 S9xGetC4(uint16 Address)
+uint8_t S9xGetC4(uint16_t Address)
{
return (Memory.C4RAM [Address - 0x6000]);
}
-static uint8 C4TestPattern [12 * 4] =
+static uint8_t C4TestPattern [12 * 4] =
{
0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0x00, 0xff,
@@ -128,19 +128,19 @@ static uint8 C4TestPattern [12 * 4] =
static void C4ConvOAM(void)
{
- uint8* i;
- uint8* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
+ uint8_t* i;
+ uint8_t* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
for (i = Memory.C4RAM + 0x1fd; i > OAMptr; i -= 4)
{
// Clear OAM-to-be
*i = 0xe0;
}
- uint16 globalX, globalY;
- uint8* OAMptr2;
- int16 SprX, SprY;
- uint8 SprName, SprAttr;
- uint8 SprCount;
+ uint16_t globalX, globalY;
+ uint8_t* OAMptr2;
+ int16_t SprX, SprY;
+ uint8_t SprName, SprAttr;
+ uint8_t SprCount;
globalX = READ_WORD(Memory.C4RAM + 0x0621);
globalY = READ_WORD(Memory.C4RAM + 0x0623);
@@ -150,10 +150,10 @@ static void C4ConvOAM(void)
{
int prio, i;
SprCount = 128 - Memory.C4RAM[0x626];
- uint8 offset = (Memory.C4RAM[0x626] & 3) * 2;
+ uint8_t offset = (Memory.C4RAM[0x626] & 3) * 2;
for (prio = 0x30; prio >= 0; prio -= 0x10)
{
- uint8* srcptr = Memory.C4RAM + 0x220;
+ uint8_t* srcptr = Memory.C4RAM + 0x220;
for (i = Memory.C4RAM[0x0620]; i > 0 && SprCount > 0; i--, srcptr += 16)
{
if ((srcptr[4] & 0x30) != prio) continue;
@@ -162,27 +162,27 @@ static void C4ConvOAM(void)
SprName = srcptr[5];
SprAttr = srcptr[4] | srcptr[0x06]; // XXX: mask bits?
- uint8* sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
+ uint8_t* sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
if (*sprptr != 0)
{
int SprCnt;
- int16 X, Y;
+ int16_t X, Y;
for (SprCnt = *sprptr++; SprCnt > 0 && SprCount > 0; SprCnt--, sprptr += 4)
{
- X = (int8)sprptr[1];
+ X = (int8_t)sprptr[1];
if (SprAttr & 0x40) // flip X
X = -X - ((sprptr[0] & 0x20) ? 16 : 8);
X += SprX;
if (X >= -16 && X <= 272)
{
- Y = (int8)sprptr[2];
+ Y = (int8_t)sprptr[2];
if (SprAttr & 0x80)
Y = -Y - ((sprptr[0] & 0x20) ? 16 : 8);
Y += SprY;
if (Y >= -16 && Y <= 224)
{
OAMptr[0] = X & 0xff;
- OAMptr[1] = (uint8)Y;
+ OAMptr[1] = (uint8_t)Y;
OAMptr[2] = SprName + sprptr[3];
OAMptr[3] = SprAttr ^ (sprptr[0] & 0xc0); // XXX: Carry from SprName addition?
*OAMptr2 &= ~(3 << offset);
@@ -198,8 +198,8 @@ static void C4ConvOAM(void)
}
else if (SprCount > 0)
{
- OAMptr[0] = (uint8)SprX;
- OAMptr[1] = (uint8)SprY;
+ OAMptr[0] = (uint8_t)SprX;
+ OAMptr[1] = (uint8_t)SprY;
OAMptr[2] = SprName;
OAMptr[3] = SprAttr;
*OAMptr2 &= ~(3 << offset);
@@ -218,12 +218,12 @@ static void C4ConvOAM(void)
static void C4DoScaleRotate(int row_padding)
{
- int16 A, B, C, D;
+ int16_t A, B, C, D;
// Calculate matrix
- int32 XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
+ int32_t XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
if (XScale & 0x8000) XScale = 0x7fff;
- int32 YScale = READ_WORD(Memory.C4RAM + 0x1f92);
+ int32_t YScale = READ_WORD(Memory.C4RAM + 0x1f92);
if (YScale & 0x8000) YScale = 0x7fff;
if (READ_WORD(Memory.C4RAM + 0x1f80) == 0)
@@ -231,50 +231,50 @@ static void C4DoScaleRotate(int row_padding)
// no rotation
// XXX: only do this for C and D?
// XXX: and then only when YScale is 0x1000?
- A = (int16)XScale;
+ A = (int16_t)XScale;
B = 0;
C = 0;
- D = (int16)YScale;
+ D = (int16_t)YScale;
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 128) // 90 degree rotation
{
// XXX: Really do this?
A = 0;
- B = (int16)(-YScale);
- C = (int16)XScale;
+ B = (int16_t)(-YScale);
+ C = (int16_t)XScale;
D = 0;
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 256) // 180 degree rotation
{
// XXX: Really do this?
- A = (int16)(-XScale);
+ A = (int16_t)(-XScale);
B = 0;
C = 0;
- D = (int16)(-YScale);
+ D = (int16_t)(-YScale);
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 384) // 270 degree rotation
{
// XXX: Really do this?
A = 0;
- B = (int16)YScale;
- C = (int16)(-XScale);
+ B = (int16_t)YScale;
+ C = (int16_t)(-XScale);
D = 0;
}
else
{
- A = (int16)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
+ A = (int16_t)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
15);
- B = (int16)(-SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] *
+ B = (int16_t)(-SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] *
YScale, 15));
- C = (int16)SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
+ C = (int16_t)SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
15);
- D = (int16)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * YScale,
+ D = (int16_t)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * YScale,
15);
}
// Calculate Pixel Resolution
- uint8 w = Memory.C4RAM[0x1f89] & ~7;
- uint8 h = Memory.C4RAM[0x1f8c] & ~7;
+ uint8_t w = Memory.C4RAM[0x1f89] & ~7;
+ uint8_t h = Memory.C4RAM[0x1f8c] & ~7;
// printf("%dx%d XScale=%04x YScale=%04x angle=%03x\n", w, h, XScale, YScale, READ_WORD(Memory.C4RAM+0x1f80)&0x1ff);
// printf("Matrix: [%10g %10g] [%04x %04x]\n", A/4096.0, B/4096.0, A&0xffff, B&0xffff);
@@ -283,22 +283,22 @@ static void C4DoScaleRotate(int row_padding)
// Clear the output RAM
memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2);
- int32 Cx = (int16)READ_WORD(Memory.C4RAM + 0x1f83);
- int32 Cy = (int16)READ_WORD(Memory.C4RAM + 0x1f86);
+ int32_t Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
+ int32_t Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
// Calculate start position (i.e. (Ox, Oy) = (0, 0))
// The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in
// the function. We do Cx*A etc normally because the matrix parameters
// already have the fractional parts.
- int32 LineX = (Cx << 12) - Cx * A - Cx * B;
- int32 LineY = (Cy << 12) - Cy * C - Cy * D;
+ int32_t LineX = (Cx << 12) - Cx * A - Cx * B;
+ int32_t LineY = (Cy << 12) - Cy * C - Cy * D;
// Start loop
- uint32 X, Y;
- uint8 byte;
+ uint32_t X, Y;
+ uint8_t byte;
int outidx = 0;
int x, y;
- uint8 bit = 0x80;
+ uint8_t bit = 0x80;
for (y = 0; y < h; y++)
{
X = LineX;
@@ -309,7 +309,7 @@ static void C4DoScaleRotate(int row_padding)
byte = 0;
else
{
- uint32 addr = (Y >> 12) * w + (X >> 12);
+ uint32_t addr = (Y >> 12) * w + (X >> 12);
byte = Memory.C4RAM[0x600 + (addr >> 1)];
if (addr & 1) byte >>= 4;
}
@@ -340,8 +340,8 @@ static void C4DoScaleRotate(int row_padding)
}
}
-static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
- int32 X2, int32 Y2, int16 Z2, uint8 Color)
+static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1,
+ int32_t X2, int32_t Y2, int16_t Z2, uint8_t Color)
{
// Transform coordinates
C4WFXVal = (short)X1;
@@ -368,8 +368,8 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
C4WFX2Val = (short)(X2 >> 8);
C4WFY2Val = (short)(Y2 >> 8);
C4CalcWireFrame();
- X2 = (int16)C4WFXVal;
- Y2 = (int16)C4WFYVal;
+ X2 = (int16_t)C4WFXVal;
+ Y2 = (int16_t)C4WFYVal;
// render line
int i;
@@ -378,10 +378,10 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
//.loop
if (X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000)
{
- uint16 addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7;
+ uint16_t addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7;
addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((
X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2;
- uint8 bit = 0x80 >> ((X1 >> 8) & 7);
+ uint8_t bit = 0x80 >> ((X1 >> 8) & 7);
Memory.C4RAM[addr + 0x300] &= ~bit;
Memory.C4RAM[addr + 0x301] &= ~bit;
if (Color & 1) Memory.C4RAM[addr + 0x300] |= bit;
@@ -394,18 +394,18 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
static void C4DrawWireFrame(void)
{
- uint8* line = S9xGetMemPointer(READ_3WORD(Memory.C4RAM + 0x1f80));
- uint8* point1, *point2;
- int16 X1, Y1, Z1;
- int16 X2, Y2, Z2;
- uint8 Color;
+ uint8_t* line = S9xGetMemPointer(READ_3WORD(Memory.C4RAM + 0x1f80));
+ uint8_t* point1, *point2;
+ int16_t X1, Y1, Z1;
+ int16_t X2, Y2, Z2;
+ uint8_t Color;
int i;
for (i = Memory.C4RAM[0x0295]; i > 0; i--, line += 5)
{
if (line[0] == 0xff && line[1] == 0xff)
{
- uint8* tmp = line - 5;
+ uint8_t* tmp = line - 5;
while (line[2] == 0xff && line[3] == 0xff) tmp -= 5;
point1 = S9xGetMemPointer((Memory.C4RAM[0x1f82] << 16) |
(tmp[2] << 8) | tmp[3]);
@@ -437,7 +437,7 @@ static void C4TransformLines(void)
int i;
// transform vertices
- uint8* ptr = Memory.C4RAM;
+ uint8_t* ptr = Memory.C4RAM;
{
for (i = READ_WORD(Memory.C4RAM + 0x1f80); i > 0; i--, ptr += 0x10)
{
@@ -459,7 +459,7 @@ static void C4TransformLines(void)
WRITE_WORD(Memory.C4RAM + 0x605 + 8, 0x40);
ptr = Memory.C4RAM + 0xb02;
- uint8* ptr2 = Memory.C4RAM;
+ uint8_t* ptr2 = Memory.C4RAM;
{
int i;
for (i = READ_WORD(Memory.C4RAM + 0xb00); i > 0; i--, ptr += 2, ptr2 += 8)
@@ -477,7 +477,7 @@ static void C4TransformLines(void)
}
static void C4BitPlaneWave()
{
- static uint16 bmpdata[] =
+ static uint16_t bmpdata[] =
{
0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000A, 0x000C, 0x000E,
0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020A, 0x020C, 0x020E,
@@ -486,20 +486,20 @@ static void C4BitPlaneWave()
0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080A, 0x080C, 0x080E
};
- uint8* dst = Memory.C4RAM;
- uint32 waveptr = Memory.C4RAM[0x1f83];
- uint16 mask1 = 0xc0c0;
- uint16 mask2 = 0x3f3f;
+ uint8_t* dst = Memory.C4RAM;
+ uint32_t waveptr = Memory.C4RAM[0x1f83];
+ uint16_t mask1 = 0xc0c0;
+ uint16_t mask2 = 0x3f3f;
int i, j;
for (j = 0; j < 0x10; j++)
{
do
{
- int16 height = -((int8)Memory.C4RAM[waveptr + 0xb00]) - 16;
+ int16_t height = -((int8_t)Memory.C4RAM[waveptr + 0xb00]) - 16;
for (i = 0; i < 40; i++)
{
- uint16 tmp = READ_WORD(dst + bmpdata[i]) & mask2;
+ uint16_t tmp = READ_WORD(dst + bmpdata[i]) & mask2;
if (height >= 0)
{
if (height < 8)
@@ -520,10 +520,10 @@ static void C4BitPlaneWave()
do
{
int i;
- int16 height = -((int8)Memory.C4RAM[waveptr + 0xb00]) - 16;
+ int16_t height = -((int8_t)Memory.C4RAM[waveptr + 0xb00]) - 16;
for (i = 0; i < 40; i++)
{
- uint16 tmp = READ_WORD(dst + bmpdata[i]) & mask2;
+ uint16_t tmp = READ_WORD(dst + bmpdata[i]) & mask2;
if (height >= 0)
{
if (height < 8)
@@ -545,34 +545,34 @@ static void C4BitPlaneWave()
static void C4SprDisintegrate()
{
- uint8 width, height;
- uint32 StartX, StartY;
- uint8* src;
- int32 scaleX, scaleY;
- int32 Cx, Cy;
+ uint8_t width, height;
+ uint32_t StartX, StartY;
+ uint8_t* src;
+ int32_t scaleX, scaleY;
+ int32_t Cx, Cy;
width = Memory.C4RAM[0x1f89];
height = Memory.C4RAM[0x1f8c];
- Cx = (int16)READ_WORD(Memory.C4RAM + 0x1f80);
- Cy = (int16)READ_WORD(Memory.C4RAM + 0x1f83);
+ Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f80);
+ Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
- scaleX = (int16)READ_WORD(Memory.C4RAM + 0x1f86);
- scaleY = (int16)READ_WORD(Memory.C4RAM + 0x1f8f);
+ scaleX = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
+ scaleY = (int16_t)READ_WORD(Memory.C4RAM + 0x1f8f);
StartX = -Cx * scaleX + (Cx << 8);
StartY = -Cy * scaleY + (Cy << 8);
src = Memory.C4RAM + 0x600;
memset(Memory.C4RAM, 0, width * height / 2);
- uint32 x, y, i, j;
+ uint32_t x, y, i, j;
for (y = StartY, i = 0; i < height; i++, y += scaleY)
{
for (x = StartX, j = 0; j < width; j++, x += scaleX)
{
if ((x >> 8) < width && (y >> 8) < height && (y >> 8)*width + (x >> 8) < 0x2000)
{
- uint8 pixel = (j & 1) ? (*src >> 4) : *src;
+ uint8_t pixel = (j & 1) ? (*src >> 4) : *src;
int idx = (y >> 11) * width * 4 + (x >> 11) * 32 + ((y >> 8) & 7) * 2;
- uint8 mask = 0x80 >> ((x >> 8) & 7);
+ uint8_t mask = 0x80 >> ((x >> 8) & 7);
if (pixel & 1) Memory.C4RAM[idx] |= mask;
if (pixel & 2) Memory.C4RAM[idx + 1] |= mask;
if (pixel & 4) Memory.C4RAM[idx + 16] |= mask;
@@ -620,7 +620,7 @@ static void S9xC4ProcessSprites()
}
}
-void S9xSetC4(uint8 byte, uint16 Address)
+void S9xSetC4(uint8_t byte, uint16_t Address)
{
int i;
Memory.C4RAM [Address - 0x6000] = byte;
@@ -643,11 +643,11 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x05: // Propulsion (?)
{
- int32 tmp = 0x10000;
+ int32_t tmp = 0x10000;
if (READ_WORD(Memory.C4RAM + 0x1f83))
tmp = SAR32((tmp / READ_WORD(Memory.C4RAM + 0x1f83)) * READ_WORD(
Memory.C4RAM + 0x1f81), 8);
- WRITE_WORD(Memory.C4RAM + 0x1f80, (uint16)tmp);
+ WRITE_WORD(Memory.C4RAM + 0x1f80, (uint16_t)tmp);
}
break;
@@ -662,10 +662,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x10: // Polar to rectangluar
{
- int32 tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) *
+ int32_t tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) *
C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f86, tmp);
- tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
+ tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f89, (tmp - SAR32(tmp, 6)));
}
@@ -673,10 +673,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x13: // Polar to rectangluar
{
- int32 tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) *
+ int32_t tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) *
C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 8);
WRITE_3WORD(Memory.C4RAM + 0x1f86, tmp);
- tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
+ tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 8);
WRITE_3WORD(Memory.C4RAM + 0x1f89, tmp);
}
@@ -685,7 +685,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x15: // Pythagorean
C41FXVal = READ_WORD(Memory.C4RAM + 0x1f80);
C41FYVal = READ_WORD(Memory.C4RAM + 0x1f83);
- C41FDist = (int16)sqrt((double)C41FXVal * C41FXVal + (double)C41FYVal *
+ C41FDist = (int16_t)sqrt((double)C41FXVal * C41FXVal + (double)C41FYVal *
C41FYVal);
WRITE_WORD(Memory.C4RAM + 0x1f80, C41FDist);
break;
@@ -699,23 +699,23 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x22: // Trapezoid
{
- int16 angle1 = READ_WORD(Memory.C4RAM + 0x1f8c) & 0x1ff;
- int16 angle2 = READ_WORD(Memory.C4RAM + 0x1f8f) & 0x1ff;
- int32 tan1 = (C4CosTable[angle1] != 0) ? ((((int32)C4SinTable[angle1]) << 16) /
+ int16_t angle1 = READ_WORD(Memory.C4RAM + 0x1f8c) & 0x1ff;
+ int16_t angle2 = READ_WORD(Memory.C4RAM + 0x1f8f) & 0x1ff;
+ int32_t tan1 = (C4CosTable[angle1] != 0) ? ((((int32_t)C4SinTable[angle1]) << 16) /
C4CosTable[angle1]) : 0x80000000;
- int32 tan2 = (C4CosTable[angle2] != 0) ? ((((int32)C4SinTable[angle2]) << 16) /
+ int32_t tan2 = (C4CosTable[angle2] != 0) ? ((((int32_t)C4SinTable[angle2]) << 16) /
C4CosTable[angle2]) : 0x80000000;
- int16 y = READ_WORD(Memory.C4RAM + 0x1f83) - READ_WORD(Memory.C4RAM + 0x1f89);
- int16 left, right;
+ int16_t y = READ_WORD(Memory.C4RAM + 0x1f83) - READ_WORD(Memory.C4RAM + 0x1f89);
+ int16_t left, right;
int j;
for (j = 0; j < 225; j++)
{
if (y >= 0)
{
- left = SAR32((int32)tan1 * y, 16) -
+ left = SAR32((int32_t)tan1 * y, 16) -
READ_WORD(Memory.C4RAM + 0x1f80) +
READ_WORD(Memory.C4RAM + 0x1f86);
- right = SAR32((int32)tan2 * y, 16) -
+ right = SAR32((int32_t)tan2 * y, 16) -
READ_WORD(Memory.C4RAM + 0x1f80) +
READ_WORD(Memory.C4RAM + 0x1f86) +
READ_WORD(Memory.C4RAM + 0x1f93);
@@ -744,8 +744,8 @@ void S9xSetC4(uint8 byte, uint16 Address)
left = 1;
right = 0;
}
- Memory.C4RAM[j + 0x800] = (uint8)left;
- Memory.C4RAM[j + 0x900] = (uint8)right;
+ Memory.C4RAM[j + 0x800] = (uint8_t)left;
+ Memory.C4RAM[j + 0x900] = (uint8_t)right;
y++;
}
}
@@ -753,8 +753,8 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x25: // Multiply
{
- int32 foo = READ_3WORD(Memory.C4RAM + 0x1f80);
- int32 bar = READ_3WORD(Memory.C4RAM + 0x1f83);
+ int32_t foo = READ_3WORD(Memory.C4RAM + 0x1f80);
+ int32_t bar = READ_3WORD(Memory.C4RAM + 0x1f83);
foo *= bar;
WRITE_3WORD(Memory.C4RAM + 0x1f80, foo);
}
@@ -776,7 +776,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x40: // Sum
{
int i;
- uint16 sum = 0;
+ uint16_t sum = 0;
for (i = 0; i < 0x800; sum += Memory.C4RAM[i++]);
WRITE_WORD(Memory.C4RAM + 0x1f80, sum);
}
@@ -784,10 +784,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x54: // Square
{
- int64 a = SAR64((int64)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
- // printf("%08X%08X\n", (uint32)(a>>32), (uint32)(a&0xFFFFFFFF));
+ int64_t a = SAR64((int64_t)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
+ // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
a *= a;
- // printf("%08X%08X\n", (uint32)(a>>32), (uint32)(a&0xFFFFFFFF));
+ // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
WRITE_3WORD(Memory.C4RAM + 0x1f83, a);
WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24));
}
@@ -818,7 +818,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
}
}
-int16 C4SinTable[512] =
+int16_t C4SinTable[512] =
{
0, 402, 804, 1206, 1607, 2009, 2410, 2811,
3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997,
@@ -886,7 +886,7 @@ int16 C4SinTable[512] =
-3211, -2811, -2410, -2009, -1607, -1206, -804, -402
};
-int16 C4CosTable[512] =
+int16_t C4CosTable[512] =
{
32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647,
32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214,