aboutsummaryrefslogtreecommitdiff
path: root/source/dsp1.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/dsp1.c')
-rw-r--r--source/dsp1.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/source/dsp1.c b/source/dsp1.c
index e0ffa99..f8a0713 100644
--- a/source/dsp1.c
+++ b/source/dsp1.c
@@ -45,7 +45,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.in_index = 0;
DSP1.waiting4command = false;
DSP1.first_parameter = true;
- switch (byte) // Mario Kart uses 0x00, 0x02, 0x06, 0x0c, 0x28, 0x0a
+ switch (byte) /* Mario Kart uses 0x00, 0x02, 0x06, 0x0c, 0x28, 0x0a */
{
case 0x07:
case 0x0a:
@@ -162,7 +162,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x1f:
DSP1.out_count = 2048;
break;
- case 0x00: // Multiple
+ case 0x00: /* Multiple */
Op00Multiplicand = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op00Multiplier = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp00();
@@ -170,7 +170,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [0] = Op00Result & 0xFF;
DSP1.output [1] = (Op00Result >> 8) & 0xFF;
break;
- case 0x20: // Multiple
+ case 0x20: /* Multiple */
Op20Multiplicand = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op20Multiplier = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp20();
@@ -179,7 +179,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [1] = (Op20Result >> 8) & 0xFF;
break;
case 0x30:
- case 0x10: // Inverse
+ case 0x10: /* Inverse */
Op10Coefficient = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op10Exponent = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp10();
@@ -190,7 +190,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [3] = (uint8_t)((((int16_t) Op10ExponentR) >> 8) & 0xff);
break;
case 0x24:
- case 0x04: // Sin and Cos of angle
+ case 0x04: /* Sin and Cos of angle */
Op04Angle = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op04Radius = (uint16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp04();
@@ -200,7 +200,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [2] = (uint8_t)(Op04Cos & 0xFF);
DSP1.output [3] = (uint8_t)((Op04Cos >> 8) & 0xFF);
break;
- case 0x08: // Radius
+ case 0x08: /* Radius */
Op08X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op08Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op08Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -211,7 +211,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [2] = (uint8_t)(((int16_t) Op08Lh) & 0xFF);
DSP1.output [3] = (uint8_t)((((int16_t) Op08Lh) >> 8) & 0xFF);
break;
- case 0x18: // Range
+ case 0x18: /* Range */
Op18X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op18Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op18Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -221,7 +221,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [0] = (uint8_t)(Op18D & 0xFF);
DSP1.output [1] = (uint8_t)((Op18D >> 8) & 0xFF);
break;
- case 0x38: // Range
+ case 0x38: /* Range */
Op38X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op38Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op38Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -231,7 +231,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [0] = (uint8_t)(Op38D & 0xFF);
DSP1.output [1] = (uint8_t)((Op38D >> 8) & 0xFF);
break;
- case 0x28: // Distance (vector length)
+ case 0x28: /* Distance (vector length) */
Op28X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op28Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op28Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -241,7 +241,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [1] = (uint8_t)((Op28R >> 8) & 0xFF);
break;
case 0x2c:
- case 0x0c: // Rotate (2D rotate)
+ case 0x0c: /* Rotate (2D rotate) */
Op0CA = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op0CX1 = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op0CY1 = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -253,7 +253,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [3] = (uint8_t)((Op0CY2 >> 8) & 0xFF);
break;
case 0x3c:
- case 0x1c: // Polar (3D rotate)
+ case 0x1c: /* Polar (3D rotate) */
Op1CZ = (DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op1CY = (DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op1CX = (DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -272,7 +272,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x32:
case 0x22:
case 0x12:
- case 0x02: // Parameter (Projection)
+ case 0x02: /* Parameter (Projection) */
Op02FX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op02FY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op02FZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -291,9 +291,9 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [6] = (uint8_t)(Op02CY & 0xFF);
DSP1.output [7] = (uint8_t)((Op02CY >> 8) & 0xFF);
break;
- case 0x3a: //1a Mirror
- case 0x2a: //1a Mirror
- case 0x1a: // Raster mode 7 matrix data
+ case 0x3a: /* 1a Mirror */
+ case 0x2a: /* 1a Mirror */
+ case 0x1a: /* Raster mode 7 matrix data */
case 0x0a:
Op0AVS = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
DSPOp0A();
@@ -311,7 +311,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x16:
case 0x26:
case 0x36:
- case 0x06: // Project object
+ case 0x06: /* Project object */
Op06X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op06Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op06Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -327,7 +327,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x1e:
case 0x2e:
case 0x3e:
- case 0x0e: // Target
+ case 0x0e: /* Target */
Op0EH = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op0EV = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp0E();
@@ -337,10 +337,10 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [2] = (uint8_t)(Op0EY & 0xFF);
DSP1.output [3] = (uint8_t)((Op0EY >> 8) & 0xFF);
break;
- case 0x05: // Extra commands used by Pilot Wings
+ case 0x05: /* Extra commands used by Pilot Wings */
case 0x35:
case 0x31:
- case 0x01: // Set attitude matrix A
+ case 0x01: /* Set attitude matrix A */
Op01m = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op01Zr = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op01Yr = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -348,7 +348,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSPOp01();
break;
case 0x15:
- case 0x11: // Set attitude matrix B
+ case 0x11: /* Set attitude matrix B */
Op11m = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op11Zr = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op11Yr = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -356,7 +356,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSPOp11();
break;
case 0x25:
- case 0x21: // Set attitude matrix C
+ case 0x21: /* Set attitude matrix C */
Op21m = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op21Zr = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op21Yr = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -366,7 +366,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x09:
case 0x39:
case 0x3d:
- case 0x0d: // Objective matrix A
+ case 0x0d: /* Objective matrix A */
Op0DX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op0DY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op0DZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -380,7 +380,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [5] = (uint8_t)((Op0DU >> 8) & 0xFF);
break;
case 0x19:
- case 0x1d: // Objective matrix B
+ case 0x1d: /* Objective matrix B */
Op1DX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op1DY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op1DZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -394,7 +394,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [5] = (uint8_t)((Op1DU >> 8) & 0xFF);
break;
case 0x29:
- case 0x2d: // Objective matrix C
+ case 0x2d: /* Objective matrix C */
Op2DX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op2DY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op2DZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -408,7 +408,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [5] = (uint8_t)((Op2DU >> 8) & 0xFF);
break;
case 0x33:
- case 0x03: // Subjective matrix A
+ case 0x03: /* Subjective matrix A */
Op03F = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op03L = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op03U = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -421,7 +421,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [4] = (uint8_t)(Op03Z & 0xFF);
DSP1.output [5] = (uint8_t)((Op03Z >> 8) & 0xFF);
break;
- case 0x13: // Subjective matrix B
+ case 0x13: /* Subjective matrix B */
Op13F = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op13L = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op13U = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -434,7 +434,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.output [4] = (uint8_t)(Op13Z & 0xFF);
DSP1.output [5] = (uint8_t)((Op13Z >> 8) & 0xFF);
break;
- case 0x23: // Subjective matrix C
+ case 0x23: /* Subjective matrix C */
Op23F = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op23L = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op23U = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -645,7 +645,7 @@ void DSP2SetByte(uint8_t byte, uint16_t address)
DSP1.out_count = 32;
DSP2_Op01();
break;
- case 0x09: // Multiply - don't yet know if this is signed or unsigned
+ case 0x09: /* Multiply - don't yet know if this is signed or unsigned */
DSP2Op09Word1 = DSP1.parameters[0] | (DSP1.parameters[1] << 8);
DSP2Op09Word2 = DSP1.parameters[2] | (DSP1.parameters[3] << 8);
DSP1.out_count = 4;
@@ -729,7 +729,7 @@ bool DSP4_init = false;
void DSP4SetByte(uint8_t byte, uint16_t address)
{
- if (!DSP4_init) // bootup
+ if (!DSP4_init) /* bootup */
{
DSP4.waiting4command = 1;
DSP4_init = true;
@@ -812,7 +812,7 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4.in_index = 0;
switch (DSP4.command)
{
- case 0x0000: // 16-bit multiplication
+ case 0x0000: /* 16-bit multiplication */
{
int16_t multiplier, multiplicand;
int32_t product;
@@ -824,7 +824,7 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4_WRITE_WORD(2, product >> 16);
break;
}
- case 0x0011: // unknown: horizontal mapping command
+ case 0x0011: /* unknown: horizontal mapping command */
{
int16_t a, b, c, d, m;
a = DSP4_READ_WORD(6);
@@ -836,44 +836,44 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4_WRITE_WORD(0, m);
break;
}
- case 0x0001: // track projection
+ case 0x0001: /* track projection */
DSP4_Op01();
break;
- case 0x0007: // track projection (pass 2)
+ case 0x0007: /* track projection (pass 2) */
DSP4_Op07();
break;
- case 0x0008: // zone projections (fuel/repair/lap/teleport/...)
+ case 0x0008: /* zone projections (fuel/repair/lap/teleport/...) */
DSP4_Op08();
break;
- case 0x0009: // sprite transformation
+ case 0x0009: /* sprite transformation */
DSP4_Op09();
break;
- case 0x000D: // fast track projection
+ case 0x000D: /* fast track projection */
DSP4_Op0D();
break;
- case 0x0003: // internal memory management (01)
+ case 0x0003: /* internal memory management (01) */
{
- // reset op09 data
+ /* reset op09 data */
op09_mode = false;
break;
}
- case 0x0005: // internal memory management (06)
+ case 0x0005: /* internal memory management (06) */
{
int32_t lcv;
- // clear OAM tables
+ /* clear OAM tables */
op06_index = 0;
op06_offset = 0;
for (lcv = 0; lcv < 32; lcv++)
op06_OAM[lcv] = 0;
break;
}
- case 0x000E: // internal memory management (0D)
+ case 0x000E: /* internal memory management (0D) */
{
- // reset op09 data
+ /* reset op09 data */
op09_mode = true;
break;
}
- case 0x0006: // sprite OAM post-table data
+ case 0x0006: /* sprite OAM post-table data */
{
int32_t lcv;
DSP4.out_count = 32;
@@ -881,7 +881,7 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4.output[lcv] = op06_OAM[lcv];
break;
}
- case 0x000A: // unknown
+ case 0x000A: /* unknown */
{
int16_t out1a, out2a;
out1a = (int16_t)0xff40;
@@ -893,29 +893,29 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4_WRITE_WORD(6, out2a);
break;
}
- case 0x000B: // render player positions around track
+ case 0x000B: /* render player positions around track */
{
int16_t sp_x = DSP4_READ_WORD(0);
int16_t sp_y = DSP4_READ_WORD(2);
int16_t oam = DSP4_READ_WORD(4);
- if (!op09_mode) // Only allow 1p/1p-split to yield output (???)
+ if (!op09_mode) /* Only allow 1p/1p-split to yield output (???) */
{
- // yield OAM output
+ /* yield OAM output */
DSP4.out_count = 6;
DSP4_WRITE_WORD(0, 1);
- // pack OAM data: x,y,name,attr
+ /* pack OAM data: x,y,name,attr */
DSP4.output[2] = sp_x & 0xff;
DSP4.output[3] = sp_y & 0xff;
DSP4_WRITE_WORD(4, oam);
- // OAM: size,msb data
+ /* OAM: size,msb data */
DSP4_Op06(false, false);
}
- else // 4p mode
+ else /* 4p mode */
{
- // no OAM available
+ /* no OAM available */
DSP4.out_count = 0;
DSP4_WRITE_WORD(0, 0);
}