aboutsummaryrefslogtreecommitdiff
path: root/source/seta010.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/seta010.c')
-rw-r--r--source/seta010.c184
1 files changed, 92 insertions, 92 deletions
diff --git a/source/seta010.c b/source/seta010.c
index 2bb9b93..de1ef1e 100644
--- a/source/seta010.c
+++ b/source/seta010.c
@@ -90,7 +90,7 @@
#include "memmap.h"
// Mode 7 scaling constants for all raster lines
-const int16 ST010_M7Scale[176] =
+const int16_t ST010_M7Scale[176] =
{
0x0380, 0x0325, 0x02da, 0x029c, 0x0268, 0x023b, 0x0215, 0x01f3,
0x01d5, 0x01bb, 0x01a3, 0x018e, 0x017b, 0x016a, 0x015a, 0x014b,
@@ -128,7 +128,7 @@ bool seta_hack;
ST010_Regs ST010;
-uint8 S9xGetST010(uint32 Address)
+uint8_t S9xGetST010(uint32_t Address)
{
if (!(Address & 0x80000))
return 0x80;
@@ -140,7 +140,7 @@ uint8 S9xGetST010(uint32 Address)
return Memory.SRAM[Address & Memory.SRAMMask];
}
-const int16 ST010_SinTable[256] =
+const int16_t ST010_SinTable[256] =
{
0x0000, 0x0324, 0x0648, 0x096a, 0x0c8c, 0x0fab, 0x12c8, 0x15e2,
0x18f9, 0x1c0b, 0x1f1a, 0x2223, 0x2528, 0x2826, 0x2b1f, 0x2e11,
@@ -381,10 +381,10 @@ void SETA_Distance(short Y0, short X0, short* Distance)
*Distance = ((X0 * 0x7af0) + 0x4000) >> 15;
}
-void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
+void ST010_SortDrivers(uint16_t Positions, uint16_t Places[32], uint16_t Drivers[32])
{
bool Sorted;
- uint16 Temp;
+ uint16_t Temp;
if (Positions > 1)
do
@@ -411,11 +411,11 @@ void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
#define ST010_WORD(offset) (Memory.SRAM[offset + 1] << 8) | Memory.SRAM[offset]
-void S9xSetST010(uint32 Address, uint8 Byte)
+void S9xSetST010(uint32_t Address, uint8_t Byte)
{
if (!(Address & 0x80000))
{
- ST010.control_enable = TRUE;
+ ST010.control_enable = true;
return;
}
//printf("Write %06X:%02X\n", Address, Byte);
@@ -444,11 +444,11 @@ void S9xSetST010(uint32 Address, uint8 Byte)
{
#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID)
/* TODO - FIXME */
- ST010_SortDrivers(*(short*)&Memory.SRAM[0x0024], (uint16*)(Memory.SRAM + 0x0040),
- (uint16*)(Memory.SRAM + 0x0080));
+ ST010_SortDrivers(*(short*)&Memory.SRAM[0x0024], (uint16_t*)(Memory.SRAM + 0x0040),
+ (uint16_t*)(Memory.SRAM + 0x0080));
#else
- uint16 Places[32];
- uint16 Positions = ST010_WORD(0x0024);
+ uint16_t Places[32];
+ uint16_t Positions = ST010_WORD(0x0024);
int Pos, Offset;
Offset = 0;
@@ -459,14 +459,14 @@ void S9xSetST010(uint32 Address, uint8 Byte)
Offset += 2;
}
- ST010_SortDrivers(Positions, Places, (uint16*)(Memory.SRAM + 0x0080));
+ ST010_SortDrivers(Positions, Places, (uint16_t*)(Memory.SRAM + 0x0080));
Offset = 0;
for (Pos = 0; Pos < Positions; Pos++)
{
- Memory.SRAM[0x0040 + Offset] = (uint8)(Places[Pos]);
- Memory.SRAM[0x0041 + Offset] = (uint8)(Places[Pos] >> 8);
+ Memory.SRAM[0x0040 + Offset] = (uint8_t)(Places[Pos]);
+ Memory.SRAM[0x0041 + Offset] = (uint8_t)(Places[Pos] >> 8);
Offset += 2;
}
#endif
@@ -497,14 +497,14 @@ void S9xSetST010(uint32 Address, uint8 Byte)
ST010_Scale(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), &x1,
&y1);
- Memory.SRAM[0x0010] = (uint8)(x1);
- Memory.SRAM[0x0011] = (uint8)(x1 >> 8);
- Memory.SRAM[0x0012] = (uint8)(x1 >> 16);
- Memory.SRAM[0x0013] = (uint8)(x1 >> 24);
- Memory.SRAM[0x0014] = (uint8)(y1);
- Memory.SRAM[0x0015] = (uint8)(y1 >> 8);
- Memory.SRAM[0x0016] = (uint8)(y1 >> 16);
- Memory.SRAM[0x0017] = (uint8)(y1 >> 24);
+ Memory.SRAM[0x0010] = (uint8_t)(x1);
+ Memory.SRAM[0x0011] = (uint8_t)(x1 >> 8);
+ Memory.SRAM[0x0012] = (uint8_t)(x1 >> 16);
+ Memory.SRAM[0x0013] = (uint8_t)(x1 >> 24);
+ Memory.SRAM[0x0014] = (uint8_t)(y1);
+ Memory.SRAM[0x0015] = (uint8_t)(y1 >> 8);
+ Memory.SRAM[0x0016] = (uint8_t)(y1 >> 16);
+ Memory.SRAM[0x0017] = (uint8_t)(y1 >> 24);
#endif
break;
}
@@ -528,10 +528,10 @@ void S9xSetST010(uint32 Address, uint8 Byte)
ST010_Multiply(ST010_WORD(0x0000), ST010_WORD(0x0002), &Product);
- Memory.SRAM[0x0010] = (uint8)(Product);
- Memory.SRAM[0x0011] = (uint8)(Product >> 8);
- Memory.SRAM[0x0012] = (uint8)(Product >> 16);
- Memory.SRAM[0x0013] = (uint8)(Product >> 24);
+ Memory.SRAM[0x0010] = (uint8_t)(Product);
+ Memory.SRAM[0x0011] = (uint8_t)(Product >> 8);
+ Memory.SRAM[0x0012] = (uint8_t)(Product >> 16);
+ Memory.SRAM[0x0013] = (uint8_t)(Product >> 24);
#endif
break;
}
@@ -548,31 +548,31 @@ void S9xSetST010(uint32 Address, uint8 Byte)
//
case 0x07:
{
- int16 data;
- int32 offset = 0;
- int16 Theta = ST010_WORD(0x0000);
+ int16_t data;
+ int32_t offset = 0;
+ int16_t Theta = ST010_WORD(0x0000);
- int32 line;
+ int32_t line;
for (line = 0; line < 176; line++)
{
// Calculate Mode 7 Matrix A/D data
data = ST010_M7Scale[line] * ST010_Cos(Theta) >> 15;
- Memory.SRAM[0x00f0 + offset] = (uint8)(data);
- Memory.SRAM[0x00f1 + offset] = (uint8)(data >> 8);
- Memory.SRAM[0x0510 + offset] = (uint8)(data);
- Memory.SRAM[0x0511 + offset] = (uint8)(data >> 8);
+ Memory.SRAM[0x00f0 + offset] = (uint8_t)(data);
+ Memory.SRAM[0x00f1 + offset] = (uint8_t)(data >> 8);
+ Memory.SRAM[0x0510 + offset] = (uint8_t)(data);
+ Memory.SRAM[0x0511 + offset] = (uint8_t)(data >> 8);
// Calculate Mode 7 Matrix B/C data
data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15;
- Memory.SRAM[0x0250 + offset] = (uint8)(data);
- Memory.SRAM[0x0251 + offset] = (uint8)(data >> 8);
+ Memory.SRAM[0x0250 + offset] = (uint8_t)(data);
+ Memory.SRAM[0x0251 + offset] = (uint8_t)(data >> 8);
if (data) data = ~data;
- Memory.SRAM[0x03b0 + offset] = (uint8)(data);
- Memory.SRAM[0x03b1 + offset] = (uint8)(data >> 8);
+ Memory.SRAM[0x03b0 + offset] = (uint8_t)(data);
+ Memory.SRAM[0x03b1 + offset] = (uint8_t)(data >> 8);
offset += 2;
}
@@ -607,10 +607,10 @@ void S9xSetST010(uint32 Address, uint8 Byte)
ST010_Rotate(ST010_WORD(0x0004), ST010_WORD(0x0000), ST010_WORD(0x0002), &x1,
&y1);
- Memory.SRAM[0x0010] = (uint8)(x1);
- Memory.SRAM[0x0011] = (uint8)(x1 >> 8);
- Memory.SRAM[0x0012] = (uint8)(y1);
- Memory.SRAM[0x0013] = (uint8)(y1 >> 8);
+ Memory.SRAM[0x0010] = (uint8_t)(x1);
+ Memory.SRAM[0x0011] = (uint8_t)(x1 >> 8);
+ Memory.SRAM[0x0012] = (uint8_t)(y1);
+ Memory.SRAM[0x0013] = (uint8_t)(y1 >> 8);
#endif
break;
}
@@ -636,14 +636,14 @@ void S9xSetST010(uint32 Address, uint8 Byte)
ST010_OP01(ST010_WORD(0x0000), ST010_WORD(0x0002), &x1, &y1, &Quadrant, &Theta);
- Memory.SRAM[0x0000] = (uint8)(x1);
- Memory.SRAM[0x0001] = (uint8)(x1 >> 8);
- Memory.SRAM[0x0002] = (uint8)(y1);
- Memory.SRAM[0x0003] = (uint8)(y1 >> 8);
- Memory.SRAM[0x0004] = (uint8)(Quadrant);
- Memory.SRAM[0x0005] = (uint8)(Quadrant >> 8);
- Memory.SRAM[0x0010] = (uint8)(Theta);
- Memory.SRAM[0x0011] = (uint8)(Theta >> 8);
+ Memory.SRAM[0x0000] = (uint8_t)(x1);
+ Memory.SRAM[0x0001] = (uint8_t)(x1 >> 8);
+ Memory.SRAM[0x0002] = (uint8_t)(y1);
+ Memory.SRAM[0x0003] = (uint8_t)(y1 >> 8);
+ Memory.SRAM[0x0004] = (uint8_t)(Quadrant);
+ Memory.SRAM[0x0005] = (uint8_t)(Quadrant >> 8);
+ Memory.SRAM[0x0010] = (uint8_t)(Theta);
+ Memory.SRAM[0x0011] = (uint8_t)(Theta >> 8);
#endif
break;
}
@@ -651,24 +651,24 @@ void S9xSetST010(uint32 Address, uint8 Byte)
// calculate the vector length of (x,y)
case 0x04:
{
- int16 square, x, y;
+ int16_t square, x, y;
#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID)
/* TODO - FIXME */
- x = *((int16*)Memory.SRAM);
- y = *((int16*)&Memory.SRAM[2]);
+ x = *((int16_t*)Memory.SRAM);
+ y = *((int16_t*)&Memory.SRAM[2]);
#else
x = Memory.SRAM[0] | (Memory.SRAM[1] << 8);
y = Memory.SRAM[2] | (Memory.SRAM[3] << 8);
#endif
- square = (int16)sqrt((double)(y * y + x * x));
+ square = (int16_t)sqrt((double)(y * y + x * x));
//SETA_Distance( x,y,square );
#if defined(FAST_LSB_WORD_ACCESS) && !defined(ANDROID)
/* TODO - FIXME */
- *((int16*)&Memory.SRAM[0x10]) = square;
+ *((int16_t*)&Memory.SRAM[0x10]) = square;
#else
- Memory.SRAM[0x10] = (uint8)(square);
- Memory.SRAM[0x11] = (uint8)(square >> 8);
+ Memory.SRAM[0x10] = (uint8_t)(square);
+ Memory.SRAM[0x11] = (uint8_t)(square >> 8);
#endif
break;
}
@@ -677,34 +677,34 @@ void S9xSetST010(uint32 Address, uint8 Byte)
case 0x05:
{
int dx, dy;
- int16 a1, b1, c1;
- uint16 o1;
+ int16_t a1, b1, c1;
+ uint16_t o1;
bool wrap = false;
// target (x,y) coordinates
- int16 ypos_max = ST010_WORD(0x00C0);
- int16 xpos_max = ST010_WORD(0x00C2);
+ int16_t ypos_max = ST010_WORD(0x00C0);
+ int16_t xpos_max = ST010_WORD(0x00C2);
// current coordinates and direction
- int32 ypos = Memory.SRAM[0xC4] | (Memory.SRAM[0xC5] << 8) |
+ int32_t 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) |
+ int32_t 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);
+ uint16_t rot = Memory.SRAM[0xCC] | (Memory.SRAM[0xCD] << 8);
// physics
- uint16 speed = ST010_WORD(0x00D4);
- uint16 accel = ST010_WORD(0x00D6);
- uint16 speed_max = ST010_WORD(0x00D8);
+ uint16_t speed = ST010_WORD(0x00D4);
+ uint16_t accel = ST010_WORD(0x00D6);
+ uint16_t speed_max = ST010_WORD(0x00D8);
// special condition acknowledgment
- int16 system = ST010_WORD(0x00DA);
- int16 flags = ST010_WORD(0x00DC);
+ int16_t system = ST010_WORD(0x00DA);
+ int16_t flags = ST010_WORD(0x00DC);
// new target coordinates
- int16 ypos_new = ST010_WORD(0x00DE);
- int16 xpos_new = ST010_WORD(0x00E0);
+ int16_t ypos_new = ST010_WORD(0x00DE);
+ int16_t xpos_new = ST010_WORD(0x00E0);
// mask upper bit
xpos_new &= 0x7FFF;
@@ -720,7 +720,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
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_t*)&o1);
// check for wrapping
//if((o1<0x6000 && rot>0xA000) ||
@@ -735,7 +735,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
//o1=0x0000;
//rot=0xFF00;
- uint16 old_speed;
+ uint16_t old_speed;
old_speed = speed;
@@ -745,7 +745,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
// slow down for sharp curves
else if (abs(o1 - rot) >= 0x1000)
{
- uint32 slow = abs(o1 - rot);
+ uint32_t slow = abs(o1 - rot);
slow >>= 4; // scaling
speed -= slow;
}
@@ -803,24 +803,24 @@ void S9xSetST010(uint32 Address, uint8 Byte)
xpos &= 0x1FFFFFFF;
ypos &= 0x1FFFFFFF;
- 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);
+ Memory.SRAM[0x00C0] = (uint8_t)(ypos_max);
+ Memory.SRAM[0x00C1] = (uint8_t)(ypos_max >> 8);
+ Memory.SRAM[0x00C2] = (uint8_t)(xpos_max);
+ Memory.SRAM[0x00C3] = (uint8_t)(xpos_max >> 8);
+ Memory.SRAM[0x00C4] = (uint8_t)(ypos);
+ Memory.SRAM[0x00C5] = (uint8_t)(ypos >> 8);
+ Memory.SRAM[0x00C6] = (uint8_t)(ypos >> 16);
+ Memory.SRAM[0x00C7] = (uint8_t)(ypos >> 24);
+ Memory.SRAM[0x00C8] = (uint8_t)(xpos);
+ Memory.SRAM[0x00C9] = (uint8_t)(xpos >> 8);
+ Memory.SRAM[0x00CA] = (uint8_t)(xpos >> 16);
+ Memory.SRAM[0x00CB] = (uint8_t)(xpos >> 24);
+ Memory.SRAM[0x00CC] = (uint8_t)(rot);
+ Memory.SRAM[0x00CD] = (uint8_t)(rot >> 8);
+ Memory.SRAM[0x00D4] = (uint8_t)(speed);
+ Memory.SRAM[0x00D5] = (uint8_t)(speed >> 8);
+ Memory.SRAM[0x00DC] = (uint8_t)(flags);
+ Memory.SRAM[0x00DD] = (uint8_t)(flags >> 8);
break;
}