aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/apu.c34
-rw-r--r--source/apu.h4
-rw-r--r--source/c4.c16
-rw-r--r--source/c4emu.c106
-rw-r--r--source/cheats2.c4
-rw-r--r--source/clip.c12
-rw-r--r--source/cpu.c2
-rw-r--r--source/cpuexec.c12
-rw-r--r--source/cpuops.c44
-rw-r--r--source/display.h2
-rw-r--r--source/dma.c36
-rw-r--r--source/dsp4.h152
-rw-r--r--source/gfx.c230
-rw-r--r--source/gfx.h16
-rw-r--r--source/globals.c12
-rw-r--r--source/memmap.h4
-rw-r--r--source/port.h8
-rw-r--r--source/ppu.h17
-rw-r--r--source/sa1.h2
-rw-r--r--source/snes9x.h14
-rw-r--r--source/soundux.c8
-rw-r--r--source/soundux.h2
-rw-r--r--source/spc700.h2
-rw-r--r--source/srtc.h6
24 files changed, 372 insertions, 373 deletions
diff --git a/source/apu.c b/source/apu.c
index b051744..1c9a758 100644
--- a/source/apu.c
+++ b/source/apu.c
@@ -49,11 +49,11 @@ void S9xResetAPU()
memset(APU.OutPorts, 0, sizeof(APU.OutPorts));
IAPU.DirectPage = IAPU.RAM;
- // memmove converted: Different mallocs [Neb]
- // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ /* memmove converted: Different mallocs [Neb]
+ * DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] */
memcpy(&IAPU.RAM [0xffc0], APUROM, sizeof(APUROM));
- // memmove converted: Different mallocs [Neb]
- // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ /* memmove converted: Different mallocs [Neb]
+ * DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] */
memcpy(APU.ExtraRAM, APUROM, sizeof(APUROM));
IAPU.PC = IAPU.RAM + IAPU.RAM [0xfffe] + (IAPU.RAM [0xffff] << 8);
APU.Cycles = 0;
@@ -112,7 +112,7 @@ void S9xSetAPUDSP(uint8_t byte)
APU.DSP [APU_KON] = 0;
S9xSetEchoWriteEnable(false);
- // Kill sound
+ /* Kill sound */
S9xResetSound(false);
}
else
@@ -200,8 +200,8 @@ void S9xSetAPUDSP(uint8_t byte)
{
if ((byte & mask) != 0)
{
- // Pac-In-Time requires that channels can be key-on
- // regardeless of their current state.
+ /* Pac-In-Time requires that channels can be key-on
+ * regardeless of their current state. */
if ((APU.DSP [APU_KOFF] & mask) == 0)
{
KeyOnPrev &= ~mask;
@@ -325,14 +325,14 @@ void S9xSetAPUDSP(uint8_t byte)
void S9xFixEnvelope(int32_t channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2)
{
- if (adsr1 & 0x80) // ADSR mode
+ if (adsr1 & 0x80) /* ADSR mode */
{
- // XXX: can DSP be switched to ADSR mode directly from GAIN/INCREASE/
- // DECREASE mode? And if so, what stage of the sequence does it start
- // at?
+ /* XXX: can DSP be switched to ADSR mode directly from GAIN/INCREASE/
+ * DECREASE mode? And if so, what stage of the sequence does it start
+ * at? */
if(S9xSetSoundMode(channel, MODE_ADSR))
S9xSetSoundADSR(channel, adsr1 & 0xf, (adsr1 >> 4) & 7, adsr2 & 0x1f, (adsr2 >> 5) & 7, 8);
- } // Gain mode
+ } /* Gain mode */
else if (!(gain & 0x80))
{
if (S9xSetSoundMode(channel, MODE_GAIN))
@@ -343,7 +343,7 @@ void S9xFixEnvelope(int32_t channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2)
}
else if (gain & 0x40)
{
- // Increase mode
+ /* Increase mode */
if(S9xSetSoundMode(channel, (gain & 0x20) ? MODE_INCREASE_BENT_LINE : MODE_INCREASE_LINEAR))
S9xSetEnvelopeRate(channel, gain, 1, 127, (3 << 28) | gain);
}
@@ -396,8 +396,8 @@ void S9xSetAPUControl(uint8_t byte)
{
if (!APU.ShowROM)
{
- // memmove converted: Different mallocs [Neb]
- // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ /* memmove converted: Different mallocs [Neb]
+ * DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] */
memcpy(&IAPU.RAM [0xffc0], APUROM, sizeof(APUROM));
APU.ShowROM = true;
}
@@ -405,8 +405,8 @@ void S9xSetAPUControl(uint8_t byte)
else if (APU.ShowROM)
{
APU.ShowROM = false;
- // memmove converted: Different mallocs [Neb]
- // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb]
+ /* memmove converted: Different mallocs [Neb]
+ * DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] */
memcpy(&IAPU.RAM [0xffc0], APU.ExtraRAM, sizeof(APUROM));
}
IAPU.RAM [0xf1] = byte;
diff --git a/source/apu.h b/source/apu.h
index 0197a20..42d266f 100644
--- a/source/apu.h
+++ b/source/apu.h
@@ -78,8 +78,8 @@ void S9xSetAPUDSP(uint8_t byte);
uint8_t S9xGetAPUDSP(void);
bool S9xInitSound(void);
void S9xPrintAPUState(void);
-extern uint8_t S9xAPUCycles [256]; // Scaled cycle lengths
-extern uint8_t S9xAPUCycleLengths [256]; // Raw data.
+extern uint8_t S9xAPUCycles [256]; /* Scaled cycle lengths */
+extern uint8_t S9xAPUCycleLengths [256]; /* Raw data. */
extern void (*S9xApuOpcodes [256])(void);
#define APU_VOL_LEFT 0x00
diff --git a/source/c4.c b/source/c4.c
index 04e4d21..d784a7c 100644
--- a/source/c4.c
+++ b/source/c4.c
@@ -137,22 +137,22 @@ void C4TransfWireFrame()
c4y = C4WFYVal;
c4z = C4WFZVal - 0x95;
- // Rotate X
+ /* Rotate X */
tanval = -C4WFX2Val << 9;
c4y2 = (c4y * C4_Cos(tanval) - c4z * C4_Sin(tanval)) >> 15;
c4z2 = (c4y * C4_Sin(tanval) + c4z * C4_Cos(tanval)) >> 15;
- // Rotate Y
+ /* Rotate Y */
tanval = -C4WFY2Val << 9;
c4x2 = (c4x * C4_Cos(tanval) + c4z2 * C4_Sin(tanval)) >> 15;
c4z = (c4x * -C4_Sin(tanval) + c4z2 * C4_Cos(tanval)) >> 15;
- // Rotate Z
+ /* Rotate Z */
tanval = -C4WFDist << 9;
c4x = (c4x2 * C4_Cos(tanval) - c4y2 * C4_Sin(tanval)) >> 15;
c4y = (c4x2 * C4_Sin(tanval) + c4y2 * C4_Cos(tanval)) >> 15;
- // Scale
+ /* Scale */
C4WFXVal = (int16_t)(((int32_t)c4x * C4WFScale * 0x95) / (0x90 * (c4z + 0x95)));
C4WFYVal = (int16_t)(((int32_t)c4y * C4WFScale * 0x95) / (0x90 * (c4z + 0x95)));
}
@@ -163,22 +163,22 @@ void C4TransfWireFrame2()
c4y = C4WFYVal;
c4z = C4WFZVal;
- // Rotate X
+ /* Rotate X */
tanval = -C4WFX2Val << 9;
c4y2 = (c4y * C4_Cos(tanval) - c4z * C4_Sin(tanval)) >> 15;
c4z2 = (c4y * C4_Sin(tanval) + c4z * C4_Cos(tanval)) >> 15;
- // Rotate Y
+ /* Rotate Y */
tanval = -C4WFY2Val << 9;
c4x2 = (c4x * C4_Cos(tanval) + c4z2 * C4_Sin(tanval)) >> 15;
c4z = (c4x * -C4_Sin(tanval) + c4z2 * C4_Cos(tanval)) >> 15;
- // Rotate Z
+ /* Rotate Z */
tanval = -C4WFDist << 9;
c4x = (c4x2 * C4_Cos(tanval) - c4y2 * C4_Sin(tanval)) >> 15;
c4y = (c4x2 * C4_Sin(tanval) + c4y2 * C4_Cos(tanval)) >> 15;
- // Scale
+ /* Scale */
C4WFXVal = (int16_t)(((int32_t)c4x * C4WFScale) / 0x100);
C4WFYVal = (int16_t)(((int32_t)c4y * C4WFScale) / 0x100);
}
diff --git a/source/c4emu.c b/source/c4emu.c
index 300e421..f38c897 100644
--- a/source/c4emu.c
+++ b/source/c4emu.c
@@ -44,7 +44,7 @@ static void C4ConvOAM()
uint8_t* i;
uint8_t* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
for (i = Memory.C4RAM + 0x1fd; i > OAMptr; i -= 4)
- *i = 0xe0; // Clear OAM-to-be
+ *i = 0xe0; /* Clear OAM-to-be */
globalX = READ_WORD(Memory.C4RAM + 0x0621);
globalY = READ_WORD(Memory.C4RAM + 0x0623);
@@ -67,7 +67,7 @@ static void C4ConvOAM()
SprX = READ_WORD(srcptr) - globalX;
SprY = READ_WORD(srcptr + 2) - globalY;
SprName = srcptr[5];
- SprAttr = srcptr[4] | srcptr[0x06]; // XXX: mask bits?
+ SprAttr = srcptr[4] | srcptr[0x06]; /* XXX: mask bits? */
sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
if (*sprptr != 0)
{
@@ -76,7 +76,7 @@ static void C4ConvOAM()
for (SprCnt = *sprptr++; SprCnt > 0 && SprCount > 0; SprCnt--, sprptr += 4)
{
X = (int8_t)sprptr[1];
- if (SprAttr & 0x40) // flip X
+ if (SprAttr & 0x40) /* flip X */
X = -X - ((sprptr[0] & 0x20) ? 16 : 8);
X += SprX;
if (X >= -16 && X <= 272)
@@ -90,7 +90,7 @@ static void C4ConvOAM()
OAMptr[0] = X & 0xff;
OAMptr[1] = (uint8_t)Y;
OAMptr[2] = SprName + sprptr[3];
- OAMptr[3] = SprAttr ^ (sprptr[0] & 0xc0); // XXX: Carry from SprName addition?
+ OAMptr[3] = SprAttr ^ (sprptr[0] & 0xc0); /* XXX: Carry from SprName addition? */
*OAMptr2 &= ~(3 << offset);
if (X & 0x100)
*OAMptr2 |= 1 << offset;
@@ -140,7 +140,7 @@ static void C4DoScaleRotate(int32_t row_padding)
int32_t x, y;
uint8_t bit = 0x80;
- // Calculate matrix
+ /* Calculate matrix */
int32_t XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
if (XScale & 0x8000)
XScale = 0x7fff;
@@ -150,33 +150,33 @@ static void C4DoScaleRotate(int32_t row_padding)
if (READ_WORD(Memory.C4RAM + 0x1f80) == 0)
{
- // no rotation
- // XXX: only do this for C and D?
- // XXX: and then only when YScale is 0x1000?
+ /* no rotation
+ * XXX: only do this for C and D?
+ * XXX: and then only when YScale is 0x1000? */
A = (int16_t)XScale;
B = 0;
C = 0;
D = (int16_t)YScale;
}
- else if (READ_WORD(Memory.C4RAM + 0x1f80) == 128) // 90 degree rotation
+ else if (READ_WORD(Memory.C4RAM + 0x1f80) == 128) /* 90 degree rotation */
{
- // XXX: Really do this?
+ /* XXX: Really do this? */
A = 0;
B = (int16_t)(-YScale);
C = (int16_t)XScale;
D = 0;
}
- else if (READ_WORD(Memory.C4RAM + 0x1f80) == 256) // 180 degree rotation
+ else if (READ_WORD(Memory.C4RAM + 0x1f80) == 256) /* 180 degree rotation */
{
- // XXX: Really do this?
+ /* XXX: Really do this? */
A = (int16_t)(-XScale);
B = 0;
C = 0;
D = (int16_t)(-YScale);
}
- else if (READ_WORD(Memory.C4RAM + 0x1f80) == 384) // 270 degree rotation
+ else if (READ_WORD(Memory.C4RAM + 0x1f80) == 384) /* 270 degree rotation */
{
- // XXX: Really do this?
+ /* XXX: Really do this? */
A = 0;
B = (int16_t)YScale;
C = (int16_t)(-XScale);
@@ -190,24 +190,24 @@ static void C4DoScaleRotate(int32_t row_padding)
D = (int16_t) SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * YScale, 15);
}
- // Calculate Pixel Resolution
+ /* Calculate Pixel Resolution */
w = Memory.C4RAM[0x1f89] & ~7;
h = Memory.C4RAM[0x1f8c] & ~7;
- // Clear the output RAM
+ /* Clear the output RAM */
memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2);
Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
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.
+ /* 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. */
LineX = (Cx << 12) - Cx * A - Cx * B;
LineY = (Cy << 12) - Cy * C - Cy * D;
- // Start loop
+ /* Start loop */
for (y = 0; y < h; y++)
{
X = LineX;
@@ -224,7 +224,7 @@ static void C4DoScaleRotate(int32_t row_padding)
byte >>= 4;
}
- // De-bitplanify
+ /* De-bitplanify */
if (byte & 1)
Memory.C4RAM[outidx] |= bit;
if (byte & 2)
@@ -241,7 +241,7 @@ static void C4DoScaleRotate(int32_t row_padding)
outidx += 32;
}
- X += A; // Add 1 to output x => add an A and a C
+ X += A; /* Add 1 to output x => add an A and a C */
Y += C;
}
outidx += 2 + row_padding;
@@ -249,7 +249,7 @@ static void C4DoScaleRotate(int32_t row_padding)
outidx &= ~0x10;
else
outidx -= w * 4 + row_padding;
- LineX += B; // Add 1 to output y => add a B and a D
+ LineX += B; /* Add 1 to output y => add a B and a D */
LineY += D;
}
}
@@ -258,7 +258,7 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, int32_t X2, int32_t Y
{
int32_t i;
- // Transform coordinates
+ /* Transform coordinates */
C4WFXVal = (int16_t)X1;
C4WFYVal = (int16_t)Y1;
C4WFZVal = Z1;
@@ -277,7 +277,7 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, int32_t X2, int32_t Y
X2 = (C4WFXVal + 48) << 8;
Y2 = (C4WFYVal + 48) << 8;
- // get line info
+ /* get line info */
C4WFXVal = (int16_t)(X1 >> 8);
C4WFYVal = (int16_t)(Y1 >> 8);
C4WFX2Val = (int16_t)(X2 >> 8);
@@ -286,10 +286,10 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, int32_t X2, int32_t Y
X2 = (int16_t)C4WFXVal;
Y2 = (int16_t)C4WFYVal;
- // render line
+ /* render line */
for (i = C4WFDist ? C4WFDist : 1; i > 0; i--)
{
- //.loop
+ /*.loop */
if (X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000)
{
uint16_t addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2;
@@ -348,7 +348,7 @@ static void C4TransformLines()
C4WFDist = Memory.C4RAM[0x1f89];
C4WFScale = Memory.C4RAM[0x1f8c];
- // transform vertices
+ /* transform vertices */
ptr = Memory.C4RAM;
for (i = READ_WORD(Memory.C4RAM + 0x1f80); i > 0; i--, ptr += 0x10)
@@ -358,7 +358,7 @@ static void C4TransformLines()
C4WFZVal = READ_WORD(ptr + 9);
C4TransfWireFrame();
- // displace
+ /* displace */
WRITE_WORD(ptr + 1, C4WFXVal + 0x80);
WRITE_WORD(ptr + 5, C4WFYVal + 0x50);
}
@@ -491,25 +491,25 @@ static void S9xC4ProcessSprites()
{
switch (Memory.C4RAM[0x1f4d])
{
- case 0x00: // Build OAM
+ case 0x00: /* Build OAM */
C4ConvOAM();
break;
- case 0x03: // Scale/Rotate
+ case 0x03: /* Scale/Rotate */
C4DoScaleRotate(0);
break;
- case 0x05: // Transform Lines
+ case 0x05: /* Transform Lines */
C4TransformLines();
break;
- case 0x07: // Scale/Rotate
+ case 0x07: /* Scale/Rotate */
C4DoScaleRotate(64);
break;
- case 0x08: // Draw wireframe
+ case 0x08: /* Draw wireframe */
C4DrawWireFrame();
break;
- case 0x0b: // Disintegrate
+ case 0x0b: /* Disintegrate */
C4SprDisintegrate();
break;
- case 0x0c: // Wave
+ case 0x0c: /* Wave */
C4BitPlaneWave();
break;
default:
@@ -529,14 +529,14 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
{
switch (byte)
{
- case 0x00: // Sprite
+ case 0x00: /* Sprite */
S9xC4ProcessSprites();
break;
- case 0x01: // Draw wireframe
+ case 0x01: /* Draw wireframe */
memset(Memory.C4RAM + 0x300, 0, 16 * 12 * 3 * 4);
C4DrawWireFrame();
break;
- case 0x05: // Propulsion (?)
+ case 0x05: /* Propulsion (?) */
{
int32_t tmp = 0x10000;
if (READ_WORD(Memory.C4RAM + 0x1f83))
@@ -544,7 +544,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_WORD(Memory.C4RAM + 0x1f80, (uint16_t)tmp);
break;
}
- case 0x0d: // Set vector length
+ case 0x0d: /* Set vector length */
C41FXVal = READ_WORD(Memory.C4RAM + 0x1f80);
C41FYVal = READ_WORD(Memory.C4RAM + 0x1f83);
C41FDistVal = READ_WORD(Memory.C4RAM + 0x1f86);
@@ -554,7 +554,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_WORD(Memory.C4RAM + 0x1f89, C41FXVal);
WRITE_WORD(Memory.C4RAM + 0x1f8c, C41FYVal);
break;
- case 0x10: // Polar to rectangluar
+ case 0x10: /* Polar to rectangular */
{
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);
@@ -562,7 +562,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_3WORD(Memory.C4RAM + 0x1f89, (tmp - SAR32(tmp, 6)));
break;
}
- case 0x13: // Polar to rectangluar
+ case 0x13: /* Polar to rectangular */
{
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);
@@ -570,13 +570,13 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_3WORD(Memory.C4RAM + 0x1f89, tmp);
break;
}
- case 0x15: // Pythagorean
+ case 0x15: /* Pythagorean */
C41FXVal = READ_WORD(Memory.C4RAM + 0x1f80);
C41FYVal = READ_WORD(Memory.C4RAM + 0x1f83);
C41FDist = (int16_t)_isqrt((int32_t) C41FXVal * C41FXVal + (int32_t) C41FYVal * C41FYVal);
WRITE_WORD(Memory.C4RAM + 0x1f80, C41FDist);
break;
- case 0x1f: // atan
+ case 0x1f: /* atan */
C41FXVal = READ_WORD(Memory.C4RAM + 0x1f80);
C41FYVal = READ_WORD(Memory.C4RAM + 0x1f83);
if (C41FXVal == 0)
@@ -595,7 +595,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
}
WRITE_WORD(Memory.C4RAM + 0x1f86, C41FAngleRes);
break;
- case 0x22: // Trapezoid
+ case 0x22: /* Trapezoid */
{
int16_t angle1 = READ_WORD(Memory.C4RAM + 0x1f8c) & 0x1ff;
int16_t angle2 = READ_WORD(Memory.C4RAM + 0x1f8f) & 0x1ff;
@@ -641,7 +641,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
}
break;
}
- case 0x25: // Multiply
+ case 0x25: /* Multiply */
{
int32_t foo = READ_3WORD(Memory.C4RAM + 0x1f80);
int32_t bar = READ_3WORD(Memory.C4RAM + 0x1f83);
@@ -649,7 +649,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_3WORD(Memory.C4RAM + 0x1f80, foo);
break;
}
- case 0x2d: // Transform Coords
+ case 0x2d: /* Transform Coords */
C4WFXVal = READ_WORD(Memory.C4RAM + 0x1f81);
C4WFYVal = READ_WORD(Memory.C4RAM + 0x1f84);
C4WFZVal = READ_WORD(Memory.C4RAM + 0x1f87);
@@ -661,7 +661,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_WORD(Memory.C4RAM + 0x1f80, C4WFXVal);
WRITE_WORD(Memory.C4RAM + 0x1f83, C4WFYVal);
break;
- case 0x40: // Sum
+ case 0x40: /* Sum */
{
int32_t i;
uint16_t sum = 0;
@@ -669,7 +669,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_WORD(Memory.C4RAM + 0x1f80, sum);
break;
}
- case 0x54: // Square
+ case 0x54: /* Square */
{
int64_t a = SAR64((int64_t)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
a *= a;
@@ -677,11 +677,11 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24));
break;
}
- case 0x5c: // Immediate Reg
+ case 0x5c: /* Immediate Reg */
for (i = 0; i < 12 * 4; i++)
Memory.C4RAM [i] = C4TestPattern [i];
break;
- case 0x89: // Immediate ROM
+ case 0x89: /* Immediate ROM */
Memory.C4RAM [0x1f80] = 0x36;
Memory.C4RAM [0x1f81] = 0x43;
Memory.C4RAM [0x1f82] = 0x05;
@@ -692,7 +692,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
}
}
else if (Address == 0x7f47)
- // memmove required: Can overlap arbitrarily [Neb]
+ /* memmove required: Can overlap arbitrarily [Neb] */
memmove(Memory.C4RAM + (READ_WORD(Memory.C4RAM + 0x1f45) & 0x1fff), S9xGetMemPointer(READ_3WORD(Memory.C4RAM + 0x1f40)), READ_WORD(Memory.C4RAM + 0x1f43));
}
diff --git a/source/cheats2.c b/source/cheats2.c
index f113cd9..cc303b8 100644
--- a/source/cheats2.c
+++ b/source/cheats2.c
@@ -41,7 +41,7 @@ void S9xDeleteCheat(uint32_t which1)
if (Cheat.c [which1].enabled)
S9xRemoveCheat(which1);
- // memmove required: Overlapping addresses [Neb]
+ /* memmove required: Overlapping addresses [Neb] */
memmove(&Cheat.c [which1], &Cheat.c [which1 + 1], sizeof(Cheat.c [0]) * (Cheat.num_cheats - which1 - 1));
Cheat.num_cheats--;
}
@@ -84,7 +84,7 @@ void S9xRemoveCheat(uint32_t which1)
*(ptr + (address & 0xffff)) = Cheat.c [which1].saved_byte;
else
S9xSetByte(Cheat.c [which1].saved_byte, address);
- // Unsave the address for the next call to S9xRemoveCheat.
+ /* Unsave the address for the next call to S9xRemoveCheat. */
Cheat.c [which1].saved = false;
}
}
diff --git a/source/clip.c b/source/clip.c
index 7cafc10..cc0f48b 100644
--- a/source/clip.c
+++ b/source/clip.c
@@ -41,18 +41,18 @@ void ComputeClipWindows()
ClipData* pClip = &IPPU.Clip [0];
int32_t c, w, i;
- // Loop around the main screen then the sub-screen.
+ /* Loop around the main screen then the sub-screen. */
for (c = 0; c < 2; c++, pClip++)
{
- // Loop around the colour window then a clip window for each of the
- // background layers.
+ /* Loop around the colour window then a clip window for each of the
+ * background layers. */
for (w = 5; w >= 0; w--)
{
pClip->Count[w] = 0;
- if (w == 5) // The colour window...
+ if (w == 5) /* The colour window... */
{
- if (c == 0) // ... on the main screen
+ if (c == 0) /* ... on the main screen */
{
if ((Memory.FillRAM [0x2130] & 0xc0) == 0xc0)
{
@@ -629,5 +629,5 @@ Clip_ok:;
}
} // if (w == 5 || pClip->Count [5] ...
} // for (w...
- } // for (c...
+ } /* for (c... */
}
diff --git a/source/cpu.c b/source/cpu.c
index 1724fd6..f0d983e 100644
--- a/source/cpu.c
+++ b/source/cpu.c
@@ -51,7 +51,7 @@ void S9xResetCPU()
CPU.PCAtOpcodeStart = NULL;
CPU.WaitAddress = NULL;
CPU.WaitCounter = 1;
- CPU.Cycles = 188; // This is the cycle count just after the jump to the Reset Vector.
+ CPU.Cycles = 188; /* This is the cycle count just after the jump to the Reset Vector. */
CPU.NextEvent = Settings.HBlankStart;
CPU.V_Counter = 0;
CPU.MemSpeed = SLOW_ONE_CYCLE;
diff --git a/source/cpuexec.c b/source/cpuexec.c
index fedb318..e031483 100644
--- a/source/cpuexec.c
+++ b/source/cpuexec.c
@@ -297,8 +297,8 @@ void S9xSetIRQ(uint32_t source)
CPU.IRQCycleCount = 3;
if (CPU.WaitingForInterrupt)
{
- // Force IRQ to trigger immediately after WAI -
- // Final Fantasy Mystic Quest crashes without this.
+ /* Force IRQ to trigger immediately after WAI -
+ * Final Fantasy Mystic Quest crashes without this. */
CPU.IRQCycleCount = 0;
CPU.WaitingForInterrupt = false;
CPU.PC++;
@@ -358,10 +358,10 @@ void S9xDoHBlankProcessing_SFX()
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE)
{
- // Start of V-blank
+ /* Start of V-blank */
S9xEndScreenRefresh();
IPPU.HDMA = 0;
- // Bits 7 and 6 of $4212 are computed when read in S9xGetPPU.
+ /* Bits 7 and 6 of $4212 are computed when read in S9xGetPPU. */
PPU.ForcedBlanking = (Memory.FillRAM [0x2100] >> 7) & 1;
if (!PPU.ForcedBlanking)
@@ -488,10 +488,10 @@ void S9xDoHBlankProcessing_NoSFX()
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE)
{
- // Start of V-blank
+ /* Start of V-blank */
S9xEndScreenRefresh();
IPPU.HDMA = 0;
- // Bits 7 and 6 of $4212 are computed when read in S9xGetPPU.
+ /* Bits 7 and 6 of $4212 are computed when read in S9xGetPPU. */
PPU.ForcedBlanking = (Memory.FillRAM [0x2100] >> 7) & 1;
if (!PPU.ForcedBlanking)
diff --git a/source/cpuops.c b/source/cpuops.c
index 9a15852..e529e98 100644
--- a/source/cpuops.c
+++ b/source/cpuops.c
@@ -2382,10 +2382,10 @@ static INLINE void CPUShutdown(void)
{
if (Settings.Shutdown && CPU.PC == CPU.WaitAddress)
{
- // Don't skip cycles with a pending NMI or IRQ - could cause delayed
- // interrupt. Interrupts are delayed for a few cycles already, but
- // the delay could allow the shutdown code to cycle skip again.
- // Was causing screen flashing on Top Gear 3000.
+ /* Don't skip cycles with a pending NMI or IRQ - could cause delayed
+ * interrupt. Interrupts are delayed for a few cycles already, but
+ * the delay could allow the shutdown code to cycle skip again.
+ * Was causing screen flashing on Top Gear 3000. */
if (CPU.WaitCounter == 0 && !(CPU.Flags & (IRQ_PENDING_FLAG | NMI_FLAG)))
{
CPU.WaitAddress = NULL;
@@ -2424,7 +2424,7 @@ static INLINE void CPUShutdown(void)
}
#endif
-// From the speed-hacks branch of CatSFC
+/* From the speed-hacks branch of CatSFC */
static INLINE void ForceShutdown(void)
{
#ifndef SA1_OPCODES
@@ -3586,7 +3586,7 @@ static void Op20(void)
#endif
}
-//JSR a,x
+/* JSR a,x */
static void OpFCE1(void)
{
AbsoluteIndexedIndirect(false);
@@ -3777,7 +3777,7 @@ static void OpCB(void)
#ifdef SA1_OPCODES
SA1.WaitingForInterrupt = true;
SA1.PC--;
-#else // SA_OPCODES
+#else /* SA_OPCODES */
CPU.WaitingForInterrupt = true;
CPU.PC--;
if (Settings.Shutdown)
@@ -3799,7 +3799,7 @@ static void OpCB(void)
#endif
}
-// Usually an STP opcode; SNESAdvance speed hack, not implemented in Snes9xTYL | Snes9x-Euphoria (from the speed-hacks branch of CatSFC)
+/* Usually an STP opcode; SNESAdvance speed hack, not implemented in Snes9xTYL | Snes9x-Euphoria (from the speed-hacks branch of CatSFC) */
static void OpDB(void)
{
#ifndef NO_SPEEDHACKS
@@ -3809,12 +3809,12 @@ static void OpDB(void)
ForceShutdown();
BranchOffset = (NextByte & 0x7F) | ((NextByte & 0x40) << 1);
- // ^ -64 .. +63, sign extend bit 6 into 7 for unpacking
+ /* ^ -64 .. +63, sign extend bit 6 into 7 for unpacking */
OpAddress = ((int32_t) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff;
switch (NextByte & 0x80)
{
- case 0x00: // BNE
+ case 0x00: /* BNE */
BranchCheck();
if (!CheckZero ())
{
@@ -3825,7 +3825,7 @@ static void OpDB(void)
CPUShutdown ();
}
return;
- case 0x80: // BEQ
+ case 0x80: /* BEQ */
BranchCheck();
if (CheckZero ())
{
@@ -3843,7 +3843,7 @@ static void OpDB(void)
#endif
}
-// SNESAdvance speed hack, as implemented in Snes9xTYL / Snes9x-Euphoria (from the speed-hacks branch of CatSFC)
+/* SNESAdvance speed hack, as implemented in Snes9xTYL / Snes9x-Euphoria (from the speed-hacks branch of CatSFC) */
static void Op42(void)
{
#ifndef NO_SPEEDHACKS
@@ -3852,12 +3852,12 @@ static void Op42(void)
ForceShutdown();
- BranchOffset = 0xF0 | (NextByte & 0xF); // always negative
+ BranchOffset = 0xF0 | (NextByte & 0xF); /* always negative */
OpAddress = ((int32_t) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff;
switch (NextByte & 0xF0)
{
- case 0x10: // BPL
+ case 0x10: /* BPL */
BranchCheck();
if (!CheckNegative ())
{
@@ -3868,7 +3868,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0x30: // BMI
+ case 0x30: /* BMI */
BranchCheck();
if (CheckNegative ())
{
@@ -3879,7 +3879,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0x50: // BVC
+ case 0x50: /* BVC */
BranchCheck();
if (!CheckOverflow ())
{
@@ -3890,7 +3890,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0x70: // BVS
+ case 0x70: /* BVS */
BranchCheck();
if (CheckOverflow ())
{
@@ -3901,14 +3901,14 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0x80: // BRA
+ case 0x80: /* BRA */
CPU.PC = CPU.PCBase + OpAddress;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
CPUShutdown ();
return;
- case 0x90: // BCC
+ case 0x90: /* BCC */
BranchCheck();
if (!CheckCarry ())
{
@@ -3919,7 +3919,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0xB0: // BCS
+ case 0xB0: /* BCS */
BranchCheck();
if (CheckCarry ())
{
@@ -3930,7 +3930,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0xD0: // BNE
+ case 0xD0: /* BNE */
BranchCheck();
if (!CheckZero ())
{
@@ -3941,7 +3941,7 @@ static void Op42(void)
CPUShutdown ();
}
return;
- case 0xF0: // BEQ
+ case 0xF0: /* BEQ */
BranchCheck();
if (CheckZero ())
{
diff --git a/source/display.h b/source/display.h
index e43b80c..213955b 100644
--- a/source/display.h
+++ b/source/display.h
@@ -3,7 +3,7 @@
#ifndef _DISPLAY_H_
#define _DISPLAY_H_
-// Routines the port specific code has to implement
+/* Routines the port specific code has to implement */
uint32_t S9xReadJoypad(int32_t port);
bool S9xReadMousePosition(int32_t which1_0_to_1, int32_t* x, int32_t* y, uint32_t* buttons);
bool S9xReadSuperScopePosition(int32_t* x, int32_t* y, uint32_t* buttons);
diff --git a/source/dma.c b/source/dma.c
index 6bc7922..58aa2f1 100644
--- a/source/dma.c
+++ b/source/dma.c
@@ -39,7 +39,7 @@ void S9xDoDMA(uint8_t Channel)
d = &DMA[Channel];
count = d->TransferBytes;
- // Prepare for custom chip DMA
+ /* Prepare for custom chip DMA */
if (count == 0)
count = 0x10000;
@@ -48,9 +48,9 @@ void S9xDoDMA(uint8_t Channel)
if ((d->ABank == 0x7E || d->ABank == 0x7F) && d->BAddress == 0x80 && !d->TransferDirection)
{
d->AAddress += d->TransferBytes;
- // Does an invalid DMA actually take time?
- // I'd say yes, since 'invalid' is probably just the WRAM chip
- // not being able to read and write itself at the same time
+ /* Does an invalid DMA actually take time?
+ * I'd say yes, since 'invalid' is probably just the WRAM chip
+ * not being able to read and write itself at the same time */
CPU.Cycles += (d->TransferBytes + 1) * SLOW_ONE_CYCLE;
goto update_address;
}
@@ -67,8 +67,8 @@ void S9xDoDMA(uint8_t Channel)
if (d->AAddressFixed && Memory.FillRAM [0x4801] > 0)
{
uint8_t* in_ptr;
- // XXX: Should probably verify that we're DMAing from ROM?
- // And somewhere we should make sure we're not running across a mapping boundary too.
+ /* XXX: Should probably verify that we're DMAing from ROM?
+ * And somewhere we should make sure we're not running across a mapping boundary too. */
inc = !d->AAddressDecrement ? 1 : -1;
in_ptr = GetBasePointer(((d->ABank << 16) | d->AAddress));
@@ -96,8 +96,8 @@ void S9xDoDMA(uint8_t Channel)
}
if (d->BAddress == 0x18 && SA1.in_char_dma && (d->ABank & 0xf0) == 0x40)
{
- // Perform packed bitmap to PPU character format conversion on the
- // data before transmitting it to V-RAM via-DMA.
+ /* Perform packed bitmap to PPU character format conversion on the
+ * data before transmitting it to V-RAM via-DMA. */
int32_t i;
int32_t num_chars = 1 << ((Memory.FillRAM [0x2231] >> 2) & 7);
int32_t depth = (Memory.FillRAM [0x2231] & 3) == 0 ? 8 : (Memory.FillRAM [0x2231] & 3) == 1 ? 4 : 2;
@@ -219,7 +219,7 @@ void S9xDoDMA(uint8_t Channel)
* XXX: PPU->PPU transfers don't work).
*/
- //reflects extra cycle used by DMA
+ /* reflects extra cycle used by DMA */
CPU.Cycles += SLOW_ONE_CYCLE * (count + 1);
base = GetBasePointer((d->ABank << 16) + d->AAddress);
@@ -332,7 +332,7 @@ void S9xDoDMA(uint8_t Channel)
{
if (d->BAddress == 0x18)
{
- // Write to V-RAM
+ /* Write to V-RAM */
IPPU.FirstVRAMRead = true;
if (!PPU.VMA.FullGraphicCount)
{
@@ -375,7 +375,7 @@ void S9xDoDMA(uint8_t Channel)
}
else
{
- // DMA mode 1 general case
+ /* DMA mode 1 general case */
while (count > 1)
{
Work = *(base + p);
@@ -553,11 +553,11 @@ void S9xDoDMA(uint8_t Channel)
free(spc7110_dma);
update_address:
- // Super Punch-Out requires that the A-BUS address be updated after the DMA transfer.
+ /* Super Punch-Out requires that the A-BUS address be updated after the DMA transfer. */
Memory.FillRAM[0x4302 + (Channel << 4)] = (uint8_t) d->AAddress;
Memory.FillRAM[0x4303 + (Channel << 4)] = d->AAddress >> 8;
- // Secret of the Mana requires that the DMA bytes transfer count be set to zero when DMA has completed.
+ /* Secret of Mana requires that the DMA bytes transfer count be set to zero when DMA has completed. */
Memory.FillRAM [0x4305 + (Channel << 4)] = 0;
Memory.FillRAM [0x4306 + (Channel << 4)] = 0;
@@ -605,8 +605,8 @@ uint8_t S9xDoHDMA(uint8_t byte)
if (!p->LineCount)
{
uint8_t line;
- //remember, InDMA is set.
- //Get/Set incur no charges!
+ /* remember, InDMA is set.
+ * Get/Set incur no charges! */
CPU.Cycles += SLOW_ONE_CYCLE;
line = S9xGetByte((p->ABank << 16) + p->Address);
@@ -621,8 +621,8 @@ uint8_t S9xDoHDMA(uint8_t byte)
p->LineCount = line & 0x7f;
}
- // Disable H-DMA'ing into V-RAM (register 2118) for Hook
- /* XXX: instead of p->BAddress == 0x18, make S9xSetPPU fail
+ /* Disable H-DMA'ing into V-RAM (register 2118) for Hook
+ * XXX: instead of p->BAddress == 0x18, make S9xSetPPU fail
* XXX: writes to $2118/9 when appropriate
*/
if (!p->LineCount || p->BAddress == 0x18)
@@ -639,7 +639,7 @@ uint8_t S9xDoHDMA(uint8_t byte)
if (p->HDMAIndirectAddressing)
{
p->IndirectBank = Memory.FillRAM [0x4307 + (d << 4)];
- //again, no cycle charges while InDMA is set!
+ /* again, no cycle charges while InDMA is set! */
CPU.Cycles += SLOW_ONE_CYCLE << 2;
p->IndirectAddress = S9xGetWord((p->ABank << 16) + p->Address);
p->Address += 2;
diff --git a/source/dsp4.h b/source/dsp4.h
index 53ff365..65cd3a2 100644
--- a/source/dsp4.h
+++ b/source/dsp4.h
@@ -3,80 +3,80 @@
#ifndef _DSP4_H_
#define _DSP4_H_
-// op control
-int8_t DSP4_Logic; // controls op flow
-
-// projection format
-const int16_t PLANE_START = 0x7fff; // starting distance
-
-int16_t view_plane; // viewer location
-int16_t far_plane; // next milestone into screen
-int16_t segments; // # raster segments to draw
-int16_t raster; // current raster line
-
-int16_t project_x; // current x-position
-int16_t project_y; // current y-position
-
-int16_t project_centerx; // x-target of projection
-int16_t project_centery; // y-target of projection
-
-int16_t project_x1; // current x-distance
-int16_t project_x1low; // lower 16-bits
-int16_t project_y1; // current y-distance
-int16_t project_y1low; // lower 16-bits
-
-int16_t project_x2; // next projected x-distance
-int16_t project_y2; // next projected y-distance
-
-int16_t project_pitchx; // delta center
-int16_t project_pitchxlow; // lower 16-bits
-int16_t project_pitchy; // delta center
-int16_t project_pitchylow; // lower 16-bits
-
-int16_t project_focalx; // x-point of projection at viewer plane
-int16_t project_focaly; // y-point of projection at viewer plane
-
-int16_t project_ptr; // data structure pointer
-
-// render window
-int16_t center_x; // x-center of viewport
-int16_t center_y; // y-center of viewport
-int16_t viewport_left; // x-left of viewport
-int16_t viewport_right; // x-right of viewport
-int16_t viewport_top; // y-top of viewport
-int16_t viewport_bottom; // y-bottom of viewport
-
-// sprite structure
-int16_t sprite_x; // projected x-pos of sprite
-int16_t sprite_y; // projected y-pos of sprite
-int16_t sprite_offset; // data pointer offset
-int8_t sprite_type; // vehicle, terrain
-bool sprite_size; // sprite size: 8x8 or 16x16
-
-// path strips
-int16_t path_clipRight[4]; // value to clip to for x>b
-int16_t path_clipLeft[4]; // value to clip to for x<a
-int16_t path_pos[4]; // x-positions of lanes
-int16_t path_ptr[4]; // data structure pointers
-int16_t path_raster[4]; // current raster
-int16_t path_top[4]; // viewport_top
-
-int16_t path_y[2]; // current y-position
-int16_t path_x[2]; // current focals
-int16_t path_plane[2]; // previous plane
-
-// op09 window sorting
-int16_t multi_index1; // index counter
-int16_t multi_index2; // index counter
-bool op09_mode; // window mode
-
-// multi-op storage
-int16_t multi_focaly[64]; // focal_y values
-int16_t multi_farplane[4]; // farthest drawn distance
-int16_t multi_raster[4]; // line where track stops
-
-// OAM
-int8_t op06_OAM[32]; // OAM (size,MSB) data
-int8_t op06_index; // index into OAM table
-int8_t op06_offset; // offset into OAM table
+/* op control */
+int8_t DSP4_Logic; /* controls op flow */
+
+/* projection format */
+const int16_t PLANE_START = 0x7fff; /* starting distance */
+
+int16_t view_plane; /* viewer location */
+int16_t far_plane; /* next milestone into screen */
+int16_t segments; /* # raster segments to draw */
+int16_t raster; /* current raster line */
+
+int16_t project_x; /* current x-position */
+int16_t project_y; /* current y-position */
+
+int16_t project_centerx; /* x-target of projection */
+int16_t project_centery; /* y-target of projection */
+
+int16_t project_x1; /* current x-distance */
+int16_t project_x1low; /* lower 16-bits */
+int16_t project_y1; /* current y-distance */
+int16_t project_y1low; /* lower 16-bits */
+
+int16_t project_x2; /* next projected x-distance */
+int16_t project_y2; /* next projected y-distance */
+
+int16_t project_pitchx; /* delta center */
+int16_t project_pitchxlow; /* lower 16-bits */
+int16_t project_pitchy; /* delta center */
+int16_t project_pitchylow; /* lower 16-bits */
+
+int16_t project_focalx; /* x-point of projection at viewer plane */
+int16_t project_focaly; /* y-point of projection at viewer plane */
+
+int16_t project_ptr; /* data structure pointer */
+
+/* render window */
+int16_t center_x; /* x-center of viewport */
+int16_t center_y; /* y-center of viewport */
+int16_t viewport_left; /* x-left of viewport */
+int16_t viewport_right; /* x-right of viewport */
+int16_t viewport_top; /* y-top of viewport */
+int16_t viewport_bottom; /* y-bottom of viewport */
+
+/* sprite structure */
+int16_t sprite_x; /* projected x-pos of sprite */
+int16_t sprite_y; /* projected y-pos of sprite */
+int16_t sprite_offset; /* data pointer offset */
+int8_t sprite_type; /* vehicle, terrain */
+bool sprite_size; /* sprite size: 8x8 or 16x16 */
+
+/* path strips */
+int16_t path_clipRight[4]; /* value to clip to for x>b */
+int16_t path_clipLeft[4]; /* value to clip to for x<a */
+int16_t path_pos[4]; /* x-positions of lanes */
+int16_t path_ptr[4]; /* data structure pointers */
+int16_t path_raster[4]; /* current raster */
+int16_t path_top[4]; /* viewport_top */
+
+int16_t path_y[2]; /* current y-position */
+int16_t path_x[2]; /* current focals */
+int16_t path_plane[2]; /* previous plane */
+
+/* op09 window sorting */
+int16_t multi_index1; /* index counter */
+int16_t multi_index2; /* index counter */
+bool op09_mode; /* window mode */
+
+/* multi-op storage */
+int16_t multi_focaly[64]; /* focal_y values */
+int16_t multi_farplane[4]; /* farthest drawn distance */
+int16_t multi_raster[4]; /* line where track stops */
+
+/* OAM */
+int8_t op06_OAM[32]; /* OAM (size,MSB) data */
+int8_t op06_index; /* index into OAM table */
+int8_t op06_offset; /* offset into OAM table */
#endif
diff --git a/source/gfx.c b/source/gfx.c
index cc946aa..0059d63 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -240,8 +240,8 @@ bool S9xInitGFX(void)
return false;
}
- // Build a lookup table that multiplies a packed RGB value by 2 with
- // saturation.
+ /* Build a lookup table that multiplies a packed RGB value by 2 with
+ * saturation. */
for (r = 0; r <= MAX_RED; r++)
{
uint32_t r2 = r << 1;
@@ -264,9 +264,9 @@ bool S9xInitGFX(void)
}
memset(GFX.ZERO, 0, 0x10000 * sizeof(uint16_t));
memset(GFX.ZERO_OR_X2, 0, 0x10000 * sizeof(uint16_t));
- // Build a lookup table that if the top bit of the color value is zero
- // then the value is zero, otherwise multiply the value by 2. Used by
- // the color subtraction code.
+ /* Build a lookup table that if the top bit of the color value is zero
+ * then the value is zero, otherwise multiply the value by 2. Used by
+ * the color subtraction code. */
for (r = 0; r <= MAX_RED; r++)
{
uint32_t r2 = r;
@@ -297,8 +297,8 @@ bool S9xInitGFX(void)
}
}
- // Build a lookup table that if the top bit of the color value is zero
- // then the value is zero, otherwise its just the value.
+ /* Build a lookup table that if the top bit of the color value is zero
+ * then the value is zero, otherwise its just the value. */
for (r = 0; r <= MAX_RED; r++)
{
uint32_t r2 = r;
@@ -332,7 +332,7 @@ bool S9xInitGFX(void)
void S9xDeinitGFX(void)
{
- // Free any memory allocated in S9xInitGFX
+ /* Free any memory allocated in S9xInitGFX */
if (GFX.X2)
{
free(GFX.X2);
@@ -355,7 +355,7 @@ void S9xBuildDirectColourMaps(void)
uint32_t p, c;
for (p = 0; p < 8; p++)
for (c = 0; c < 256; c++)
- DirectColourMaps [p][c] = BUILD_PIXEL(((c & 7) << 2) | ((p & 1) << 1), ((c & 0x38) >> 1) | (p & 2), ((c & 0xc0) >> 3) | (p & 4)); // XXX: Brightness
+ DirectColourMaps [p][c] = BUILD_PIXEL(((c & 7) << 2) | ((p & 1) << 1), ((c & 0x38) >> 1) | (p & 2), ((c & 0xc0) >> 3) | (p & 4)); /* XXX: Brightness */
IPPU.DirectColourMapsNeedRebuild = false;
}
@@ -453,7 +453,7 @@ void RenderLine(uint8_t C)
else
{
/* if we're not rendering this frame, we still need to update this */
- // XXX: Check ForceBlank? Or anything else?
+ /* XXX: Check ForceBlank? Or anything else? */
if (IPPU.OBJChanged)
S9xSetupOBJ();
PPU.RangeTimeOver |= GFX.OBJLines[C].RTOFlags;
@@ -516,7 +516,7 @@ static INLINE void SelectTileRenderer(bool normal)
}
else
{
- // Fixed colour addition
+ /* Fixed colour addition */
DrawTilePtr = DrawTile16FixedAdd1_2;
DrawClippedTilePtr = DrawClippedTile16FixedAdd1_2;
}
@@ -535,7 +535,7 @@ static INLINE void SelectTileRenderer(bool normal)
}
else
{
- // Fixed colour substraction
+ /* Fixed colour substraction */
DrawTilePtr = DrawTile16FixedSub1_2;
DrawClippedTilePtr = DrawClippedTile16FixedSub1_2;
}
@@ -650,8 +650,8 @@ void S9xSetupOBJ(void)
GFX.OBJLines[Y].OBJ[LineOBJ[Y]].Sprite = S;
if (PPU.OBJ[S].VFlip)
{
- // Yes, Width not Height. It so happens that the
- // sprites with H = 2 * W flip as two W * W sprites.
+ /* Yes, Width not Height. It so happens that the
+ * sprites with H = 2 * W flip as two W * W sprites. */
GFX.OBJLines[Y].OBJ[LineOBJ[Y]].Line = line ^ (GFX.OBJWidths[S] - 1);
}
else
@@ -663,7 +663,7 @@ void S9xSetupOBJ(void)
} while (S != FirstSprite);
for (Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++)
- if (LineOBJ[Y] < 32) // Add the sentinel
+ if (LineOBJ[Y] < 32) /* Add the sentinel */
GFX.OBJLines[Y].OBJ[LineOBJ[Y]].Sprite = -1;
for (Y = 1; Y < SNES_HEIGHT_EXTENDED; Y++)
GFX.OBJLines[Y].RTOFlags |= GFX.OBJLines[Y - 1].RTOFlags;
@@ -715,8 +715,8 @@ void S9xSetupOBJ(void)
}
if (PPU.OBJ[S].VFlip)
{
- // Yes, Width not Height. It so happens that the
- // sprites with H=2*W flip as two WxW sprites.
+ /* Yes, Width not Height. It so happens that the
+ * sprites with H=2*W flip as two WxW sprites. */
OBJOnLine[Y][S] = (line ^ (GFX.OBJWidths[S] - 1)) | 0x80;
}
else
@@ -808,7 +808,7 @@ static void DrawOBJS(bool OnMain, uint8_t D)
Windows[j].Value = true;
else
{
- // memmove required: Overlapping addresses [Neb]
+ /* memmove required: Overlapping addresses [Neb] */
if (j < i)
memmove(&Windows[j + 1], &Windows[j], sizeof(Windows[0]) * (i - j));
Windows[j].Pos = GFX.pCurrentClip->Left[clip][4];
@@ -818,7 +818,7 @@ static void DrawOBJS(bool OnMain, uint8_t D)
for (j = 0; j < i && Windows[j].Pos < GFX.pCurrentClip->Right[clip][4]; j++);
if (j >= i || Windows[j].Pos != GFX.pCurrentClip->Right[clip][4])
{
- // memmove required: Overlapping addresses [Neb]
+ /* memmove required: Overlapping addresses [Neb] */
if (j < i)
memmove(&Windows[j + 1], &Windows[j], sizeof(Windows[0]) * (i - j));
Windows[j].Pos = GFX.pCurrentClip->Right[clip][4];
@@ -830,10 +830,10 @@ static void DrawOBJS(bool OnMain, uint8_t D)
if (PPU.BGMode == 5 || PPU.BGMode == 6)
{
- // Bah, OnMain is never used except to determine if calling
- // SelectTileRenderer is necessary. So let's hack it to false here
- // to stop SelectTileRenderer from being called when it causes
- // problems.
+ /* Bah, OnMain is never used except to determine if calling
+ * SelectTileRenderer is necessary. So let's hack it to false here
+ * to stop SelectTileRenderer from being called when it causes
+ * problems. */
OnMain = false;
GFX.PixSize = 2;
if (IPPU.DoubleHeightPixels)
@@ -1084,15 +1084,15 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
Tile = READ_2BYTES(t);
GFX.Z1 = GFX.Z2 = depths [(Tile & 0x2000) >> 13];
- // Draw tile...
+ /* Draw tile... */
if (BG.TileSize != 8)
{
if (Tile & H_FLIP)
{
- // Horizontal flip, but what about vertical flip ?
+ /* Horizontal flip, but what about vertical flip ? */
if (Tile & V_FLIP)
{
- // Both horzontal & vertical flip
+ /* Both horzontal & vertical flip */
if (Rem16 < 8)
(*DrawLargePixelPtr)(Tile + 17 - (Quot & 1), s, HPos & 7, PixWidth, VirtAlign, Lines);
else
@@ -1100,7 +1100,7 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
}
else
{
- // Horizontal flip only
+ /* Horizontal flip only */
if (Rem16 > 7)
(*DrawLargePixelPtr)(Tile + 17 - (Quot & 1), s, HPos & 7, PixWidth, VirtAlign, Lines);
else
@@ -1109,10 +1109,10 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
}
else
{
- // No horizontal flip, but is there a vertical flip ?
+ /* No horizontal flip, but is there a vertical flip ? */
if (Tile & V_FLIP)
{
- // Vertical flip only
+ /* Vertical flip only */
if (Rem16 < 8)
(*DrawLargePixelPtr)(Tile + 16 + (Quot & 1), s, HPos & 7, PixWidth, VirtAlign, Lines);
else
@@ -1120,7 +1120,7 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
}
else
{
- // Normal unflipped
+ /* Normal unflipped */
if (Rem16 > 7)
(*DrawLargePixelPtr)(Tile + 16 + (Quot & 1), s, HPos & 7, PixWidth, VirtAlign, Lines);
else
@@ -1301,17 +1301,17 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
{
if (left_hand_edge)
{
- // The SNES offset-per-tile background mode has a
- // hardware limitation that the offsets cannot be set
- // for the tile at the left-hand edge of the screen.
+ /* The SNES offset-per-tile background mode has a
+ * hardware limitation that the offsets cannot be set
+ * for the tile at the left-hand edge of the screen. */
VOffset = LineData [Y].BG[bg].VOffset;
HOffset = LineHOffset;
left_hand_edge = false;
}
else
{
- // All subsequent offset tile data is shifted left by one,
- // hence the - 1 below.
+ /* All subsequent offset tile data is shifted left by one,
+ * hence the - 1 below. */
Quot2 = ((HOff + Left - 1) & OffsetMask) >> 3;
if (Quot2 > 31)
@@ -1341,12 +1341,12 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
else
VOffset = LineData [Y].BG[bg].VOffset;
- //MKendora Strike Gunner fix
+ /* MKendora Strike Gunner fix */
if ((HCellOffset & OffsetEnableMask))
HOffset = (HCellOffset & ~7) | (LineHOffset & 7);
else
HOffset = LineHOffset;
- //end MK
+ /* end MK */
}
}
VirtAlign = ((Y + VOffset) & 7) << 3;
@@ -1407,16 +1407,16 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
(*DrawClippedTilePtr)(Tile, s, Offset, Count, VirtAlign, Lines);
else
{
- if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawClippedTilePtr)(Tile + t1 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawClippedTilePtr)(Tile + t2 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawClippedTilePtr)(Tile + t1 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawClippedTilePtr)(Tile + t2 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
@@ -1569,7 +1569,7 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
t = b1 + (Quot >> 1);
Width = Right - Left;
- // Left hand edge clipped tile
+ /* Left hand edge clipped tile */
if (HPos & 7)
{
int32_t Offset = (HPos & 7);
@@ -1582,23 +1582,23 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
if (BG.TileSize == 8)
{
- if (!(Tile & H_FLIP)) // Normal, unflipped
+ if (!(Tile & H_FLIP)) /* Normal, unflipped */
(*DrawHiResClippedTilePtr)(Tile + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
- else // H flip
+ else /* H flip */
(*DrawHiResClippedTilePtr)(Tile + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
else
{
- if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawHiResClippedTilePtr)(Tile + t1 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawHiResClippedTilePtr)(Tile + t2 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawHiResClippedTilePtr)(Tile + t1 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawHiResClippedTilePtr)(Tile + t2 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
@@ -1611,7 +1611,7 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
s += (IPPU.HalfWidthPixels ? 4 : 8);
}
- // Middle, unclipped tiles
+ /* Middle, unclipped tiles */
Count = Width - Count;
Middle = Count >> 3;
Count &= 7;
@@ -1622,23 +1622,23 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
GFX.Z1 = GFX.Z2 = depths [(Tile & 0x2000) >> 13];
if (BG.TileSize == 8)
{
- if (!(Tile & H_FLIP)) // Normal, unflipped
+ if (!(Tile & H_FLIP)) /* Normal, unflipped */
(*DrawHiResTilePtr)(Tile + (Quot & 1), s, VirtAlign, Lines);
- else // H flip
+ else /* H flip */
(*DrawHiResTilePtr)(Tile + 1 - (Quot & 1), s, VirtAlign, Lines);
}
else
{
- if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawHiResTilePtr)(Tile + t1 + (Quot & 1), s, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawHiResTilePtr)(Tile + t2 + 1 - (Quot & 1), s, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawHiResTilePtr)(Tile + t1 + 1 - (Quot & 1), s, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawHiResTilePtr)(Tile + t2 + (Quot & 1), s, VirtAlign, Lines);
}
@@ -1649,30 +1649,30 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
t = b1;
}
- // Right-hand edge clipped tiles
+ /* Right-hand edge clipped tiles */
if (Count)
{
Tile = READ_2BYTES(t);
GFX.Z1 = GFX.Z2 = depths [(Tile & 0x2000) >> 13];
if (BG.TileSize == 8)
{
- if (!(Tile & H_FLIP)) // Normal, unflipped
+ if (!(Tile & H_FLIP)) /* Normal, unflipped */
(*DrawHiResClippedTilePtr)(Tile + (Quot & 1), s, 0, Count, VirtAlign, Lines);
- else // H flip
+ else /* H flip */
(*DrawHiResClippedTilePtr)(Tile + 1 - (Quot & 1), s, 0, Count, VirtAlign, Lines);
}
else
{
- if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawHiResClippedTilePtr)(Tile + t1 + (Quot & 1), s, 0, Count, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawHiResClippedTilePtr)(Tile + t2 + 1 - (Quot & 1), s, 0, Count, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawHiResClippedTilePtr)(Tile + t1 + 1 - (Quot & 1), s, 0, Count, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawHiResClippedTilePtr)(Tile + t2 + (Quot & 1), s, 0, Count, VirtAlign, Lines);
}
}
@@ -1716,12 +1716,12 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
switch (BGMode)
{
case 2:
- case 4: // Used by Puzzle Bobble
+ case 4: /* Used by Puzzle Bobble */
DrawBackgroundOffset(BGMode, bg, Z1, Z2);
return;
case 5:
- case 6: // XXX: is also offset per tile.
+ case 6: /* XXX: is also offset per tile. */
DrawBackgroundMode5(bg, Z1, Z2);
return;
}
@@ -1860,7 +1860,7 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
}
Width = Right - Left;
- // Left hand edge clipped tile
+ /* Left hand edge clipped tile */
if (HPos & 7)
{
uint32_t Offset = (HPos & 7);
@@ -1873,16 +1873,16 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
if (BG.TileSize == 8)
(*DrawClippedTilePtr)(Tile, s, Offset, Count, VirtAlign, Lines);
- else if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ else if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawClippedTilePtr)(Tile + t1 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawClippedTilePtr)(Tile + t2 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawClippedTilePtr)(Tile + t1 + 1 - (Quot & 1), s, Offset, Count, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawClippedTilePtr)(Tile + t2 + (Quot & 1), s, Offset, Count, VirtAlign, Lines);
if (BG.TileSize == 8)
@@ -1905,7 +1905,7 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
s += (IPPU.HalfWidthPixels ? 4 : 8) * GFX.PixSize;
}
- // Middle, unclipped tiles
+ /* Middle, unclipped tiles */
Count = Width - Count;
Middle = Count >> 3;
Count &= 7;
@@ -1917,16 +1917,16 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
if (BG.TileSize != 8)
{
- if (Tile & H_FLIP) // Horizontal flip, but what about vertical flip?
+ if (Tile & H_FLIP) /* Horizontal flip, but what about vertical flip? */
{
- if (Tile & V_FLIP) // Both horzontal & vertical flip
+ if (Tile & V_FLIP) /* Both horzontal & vertical flip */
(*DrawTilePtr)(Tile + t2 + 1 - (Quot & 1), s, VirtAlign, Lines);
- else // Horizontal flip only
+ else /* Horizontal flip only */
(*DrawTilePtr)(Tile + t1 + 1 - (Quot & 1), s, VirtAlign, Lines);
}
- else if (Tile & V_FLIP) // Vertical flip only
+ else if (Tile & V_FLIP) /* Vertical flip only */
(*DrawTilePtr)(Tile + t2 + (Quot & 1), s, VirtAlign, Lines);
- else // Normal unflipped
+ else /* Normal unflipped */
(*DrawTilePtr)(Tile + t1 + (Quot & 1), s, VirtAlign, Lines);
}
else
@@ -1949,7 +1949,7 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
t = b1;
}
}
- // Right-hand edge clipped tiles
+ /* Right-hand edge clipped tiles */
if (Count)
{
Tile = READ_2BYTES(t);
@@ -1959,16 +1959,16 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
(*DrawClippedTilePtr)(Tile, s, 0, Count, VirtAlign, Lines);
else
{
- if (!(Tile & (V_FLIP | H_FLIP))) // Normal, unflipped
+ if (!(Tile & (V_FLIP | H_FLIP))) /* Normal, unflipped */
(*DrawClippedTilePtr)(Tile + t1 + (Quot & 1), s, 0, Count, VirtAlign, Lines);
else if (Tile & H_FLIP)
{
- if (Tile & V_FLIP) // H & V flip
+ if (Tile & V_FLIP) /* H & V flip */
(*DrawClippedTilePtr)(Tile + t2 + 1 - (Quot & 1), s, 0, Count, VirtAlign, Lines);
- else // H flip only
+ else /* H flip only */
(*DrawClippedTilePtr)(Tile + t1 + 1 - (Quot & 1), s, 0, Count, VirtAlign, Lines);
}
- else // V flip only
+ else /* V flip only */
(*DrawClippedTilePtr)(Tile + t2 + (Quot & 1), s, 0, Count, VirtAlign, Lines);
}
}
@@ -2730,7 +2730,7 @@ void S9xUpdateScreen(void)
if ((GFX.EndY = IPPU.CurrentLine - 1) >= PPU.ScreenHeight)
GFX.EndY = PPU.ScreenHeight - 1;
- // XXX: Check ForceBlank? Or anything else?
+ /* XXX: Check ForceBlank? Or anything else? */
PPU.RangeTimeOver |= GFX.OBJLines[GFX.EndY].RTOFlags;
uint32_t starty = GFX.StartY;
@@ -2752,8 +2752,8 @@ void S9xUpdateScreen(void)
if ((PPU.BGMode == 5 || PPU.BGMode == 6) && !IPPU.DoubleWidthPixels)
{
- // The game has switched from lo-res to hi-res mode part way down
- // the screen. Scale any existing lo-res pixels on screen
+ /* The game has switched from lo-res to hi-res mode part way down
+ * the screen. Scale any existing lo-res pixels on screen */
uint32_t y;
for (y = 0; y < starty; y++)
{
@@ -2766,8 +2766,8 @@ void S9xUpdateScreen(void)
IPPU.DoubleWidthPixels = true;
IPPU.HalfWidthPixels = false;
}
- // BJ: And we have to change the height if Interlace gets set,
- // too.
+ /* BJ: And we have to change the height if Interlace gets set,
+ * too. */
if (IPPU.Interlace && !IPPU.DoubleHeightPixels)
{
starty = GFX.StartY * 2;
@@ -2779,15 +2779,15 @@ void S9xUpdateScreen(void)
GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
- // The game has switched from non-interlaced to interlaced mode
- // part way down the screen. Scale everything.
+ /* The game has switched from non-interlaced to interlaced mode
+ * part way down the screen. Scale everything. */
int32_t y;
for (y = (int32_t) GFX.StartY - 1; y >= 0; y--)
{
- // memmove converted: Same malloc, different addresses, and identical addresses at line 0 [Neb]
- // DS2 DMA notes: This code path is unused [Neb]
+ /* memmove converted: Same malloc, different addresses, and identical addresses at line 0 [Neb]
+ * DS2 DMA notes: This code path is unused [Neb] */
memcpy(GFX.Screen + y * 2 * GFX.Pitch2, GFX.Screen + y * GFX.Pitch2, GFX.Pitch2);
- // memmove converted: Same malloc, different addresses [Neb]
+ /* memmove converted: Same malloc, different addresses [Neb] */
memcpy(GFX.Screen + (y * 2 + 1) * GFX.Pitch2, GFX.Screen + y * GFX.Pitch2, GFX.Pitch2);
}
}
@@ -2809,14 +2809,14 @@ void S9xUpdateScreen(void)
GFX.FixedColour = BUILD_PIXEL(IPPU.XB [PPU.FixedColourRed], IPPU.XB [PPU.FixedColourGreen], IPPU.XB [PPU.FixedColourBlue]);
- // Clear the z-buffer, marking areas 'covered' by the fixed
- // colour as depth 1.
+ /* Clear the z-buffer, marking areas 'covered' by the fixed
+ * colour as depth 1. */
pClip = &IPPU.Clip [1];
- // Clear the z-buffer
+ /* Clear the z-buffer */
if (pClip->Count [5])
{
- // Colour window enabled.
+ /* Colour window enabled. */
uint32_t y;
for (y = starty; y <= endy; y++)
{
@@ -2840,10 +2840,10 @@ void S9xUpdateScreen(void)
if (IPPU.Clip [0].Count [5])
{
- // Blast, have to clear the sub-screen to the fixed-colour
- // because there is a colour window in effect clipping
- // the main screen that will allow the sub-screen
- // 'underneath' to show through.
+ /* Blast, have to clear the sub-screen to the fixed-colour
+ * because there is a colour window in effect clipping
+ * the main screen that will allow the sub-screen
+ * 'underneath' to show through. */
uint16_t* p = (uint16_t*)(GFX.SubScreen + y * GFX.Pitch2);
uint16_t* q = p + pClip->Right [c][5] * x2;
@@ -2866,10 +2866,10 @@ void S9xUpdateScreen(void)
if (IPPU.Clip [0].Count [5])
{
- // Blast, have to clear the sub-screen to the fixed-colour
- // because there is a colour window in effect clipping
- // the main screen that will allow the sub-screen
- // 'underneath' to show through.
+ /* Blast, have to clear the sub-screen to the fixed-colour
+ * because there is a colour window in effect clipping
+ * the main screen that will allow the sub-screen
+ * 'underneath' to show through. */
uint32_t b = GFX.FixedColour | (GFX.FixedColour << 16);
uint32_t* p = (uint32_t*)(GFX.SubScreen + y * GFX.Pitch2);
uint32_t* q = (uint32_t*)((uint16_t*) p + IPPU.RenderedScreenWidth);
@@ -2972,7 +2972,7 @@ void S9xUpdateScreen(void)
}
else
{
- // Subtract
+ /* Subtract */
uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
@@ -3058,10 +3058,10 @@ void S9xUpdateScreen(void)
{
if (!pClip->Count [5])
{
- // The backdrop has not been cleared yet - so
- // copy the sub-screen to the main screen
- // or fill it with the back-drop colour if the
- // sub-screen is clear.
+ /* The backdrop has not been cleared yet - so
+ * copy the sub-screen to the main screen
+ * or fill it with the back-drop colour if the
+ * sub-screen is clear. */
uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
@@ -3089,11 +3089,11 @@ void S9xUpdateScreen(void)
}
}
}
- } // --if (SUB_OR_ADD(5))
+ } /* --if (SUB_OR_ADD(5)) */
else
{
uint32_t y;
- // Subscreen not being added to back
+ /* Subscreen not being added to back */
uint32_t back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
pClip = &IPPU.Clip [0];
@@ -3139,11 +3139,11 @@ void S9xUpdateScreen(void)
}
}
}
- } //force blanking
+ } /* force blanking */
else
{
- // 16bit and transparency but currently no transparency effects in
- // operation.
+ /* 16bit and transparency but currently no transparency effects in
+ * operation. */
uint32_t back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
@@ -3200,8 +3200,8 @@ void S9xUpdateScreen(void)
if (PPU.BGMode != 5 && PPU.BGMode != 6 && IPPU.DoubleWidthPixels)
{
- // Mixture of background modes used on screen - scale width
- // of all non-mode 5 and 6 pixels.
+ /* Mixture of background modes used on screen - scale width
+ * of all non-mode 5 and 6 pixels. */
uint32_t y;
for (y = starty; y <= endy; y++)
{
@@ -3213,7 +3213,7 @@ void S9xUpdateScreen(void)
}
}
- // Double the height of the pixels just drawn
+ /* Double the height of the pixels just drawn */
FIX_INTERLACE(GFX.Screen, false, GFX.ZBuffer);
IPPU.PreviousLine = IPPU.CurrentLine;
diff --git a/source/gfx.h b/source/gfx.h
index 5599527..582f7c2 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -36,17 +36,17 @@ typedef struct
uint16_t* X2;
uint16_t* ZERO_OR_X2;
uint16_t* ZERO;
- uint32_t RealPitch; // True pitch of Screen buffer.
- uint32_t Pitch2; // Same as RealPitch except while using speed up hack for Glide.
- uint32_t ZPitch; // Pitch of ZBuffer
- uint32_t PPL; // Number of pixels on each of Screen buffer
+ uint32_t RealPitch; /* True pitch of Screen buffer. */
+ uint32_t Pitch2; /* Same as RealPitch except while using speed up hack for Glide. */
+ uint32_t ZPitch; /* Pitch of ZBuffer */
+ uint32_t PPL; /* Number of pixels on each of Screen buffer */
uint32_t PPLx2;
uint32_t PixSize;
uint8_t* S;
uint8_t* DB;
ptrdiff_t DepthDelta;
- uint8_t Z1; // Depth for comparison
- uint8_t Z2; // Depth to save
+ uint8_t Z1; /* Depth for comparison */
+ uint8_t Z2; /* Depth to save */
uint32_t FixedColour;
uint32_t StartY;
uint32_t EndY;
@@ -75,7 +75,7 @@ typedef struct
bool Pseudo;
} SGFX;
-// External port interface which must be implemented or initialised for each port.
+/* External port interface which must be implemented or initialised for each port. */
extern SGFX GFX;
typedef struct
@@ -126,7 +126,7 @@ extern uint16_t DirectColourMaps [8][256];
extern uint8_t mul_brightness [16][32];
-// Could use BSWAP instruction on Intel port...
+/* Could use BSWAP instruction on Intel port... */
#define SWAP_DWORD(dword) dword = ((((dword) & 0x000000ff) << 24) \
| (((dword) & 0x0000ff00) << 8) \
| (((dword) & 0x00ff0000) >> 8) \
diff --git a/source/globals.c b/source/globals.c
index 36d0e67..233ca42 100644
--- a/source/globals.c
+++ b/source/globals.c
@@ -84,7 +84,7 @@ uint16_t SignExtend [2] =
0x00, 0xff00
};
-//modified per anomie Mode 5 findings
+/*modified per anomie Mode 5 findings */
int32_t HDMA_ModeByteCounts [8] =
{
1, 2, 2, 4, 4, 4, 2, 4
@@ -92,8 +92,8 @@ int32_t HDMA_ModeByteCounts [8] =
uint8_t BitShifts[8][4] =
{
- {2, 2, 2, 2}, // 0
- {4, 4, 2, 0}, // 1
+ {2, 2, 2, 2}, /* 0 */
+ {4, 4, 2, 0}, /* 1 */
{4, 4, 0, 0}, // 2
{8, 4, 0, 0}, // 3
{8, 2, 0, 0}, // 4
@@ -192,7 +192,7 @@ uint8_t APUROM [64] =
0xF6, 0xDA, 0x00, 0xBA, 0xF4, 0xC4, 0xF4, 0xDD, 0x5D, 0xD0, 0xDB, 0x1F, 0x00, 0x00, 0xC0, 0xFF
};
-// Raw SPC700 instruction cycle lengths
+/* Raw SPC700 instruction cycle lengths */
uint8_t S9xAPUCycleLengths [256] =
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
@@ -214,8 +214,8 @@ uint8_t S9xAPUCycleLengths [256] =
/* f0 */ 2, 8, 4, 5, 4, 5, 5, 6, 3, 4, 5, 4, 2, 2, 4, 3
};
-// Actual data used by CPU emulation, will be scaled by APUReset routine
-// to be relative to the 65c816 instruction lengths.
+/* Actual data used by CPU emulation, will be scaled by APUReset routine
+ * to be relative to the 65c816 instruction lengths. */
uint8_t S9xAPUCycles [256] =
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
diff --git a/source/memmap.h b/source/memmap.h
index 157f4f3..a17a207 100644
--- a/source/memmap.h
+++ b/source/memmap.h
@@ -27,7 +27,7 @@
#define MEMMAP_SHIFT 12
#define MEMMAP_MASK (MEMMAP_BLOCK_SIZE - 1)
-//Extended ROM Formats
+/* Extended ROM Formats */
#define NOPE 0
#define YEAH 1
#define BIGFIRST 2
@@ -150,4 +150,4 @@ uint8_t* S9xGetMemPointer(uint32_t Address);
uint8_t* GetBasePointer(uint32_t Address);
extern uint8_t OpenBus;
-#endif // _memmap_h_
+#endif /* _memmap_h_ */
diff --git a/source/port.h b/source/port.h
index dfd08f1..c2a9b7f 100644
--- a/source/port.h
+++ b/source/port.h
@@ -13,8 +13,8 @@
#else
#define PIXEL_FORMAT RGB565
#endif
-// The above is used to disable the 16-bit graphics mode checks sprinkled
-// throughout the code, if the pixel format is always 16-bit.
+/* The above is used to disable the 16-bit graphics mode checks sprinkled
+ * throughout the code, if the pixel format is always 16-bit. */
#include "pixform.h"
@@ -57,8 +57,8 @@ void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__WIN32__) || defined(__alpha__)
#define FAST_LSB_WORD_ACCESS
#elif defined(__MIPSEL__)
-// On little-endian MIPS, a 16-bit word can be read directly from an address
-// only if it's aligned.
+/* On little-endian MIPS, a 16-bit word can be read directly from an address
+ * only if it's aligned. */
#define FAST_ALIGNED_LSB_WORD_ACCESS
#endif
diff --git a/source/ppu.h b/source/ppu.h
index fef59d3..e04c4ad 100644
--- a/source/ppu.h
+++ b/source/ppu.h
@@ -188,10 +188,10 @@ typedef struct
uint16_t Address;
uint8_t BAddress;
- // General DMA only:
+ /* General DMA only: */
uint16_t TransferBytes;
- // H-DMA only:
+ /* H-DMA only: */
bool HDMAIndirectAddressing;
uint16_t IndirectAddress;
uint8_t IndirectBank;
@@ -240,7 +240,7 @@ extern SnesModel M2SNES;
#define MAX_5A22_VERSION 0x02
#define MAX_5C78_VERSION 0x03
-//Platform specific input functions used by PPU.CPP
+/* Platform specific input functions used by PPU.C */
void JustifierButtons(uint32_t*);
bool JustifierOffscreen(void);
@@ -262,7 +262,7 @@ static INLINE void REGISTER_2104(uint8_t byte)
PPU.OAMData [addr] = byte;
IPPU.OBJChanged = true;
- // X position high bit, and sprite size (x4)
+ /* X position high bit, and sprite size (x4) */
pObj = &PPU.OBJ [(addr & 0x1f) * 4];
pObj->HPos = (pObj->HPos & 0xFF) | SignExtend[(byte >> 0) & 1];
@@ -314,10 +314,9 @@ static INLINE void REGISTER_2104(uint8_t byte)
IPPU.OBJChanged = true;
if (addr & 2)
{
- // Tile
+ /* Tile */
PPU.OBJ[addr = PPU.OAMAddr >> 1].Name = PPU.OAMWriteRegister & 0x1ff;
-
- // priority, h and v flip.
+ /* priority, h and v flip. */
PPU.OBJ[addr].Palette = (highbyte >> 1) & 7;
PPU.OBJ[addr].Priority = (highbyte >> 4) & 3;
PPU.OBJ[addr].HFlip = (highbyte >> 6) & 1;
@@ -325,11 +324,11 @@ static INLINE void REGISTER_2104(uint8_t byte)
}
else
{
- // X position (low)
+ /* X position (low) */
PPU.OBJ[addr = PPU.OAMAddr >> 1].HPos &= 0xFF00;
PPU.OBJ[addr].HPos |= lowbyte;
- // Sprite Y position
+ /* Sprite Y position */
PPU.OBJ[addr].VPos = highbyte;
}
}
diff --git a/source/sa1.h b/source/sa1.h
index 6679a1c..cf6cdb3 100644
--- a/source/sa1.h
+++ b/source/sa1.h
@@ -48,7 +48,7 @@ typedef struct
uint8_t* WriteMap [MEMMAP_NUM_BLOCKS];
int16_t op1;
int16_t op2;
- int arithmetic_op; // For savestate compatibility can't change to int32_t
+ int arithmetic_op; /* For savestate compatibility can't change to int32_t */
int64_t sum;
bool overflow;
uint8_t VirtualBitmapFormat;
diff --git a/source/snes9x.h b/source/snes9x.h
index 536642b..fdeae61 100644
--- a/source/snes9x.h
+++ b/source/snes9x.h
@@ -101,12 +101,12 @@ typedef struct
uint8_t* PCAtOpcodeStart;
uint8_t* WaitAddress;
uint32_t WaitCounter;
- long Cycles; // For savestate compatibility can't change to int32_t
- long NextEvent; // For savestate compatibility can't change to int32_t
- long V_Counter; // For savestate compatibility can't change to int32_t
- long MemSpeed; // For savestate compatibility can't change to int32_t
- long MemSpeedx2; // For savestate compatibility can't change to int32_t
- long FastROMSpeed; // For savestate compatibility can't change to int32_t
+ long Cycles; /* For savestate compatibility can't change to int32_t */
+ long NextEvent; /* For savestate compatibility can't change to int32_t */
+ long V_Counter; /* For savestate compatibility can't change to int32_t */
+ long MemSpeed; /* For savestate compatibility can't change to int32_t */
+ long MemSpeedx2; /* For savestate compatibility can't change to int32_t */
+ long FastROMSpeed; /* For savestate compatibility can't change to int32_t */
uint32_t SaveStateVersion;
bool SRAMModified;
uint32_t NMITriggerPoint;
@@ -188,7 +188,7 @@ typedef struct
uint32_t SoundInputRate;
#endif
bool TraceSoundDSP;
- bool EightBitConsoleSound; // due to caching, this needs S9xSetEightBitConsoleSound()
+ bool EightBitConsoleSound; /* due to caching, this needs S9xSetEightBitConsoleSound() */
int32_t SoundBufferSize;
int32_t SoundMixInterval;
bool SoundEnvelopeHeightReading;
diff --git a/source/soundux.c b/source/soundux.c
index f053290..90cf18e 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -31,7 +31,7 @@ extern int32_t MixBuffer [SOUND_BUFFER_SIZE];
extern int32_t EchoBuffer [SOUND_BUFFER_SIZE];
extern int32_t FilterTaps [8];
static uint8_t FilterTapDefinitionBitfield;
-// In the above, bit I is set if FilterTaps[I] is non-zero.
+/* In the above, bit I is set if FilterTaps[I] is non-zero. */
extern uint32_t Z;
extern int32_t Loop [16];
@@ -66,7 +66,7 @@ uint32_t IncreaseRate [32] =
#define SustainRate DecreaseRateExp
-// precalculated env rates for S9xSetEnvRate
+/* precalculated env rates for S9xSetEnvRate */
uint32_t AttackERate [16][10];
uint32_t DecayERate [8][10];
uint32_t SustainERate [32][10];
@@ -81,8 +81,8 @@ uint32_t KeyOffERate [10];
#define VOL_DIV16 0x0080
#define ENVX_SHIFT 24
-// F is channel's current frequency and M is the 16-bit modulation waveform
-// from the previous channel multiplied by the current envelope volume level.
+/* F is channel's current frequency and M is the 16-bit modulation waveform
+ * from the previous channel multiplied by the current envelope volume level. */
#define PITCH_MOD(F,M) ((F) * ((((uint32_t) (M)) + 0x800000) >> 16) >> 7)
#define LAST_SAMPLE 0xffffff
diff --git a/source/soundux.h b/source/soundux.h
index acf4664..a3b4bbc 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -44,7 +44,7 @@ typedef struct
{
int32_t playback_rate;
int32_t noise_gen;
- uint32_t freqbase; // notaz
+ uint32_t freqbase; /* notaz */
bool mute_sound;
} SoundStatus;
diff --git a/source/spc700.h b/source/spc700.h
index 3de94ae..b2c6e81 100644
--- a/source/spc700.h
+++ b/source/spc700.h
@@ -59,7 +59,7 @@ typedef struct
uint16_t PC;
} SAPURegisters;
-// Needed by ILLUSION OF GAIA
+/* Needed by ILLUSION OF GAIA */
#define ONE_APU_CYCLE 21
#define APU_EXECUTE1() \
diff --git a/source/srtc.h b/source/srtc.h
index 2bd3490..0459524 100644
--- a/source/srtc.h
+++ b/source/srtc.h
@@ -36,11 +36,11 @@ Index Description Range (nibble)
typedef struct
{
bool needs_init;
- bool count_enable; // Does RTC mark time or is it frozen
+ bool count_enable; /* Does RTC mark time or is it frozen */
uint8_t data [MAX_RTC_INDEX + 1];
int8_t index;
uint8_t mode;
- time_t system_timestamp; // Of latest RTC load time
+ time_t system_timestamp; /* Of latest RTC load time */
} SRTC_DATA;
extern SRTC_DATA rtc;
@@ -52,4 +52,4 @@ void S9xSRTCPreSaveState(void);
void S9xSRTCPostLoadState(void);
void S9xResetSRTC(void);
void S9xHardResetSRTC(void);
-#endif // _srtc_h
+#endif /* _srtc_h */