aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2014-11-03 15:26:54 +0100
committeraliaspider2014-11-03 15:26:54 +0100
commit4a54fd4018adf931fb436acba2399efc6d6d1176 (patch)
treeefba5c3c8e1057bce6a7fff834f2dcda36707e5a
parentc599f551ea0862b397b2e8b1ca4b441b4ab8c8f1 (diff)
downloadsnes9x2005-4a54fd4018adf931fb436acba2399efc6d6d1176.tar.gz
snes9x2005-4a54fd4018adf931fb436acba2399efc6d6d1176.tar.bz2
snes9x2005-4a54fd4018adf931fb436acba2399efc6d6d1176.zip
use stdint/stdbool
-rw-r--r--libretro.c66
-rw-r--r--source/65c816.h12
-rw-r--r--source/apu.c62
-rw-r--r--source/apu.h128
-rw-r--r--source/apu_blargg.c80
-rw-r--r--source/apu_blargg.h20
-rw-r--r--source/apumem.h16
-rw-r--r--source/c4.h28
-rw-r--r--source/c4emu.c208
-rw-r--r--source/cheats.c54
-rw-r--r--source/cheats.h62
-rw-r--r--source/cheats2.c70
-rw-r--r--source/clip.c30
-rw-r--r--source/cpu.c18
-rw-r--r--source/cpuaddr.h40
-rw-r--r--source/cpuexec.c58
-rw-r--r--source/cpuexec.h30
-rw-r--r--source/cpumacro.h204
-rw-r--r--source/cpuops.c98
-rw-r--r--source/data.c10
-rw-r--r--source/display.h10
-rw-r--r--source/dma.c144
-rw-r--r--source/dma.h4
-rw-r--r--source/dsp1.c514
-rw-r--r--source/dsp1.h42
-rw-r--r--source/dsp2emu.c18
-rw-r--r--source/dsp4.h104
-rw-r--r--source/dsp4emu.c160
-rw-r--r--source/fxdbg.c6
-rw-r--r--source/fxemu.c150
-rw-r--r--source/fxemu.h53
-rw-r--r--source/fxinst.c278
-rw-r--r--source/fxinst.h118
-rw-r--r--source/getset.h108
-rw-r--r--source/gfx.c1106
-rw-r--r--source/gfx.h188
-rw-r--r--source/globals.c44
-rw-r--r--source/memmap.c1112
-rw-r--r--source/memmap.h178
-rw-r--r--source/missing.h120
-rw-r--r--source/obc1.c10
-rw-r--r--source/obc1.h10
-rw-r--r--source/port.h62
-rw-r--r--source/ppu.c422
-rw-r--r--source/ppu.h312
-rw-r--r--source/sa1.c158
-rw-r--r--source/sa1.h82
-rw-r--r--source/sa1cpu.c4
-rw-r--r--source/sar.h12
-rw-r--r--source/sdd1.c12
-rw-r--r--source/sdd1.h2
-rw-r--r--source/sdd1emu.c52
-rw-r--r--source/sdd1emu.h6
-rw-r--r--source/seta.c8
-rw-r--r--source/seta.h70
-rw-r--r--source/seta010.c184
-rw-r--r--source/seta011.c12
-rw-r--r--source/seta018.c12
-rw-r--r--source/snes9x.h248
-rw-r--r--source/soundux.c170
-rw-r--r--source/soundux.h64
-rw-r--r--source/spc700.c324
-rw-r--r--source/spc700.h18
-rw-r--r--source/spc7110.c172
-rw-r--r--source/spc7110.h32
-rw-r--r--source/srtc.c32
-rw-r--r--source/srtc.h16
-rw-r--r--source/tile.c512
-rw-r--r--source/tile.h64
69 files changed, 4375 insertions, 4458 deletions
diff --git a/libretro.c b/libretro.c
index 081413c..70f8a11 100644
--- a/libretro.c
+++ b/libretro.c
@@ -165,13 +165,13 @@ const char* S9xBasename(const char* f)
return (f);
}
-bool8 S9xInitUpdate()
+bool S9xInitUpdate()
{
// IPPU.RenderThisFrame = 0;
// video_cb(dummy_frame,256,224,512);
- // return (FALSE);
+ // return (false);
- return (TRUE);
+ return (true);
}
void _makepath(char* path, const char* drive, const char* dir,
@@ -250,33 +250,33 @@ const char* S9xGetFilename(const char* ex)
void init_sfc_setting(void)
{
memset(&Settings, 0, sizeof(Settings));
- Settings.JoystickEnabled = FALSE;
+ Settings.JoystickEnabled = false;
Settings.SoundPlaybackRate = 32000; // -> ds2sound.h for defs
Settings.SoundBufferSize = 512;
Settings.CyclesPercentage = 100;
- Settings.DisableSoundEcho = FALSE;
- Settings.InterpolatedSound = TRUE;
- Settings.APUEnabled = Settings.NextAPUEnabled = TRUE;
+ Settings.DisableSoundEcho = false;
+ Settings.InterpolatedSound = true;
+ Settings.APUEnabled = Settings.NextAPUEnabled = true;
Settings.H_Max = SNES_CYCLES_PER_SCANLINE;
Settings.SkipFrames = AUTO_FRAMERATE;
- Settings.ShutdownMaster = TRUE;
+ Settings.ShutdownMaster = true;
Settings.FrameTimePAL = 20000;
Settings.FrameTimeNTSC = 16667;
- Settings.DisableMasterVolume = FALSE;
- Settings.Mouse = TRUE;
- Settings.SuperScope = TRUE;
- Settings.MultiPlayer5 = TRUE;
+ Settings.DisableMasterVolume = false;
+ Settings.Mouse = true;
+ Settings.SuperScope = true;
+ Settings.MultiPlayer5 = true;
Settings.ControllerOption = SNES_JOYPAD;
- Settings.Transparency = TRUE;
- Settings.SupportHiRes = TRUE;
- Settings.ThreadSound = FALSE;
+ Settings.Transparency = true;
+ Settings.SupportHiRes = true;
+ Settings.ThreadSound = false;
#ifdef USE_BLARGG_APU
- Settings.SoundSync = FALSE;
+ Settings.SoundSync = false;
#else
- Settings.ApplyCheats = TRUE;
+ Settings.ApplyCheats = true;
#endif
Settings.StretchScreenshots = 1;
@@ -328,7 +328,7 @@ void retro_init(void)
S9xSetSamplesAvailableCallback(S9xAudioCallback);
#else
S9xInitSound(Settings.SoundPlaybackRate,
- TRUE,
+ true,
Settings.SoundBufferSize);
#endif
@@ -354,9 +354,9 @@ void retro_deinit(void)
}
-uint32 S9xReadJoypad(int port)
+uint32_t S9xReadJoypad(int port)
{
- static const uint32 snes_lut[] =
+ static const uint32_t snes_lut[] =
{
SNES_B_MASK,
SNES_Y_MASK,
@@ -373,7 +373,7 @@ uint32 S9xReadJoypad(int port)
};
int i;
- uint32 joypad = 0;
+ uint32_t joypad = 0;
for (i = RETRO_DEVICE_ID_JOYPAD_B; i <= RETRO_DEVICE_ID_JOYPAD_R; i++)
if (input_cb(port, RETRO_DEVICE_JOYPAD, 0, i))
@@ -488,22 +488,22 @@ void S9xLoadSDD1Data()
}
-bool8 S9xReadMousePosition(int which1, int* x, int* y, uint32* buttons)
+bool S9xReadMousePosition(int which1, int* x, int* y, uint32_t* buttons)
{
- return (FALSE);
+ return (false);
}
-bool8 S9xReadSuperScopePosition(int* x, int* y, uint32* buttons)
+bool S9xReadSuperScopePosition(int* x, int* y, uint32_t* buttons)
{
- return (TRUE);
+ return (true);
}
bool JustifierOffscreen()
{
- return (FALSE);
+ return (false);
}
-void JustifierButtons(uint32* justifiers)
+void JustifierButtons(uint32_t* justifiers)
{
}
@@ -620,9 +620,9 @@ bool retro_serialize(void* data, size_t size)
#ifndef USE_BLARGG_APU
for (i = 0; i < 8; i++)
{
- SoundData.channels[i].previous16[0] = (int16)
+ SoundData.channels[i].previous16[0] = (int16_t)
SoundData.channels[i].previous[0];
- SoundData.channels[i].previous16[1] = (int16)
+ SoundData.channels[i].previous16[1] = (int16_t)
SoundData.channels[i].previous[1];
}
#endif
@@ -673,7 +673,7 @@ bool retro_unserialize(const void* data, size_t size)
S9xReset();
#ifndef USE_BLARGG_APU
- uint8* IAPU_RAM_current = IAPU.RAM;
+ uint8_t* IAPU_RAM_current = IAPU.RAM;
#endif
memcpy(&CPU, buffer, sizeof(CPU));
buffer += sizeof(CPU);
@@ -712,9 +712,9 @@ bool retro_unserialize(const void* data, size_t size)
S9xFixSA1AfterSnapshotLoad();
FixROMSpeed();
- IPPU.ColorsChanged = TRUE;
- IPPU.OBJChanged = TRUE;
- CPU.InDMA = FALSE;
+ IPPU.ColorsChanged = true;
+ IPPU.OBJChanged = true;
+ CPU.InDMA = false;
S9xFixColourBrightness();
S9xSA1UnpackStatus();
diff --git a/source/65c816.h b/source/65c816.h
index 851939d..505d185 100644
--- a/source/65c816.h
+++ b/source/65c816.h
@@ -149,28 +149,28 @@ typedef union
#ifdef LSB_FIRST
struct
{
- uint8 l, h;
+ uint8_t l, h;
} B;
#else
struct
{
- uint8 h, l;
+ uint8_t h, l;
} B;
#endif
- uint16 W;
+ uint16_t W;
} pair;
typedef struct
{
- uint8 PB;
- uint8 DB;
+ uint8_t PB;
+ uint8_t DB;
pair P;
pair A;
pair D;
pair S;
pair X;
pair Y;
- uint16 PC;
+ uint16_t PC;
} SRegisters;
#endif
diff --git a/source/apu.c b/source/apu.c
index de0bae9..b47ef54 100644
--- a/source/apu.c
+++ b/source/apu.c
@@ -91,7 +91,7 @@
#ifdef __DJGPP
#include <allegro.h>
-#undef TRUE
+#undef true
#endif
#include "snes9x.h"
@@ -102,19 +102,19 @@
extern int NoiseFreq [32];
-bool8 S9xInitAPU()
+bool S9xInitAPU()
{
- IAPU.RAM = (uint8*) malloc(0x10000);
+ IAPU.RAM = (uint8_t*) malloc(0x10000);
if (!IAPU.RAM)
{
S9xDeinitAPU();
- return (FALSE);
+ return (false);
}
memset(IAPU.RAM, 0, 0x10000);
- return (TRUE);
+ return (true);
}
void S9xDeinitAPU()
@@ -126,7 +126,7 @@ void S9xDeinitAPU()
}
}
-uint8 APUROM [64];
+uint8_t APUROM [64];
void S9xResetAPU()
{
@@ -166,12 +166,12 @@ void S9xResetAPU()
IAPU.WaitAddress2 = NULL;
IAPU.WaitCounter = 0;
#endif
- APU.ShowROM = TRUE;
+ APU.ShowROM = true;
IAPU.RAM [0xf1] = 0x80;
for (i = 0; i < 3; i++)
{
- APU.TimerEnabled [i] = FALSE;
+ APU.TimerEnabled [i] = false;
APU.TimerValueWritten [i] = 0;
APU.TimerTarget [i] = 0;
APU.Timer [i] = 0;
@@ -190,15 +190,15 @@ void S9xResetAPU()
APU.DSP [APU_FLG] = APU_MUTE | APU_ECHO_DISABLED;
APU.KeyedChannels = 0;
- S9xResetSound(TRUE);
+ S9xResetSound(true);
S9xSetEchoEnable(0);
}
-void S9xSetAPUDSP(uint8 byte)
+void S9xSetAPUDSP(uint8_t byte)
{
- uint8 reg = IAPU.RAM [0xf2];
- static uint8 KeyOn;
- static uint8 KeyOnPrev;
+ uint8_t reg = IAPU.RAM [0xf2];
+ static uint8_t KeyOn;
+ static uint8_t KeyOnPrev;
int i;
switch (reg)
@@ -210,10 +210,10 @@ void S9xSetAPUDSP(uint8 byte)
APU.DSP [APU_ENDX] = 0;
APU.DSP [APU_KOFF] = 0;
APU.DSP [APU_KON] = 0;
- S9xSetEchoWriteEnable(FALSE);
+ S9xSetEchoWriteEnable(false);
// Kill sound
- S9xResetSound(FALSE);
+ S9xResetSound(false);
}
else
{
@@ -231,7 +231,7 @@ void S9xSetAPUDSP(uint8 byte)
if (byte != APU.DSP [APU_NON])
{
int c;
- uint8 mask = 1;
+ uint8_t mask = 1;
for (c = 0; c < 8; c++, mask <<= 1)
{
int type;
@@ -281,7 +281,7 @@ void S9xSetAPUDSP(uint8 byte)
// if (byte)
{
int c;
- uint8 mask = 1;
+ uint8_t mask = 1;
for (c = 0; c < 8; c++, mask <<= 1)
{
if ((byte & mask) != 0)
@@ -315,7 +315,7 @@ void S9xSetAPUDSP(uint8 byte)
if (byte)
{
int c;
- uint8 mask = 1;
+ uint8_t mask = 1;
for (c = 0; c < 8; c++, mask <<= 1)
{
if ((byte & mask) != 0)
@@ -522,7 +522,7 @@ void S9xSetAPUDSP(uint8 byte)
APU.DSP [reg] = byte;
}
-void S9xFixEnvelope(int channel, uint8 gain, uint8 adsr1, uint8 adsr2)
+void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2)
{
if (adsr1 & 0x80)
{
@@ -606,7 +606,7 @@ void S9xFixEnvelope(int channel, uint8 gain, uint8 adsr1, uint8 adsr2)
}
else
{
- uint32 rate = (gain & 0x20) ? DecreaseRateExp [gain & 0x1f] / 2 :
+ uint32_t rate = (gain & 0x20) ? DecreaseRateExp [gain & 0x1f] / 2 :
IncreaseRate [gain & 0x1f];
int mode = (gain & 0x20) ? MODE_DECREASE_EXPONENTIAL
: MODE_DECREASE_LINEAR;
@@ -618,7 +618,7 @@ void S9xFixEnvelope(int channel, uint8 gain, uint8 adsr1, uint8 adsr2)
}
}
-void S9xSetAPUControl(uint8 byte)
+void S9xSetAPUControl(uint8_t byte)
{
//if (byte & 0x40)
//printf ("*** Special SPC700 timing enabled\n");
@@ -660,14 +660,14 @@ void S9xSetAPUControl(uint8 byte)
// 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;
+ APU.ShowROM = true;
}
}
else
{
if (APU.ShowROM)
{
- APU.ShowROM = FALSE;
+ APU.ShowROM = false;
// 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));
@@ -676,7 +676,7 @@ void S9xSetAPUControl(uint8 byte)
IAPU.RAM [0xf1] = byte;
}
-void S9xSetAPUTimer(uint16 Address, uint8 byte)
+void S9xSetAPUTimer(uint16_t Address, uint8_t byte)
{
IAPU.RAM [Address] = byte;
@@ -685,25 +685,25 @@ void S9xSetAPUTimer(uint16 Address, uint8 byte)
case 0xfa:
if ((APU.TimerTarget [0] = IAPU.RAM [0xfa]) == 0)
APU.TimerTarget [0] = 0x100;
- APU.TimerValueWritten [0] = TRUE;
+ APU.TimerValueWritten [0] = true;
break;
case 0xfb:
if ((APU.TimerTarget [1] = IAPU.RAM [0xfb]) == 0)
APU.TimerTarget [1] = 0x100;
- APU.TimerValueWritten [1] = TRUE;
+ APU.TimerValueWritten [1] = true;
break;
case 0xfc:
if ((APU.TimerTarget [2] = IAPU.RAM [0xfc]) == 0)
APU.TimerTarget [2] = 0x100;
- APU.TimerValueWritten [2] = TRUE;
+ APU.TimerValueWritten [2] = true;
break;
}
}
-uint8 S9xGetAPUDSP()
+uint8_t S9xGetAPUDSP()
{
- uint8 reg = IAPU.RAM [0xf2] & 0x7f;
- uint8 byte = APU.DSP [reg];
+ uint8_t reg = IAPU.RAM [0xf2] & 0x7f;
+ uint8_t byte = APU.DSP [reg];
switch (reg)
{
@@ -732,7 +732,7 @@ uint8 S9xGetAPUDSP()
case APU_ENVX + 0x50:
case APU_ENVX + 0x60:
case APU_ENVX + 0x70:
- return ((uint8) S9xGetEnvelopeHeight(reg >> 4));
+ return ((uint8_t) S9xGetEnvelopeHeight(reg >> 4));
case APU_ENDX:
// To fix speech in Magical Drop 2 6/11/00
diff --git a/source/apu.h b/source/apu.h
index 59c8aeb..023c1fe 100644
--- a/source/apu.h
+++ b/source/apu.h
@@ -97,38 +97,38 @@
typedef struct
{
- uint8* PC;
+ uint8_t* PC;
SAPURegisters Registers;
- uint8* RAM;
- uint8* DirectPage;
- bool8 APUExecuting;
- uint8 Bit;
- uint32 Address;
- uint8* WaitAddress1;
- uint8* WaitAddress2;
- uint32 WaitCounter;
- uint8 _Carry;
- uint8 _Zero;
- uint8 _Overflow;
- uint32 TimerErrorCounter;
- uint32 Scanline;
- int32 OneCycle;
- int32 TwoCycles;
+ uint8_t* RAM;
+ uint8_t* DirectPage;
+ bool APUExecuting;
+ uint8_t Bit;
+ uint32_t Address;
+ uint8_t* WaitAddress1;
+ uint8_t* WaitAddress2;
+ uint32_t WaitCounter;
+ uint8_t _Carry;
+ uint8_t _Zero;
+ uint8_t _Overflow;
+ uint32_t TimerErrorCounter;
+ uint32_t Scanline;
+ int32_t OneCycle;
+ int32_t TwoCycles;
} SIAPU;
typedef struct
{
- int32 Cycles;
- bool8 ShowROM;
- uint8 Flags;
- uint8 KeyedChannels;
- uint8 OutPorts [4];
- uint8 DSP [0x80];
- uint8 ExtraRAM [64];
- uint16 Timer [3];
- uint16 TimerTarget [3];
- bool8 TimerEnabled [3];
- bool8 TimerValueWritten [3];
+ int32_t Cycles;
+ bool ShowROM;
+ uint8_t Flags;
+ uint8_t KeyedChannels;
+ uint8_t OutPorts [4];
+ uint8_t DSP [0x80];
+ uint8_t ExtraRAM [64];
+ uint16_t Timer [3];
+ uint16_t TimerTarget [3];
+ bool TimerEnabled [3];
+ bool TimerValueWritten [3];
} SAPU;
SAPU APU;
@@ -149,20 +149,20 @@ STATIC inline void S9xAPUPackStatus()
}
void S9xResetAPU(void);
-bool8 S9xInitAPU();
+bool S9xInitAPU();
void S9xDeinitAPU();
void S9xDecacheSamples();
int S9xTraceAPU();
-int S9xAPUOPrint(char* buffer, uint16 Address);
-void S9xSetAPUControl(uint8 byte);
-void S9xSetAPUDSP(uint8 byte);
-uint8 S9xGetAPUDSP();
-void S9xSetAPUTimer(uint16 Address, uint8 byte);
-bool8 S9xInitSound(int quality, bool8 stereo, int buffer_size);
-void S9xOpenCloseSoundTracingFile(bool8);
+int S9xAPUOPrint(char* buffer, uint16_t Address);
+void S9xSetAPUControl(uint8_t byte);
+void S9xSetAPUDSP(uint8_t byte);
+uint8_t S9xGetAPUDSP();
+void S9xSetAPUTimer(uint16_t Address, uint8_t byte);
+bool S9xInitSound(int quality, bool stereo, int buffer_size);
+void S9xOpenCloseSoundTracingFile(bool);
void S9xPrintAPUState();
-extern uint16 S9xAPUCycles [256]; // Scaled cycle lengths
-extern uint16 S9xAPUCycleLengths [256]; // Raw data.
+extern uint16_t S9xAPUCycles [256]; // Scaled cycle lengths
+extern uint16_t S9xAPUCycleLengths [256]; // Raw data.
extern void (*S9xApuOpcodes [256])(void);
@@ -218,38 +218,38 @@ extern void (*S9xApuOpcodes [256])(void);
//typedef struct
//{
-// uint8* PC;
+// uint8_t* PC;
// SAPURegisters Registers;
-// uint8* RAM;
-// uint8* DirectPage;
-// bool8 APUExecuting;
-// uint8 Bit;
-// uint32 Address;
-// uint8* WaitAddress1;
-// uint8* WaitAddress2;
-// uint32 WaitCounter;
-// uint8 _Carry;
-// uint8 _Zero;
-// uint8 _Overflow;
-// uint32 TimerErrorCounter;
-// uint32 Scanline;
-// int32 OneCycle;
-// int32 TwoCycles;
+// uint8_t* RAM;
+// uint8_t* DirectPage;
+// bool APUExecuting;
+// uint8_t Bit;
+// uint32_t Address;
+// uint8_t* WaitAddress1;
+// uint8_t* WaitAddress2;
+// uint32_t WaitCounter;
+// uint8_t _Carry;
+// uint8_t _Zero;
+// uint8_t _Overflow;
+// uint32_t TimerErrorCounter;
+// uint32_t Scanline;
+// int32_t OneCycle;
+// int32_t TwoCycles;
//} SIAPU;
//typedef struct
//{
-// int32 Cycles;
-// bool8 ShowROM;
-// uint8 Flags;
-// uint8 KeyedChannels;
-// uint8 OutPorts [4];
-// uint8 DSP [0x80];
-// uint8 ExtraRAM [64];
-// uint16 Timer [3];
-// uint16 TimerTarget [3];
-// bool8 TimerEnabled [3];
-// bool8 TimerValueWritten [3];
+// int32_t Cycles;
+// bool ShowROM;
+// uint8_t Flags;
+// uint8_t KeyedChannels;
+// uint8_t OutPorts [4];
+// uint8_t DSP [0x80];
+// uint8_t ExtraRAM [64];
+// uint16_t Timer [3];
+// uint16_t TimerTarget [3];
+// bool TimerEnabled [3];
+// bool TimerValueWritten [3];
//} SAPU;
//SAPU APU;
diff --git a/source/apu_blargg.c b/source/apu_blargg.c
index 78b4c25..6a562ef 100644
--- a/source/apu_blargg.c
+++ b/source/apu_blargg.c
@@ -1351,7 +1351,7 @@ static void dsp_copy_state( unsigned char** io, dsp_copy_func_t copy )
static spc_state_t m;
static signed char reg_times [256];
-static bool8 allow_time_overflow;
+static bool allow_time_overflow;
/* Copyright (C) 2004-2007 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@@ -3067,7 +3067,7 @@ void spc_copy_state( unsigned char** io, dsp_copy_func_t copy )
static apu_callback sa_callback = NULL;
-static bool8 sound_in_sync = TRUE;
+static bool sound_in_sync = true;
static int buffer_size;
static int lag_master = 0;
@@ -3075,16 +3075,16 @@ static int lag = 0;
static short *landing_buffer = NULL;
-static bool8 resampler = FALSE;
+static bool resampler = false;
-static int32 reference_time;
-static uint32 spc_remainder;
+static int32_t reference_time;
+static uint32_t spc_remainder;
static int timing_hack_denominator = TEMPO_UNIT;
/* Set these to NTSC for now. Will change to PAL in S9xAPUTimingSetSpeedup
if necessary on game load. */
-static uint32 ratio_numerator = APU_NUMERATOR_NTSC;
-static uint32 ratio_denominator = APU_DENOMINATOR_NTSC;
+static uint32_t ratio_numerator = APU_NUMERATOR_NTSC;
+static uint32_t ratio_denominator = APU_DENOMINATOR_NTSC;
/***********************************************************************************
RESAMPLER
@@ -3212,14 +3212,14 @@ static void resampler_new(int num_samples)
resampler_clear();
}
-static INLINE bool8 resampler_push(short *src, int num_samples)
+static INLINE bool resampler_push(short *src, int num_samples)
{
int bytes, end, first_write_size;
unsigned char *src_ring;
bytes = num_samples << 1;
if (MAX_WRITE() < num_samples || SPACE_EMPTY() < bytes)
- return FALSE;
+ return false;
/* Ring buffer push */
src_ring = (unsigned char*)src;
@@ -3233,7 +3233,7 @@ static INLINE bool8 resampler_push(short *src, int num_samples)
rb_size += bytes;
- return TRUE;
+ return true;
}
static INLINE void resampler_resize (int num_samples)
@@ -3253,7 +3253,7 @@ static INLINE void resampler_resize (int num_samples)
APU
***********************************************************************************/
-bool8 S9xMixSamples (short *buffer, unsigned sample_count)
+bool S9xMixSamples (short *buffer, unsigned sample_count)
{
if (AVAIL() >= (sample_count + lag))
{
@@ -3267,10 +3267,10 @@ bool8 S9xMixSamples (short *buffer, unsigned sample_count)
if (lag == 0)
lag = lag_master;
- return (FALSE);
+ return (false);
}
- return (TRUE);
+ return (true);
}
int S9xGetSampleCount (void)
@@ -3310,17 +3310,17 @@ static void spc_set_output( short* out, int size )
void S9xFinalizeSamples (void)
{
- bool8 ret;
+ bool ret;
ret = resampler_push(landing_buffer, SPC_SAMPLE_COUNT());
- sound_in_sync = FALSE;
+ sound_in_sync = false;
/* We weren't able to process the entire buffer. Potential overrun. */
if (!ret && Settings.SoundSync)
return;
if (!Settings.SoundSync || (SPACE_EMPTY() >= SPACE_FILLED()))
- sound_in_sync = TRUE;
+ sound_in_sync = true;
m.extra_clocks &= CLOCKS_PER_SAMPLE - 1;
spc_set_output(landing_buffer, buffer_size);
@@ -3332,10 +3332,10 @@ void S9xClearSamples (void)
lag = lag_master;
}
-bool8 S9xSyncSound (void)
+bool S9xSyncSound (void)
{
if (!Settings.SoundSync || sound_in_sync)
- return TRUE;
+ return true;
sa_callback();
@@ -3357,7 +3357,7 @@ static void UpdatePlaybackRate (void)
resampler_time_ratio(time_ratio);
}
-bool8 S9xInitSound (int buffer_ms, int lag_ms)
+bool S9xInitSound (int buffer_ms, int lag_ms)
{
/* buffer_ms : buffer size given in millisecond
lag_ms : allowable time-lag given in millisecond */
@@ -3385,7 +3385,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
free(landing_buffer);
landing_buffer = (short*)malloc(buffer_size * 2);
if (!landing_buffer)
- return (FALSE);
+ return (false);
/* The resampler and spc unit use samples (16-bit short) as
arguments. Use 2x in the resampler for buffer leveling with SoundSync */
@@ -3393,7 +3393,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
if (!resampler)
{
resampler_new(buffer_size >> (Settings.SoundSync ? 0 : 1));
- resampler = TRUE;
+ resampler = true;
}
else
resampler_resize(buffer_size >> (Settings.SoundSync ? 0 : 1));
@@ -3403,7 +3403,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
UpdatePlaybackRate();
- return TRUE;
+ return true;
}
/* Must be called once before using */
@@ -3448,7 +3448,7 @@ static signed char const reg_times_ [256] =
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
};
-bool8 S9xInitAPU (void)
+bool S9xInitAPU (void)
{
int i;
@@ -3485,7 +3485,7 @@ bool8 S9xInitAPU (void)
m.cycle_table [i * 2 + 1] = n & 0x0F;
}
- allow_time_overflow = FALSE;
+ allow_time_overflow = false;
dsp_m.rom = m.rom;
dsp_m.hi_ram = m.hi_ram;
@@ -3500,7 +3500,7 @@ bool8 S9xInitAPU (void)
landing_buffer = NULL;
- return TRUE;
+ return true;
}
void S9xDeinitAPU (void)
@@ -3508,7 +3508,7 @@ void S9xDeinitAPU (void)
if (resampler)
{
free(rb_buffer);
- resampler = FALSE;
+ resampler = false;
}
if (landing_buffer)
@@ -3523,17 +3523,17 @@ void S9xDeinitAPU (void)
/* Emulated port read at specified time */
-uint8 S9xAPUReadPort (int port) { return ((uint8) spc_run_until_(S9X_APU_GET_CLOCK(CPU.Cycles))[port]); }
+uint8_t S9xAPUReadPort (int port) { return ((uint8_t) spc_run_until_(S9X_APU_GET_CLOCK(CPU.Cycles))[port]); }
/* Emulated port write at specified time */
-void S9xAPUWritePort (int port, uint8 byte)
+void S9xAPUWritePort (int port, uint8_t byte)
{
spc_run_until_( S9X_APU_GET_CLOCK(CPU.Cycles) ) [0x10 + port] = byte;
m.ram.ram [0xF4 + port] = byte;
}
-void S9xAPUSetReferenceTime (int32 cpucycles)
+void S9xAPUSetReferenceTime (int32_t cpucycles)
{
reference_time = cpucycles;
}
@@ -3565,7 +3565,7 @@ void S9xAPUTimingSetSpeedup (int ticks)
UpdatePlaybackRate();
}
-void S9xAPUAllowTimeOverflow (bool8 allow)
+void S9xAPUAllowTimeOverflow (bool allow)
{
allow_time_overflow = allow;
}
@@ -3595,13 +3595,13 @@ void S9xSoftResetAPU (void)
resampler_clear();
}
-static void from_apu_to_state (uint8 **buf, void *var, size_t size)
+static void from_apu_to_state (uint8_t **buf, void *var, size_t size)
{
memcpy(*buf, var, size);
*buf += size;
}
-static void to_apu_from_state (uint8 **buf, void *var, size_t size)
+static void to_apu_from_state (uint8_t **buf, void *var, size_t size)
{
memcpy(var, *buf, size);
*buf += size;
@@ -3610,29 +3610,29 @@ static void to_apu_from_state (uint8 **buf, void *var, size_t size)
// work around optimization bug in android GCC
// similar to this: http://jeffq.com/blog/over-aggressive-gcc-optimization-can-cause-sigbus-crash-when-using-memcpy-with-the-android-ndk/
#if defined(ANDROID) || defined(__QNX__)
-void __attribute__((optimize(0))) S9xAPUSaveState (uint8 *block)
+void __attribute__((optimize(0))) S9xAPUSaveState (uint8_t *block)
#else
-void S9xAPUSaveState (uint8 *block)
+void S9xAPUSaveState (uint8_t *block)
#endif
{
- uint8 *ptr;
+ uint8_t *ptr;
ptr = block;
spc_copy_state(&ptr, from_apu_to_state);
SET_LE32(ptr, reference_time);
- ptr += sizeof(int32);
+ ptr += sizeof(int32_t);
SET_LE32(ptr, spc_remainder);
}
#if defined(ANDROID) || defined(__QNX__)
-void __attribute__((optimize(0))) S9xAPULoadState (uint8 *block)
+void __attribute__((optimize(0))) S9xAPULoadState (uint8_t *block)
#else
-void S9xAPULoadState (uint8 *block)
+void S9xAPULoadState (uint8_t *block)
#endif
{
- uint8 *ptr;
+ uint8_t *ptr;
ptr = block;
@@ -3641,7 +3641,7 @@ void S9xAPULoadState (uint8 *block)
spc_copy_state(&ptr, to_apu_from_state);
reference_time = GET_LE32(ptr);
- ptr += sizeof(int32);
+ ptr += sizeof(int32_t);
spc_remainder = GET_LE32(ptr);
}
diff --git a/source/apu_blargg.h b/source/apu_blargg.h
index 1760af2..ebf50b0 100644
--- a/source/apu_blargg.h
+++ b/source/apu_blargg.h
@@ -464,26 +464,26 @@ typedef void (*apu_callback)(void);
#define SPC_SAVE_STATE_BLOCK_SIZE (STATE_SIZE + 8)
-bool8 S9xInitAPU (void);
+bool S9xInitAPU (void);
void S9xDeinitAPU (void);
void S9xResetAPU (void);
void S9xSoftResetAPU (void);
-uint8 S9xAPUReadPort (int port);
-void S9xAPUWritePort (int port, uint8 byte);
+uint8_t S9xAPUReadPort (int port);
+void S9xAPUWritePort (int port, uint8_t byte);
void S9xAPUExecute (void);
-void S9xAPUSetReferenceTime (int32 cpucycles);
+void S9xAPUSetReferenceTime (int32_t cpucycles);
void S9xAPUTimingSetSpeedup (int ticks);
-void S9xAPUAllowTimeOverflow (bool8 allow);
-void S9xAPULoadState (uint8 * block);
-void S9xAPUSaveState (uint8 * block);
+void S9xAPUAllowTimeOverflow (bool allow);
+void S9xAPULoadState (uint8_t * block);
+void S9xAPUSaveState (uint8_t * block);
-bool8 S9xInitSound (int buffer_ms, int lag_ms);
+bool S9xInitSound (int buffer_ms, int lag_ms);
-bool8 S9xSyncSound (void);
+bool S9xSyncSound (void);
int S9xGetSampleCount (void);
void S9xFinalizeSamples (void);
void S9xClearSamples (void);
-bool8 S9xMixSamples (short * buffer, unsigned sample_count);
+bool S9xMixSamples (short * buffer, unsigned sample_count);
void S9xSetSamplesAvailableCallback (apu_callback);
#endif // APU_BLARGG_H
diff --git a/source/apumem.h b/source/apumem.h
index 27d9bfd..9bbc675 100644
--- a/source/apumem.h
+++ b/source/apumem.h
@@ -90,10 +90,10 @@
#ifndef _apumemory_h_
#define _apumemory_h_
-extern uint8 W4;
-extern uint8 APUROM[64];
+extern uint8_t W4;
+extern uint8_t APUROM[64];
-INLINE uint8 S9xAPUGetByteZ(uint8 Address)
+INLINE uint8_t S9xAPUGetByteZ(uint8_t Address)
{
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
{
@@ -111,7 +111,7 @@ INLINE uint8 S9xAPUGetByteZ(uint8 Address)
IAPU.WaitAddress2 = IAPU.WaitAddress1;
IAPU.WaitAddress1 = IAPU.PC;
#endif
- uint8 t = IAPU.RAM [Address];
+ uint8_t t = IAPU.RAM [Address];
IAPU.RAM [Address] = 0;
return (t);
}
@@ -124,7 +124,7 @@ INLINE uint8 S9xAPUGetByteZ(uint8 Address)
return (IAPU.DirectPage [Address]);
}
-INLINE void S9xAPUSetByteZ(uint8 byte, uint8 Address)
+INLINE void S9xAPUSetByteZ(uint8_t byte, uint8_t Address)
{
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
{
@@ -150,7 +150,7 @@ INLINE void S9xAPUSetByteZ(uint8 byte, uint8 Address)
IAPU.DirectPage [Address] = byte;
}
-INLINE uint8 S9xAPUGetByte(uint32 Address)
+INLINE uint8_t S9xAPUGetByte(uint32_t Address)
{
Address &= 0xffff;
@@ -172,7 +172,7 @@ INLINE uint8 S9xAPUGetByte(uint32 Address)
IAPU.WaitAddress2 = IAPU.WaitAddress1;
IAPU.WaitAddress1 = IAPU.PC;
#endif
- uint8 t = IAPU.RAM [Address];
+ uint8_t t = IAPU.RAM [Address];
IAPU.RAM [Address] = 0;
return (t);
}
@@ -182,7 +182,7 @@ INLINE uint8 S9xAPUGetByte(uint32 Address)
return (IAPU.RAM [Address]);
}
-INLINE void S9xAPUSetByte(uint8 byte, uint32 Address)
+INLINE void S9xAPUSetByte(uint8_t byte, uint32_t Address)
{
Address &= 0xffff;
diff --git a/source/c4.h b/source/c4.h
index ba67c84..c6964ff 100644
--- a/source/c4.h
+++ b/source/c4.h
@@ -91,30 +91,30 @@
#include "port.h"
-extern int16 C4WFXVal;
-extern int16 C4WFYVal;
-extern int16 C4WFZVal;
-extern int16 C4WFX2Val;
-extern int16 C4WFY2Val;
-extern int16 C4WFDist;
-extern int16 C4WFScale;
+extern int16_t C4WFXVal;
+extern int16_t C4WFYVal;
+extern int16_t C4WFZVal;
+extern int16_t C4WFX2Val;
+extern int16_t C4WFY2Val;
+extern int16_t C4WFDist;
+extern int16_t C4WFScale;
void C4TransfWireFrame();
void C4TransfWireFrame2();
void C4CalcWireFrame();
-extern int16 C41FXVal;
-extern int16 C41FYVal;
-extern int16 C41FAngleRes;
-extern int16 C41FDist;
-extern int16 C41FDistVal;
+extern int16_t C41FXVal;
+extern int16_t C41FYVal;
+extern int16_t C41FAngleRes;
+extern int16_t C41FDist;
+extern int16_t C41FDistVal;
void C4Op1F();
void C4Op15();
void C4Op0D();
-extern int16 C4CosTable[];
-extern int16 C4SinTable[];
+extern int16_t C4CosTable[];
+extern int16_t C4SinTable[];
#endif
diff --git a/source/c4emu.c b/source/c4emu.c
index 0b87bfe..517df2e 100644
--- a/source/c4emu.c
+++ b/source/c4emu.c
@@ -104,12 +104,12 @@ void S9xInitC4()
memset(Memory.C4RAM, 0, 0x2000);
}
-uint8 S9xGetC4(uint16 Address)
+uint8_t S9xGetC4(uint16_t Address)
{
return (Memory.C4RAM [Address - 0x6000]);
}
-static uint8 C4TestPattern [12 * 4] =
+static uint8_t C4TestPattern [12 * 4] =
{
0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0x00, 0xff,
@@ -128,19 +128,19 @@ static uint8 C4TestPattern [12 * 4] =
static void C4ConvOAM(void)
{
- uint8* i;
- uint8* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
+ uint8_t* i;
+ uint8_t* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
for (i = Memory.C4RAM + 0x1fd; i > OAMptr; i -= 4)
{
// Clear OAM-to-be
*i = 0xe0;
}
- uint16 globalX, globalY;
- uint8* OAMptr2;
- int16 SprX, SprY;
- uint8 SprName, SprAttr;
- uint8 SprCount;
+ uint16_t globalX, globalY;
+ uint8_t* OAMptr2;
+ int16_t SprX, SprY;
+ uint8_t SprName, SprAttr;
+ uint8_t SprCount;
globalX = READ_WORD(Memory.C4RAM + 0x0621);
globalY = READ_WORD(Memory.C4RAM + 0x0623);
@@ -150,10 +150,10 @@ static void C4ConvOAM(void)
{
int prio, i;
SprCount = 128 - Memory.C4RAM[0x626];
- uint8 offset = (Memory.C4RAM[0x626] & 3) * 2;
+ uint8_t offset = (Memory.C4RAM[0x626] & 3) * 2;
for (prio = 0x30; prio >= 0; prio -= 0x10)
{
- uint8* srcptr = Memory.C4RAM + 0x220;
+ uint8_t* srcptr = Memory.C4RAM + 0x220;
for (i = Memory.C4RAM[0x0620]; i > 0 && SprCount > 0; i--, srcptr += 16)
{
if ((srcptr[4] & 0x30) != prio) continue;
@@ -162,27 +162,27 @@ static void C4ConvOAM(void)
SprName = srcptr[5];
SprAttr = srcptr[4] | srcptr[0x06]; // XXX: mask bits?
- uint8* sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
+ uint8_t* sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
if (*sprptr != 0)
{
int SprCnt;
- int16 X, Y;
+ int16_t X, Y;
for (SprCnt = *sprptr++; SprCnt > 0 && SprCount > 0; SprCnt--, sprptr += 4)
{
- X = (int8)sprptr[1];
+ X = (int8_t)sprptr[1];
if (SprAttr & 0x40) // flip X
X = -X - ((sprptr[0] & 0x20) ? 16 : 8);
X += SprX;
if (X >= -16 && X <= 272)
{
- Y = (int8)sprptr[2];
+ Y = (int8_t)sprptr[2];
if (SprAttr & 0x80)
Y = -Y - ((sprptr[0] & 0x20) ? 16 : 8);
Y += SprY;
if (Y >= -16 && Y <= 224)
{
OAMptr[0] = X & 0xff;
- OAMptr[1] = (uint8)Y;
+ OAMptr[1] = (uint8_t)Y;
OAMptr[2] = SprName + sprptr[3];
OAMptr[3] = SprAttr ^ (sprptr[0] & 0xc0); // XXX: Carry from SprName addition?
*OAMptr2 &= ~(3 << offset);
@@ -198,8 +198,8 @@ static void C4ConvOAM(void)
}
else if (SprCount > 0)
{
- OAMptr[0] = (uint8)SprX;
- OAMptr[1] = (uint8)SprY;
+ OAMptr[0] = (uint8_t)SprX;
+ OAMptr[1] = (uint8_t)SprY;
OAMptr[2] = SprName;
OAMptr[3] = SprAttr;
*OAMptr2 &= ~(3 << offset);
@@ -218,12 +218,12 @@ static void C4ConvOAM(void)
static void C4DoScaleRotate(int row_padding)
{
- int16 A, B, C, D;
+ int16_t A, B, C, D;
// Calculate matrix
- int32 XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
+ int32_t XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
if (XScale & 0x8000) XScale = 0x7fff;
- int32 YScale = READ_WORD(Memory.C4RAM + 0x1f92);
+ int32_t YScale = READ_WORD(Memory.C4RAM + 0x1f92);
if (YScale & 0x8000) YScale = 0x7fff;
if (READ_WORD(Memory.C4RAM + 0x1f80) == 0)
@@ -231,50 +231,50 @@ static void C4DoScaleRotate(int row_padding)
// no rotation
// XXX: only do this for C and D?
// XXX: and then only when YScale is 0x1000?
- A = (int16)XScale;
+ A = (int16_t)XScale;
B = 0;
C = 0;
- D = (int16)YScale;
+ D = (int16_t)YScale;
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 128) // 90 degree rotation
{
// XXX: Really do this?
A = 0;
- B = (int16)(-YScale);
- C = (int16)XScale;
+ B = (int16_t)(-YScale);
+ C = (int16_t)XScale;
D = 0;
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 256) // 180 degree rotation
{
// XXX: Really do this?
- A = (int16)(-XScale);
+ A = (int16_t)(-XScale);
B = 0;
C = 0;
- D = (int16)(-YScale);
+ D = (int16_t)(-YScale);
}
else if (READ_WORD(Memory.C4RAM + 0x1f80) == 384) // 270 degree rotation
{
// XXX: Really do this?
A = 0;
- B = (int16)YScale;
- C = (int16)(-XScale);
+ B = (int16_t)YScale;
+ C = (int16_t)(-XScale);
D = 0;
}
else
{
- A = (int16)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
+ A = (int16_t)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
15);
- B = (int16)(-SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] *
+ B = (int16_t)(-SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] *
YScale, 15));
- C = (int16)SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
+ C = (int16_t)SAR16(C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * XScale,
15);
- D = (int16)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * YScale,
+ D = (int16_t)SAR16(C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * YScale,
15);
}
// Calculate Pixel Resolution
- uint8 w = Memory.C4RAM[0x1f89] & ~7;
- uint8 h = Memory.C4RAM[0x1f8c] & ~7;
+ uint8_t w = Memory.C4RAM[0x1f89] & ~7;
+ uint8_t h = Memory.C4RAM[0x1f8c] & ~7;
// printf("%dx%d XScale=%04x YScale=%04x angle=%03x\n", w, h, XScale, YScale, READ_WORD(Memory.C4RAM+0x1f80)&0x1ff);
// printf("Matrix: [%10g %10g] [%04x %04x]\n", A/4096.0, B/4096.0, A&0xffff, B&0xffff);
@@ -283,22 +283,22 @@ static void C4DoScaleRotate(int row_padding)
// Clear the output RAM
memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2);
- int32 Cx = (int16)READ_WORD(Memory.C4RAM + 0x1f83);
- int32 Cy = (int16)READ_WORD(Memory.C4RAM + 0x1f86);
+ int32_t Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
+ int32_t Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
// Calculate start position (i.e. (Ox, Oy) = (0, 0))
// The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in
// the function. We do Cx*A etc normally because the matrix parameters
// already have the fractional parts.
- int32 LineX = (Cx << 12) - Cx * A - Cx * B;
- int32 LineY = (Cy << 12) - Cy * C - Cy * D;
+ int32_t LineX = (Cx << 12) - Cx * A - Cx * B;
+ int32_t LineY = (Cy << 12) - Cy * C - Cy * D;
// Start loop
- uint32 X, Y;
- uint8 byte;
+ uint32_t X, Y;
+ uint8_t byte;
int outidx = 0;
int x, y;
- uint8 bit = 0x80;
+ uint8_t bit = 0x80;
for (y = 0; y < h; y++)
{
X = LineX;
@@ -309,7 +309,7 @@ static void C4DoScaleRotate(int row_padding)
byte = 0;
else
{
- uint32 addr = (Y >> 12) * w + (X >> 12);
+ uint32_t addr = (Y >> 12) * w + (X >> 12);
byte = Memory.C4RAM[0x600 + (addr >> 1)];
if (addr & 1) byte >>= 4;
}
@@ -340,8 +340,8 @@ static void C4DoScaleRotate(int row_padding)
}
}
-static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
- int32 X2, int32 Y2, int16 Z2, uint8 Color)
+static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1,
+ int32_t X2, int32_t Y2, int16_t Z2, uint8_t Color)
{
// Transform coordinates
C4WFXVal = (short)X1;
@@ -368,8 +368,8 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
C4WFX2Val = (short)(X2 >> 8);
C4WFY2Val = (short)(Y2 >> 8);
C4CalcWireFrame();
- X2 = (int16)C4WFXVal;
- Y2 = (int16)C4WFYVal;
+ X2 = (int16_t)C4WFXVal;
+ Y2 = (int16_t)C4WFYVal;
// render line
int i;
@@ -378,10 +378,10 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
//.loop
if (X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000)
{
- uint16 addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7;
+ uint16_t addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7;
addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((
X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2;
- uint8 bit = 0x80 >> ((X1 >> 8) & 7);
+ uint8_t bit = 0x80 >> ((X1 >> 8) & 7);
Memory.C4RAM[addr + 0x300] &= ~bit;
Memory.C4RAM[addr + 0x301] &= ~bit;
if (Color & 1) Memory.C4RAM[addr + 0x300] |= bit;
@@ -394,18 +394,18 @@ static void C4DrawLine(int32 X1, int32 Y1, int16 Z1,
static void C4DrawWireFrame(void)
{
- uint8* line = S9xGetMemPointer(READ_3WORD(Memory.C4RAM + 0x1f80));
- uint8* point1, *point2;
- int16 X1, Y1, Z1;
- int16 X2, Y2, Z2;
- uint8 Color;
+ uint8_t* line = S9xGetMemPointer(READ_3WORD(Memory.C4RAM + 0x1f80));
+ uint8_t* point1, *point2;
+ int16_t X1, Y1, Z1;
+ int16_t X2, Y2, Z2;
+ uint8_t Color;
int i;
for (i = Memory.C4RAM[0x0295]; i > 0; i--, line += 5)
{
if (line[0] == 0xff && line[1] == 0xff)
{
- uint8* tmp = line - 5;
+ uint8_t* tmp = line - 5;
while (line[2] == 0xff && line[3] == 0xff) tmp -= 5;
point1 = S9xGetMemPointer((Memory.C4RAM[0x1f82] << 16) |
(tmp[2] << 8) | tmp[3]);
@@ -437,7 +437,7 @@ static void C4TransformLines(void)
int i;
// transform vertices
- uint8* ptr = Memory.C4RAM;
+ uint8_t* ptr = Memory.C4RAM;
{
for (i = READ_WORD(Memory.C4RAM + 0x1f80); i > 0; i--, ptr += 0x10)
{
@@ -459,7 +459,7 @@ static void C4TransformLines(void)
WRITE_WORD(Memory.C4RAM + 0x605 + 8, 0x40);
ptr = Memory.C4RAM + 0xb02;
- uint8* ptr2 = Memory.C4RAM;
+ uint8_t* ptr2 = Memory.C4RAM;
{
int i;
for (i = READ_WORD(Memory.C4RAM + 0xb00); i > 0; i--, ptr += 2, ptr2 += 8)
@@ -477,7 +477,7 @@ static void C4TransformLines(void)
}
static void C4BitPlaneWave()
{
- static uint16 bmpdata[] =
+ static uint16_t bmpdata[] =
{
0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000A, 0x000C, 0x000E,
0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020A, 0x020C, 0x020E,
@@ -486,20 +486,20 @@ static void C4BitPlaneWave()
0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080A, 0x080C, 0x080E
};
- uint8* dst = Memory.C4RAM;
- uint32 waveptr = Memory.C4RAM[0x1f83];
- uint16 mask1 = 0xc0c0;
- uint16 mask2 = 0x3f3f;
+ uint8_t* dst = Memory.C4RAM;
+ uint32_t waveptr = Memory.C4RAM[0x1f83];
+ uint16_t mask1 = 0xc0c0;
+ uint16_t mask2 = 0x3f3f;
int i, j;
for (j = 0; j < 0x10; j++)
{
do
{
- int16 height = -((int8)Memory.C4RAM[waveptr + 0xb00]) - 16;
+ int16_t height = -((int8_t)Memory.C4RAM[waveptr + 0xb00]) - 16;
for (i = 0; i < 40; i++)
{
- uint16 tmp = READ_WORD(dst + bmpdata[i]) & mask2;
+ uint16_t tmp = READ_WORD(dst + bmpdata[i]) & mask2;
if (height >= 0)
{
if (height < 8)
@@ -520,10 +520,10 @@ static void C4BitPlaneWave()
do
{
int i;
- int16 height = -((int8)Memory.C4RAM[waveptr + 0xb00]) - 16;
+ int16_t height = -((int8_t)Memory.C4RAM[waveptr + 0xb00]) - 16;
for (i = 0; i < 40; i++)
{
- uint16 tmp = READ_WORD(dst + bmpdata[i]) & mask2;
+ uint16_t tmp = READ_WORD(dst + bmpdata[i]) & mask2;
if (height >= 0)
{
if (height < 8)
@@ -545,34 +545,34 @@ static void C4BitPlaneWave()
static void C4SprDisintegrate()
{
- uint8 width, height;
- uint32 StartX, StartY;
- uint8* src;
- int32 scaleX, scaleY;
- int32 Cx, Cy;
+ uint8_t width, height;
+ uint32_t StartX, StartY;
+ uint8_t* src;
+ int32_t scaleX, scaleY;
+ int32_t Cx, Cy;
width = Memory.C4RAM[0x1f89];
height = Memory.C4RAM[0x1f8c];
- Cx = (int16)READ_WORD(Memory.C4RAM + 0x1f80);
- Cy = (int16)READ_WORD(Memory.C4RAM + 0x1f83);
+ Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f80);
+ Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
- scaleX = (int16)READ_WORD(Memory.C4RAM + 0x1f86);
- scaleY = (int16)READ_WORD(Memory.C4RAM + 0x1f8f);
+ scaleX = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
+ scaleY = (int16_t)READ_WORD(Memory.C4RAM + 0x1f8f);
StartX = -Cx * scaleX + (Cx << 8);
StartY = -Cy * scaleY + (Cy << 8);
src = Memory.C4RAM + 0x600;
memset(Memory.C4RAM, 0, width * height / 2);
- uint32 x, y, i, j;
+ uint32_t x, y, i, j;
for (y = StartY, i = 0; i < height; i++, y += scaleY)
{
for (x = StartX, j = 0; j < width; j++, x += scaleX)
{
if ((x >> 8) < width && (y >> 8) < height && (y >> 8)*width + (x >> 8) < 0x2000)
{
- uint8 pixel = (j & 1) ? (*src >> 4) : *src;
+ uint8_t pixel = (j & 1) ? (*src >> 4) : *src;
int idx = (y >> 11) * width * 4 + (x >> 11) * 32 + ((y >> 8) & 7) * 2;
- uint8 mask = 0x80 >> ((x >> 8) & 7);
+ uint8_t mask = 0x80 >> ((x >> 8) & 7);
if (pixel & 1) Memory.C4RAM[idx] |= mask;
if (pixel & 2) Memory.C4RAM[idx + 1] |= mask;
if (pixel & 4) Memory.C4RAM[idx + 16] |= mask;
@@ -620,7 +620,7 @@ static void S9xC4ProcessSprites()
}
}
-void S9xSetC4(uint8 byte, uint16 Address)
+void S9xSetC4(uint8_t byte, uint16_t Address)
{
int i;
Memory.C4RAM [Address - 0x6000] = byte;
@@ -643,11 +643,11 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x05: // Propulsion (?)
{
- int32 tmp = 0x10000;
+ int32_t tmp = 0x10000;
if (READ_WORD(Memory.C4RAM + 0x1f83))
tmp = SAR32((tmp / READ_WORD(Memory.C4RAM + 0x1f83)) * READ_WORD(
Memory.C4RAM + 0x1f81), 8);
- WRITE_WORD(Memory.C4RAM + 0x1f80, (uint16)tmp);
+ WRITE_WORD(Memory.C4RAM + 0x1f80, (uint16_t)tmp);
}
break;
@@ -662,10 +662,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x10: // Polar to rectangluar
{
- int32 tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) *
+ int32_t tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) *
C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f86, tmp);
- tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
+ tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f89, (tmp - SAR32(tmp, 6)));
}
@@ -673,10 +673,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x13: // Polar to rectangluar
{
- int32 tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) *
+ int32_t tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) *
C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 8);
WRITE_3WORD(Memory.C4RAM + 0x1f86, tmp);
- tmp = SAR32((int32)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
+ tmp = SAR32((int32_t)READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(
Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 8);
WRITE_3WORD(Memory.C4RAM + 0x1f89, tmp);
}
@@ -685,7 +685,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x15: // Pythagorean
C41FXVal = READ_WORD(Memory.C4RAM + 0x1f80);
C41FYVal = READ_WORD(Memory.C4RAM + 0x1f83);
- C41FDist = (int16)sqrt((double)C41FXVal * C41FXVal + (double)C41FYVal *
+ C41FDist = (int16_t)sqrt((double)C41FXVal * C41FXVal + (double)C41FYVal *
C41FYVal);
WRITE_WORD(Memory.C4RAM + 0x1f80, C41FDist);
break;
@@ -699,23 +699,23 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x22: // Trapezoid
{
- int16 angle1 = READ_WORD(Memory.C4RAM + 0x1f8c) & 0x1ff;
- int16 angle2 = READ_WORD(Memory.C4RAM + 0x1f8f) & 0x1ff;
- int32 tan1 = (C4CosTable[angle1] != 0) ? ((((int32)C4SinTable[angle1]) << 16) /
+ int16_t angle1 = READ_WORD(Memory.C4RAM + 0x1f8c) & 0x1ff;
+ int16_t angle2 = READ_WORD(Memory.C4RAM + 0x1f8f) & 0x1ff;
+ int32_t tan1 = (C4CosTable[angle1] != 0) ? ((((int32_t)C4SinTable[angle1]) << 16) /
C4CosTable[angle1]) : 0x80000000;
- int32 tan2 = (C4CosTable[angle2] != 0) ? ((((int32)C4SinTable[angle2]) << 16) /
+ int32_t tan2 = (C4CosTable[angle2] != 0) ? ((((int32_t)C4SinTable[angle2]) << 16) /
C4CosTable[angle2]) : 0x80000000;
- int16 y = READ_WORD(Memory.C4RAM + 0x1f83) - READ_WORD(Memory.C4RAM + 0x1f89);
- int16 left, right;
+ int16_t y = READ_WORD(Memory.C4RAM + 0x1f83) - READ_WORD(Memory.C4RAM + 0x1f89);
+ int16_t left, right;
int j;
for (j = 0; j < 225; j++)
{
if (y >= 0)
{
- left = SAR32((int32)tan1 * y, 16) -
+ left = SAR32((int32_t)tan1 * y, 16) -
READ_WORD(Memory.C4RAM + 0x1f80) +
READ_WORD(Memory.C4RAM + 0x1f86);
- right = SAR32((int32)tan2 * y, 16) -
+ right = SAR32((int32_t)tan2 * y, 16) -
READ_WORD(Memory.C4RAM + 0x1f80) +
READ_WORD(Memory.C4RAM + 0x1f86) +
READ_WORD(Memory.C4RAM + 0x1f93);
@@ -744,8 +744,8 @@ void S9xSetC4(uint8 byte, uint16 Address)
left = 1;
right = 0;
}
- Memory.C4RAM[j + 0x800] = (uint8)left;
- Memory.C4RAM[j + 0x900] = (uint8)right;
+ Memory.C4RAM[j + 0x800] = (uint8_t)left;
+ Memory.C4RAM[j + 0x900] = (uint8_t)right;
y++;
}
}
@@ -753,8 +753,8 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x25: // Multiply
{
- int32 foo = READ_3WORD(Memory.C4RAM + 0x1f80);
- int32 bar = READ_3WORD(Memory.C4RAM + 0x1f83);
+ int32_t foo = READ_3WORD(Memory.C4RAM + 0x1f80);
+ int32_t bar = READ_3WORD(Memory.C4RAM + 0x1f83);
foo *= bar;
WRITE_3WORD(Memory.C4RAM + 0x1f80, foo);
}
@@ -776,7 +776,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x40: // Sum
{
int i;
- uint16 sum = 0;
+ uint16_t sum = 0;
for (i = 0; i < 0x800; sum += Memory.C4RAM[i++]);
WRITE_WORD(Memory.C4RAM + 0x1f80, sum);
}
@@ -784,10 +784,10 @@ void S9xSetC4(uint8 byte, uint16 Address)
case 0x54: // Square
{
- int64 a = SAR64((int64)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
- // printf("%08X%08X\n", (uint32)(a>>32), (uint32)(a&0xFFFFFFFF));
+ int64_t a = SAR64((int64_t)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
+ // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
a *= a;
- // printf("%08X%08X\n", (uint32)(a>>32), (uint32)(a&0xFFFFFFFF));
+ // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
WRITE_3WORD(Memory.C4RAM + 0x1f83, a);
WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24));
}
@@ -818,7 +818,7 @@ void S9xSetC4(uint8 byte, uint16 Address)
}
}
-int16 C4SinTable[512] =
+int16_t C4SinTable[512] =
{
0, 402, 804, 1206, 1607, 2009, 2410, 2811,
3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997,
@@ -886,7 +886,7 @@ int16 C4SinTable[512] =
-3211, -2811, -2410, -2009, -1607, -1206, -804, -402
};
-int16 C4CosTable[512] =
+int16_t C4CosTable[512] =
{
32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647,
32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214,
diff --git a/source/cheats.c b/source/cheats.c
index 403738d..5f6cb69 100644
--- a/source/cheats.c
+++ b/source/cheats.c
@@ -96,33 +96,33 @@
#include "cheats.h"
#include "memmap.h"
-static bool8 S9xAllHex(const char* code, int len)
+static bool S9xAllHex(const char* code, int len)
{
int i;
for (i = 0; i < len; i++)
if ((code [i] < '0' || code [i] > '9') &&
(code [i] < 'a' || code [i] > 'f') &&
(code [i] < 'A' || code [i] > 'F'))
- return (FALSE);
+ return (false);
- return (TRUE);
+ return (true);
}
-const char* S9xProActionReplayToRaw(const char* code, uint32* address,
- uint8* byte)
+const char* S9xProActionReplayToRaw(const char* code, uint32_t* address,
+ uint8_t* byte)
{
- uint32 data = 0;
+ uint32_t data = 0;
if (strlen(code) != 8 || !S9xAllHex(code, 8) ||
sscanf(code, "%x", &data) != 1)
return ("Invalid Pro Action Replay code - should be 8 hex digits in length.");
*address = data >> 8;
- *byte = (uint8) data;
+ *byte = (uint8_t) data;
return (NULL);
}
-const char* S9xGoldFingerToRaw(const char* code, uint32* address, bool8* sram,
- uint8* num_bytes, uint8 bytes[3])
+const char* S9xGoldFingerToRaw(const char* code, uint32_t* address, bool* sram,
+ uint8_t* num_bytes, uint8_t bytes[3])
{
char tmp [15];
if (strlen(code) != 14)
@@ -141,14 +141,14 @@ const char* S9xGoldFingerToRaw(const char* code, uint32* address, bool8* sram,
int byte;
if (sscanf(tmp, "%x", &byte) != 1)
break;
- bytes [i] = (uint8) byte;
+ bytes [i] = (uint8_t) byte;
}
*num_bytes = i;
*sram = code [13] == '1';
return (NULL);
}
-const char* S9xGameGenieToRaw(const char* code, uint32* address, uint8* byte)
+const char* S9xGameGenieToRaw(const char* code, uint32_t* address, uint8_t* byte)
{
char new_code [12];
@@ -180,9 +180,9 @@ const char* S9xGameGenieToRaw(const char* code, uint32* address, uint8* byte)
if (j == 16)
return ("Invalid hex-character in Game Genie(tm) code");
}
- uint32 data = 0;
+ uint32_t data = 0;
sscanf(new_code, "%x", &data);
- *byte = (uint8)(data >> 24);
+ *byte = (uint8_t)(data >> 24);
*address = ((data & 0x003c00) << 10) +
((data & 0x00003c) << 14) +
((data & 0xf00000) >> 8) +
@@ -225,19 +225,19 @@ void S9xStartCheatSearch(SCheatData* d)
(a) != (b))
#define _D(s,m,o) \
-((s) == S9X_8_BITS ? (uint8) (*((m) + (o))) : \
- (s) == S9X_16_BITS ? ((uint16) (*((m) + (o)) + (*((m) + (o) + 1) << 8))) : \
- (s) == S9X_24_BITS ? ((uint32) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16))) : \
-((uint32) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16) + (*((m) + (o) + 3) << 24))))
+((s) == S9X_8_BITS ? (uint8_t) (*((m) + (o))) : \
+ (s) == S9X_16_BITS ? ((uint16_t) (*((m) + (o)) + (*((m) + (o) + 1) << 8))) : \
+ (s) == S9X_24_BITS ? ((uint32_t) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16))) : \
+((uint32_t) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16) + (*((m) + (o) + 3) << 24))))
#define _DS(s,m,o) \
-((s) == S9X_8_BITS ? ((int8) *((m) + (o))) : \
- (s) == S9X_16_BITS ? ((int16) (*((m) + (o)) + (*((m) + (o) + 1) << 8))) : \
- (s) == S9X_24_BITS ? (((int32) ((*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16)) << 8)) >> 8): \
- ((int32) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16) + (*((m) + (o) + 3) << 24))))
+((s) == S9X_8_BITS ? ((int8_t) *((m) + (o))) : \
+ (s) == S9X_16_BITS ? ((int16_t) (*((m) + (o)) + (*((m) + (o) + 1) << 8))) : \
+ (s) == S9X_24_BITS ? (((int32_t) ((*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16)) << 8)) >> 8): \
+ ((int32_t) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16) + (*((m) + (o) + 3) << 24))))
void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp,
- S9xCheatDataSize size, bool8 is_signed, bool8 update)
+ S9xCheatDataSize size, bool is_signed, bool update)
{
int l;
@@ -338,8 +338,8 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp,
}
void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
- S9xCheatDataSize size, uint32 value,
- bool8 is_signed, bool8 update)
+ S9xCheatDataSize size, uint32_t value,
+ bool is_signed, bool update)
{
int l;
@@ -367,7 +367,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
for (i = 0; i < 0x20000 - l; i++)
{
if (TEST_BIT(d->WRAM_BITS, i) &&
- CHEATS_C(cmp, _DS(size, d->RAM, i), (int32) value))
+ CHEATS_C(cmp, _DS(size, d->RAM, i), (int32_t) value))
{
if (update)
d->CWRAM [i] = d->RAM [i];
@@ -379,7 +379,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
for (i = 0; i < 0x10000 - l; i++)
{
if (TEST_BIT(d->SRAM_BITS, i) &&
- CHEATS_C(cmp, _DS(size, d->SRAM, i), (int32) value))
+ CHEATS_C(cmp, _DS(size, d->SRAM, i), (int32_t) value))
{
if (update)
d->CSRAM [i] = d->SRAM [i];
@@ -391,7 +391,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
for (i = 0; i < 0x2000 - l; i++)
{
if (TEST_BIT(d->IRAM_BITS, i) &&
- CHEATS_C(cmp, _DS(size, d->FillRAM + 0x3000, i), (int32) value))
+ CHEATS_C(cmp, _DS(size, d->FillRAM + 0x3000, i), (int32_t) value))
{
if (update)
d->CIRAM [i] = d->FillRAM [i + 0x3000];
diff --git a/source/cheats.h b/source/cheats.h
index c3a7a54..7d43f2b 100644
--- a/source/cheats.h
+++ b/source/cheats.h
@@ -96,11 +96,11 @@
typedef struct
{
- uint32 address;
- uint8 byte;
- uint8 saved_byte;
- bool8 enabled;
- bool8 saved;
+ uint32_t address;
+ uint8_t byte;
+ uint8_t saved_byte;
+ bool enabled;
+ bool saved;
char name[MAX_SFCCHEAT_NAME];
}SCheat;
@@ -108,16 +108,16 @@ typedef struct
typedef struct
{
SCheat c [MAX_CHEATS_T];
- uint32 num_cheats;
- uint8 CWRAM [0x20000];
- uint8 CSRAM [0x10000];
- uint8 CIRAM [0x2000];
- uint8 *RAM;
- uint8 *FillRAM;
- uint8 *SRAM;
- uint32 WRAM_BITS [0x20000 >> 3];
- uint32 SRAM_BITS [0x10000 >> 3];
- uint32 IRAM_BITS [0x2000 >> 3];
+ uint32_t num_cheats;
+ uint8_t CWRAM [0x20000];
+ uint8_t CSRAM [0x10000];
+ uint8_t CIRAM [0x2000];
+ uint8_t *RAM;
+ uint8_t *FillRAM;
+ uint8_t *SRAM;
+ uint32_t WRAM_BITS [0x20000 >> 3];
+ uint32_t SRAM_BITS [0x10000 >> 3];
+ uint32_t IRAM_BITS [0x2000 >> 3];
}SCheatData;
typedef enum
@@ -133,30 +133,30 @@ typedef enum
void S9xInitCheatData ();
-const char *S9xGameGenieToRaw (const char *code, uint32 *address, uint8 *byte);
-const char *S9xProActionReplayToRaw (const char *code, uint32 *address, uint8 *byte);
-const char *S9xGoldFingerToRaw (const char *code, uint32 *address, bool8 *sram,
- uint8 *num_bytes, uint8 bytes[3]);
+const char *S9xGameGenieToRaw (const char *code, uint32_t *address, uint8_t *byte);
+const char *S9xProActionReplayToRaw (const char *code, uint32_t *address, uint8_t *byte);
+const char *S9xGoldFingerToRaw (const char *code, uint32_t *address, bool *sram,
+ uint8_t *num_bytes, uint8_t bytes[3]);
void S9xApplyCheats ();
-void S9xApplyCheat (uint32 which1);
+void S9xApplyCheat (uint32_t which1);
void S9xRemoveCheats ();
-void S9xRemoveCheat (uint32 which1);
-void S9xEnableCheat (uint32 which1);
-void S9xDisableCheat (uint32 which1);
+void S9xRemoveCheat (uint32_t which1);
+void S9xEnableCheat (uint32_t which1);
+void S9xDisableCheat (uint32_t which1);
void S9xDisableAllCheat(void);
-void S9xAddCheat (bool8 enable, bool8 save_current_value, uint32 address,
- uint8 byte);
+void S9xAddCheat (bool enable, bool save_current_value, uint32_t address,
+ uint8_t byte);
void S9xDeleteCheats ();
-void S9xDeleteCheat (uint32 which1);
-bool8 S9xLoadCheatFile (const char *filename);
-bool8 S9xSaveCheatFile (const char *filename);
+void S9xDeleteCheat (uint32_t which1);
+bool S9xLoadCheatFile (const char *filename);
+bool S9xSaveCheatFile (const char *filename);
void S9xStartCheatSearch (SCheatData *cheats);
void S9xSearchForChange (SCheatData *cheats, S9xCheatComparisonType cmp,
- S9xCheatDataSize size, bool8 is_signed, bool8 update);
+ S9xCheatDataSize size, bool is_signed, bool update);
void S9xSearchForValue (SCheatData *cheats, S9xCheatComparisonType cmp,
- S9xCheatDataSize size, uint32 value,
- bool8 is_signed, bool8 update);
+ S9xCheatDataSize size, uint32_t value,
+ bool is_signed, bool update);
void S9xOutputCheatSearchResults (SCheatData *cheats);
#endif
diff --git a/source/cheats2.c b/source/cheats2.c
index aaee684..7781ba7 100644
--- a/source/cheats2.c
+++ b/source/cheats2.c
@@ -105,8 +105,8 @@ void S9xInitCheatData()
Cheat.FillRAM = Memory.FillRAM;
}
-void S9xAddCheat(bool8 enable, bool8 save_current_value,
- uint32 address, uint8 byte)
+void S9xAddCheat(bool enable, bool save_current_value,
+ uint32_t address, uint8_t byte)
{
if (Cheat.num_cheats < sizeof(Cheat.c) / sizeof(Cheat.c [0]))
{
@@ -116,7 +116,7 @@ void S9xAddCheat(bool8 enable, bool8 save_current_value,
if (save_current_value)
{
Cheat.c [Cheat.num_cheats].saved_byte = S9xGetByte(address);
- Cheat.c [Cheat.num_cheats].saved = TRUE;
+ Cheat.c [Cheat.num_cheats].saved = true;
}
Cheat.num_cheats++;
if (enable)
@@ -124,7 +124,7 @@ void S9xAddCheat(bool8 enable, bool8 save_current_value,
}
}
-void S9xDeleteCheat(uint32 which1)
+void S9xDeleteCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats)
{
@@ -144,62 +144,62 @@ void S9xDeleteCheats()
Cheat.num_cheats = 0;
}
-void S9xEnableCheat(uint32 which1)
+void S9xEnableCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats && !Cheat.c [which1].enabled)
{
- Cheat.c [which1].enabled = TRUE;
+ Cheat.c [which1].enabled = true;
S9xApplyCheat(which1);
}
}
-void S9xDisableCheat(uint32 which1)
+void S9xDisableCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats && Cheat.c [which1].enabled)
{
S9xRemoveCheat(which1);
- Cheat.c [which1].enabled = FALSE;
+ Cheat.c [which1].enabled = false;
}
}
-void S9xRemoveCheat(uint32 which1)
+void S9xRemoveCheat(uint32_t which1)
{
if (Cheat.c [which1].saved)
{
- uint32 address = Cheat.c [which1].address;
+ uint32_t address = Cheat.c [which1].address;
int block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
- uint8* ptr = Memory.Map [block];
+ uint8_t* ptr = Memory.Map [block];
- if (ptr >= (uint8*) MAP_LAST)
+ if (ptr >= (uint8_t*) MAP_LAST)
*(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.
- Cheat.c [which1].saved = FALSE;
+ Cheat.c [which1].saved = false;
}
}
-void S9xApplyCheat(uint32 which1)
+void S9xApplyCheat(uint32_t which1)
{
- uint32 address = Cheat.c [which1].address;
+ uint32_t address = Cheat.c [which1].address;
if (!Cheat.c [which1].saved)
Cheat.c [which1].saved_byte = S9xGetByte(address);
int block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
- uint8* ptr = Memory.Map [block];
+ uint8_t* ptr = Memory.Map [block];
- if (ptr >= (uint8*) MAP_LAST)
+ if (ptr >= (uint8_t*) MAP_LAST)
*(ptr + (address & 0xffff)) = Cheat.c [which1].byte;
else
S9xSetByte(Cheat.c [which1].byte, address);
- Cheat.c [which1].saved = TRUE;
+ Cheat.c [which1].saved = true;
}
void S9xApplyCheats()
{
- uint32 i;
+ uint32_t i;
if (Settings.ApplyCheats)
{
for (i = 0; i < Cheat.num_cheats; i++)
@@ -210,21 +210,21 @@ void S9xApplyCheats()
void S9xRemoveCheats()
{
- uint32 i;
+ uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
if (Cheat.c [i].enabled)
S9xRemoveCheat(i);
}
-bool8 S9xLoadCheatFile(const char* filename)
+bool S9xLoadCheatFile(const char* filename)
{
Cheat.num_cheats = 0;
FILE* fs = fopen(filename, "rb");
- uint8 data [8 + MAX_SFCCHEAT_NAME];
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
if (!fs)
- return (FALSE);
+ return (false);
while (fread((void*) data, 1, 8 + MAX_SFCCHEAT_NAME,
fs) == 8 + MAX_SFCCHEAT_NAME)
@@ -232,7 +232,7 @@ bool8 S9xLoadCheatFile(const char* filename)
if (data[6] != 254 || data[7] != 252)
{
fclose(fs);
- return (FALSE);
+ return (false);
}
Cheat.c [Cheat.num_cheats].enabled = (data [0] & 4) == 0;
Cheat.c [Cheat.num_cheats].byte = data [1];
@@ -245,24 +245,24 @@ bool8 S9xLoadCheatFile(const char* filename)
}
fclose(fs);
- return (TRUE);
+ return (true);
}
-bool8 S9xSaveCheatFile(const char* filename)
+bool S9xSaveCheatFile(const char* filename)
{
if (Cheat.num_cheats == 0)
{
(void) remove(filename);
- return (TRUE);
+ return (true);
}
FILE* fs = fopen(filename, "wb");
- uint8 data [8 + MAX_SFCCHEAT_NAME];
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
if (!fs)
- return (FALSE);
+ return (false);
- uint32 i;
+ uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
{
memset(data, 0, 8 + MAX_SFCCHEAT_NAME);
@@ -275,21 +275,21 @@ bool8 S9xSaveCheatFile(const char* filename)
data [0] |= 8;
data [1] = Cheat.c [i].byte;
- data [2] = (uint8) Cheat.c [i].address;
- data [3] = (uint8)(Cheat.c [i].address >> 8);
- data [4] = (uint8)(Cheat.c [i].address >> 16);
+ data [2] = (uint8_t) Cheat.c [i].address;
+ data [3] = (uint8_t)(Cheat.c [i].address >> 8);
+ data [4] = (uint8_t)(Cheat.c [i].address >> 16);
data [5] = Cheat.c [i].saved_byte;
memcpy(&data [8], Cheat.c [i].name, MAX_SFCCHEAT_NAME - 1);
if (fwrite(data, 8 + MAX_SFCCHEAT_NAME, 1, fs) != 1)
{
fclose(fs);
- return (FALSE);
+ return (false);
}
}
fclose(fs);
- return (TRUE);
+ return (true);
}
#endif
diff --git a/source/clip.c b/source/clip.c
index dd4a16b..38011fd 100644
--- a/source/clip.c
+++ b/source/clip.c
@@ -94,8 +94,8 @@
struct Band
{
- uint32 Left;
- uint32 Right;
+ uint32_t Left;
+ uint32_t Right;
};
#undef MIN
@@ -115,9 +115,9 @@ struct Band
static int IntCompare(const void* d1, const void* d2)
{
- if (*(uint32*) d1 > *(uint32*) d2)
+ if (*(uint32_t*) d1 > *(uint32_t*) d2)
return (1);
- else if (*(uint32*) d1 < * (uint32*) d2)
+ else if (*(uint32_t*) d1 < * (uint32_t*) d2)
return (-1);
return (0);
}
@@ -192,9 +192,9 @@ void ComputeClipWindows()
{
struct Band Win1[3];
struct Band Win2[3];
- uint32 Window1Enabled = 0;
- uint32 Window2Enabled = 0;
- bool8 invert = (w == 5 &&
+ uint32_t Window1Enabled = 0;
+ uint32_t Window2Enabled = 0;
+ bool invert = (w == 5 &&
((c == 1 && (Memory.FillRAM [0x2130] & 0x30) == 0x10) ||
(c == 0 && (Memory.FillRAM [0x2130] & 0xc0) == 0x40)));
@@ -477,9 +477,9 @@ void ComputeClipWindows()
}
else
{
- uint32 p = 0;
- uint32 points [10];
- uint32 i;
+ uint32_t p = 0;
+ uint32_t points [10];
+ uint32_t i;
invert = !invert;
// Build an array of points (window edges)
@@ -653,7 +653,7 @@ void ComputeClipWindows()
}
else
{
- uint32 j;
+ uint32_t j;
for (j = 0; j < Window1Enabled; j++)
{
pClip->Left [j][w] = Win1[j].Left;
@@ -702,7 +702,7 @@ void ComputeClipWindows()
}
else
{
- uint32 j;
+ uint32_t j;
for (j = 0; j < Window2Enabled; j++)
{
pClip->Left [j][w] = Win2[j].Left;
@@ -720,7 +720,7 @@ void ComputeClipWindows()
// the same as the colour window.
if (pClip->Count [w] == 0)
{
- uint32 i;
+ uint32_t i;
pClip->Count [w] = pClip->Count [5];
for (i = 0; i < pClip->Count [w]; i++)
{
@@ -732,10 +732,10 @@ void ComputeClipWindows()
{
// Intersect the colour window with the bg's
// own clip window.
- uint32 i;
+ uint32_t i;
for (i = 0; i < pClip->Count [w]; i++)
{
- uint32 j;
+ uint32_t j;
for (j = 0; j < pClip->Count [5]; j++)
{
if ((pClip->Left[i][w] >= pClip->Left[j][5]
diff --git a/source/cpu.c b/source/cpu.c
index be74003..5148519 100644
--- a/source/cpu.c
+++ b/source/cpu.c
@@ -130,11 +130,11 @@ void S9xResetCPU()
ClearFlags(Decimal);
CPU.Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG);
- CPU.BranchSkip = FALSE;
- CPU.NMIActive = FALSE;
- CPU.IRQActive = FALSE;
- CPU.WaitingForInterrupt = FALSE;
- CPU.InDMA = FALSE;
+ CPU.BranchSkip = false;
+ CPU.NMIActive = false;
+ CPU.IRQActive = false;
+ CPU.WaitingForInterrupt = false;
+ CPU.InDMA = false;
CPU.WhichEvent = HBLANK_START_EVENT;
CPU.PC = NULL;
CPU.PCBase = NULL;
@@ -148,16 +148,16 @@ void S9xResetCPU()
CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
CPU.FastROMSpeed = SLOW_ONE_CYCLE;
CPU.AutoSaveTimer = 0;
- CPU.SRAMModified = FALSE;
+ CPU.SRAMModified = false;
// CPU.NMITriggerPoint = 4; // Set when ROM image loaded
- CPU.BRKTriggered = FALSE;
- //CPU.TriedInterleavedMode2 = FALSE; // Reset when ROM image loaded
+ CPU.BRKTriggered = false;
+ //CPU.TriedInterleavedMode2 = false; // Reset when ROM image loaded
CPU.NMICycleCount = 0;
CPU.IRQCycleCount = 0;
S9xSetPCBase(ICPU.Registers.PC);
ICPU.S9xOpcodes = S9xOpcodesE1;
- ICPU.CPUExecuting = TRUE;
+ ICPU.CPUExecuting = true;
S9xUnpackStatus();
}
diff --git a/source/cpuaddr.h b/source/cpuaddr.h
index 3ca6dbf..ffd8703 100644
--- a/source/cpuaddr.h
+++ b/source/cpuaddr.h
@@ -119,7 +119,7 @@ static void Immediate16(AccessMode a, InternalOp op)
static void Relative(AccessMode a, InternalOp op)
{
- int8 Int8 = *CPU.PC++;
+ int8_t Int8 = *CPU.PC++;
long Addr = ((intptr_t)(CPU.PC - CPU.PCBase) + Int8) & 0xffff;
(*op)(Addr);
}
@@ -128,7 +128,7 @@ static void RelativeLong(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = *(uint16*) CPU.PC;
+ Addr = *(uint16_t*) CPU.PC;
#else
Addr = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -142,14 +142,14 @@ static void AbsoluteIndexedIndirect(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = (ICPU.Registers.X.W + * (uint16*) CPU.PC) & 0xffff;
+ Addr = (ICPU.Registers.X.W + * (uint16_t*) CPU.PC) & 0xffff;
#else
Addr = (ICPU.Registers.X.W + *CPU.PC + (*(CPU.PC + 1) << 8)) & 0xffff;
#endif
OpenBus = *(CPU.PC + 1);
CPU.PC += 2;
Addr = S9xGetWord(ICPU.ShiftedPB + Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
(*op)(Addr);
}
@@ -157,7 +157,7 @@ static void AbsoluteIndirectLong(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = *(uint16*) CPU.PC;
+ Addr = *(uint16_t*) CPU.PC;
#else
Addr = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -175,7 +175,7 @@ static void AbsoluteIndirect(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = *(uint16*) CPU.PC;
+ Addr = *(uint16_t*) CPU.PC;
#else
Addr = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -183,7 +183,7 @@ static void AbsoluteIndirect(AccessMode a, InternalOp op)
OpenBus = *(CPU.PC + 1);
CPU.PC += 2;
Addr = S9xGetWord(Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedPB;
(*op)(Addr);
}
@@ -192,7 +192,7 @@ static void Absolute(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = *(uint16*) CPU.PC + ICPU.ShiftedDB;
+ Addr = *(uint16_t*) CPU.PC + ICPU.ShiftedDB;
#else
Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + ICPU.ShiftedDB;
#endif
@@ -205,12 +205,12 @@ static void AbsoluteLong(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = (*(uint32*) CPU.PC) & 0xffffff;
+ Addr = (*(uint32_t*) CPU.PC) & 0xffffff;
#elif defined FAST_ALIGNED_LSB_WORD_ACCESS
if (((intptr_t) CPU.PC & 1) == 0)
- Addr = (*(uint16*) CPU.PC) + (*(CPU.PC + 2) << 16);
+ Addr = (*(uint16_t*) CPU.PC) + (*(CPU.PC + 2) << 16);
else
- Addr = *CPU.PC + ((*(uint16*)(CPU.PC + 1)) << 8);
+ Addr = *CPU.PC + ((*(uint16_t*)(CPU.PC + 1)) << 8);
#else
Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16);
#endif
@@ -233,7 +233,7 @@ static void DirectIndirectIndexed(AccessMode a, InternalOp op)
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
Addr = S9xGetWord(Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedDB + ICPU.Registers.Y.W;
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
@@ -262,7 +262,7 @@ static void DirectIndexedIndirect(AccessMode a, InternalOp op)
long Addr = (*CPU.PC++ + ICPU.Registers.D.W + ICPU.Registers.X.W) & 0xffff;
Addr = S9xGetWord(Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedDB;
(*op)(Addr);
}
@@ -288,7 +288,7 @@ static void AbsoluteIndexedX(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = ICPU.ShiftedDB + *(uint16*) CPU.PC + ICPU.Registers.X.W;
+ Addr = ICPU.ShiftedDB + *(uint16_t*) CPU.PC + ICPU.Registers.X.W;
#else
Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) +
ICPU.Registers.X.W;
@@ -304,7 +304,7 @@ static void AbsoluteIndexedY(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = ICPU.ShiftedDB + *(uint16*) CPU.PC + ICPU.Registers.Y.W;
+ Addr = ICPU.ShiftedDB + *(uint16_t*) CPU.PC + ICPU.Registers.Y.W;
#else
Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) +
ICPU.Registers.Y.W;
@@ -320,13 +320,13 @@ static void AbsoluteLongIndexedX(AccessMode a, InternalOp op)
{
long Addr;
#ifdef FAST_LSB_WORD_ACCESS
- Addr = (*(uint32*) CPU.PC + ICPU.Registers.X.W) & 0xffffff;
+ Addr = (*(uint32_t*) CPU.PC + ICPU.Registers.X.W) & 0xffffff;
#elif defined FAST_ALIGNED_LSB_WORD_ACCESS
if (((intptr_t) CPU.PC & 1) == 0)
- Addr = ((*(uint16*) CPU.PC) + (*(CPU.PC + 2) << 16) + ICPU.Registers.X.W) &
+ Addr = ((*(uint16_t*) CPU.PC) + (*(CPU.PC + 2) << 16) + ICPU.Registers.X.W) &
0xFFFFFF;
else
- Addr = (*CPU.PC + ((*(uint16*)(CPU.PC + 1)) << 8) + ICPU.Registers.X.W) &
+ Addr = (*CPU.PC + ((*(uint16_t*)(CPU.PC + 1)) << 8) + ICPU.Registers.X.W) &
0xFFFFFF;
#else
Addr = (*CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16) +
@@ -342,7 +342,7 @@ static void DirectIndirect(AccessMode a, InternalOp op)
OpenBus = *CPU.PC;
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
Addr = S9xGetWord(Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedDB;
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
@@ -373,7 +373,7 @@ static void StackRelativeIndirectIndexed(AccessMode a, InternalOp op)
OpenBus = *CPU.PC;
long Addr = (*CPU.PC++ + ICPU.Registers.S.W) & 0xffff;
Addr = S9xGetWord(Addr);
- if (a & READ) OpenBus = (uint8)(Addr >> 8);
+ if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr = (Addr + ICPU.ShiftedDB +
ICPU.Registers.Y.W) & 0xffffff;
(*op)(Addr);
diff --git a/source/cpuexec.c b/source/cpuexec.c
index ce2d5c3..7b9cdcd 100644
--- a/source/cpuexec.c
+++ b/source/cpuexec.c
@@ -152,7 +152,7 @@ void S9xMainLoop_SA1_SFX(void)
CPU.Flags &= ~NMI_FLAG;
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
S9xOpcode_NMI();
@@ -167,7 +167,7 @@ void S9xMainLoop_SA1_SFX(void)
{
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
if (CPU.IRQActive && !Settings.DisableIRQ)
@@ -216,8 +216,8 @@ void S9xMainLoop_SA1_SFX(void)
#ifdef DETECT_NASTY_FX_INTERLEAVE
if (CPU.BRKTriggered && Settings.SuperFX && !CPU.TriedInterleavedMode2)
{
- CPU.TriedInterleavedMode2 = TRUE;
- CPU.BRKTriggered = FALSE;
+ CPU.TriedInterleavedMode2 = true;
+ CPU.BRKTriggered = false;
S9xDeinterleaveMode2();
}
#endif
@@ -238,7 +238,7 @@ void S9xMainLoop_SA1_NoSFX(void)
CPU.Flags &= ~NMI_FLAG;
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
S9xOpcode_NMI();
@@ -253,7 +253,7 @@ void S9xMainLoop_SA1_NoSFX(void)
{
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
if (CPU.IRQActive && !Settings.DisableIRQ)
@@ -315,7 +315,7 @@ void S9xMainLoop_NoSA1_SFX(void)
CPU.Flags &= ~NMI_FLAG;
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
S9xOpcode_NMI();
@@ -330,7 +330,7 @@ void S9xMainLoop_NoSA1_SFX(void)
{
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
if (CPU.IRQActive && !Settings.DisableIRQ)
@@ -377,8 +377,8 @@ void S9xMainLoop_NoSA1_SFX(void)
#ifdef DETECT_NASTY_FX_INTERLEAVE
if (CPU.BRKTriggered && Settings.SuperFX && !CPU.TriedInterleavedMode2)
{
- CPU.TriedInterleavedMode2 = TRUE;
- CPU.BRKTriggered = FALSE;
+ CPU.TriedInterleavedMode2 = true;
+ CPU.BRKTriggered = false;
S9xDeinterleaveMode2();
}
#endif
@@ -399,7 +399,7 @@ void S9xMainLoop_NoSA1_NoSFX(void)
CPU.Flags &= ~NMI_FLAG;
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
S9xOpcode_NMI();
@@ -414,7 +414,7 @@ void S9xMainLoop_NoSA1_NoSFX(void)
{
if (CPU.WaitingForInterrupt)
{
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
if (CPU.IRQActive && !Settings.DisableIRQ)
@@ -459,7 +459,7 @@ void S9xMainLoop_NoSA1_NoSFX(void)
}
}
-void S9xSetIRQ(uint32 source)
+void S9xSetIRQ(uint32_t source)
{
CPU.IRQActive |= source;
CPU.Flags |= IRQ_PENDING_FLAG;
@@ -469,12 +469,12 @@ void S9xSetIRQ(uint32 source)
// Force IRQ to trigger immediately after WAI -
// Final Fantasy Mystic Quest crashes without this.
CPU.IRQCycleCount = 0;
- CPU.WaitingForInterrupt = FALSE;
+ CPU.WaitingForInterrupt = false;
CPU.PC++;
}
}
-void S9xClearIRQ(uint32 source)
+void S9xClearIRQ(uint32_t source)
{
CLEAR_IRQ_SOURCE(source);
}
@@ -542,7 +542,7 @@ void S9xDoHBlankProcessing_SFX()
CPU.V_Counter = 0;
Memory.FillRAM[0x213F] ^= 0x80;
PPU.RangeTimeOver = 0;
- CPU.NMIActive = FALSE;
+ CPU.NMIActive = false;
ICPU.Frame++;
PPU.HVBeamCounterLatched = 0;
CPU.Flags |= SCAN_KEYS_FLAG;
@@ -568,13 +568,13 @@ void S9xDoHBlankProcessing_SFX()
{
PPU.OAMAddr = PPU.SavedOAMAddr;
- uint8 tmp = 0;
+ uint8_t tmp = 0;
if (PPU.OAMPriorityRotation)
tmp = (PPU.OAMAddr & 0xFE) >> 1;
if ((PPU.OAMFlip & 1) || PPU.FirstSprite != tmp)
{
PPU.FirstSprite = tmp;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
PPU.OAMFlip = 0;
@@ -583,7 +583,7 @@ void S9xDoHBlankProcessing_SFX()
Memory.FillRAM[0x4210] = 0x80 | Model->_5A22;
if (Memory.FillRAM[0x4200] & 0x80)
{
- CPU.NMIActive = TRUE;
+ CPU.NMIActive = true;
CPU.Flags |= NMI_FLAG;
CPU.NMICycleCount = CPU.NMITriggerPoint;
}
@@ -633,7 +633,7 @@ void S9xDoHBlankProcessing_SFX()
APU.Timer [2] -= APU.TimerTarget [2];
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
@@ -648,7 +648,7 @@ void S9xDoHBlankProcessing_SFX()
APU.Timer [0] = 0;
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
@@ -661,7 +661,7 @@ void S9xDoHBlankProcessing_SFX()
APU.Timer [1] = 0;
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
@@ -734,7 +734,7 @@ void S9xDoHBlankProcessing_NoSFX()
CPU.V_Counter = 0;
Memory.FillRAM[0x213F] ^= 0x80;
PPU.RangeTimeOver = 0;
- CPU.NMIActive = FALSE;
+ CPU.NMIActive = false;
ICPU.Frame++;
PPU.HVBeamCounterLatched = 0;
CPU.Flags |= SCAN_KEYS_FLAG;
@@ -760,13 +760,13 @@ void S9xDoHBlankProcessing_NoSFX()
{
PPU.OAMAddr = PPU.SavedOAMAddr;
- uint8 tmp = 0;
+ uint8_t tmp = 0;
if (PPU.OAMPriorityRotation)
tmp = (PPU.OAMAddr & 0xFE) >> 1;
if ((PPU.OAMFlip & 1) || PPU.FirstSprite != tmp)
{
PPU.FirstSprite = tmp;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
PPU.OAMFlip = 0;
@@ -775,7 +775,7 @@ void S9xDoHBlankProcessing_NoSFX()
Memory.FillRAM[0x4210] = 0x80 | Model->_5A22;
if (Memory.FillRAM[0x4200] & 0x80)
{
- CPU.NMIActive = TRUE;
+ CPU.NMIActive = true;
CPU.Flags |= NMI_FLAG;
CPU.NMICycleCount = CPU.NMITriggerPoint;
}
@@ -824,7 +824,7 @@ void S9xDoHBlankProcessing_NoSFX()
APU.Timer [2] -= APU.TimerTarget [2];
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
@@ -839,7 +839,7 @@ void S9xDoHBlankProcessing_NoSFX()
APU.Timer [0] = 0;
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
@@ -852,7 +852,7 @@ void S9xDoHBlankProcessing_NoSFX()
APU.Timer [1] = 0;
#ifdef SPC700_SHUTDOWN
IAPU.WaitCounter++;
- IAPU.APUExecuting = TRUE;
+ IAPU.APUExecuting = true;
#endif
}
}
diff --git a/source/cpuexec.h b/source/cpuexec.h
index ca5eb4f..531531d 100644
--- a/source/cpuexec.h
+++ b/source/cpuexec.h
@@ -114,19 +114,19 @@ typedef struct
typedef struct
{
- uint8* Speed;
+ uint8_t* Speed;
SOpcodes* S9xOpcodes;
SRegisters Registers;
- uint8 _Carry;
- uint8 _Zero;
- uint8 _Negative;
- uint8 _Overflow;
- bool8 CPUExecuting;
- uint32 ShiftedPB;
- uint32 ShiftedDB;
- uint32 Frame;
- uint32 Scanline;
- uint32 FrameAdvanceCount;
+ uint8_t _Carry;
+ uint8_t _Zero;
+ uint8_t _Negative;
+ uint8_t _Overflow;
+ bool CPUExecuting;
+ uint32_t ShiftedPB;
+ uint32_t ShiftedDB;
+ uint32_t Frame;
+ uint32_t Scanline;
+ uint32_t FrameAdvanceCount;
} SICPU;
void S9xMainLoop(void);
@@ -134,8 +134,8 @@ void S9xReset(void);
void S9xSoftReset(void);
void S9xDoHBlankProcessing_SFX();
void S9xDoHBlankProcessing_NoSFX();
-void S9xClearIRQ(uint32);
-void S9xSetIRQ(uint32);
+void S9xClearIRQ(uint32_t);
+void S9xSetIRQ(uint32_t);
extern SOpcodes S9xOpcodesE1 [256];
extern SOpcodes S9xOpcodesM1X1 [256];
@@ -160,7 +160,7 @@ STATIC inline void S9xPackStatus()
(ICPU._Negative & 0x80) | (ICPU._Overflow << 6);
}
-STATIC inline void CLEAR_IRQ_SOURCE(uint32 M)
+STATIC inline void CLEAR_IRQ_SOURCE(uint32_t M)
{
CPU.IRQActive &= ~M;
if (!CPU.IRQActive)
@@ -189,7 +189,7 @@ STATIC inline void S9xFixCycles()
STATIC inline void S9xReschedule()
{
- uint8 which;
+ uint8_t which;
long max;
if (CPU.WhichEvent == HBLANK_START_EVENT ||
diff --git a/source/cpumacro.h b/source/cpumacro.h
index 89ac88c..6975b04 100644
--- a/source/cpumacro.h
+++ b/source/cpumacro.h
@@ -90,13 +90,13 @@
#ifndef _CPUMACRO_H_
#define _CPUMACRO_H_
-static void SetZN16(uint16 Work)
+static void SetZN16(uint16_t Work)
{
ICPU._Zero = Work != 0;
- ICPU._Negative = (uint8)(Work >> 8);
+ ICPU._Negative = (uint8_t)(Work >> 8);
}
-static void SetZN8(uint8 Work)
+static void SetZN8(uint8_t Work)
{
ICPU._Zero = Work;
ICPU._Negative = Work;
@@ -104,14 +104,14 @@ static void SetZN8(uint8 Work)
static void ADC8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
if (CheckDecimal())
{
- uint8 A1 = (ICPU.Registers.A.W) & 0xF;
- uint8 A2 = (ICPU.Registers.A.W >> 4) & 0xF;
- uint8 W1 = Work8 & 0xF;
- uint8 W2 = (Work8 >> 4) & 0xF;
+ uint8_t A1 = (ICPU.Registers.A.W) & 0xF;
+ uint8_t A2 = (ICPU.Registers.A.W >> 4) & 0xF;
+ uint8_t W1 = Work8 & 0xF;
+ uint8_t W2 = (Work8 >> 4) & 0xF;
A1 += W1 + CheckCarry();
if (A1 > 9)
@@ -131,7 +131,7 @@ static void ADC8(long Addr)
else
ClearCarry();
- int8 Ans8 = (A2 << 4) | A1;
+ int8_t Ans8 = (A2 << 4) | A1;
if (~(ICPU.Registers.AL ^ Work8) &
(Work8 ^ Ans8) & 0x80)
SetOverflow();
@@ -141,34 +141,34 @@ static void ADC8(long Addr)
}
else
{
- int16 Ans16 = ICPU.Registers.AL + Work8 + CheckCarry();
+ int16_t Ans16 = ICPU.Registers.AL + Work8 + CheckCarry();
ICPU._Carry = Ans16 >= 0x100;
if (~(ICPU.Registers.AL ^ Work8) &
- (Work8 ^ (uint8) Ans16) & 0x80)
+ (Work8 ^ (uint8_t) Ans16) & 0x80)
SetOverflow();
else
ClearOverflow();
- ICPU.Registers.AL = (uint8) Ans16;
+ ICPU.Registers.AL = (uint8_t) Ans16;
}
SetZN8(ICPU.Registers.AL);
}
static void ADC16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
if (CheckDecimal())
{
- uint8 A1 = (ICPU.Registers.A.W) & 0xF;
- uint8 A2 = (ICPU.Registers.A.W >> 4) & 0xF;
- uint8 A3 = (ICPU.Registers.A.W >> 8) & 0xF;
- uint8 A4 = (ICPU.Registers.A.W >> 12) & 0xF;
- uint8 W1 = Work16 & 0xF;
- uint8 W2 = (Work16 >> 4) & 0xF;
- uint8 W3 = (Work16 >> 8) & 0xF;
- uint8 W4 = (Work16 >> 12) & 0xF;
+ uint8_t A1 = (ICPU.Registers.A.W) & 0xF;
+ uint8_t A2 = (ICPU.Registers.A.W >> 4) & 0xF;
+ uint8_t A3 = (ICPU.Registers.A.W >> 8) & 0xF;
+ uint8_t A4 = (ICPU.Registers.A.W >> 12) & 0xF;
+ uint8_t W1 = Work16 & 0xF;
+ uint8_t W2 = (Work16 >> 4) & 0xF;
+ uint8_t W3 = (Work16 >> 8) & 0xF;
+ uint8_t W4 = (Work16 >> 12) & 0xF;
A1 += W1 + CheckCarry();
if (A1 > 9)
@@ -204,7 +204,7 @@ static void ADC16(long Addr)
else
ClearCarry();
- uint16 Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1);
+ uint16_t Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1);
if (~(ICPU.Registers.A.W ^ Work16) &
(Work16 ^ Ans16) & 0x8000)
SetOverflow();
@@ -214,16 +214,16 @@ static void ADC16(long Addr)
}
else
{
- uint32 Ans32 = ICPU.Registers.A.W + Work16 + CheckCarry();
+ uint32_t Ans32 = ICPU.Registers.A.W + Work16 + CheckCarry();
ICPU._Carry = Ans32 >= 0x10000;
if (~(ICPU.Registers.A.W ^ Work16) &
- (Work16 ^ (uint16) Ans32) & 0x8000)
+ (Work16 ^ (uint16_t) Ans32) & 0x8000)
SetOverflow();
else
ClearOverflow();
- ICPU.Registers.A.W = (uint16) Ans32;
+ ICPU.Registers.A.W = (uint16_t) Ans32;
}
SetZN16(ICPU.Registers.A.W);
}
@@ -262,7 +262,7 @@ static inline void A_ASL8()
static void ASL16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
ICPU._Carry = (Work16 & 0x8000) != 0;
Work16 <<= 1;
//S9xSetWord (Work16, Addr);
@@ -273,7 +273,7 @@ static void ASL16(long Addr)
static void ASL8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
ICPU._Carry = (Work8 & 0x80) != 0;
Work8 <<= 1;
S9xSetByte(Work8, Addr);
@@ -282,15 +282,15 @@ static void ASL8(long Addr)
static void BIT16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
ICPU._Overflow = (Work16 & 0x4000) != 0;
- ICPU._Negative = (uint8)(Work16 >> 8);
+ ICPU._Negative = (uint8_t)(Work16 >> 8);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
}
static void BIT8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
ICPU._Overflow = (Work8 & 0x40) != 0;
ICPU._Negative = Work8;
ICPU._Zero = Work8 & ICPU.Registers.AL;
@@ -298,50 +298,50 @@ static void BIT8(long Addr)
static void CMP16(long Addr)
{
- int32 Int32 = (long) ICPU.Registers.A.W -
+ int32_t Int32 = (long) ICPU.Registers.A.W -
(long) S9xGetWord(Addr);
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
}
static void CMP8(long Addr)
{
- int16 Int16 = (short) ICPU.Registers.AL -
+ int16_t Int16 = (short) ICPU.Registers.AL -
(short) S9xGetByte(Addr);
ICPU._Carry = Int16 >= 0;
- SetZN8((uint8) Int16);
+ SetZN8((uint8_t) Int16);
}
static void CMX16(long Addr)
{
- int32 Int32 = (long) ICPU.Registers.X.W -
+ int32_t Int32 = (long) ICPU.Registers.X.W -
(long) S9xGetWord(Addr);
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
}
static void CMX8(long Addr)
{
- int16 Int16 = (short) ICPU.Registers.XL -
+ int16_t Int16 = (short) ICPU.Registers.XL -
(short) S9xGetByte(Addr);
ICPU._Carry = Int16 >= 0;
- SetZN8((uint8) Int16);
+ SetZN8((uint8_t) Int16);
}
static void CMY16(long Addr)
{
- int32 Int32 = (long) ICPU.Registers.Y.W -
+ int32_t Int32 = (long) ICPU.Registers.Y.W -
(long) S9xGetWord(Addr);
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
}
static void CMY8(long Addr)
{
- int16 Int16 = (short) ICPU.Registers.YL -
+ int16_t Int16 = (short) ICPU.Registers.YL -
(short) S9xGetByte(Addr);
ICPU._Carry = Int16 >= 0;
- SetZN8((uint8) Int16);
+ SetZN8((uint8_t) Int16);
}
static inline void A_DEC16()
@@ -376,7 +376,7 @@ static void DEC16(long Addr)
CPU.WaitAddress = NULL;
#endif
- uint16 Work16 = S9xGetWord(Addr) - 1;
+ uint16_t Work16 = S9xGetWord(Addr) - 1;
//S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
@@ -389,7 +389,7 @@ static void DEC8(long Addr)
CPU.WaitAddress = NULL;
#endif
- uint8 Work8 = S9xGetByte(Addr) - 1;
+ uint8_t Work8 = S9xGetByte(Addr) - 1;
S9xSetByte(Work8, Addr);
SetZN8(Work8);
}
@@ -438,7 +438,7 @@ static void INC16(long Addr)
CPU.WaitAddress = NULL;
#endif
- uint16 Work16 = S9xGetWord(Addr) + 1;
+ uint16_t Work16 = S9xGetWord(Addr) + 1;
//S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
@@ -451,7 +451,7 @@ static void INC8(long Addr)
CPU.WaitAddress = NULL;
#endif
- uint8 Work8 = S9xGetByte(Addr) + 1;
+ uint8_t Work8 = S9xGetByte(Addr) + 1;
S9xSetByte(Work8, Addr);
SetZN8(Work8);
}
@@ -514,7 +514,7 @@ static inline void A_LSR8()
static void LSR16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
ICPU._Carry = Work16 & 1;
Work16 >>= 1;
//S9xSetWord (Work16, Addr);
@@ -525,7 +525,7 @@ static void LSR16(long Addr)
static void LSR8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
ICPU._Carry = Work8 & 1;
Work8 >>= 1;
S9xSetByte(Work8, Addr);
@@ -549,10 +549,10 @@ static inline void A_ROL16()
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32 Work32 = (ICPU.Registers.A.W << 1) | CheckCarry();
+ uint32_t Work32 = (ICPU.Registers.A.W << 1) | CheckCarry();
ICPU._Carry = Work32 >= 0x10000;
- ICPU.Registers.A.W = (uint16) Work32;
- SetZN16((uint16) Work32);
+ ICPU.Registers.A.W = (uint16_t) Work32;
+ SetZN16((uint16_t) Work32);
}
static inline void A_ROL8()
@@ -560,34 +560,34 @@ static inline void A_ROL8()
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16 Work16 = ICPU.Registers.AL;
+ uint16_t Work16 = ICPU.Registers.AL;
Work16 <<= 1;
Work16 |= CheckCarry();
ICPU._Carry = Work16 >= 0x100;
- ICPU.Registers.AL = (uint8) Work16;
- SetZN8((uint8) Work16);
+ ICPU.Registers.AL = (uint8_t) Work16;
+ SetZN8((uint8_t) Work16);
}
static void ROL16(long Addr)
{
- uint32 Work32 = S9xGetWord(Addr);
+ uint32_t Work32 = S9xGetWord(Addr);
Work32 <<= 1;
Work32 |= CheckCarry();
ICPU._Carry = Work32 >= 0x10000;
- //S9xSetWord ((uint16) Work32, Addr);
+ //S9xSetWord ((uint16_t) Work32, Addr);
S9xSetByte((Work32 >> 8) & 0xFF, Addr + 1);
S9xSetByte(Work32 & 0xFF, Addr);
- SetZN16((uint16) Work32);
+ SetZN16((uint16_t) Work32);
}
static void ROL8(long Addr)
{
- uint16 Work16 = S9xGetByte(Addr);
+ uint16_t Work16 = S9xGetByte(Addr);
Work16 <<= 1;
Work16 |= CheckCarry();
ICPU._Carry = Work16 >= 0x100;
- S9xSetByte((uint8) Work16, Addr);
- SetZN8((uint8) Work16);
+ S9xSetByte((uint8_t) Work16, Addr);
+ SetZN8((uint8_t) Work16);
}
static inline void A_ROR16()
@@ -595,12 +595,12 @@ static inline void A_ROR16()
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32 Work32 = ICPU.Registers.A.W;
+ uint32_t Work32 = ICPU.Registers.A.W;
Work32 |= (int) CheckCarry() << 16;
- ICPU._Carry = (uint8)(Work32 & 1);
+ ICPU._Carry = (uint8_t)(Work32 & 1);
Work32 >>= 1;
- ICPU.Registers.A.W = (uint16) Work32;
- SetZN16((uint16) Work32);
+ ICPU.Registers.A.W = (uint16_t) Work32;
+ SetZN16((uint16_t) Work32);
}
static inline void A_ROR8()
@@ -608,49 +608,49 @@ static inline void A_ROR8()
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16 Work16 = ICPU.Registers.AL | ((uint16) CheckCarry() << 8);
- ICPU._Carry = (uint8) Work16 & 1;
+ uint16_t Work16 = ICPU.Registers.AL | ((uint16_t) CheckCarry() << 8);
+ ICPU._Carry = (uint8_t) Work16 & 1;
Work16 >>= 1;
- ICPU.Registers.AL = (uint8) Work16;
- SetZN8((uint8) Work16);
+ ICPU.Registers.AL = (uint8_t) Work16;
+ SetZN8((uint8_t) Work16);
}
static void ROR16(long Addr)
{
- uint32 Work32 = S9xGetWord(Addr);
+ uint32_t Work32 = S9xGetWord(Addr);
Work32 |= (int) CheckCarry() << 16;
- ICPU._Carry = (uint8)(Work32 & 1);
+ ICPU._Carry = (uint8_t)(Work32 & 1);
Work32 >>= 1;
- //S9xSetWord ((uint16) Work32, Addr);
+ //S9xSetWord ((uint16_t) Work32, Addr);
S9xSetByte((Work32 >> 8) & 0x00FF, Addr + 1);
S9xSetByte(Work32 & 0x00FF, Addr);
- SetZN16((uint16) Work32);
+ SetZN16((uint16_t) Work32);
}
static void ROR8(long Addr)
{
- uint16 Work16 = S9xGetByte(Addr);
+ uint16_t Work16 = S9xGetByte(Addr);
Work16 |= (int) CheckCarry() << 8;
- ICPU._Carry = (uint8)(Work16 & 1);
+ ICPU._Carry = (uint8_t)(Work16 & 1);
Work16 >>= 1;
- S9xSetByte((uint8) Work16, Addr);
- SetZN8((uint8) Work16);
+ S9xSetByte((uint8_t) Work16, Addr);
+ SetZN8((uint8_t) Work16);
}
static void SBC16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
if (CheckDecimal())
{
- uint8 A1 = (ICPU.Registers.A.W) & 0xF;
- uint8 A2 = (ICPU.Registers.A.W >> 4) & 0xF;
- uint8 A3 = (ICPU.Registers.A.W >> 8) & 0xF;
- uint8 A4 = (ICPU.Registers.A.W >> 12) & 0xF;
- uint8 W1 = Work16 & 0xF;
- uint8 W2 = (Work16 >> 4) & 0xF;
- uint8 W3 = (Work16 >> 8) & 0xF;
- uint8 W4 = (Work16 >> 12) & 0xF;
+ uint8_t A1 = (ICPU.Registers.A.W) & 0xF;
+ uint8_t A2 = (ICPU.Registers.A.W >> 4) & 0xF;
+ uint8_t A3 = (ICPU.Registers.A.W >> 8) & 0xF;
+ uint8_t A4 = (ICPU.Registers.A.W >> 12) & 0xF;
+ uint8_t W1 = Work16 & 0xF;
+ uint8_t W2 = (Work16 >> 4) & 0xF;
+ uint8_t W3 = (Work16 >> 8) & 0xF;
+ uint8_t W4 = (Work16 >> 12) & 0xF;
A1 -= W1 + !CheckCarry();
A2 -= W2;
@@ -679,7 +679,7 @@ static void SBC16(long Addr)
else
SetCarry();
- uint16 Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1);
+ uint16_t Ans16 = (A4 << 12) | (A3 << 8) | (A2 << 4) | (A1);
if ((ICPU.Registers.A.W ^ Work16) &
(ICPU.Registers.A.W ^ Ans16) & 0x8000)
SetOverflow();
@@ -691,30 +691,30 @@ static void SBC16(long Addr)
else
{
- int32 Int32 = (long) ICPU.Registers.A.W - (long) Work16 +
+ int32_t Int32 = (long) ICPU.Registers.A.W - (long) Work16 +
(long) CheckCarry() - 1;
ICPU._Carry = Int32 >= 0;
if ((ICPU.Registers.A.W ^ Work16) &
- (ICPU.Registers.A.W ^ (uint16) Int32) & 0x8000)
+ (ICPU.Registers.A.W ^ (uint16_t) Int32) & 0x8000)
SetOverflow();
else
ClearOverflow();
- ICPU.Registers.A.W = (uint16) Int32;
+ ICPU.Registers.A.W = (uint16_t) Int32;
SetZN16(ICPU.Registers.A.W);
}
}
static void SBC8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
if (CheckDecimal())
{
- uint8 A1 = (ICPU.Registers.A.W) & 0xF;
- uint8 A2 = (ICPU.Registers.A.W >> 4) & 0xF;
- uint8 W1 = Work8 & 0xF;
- uint8 W2 = (Work8 >> 4) & 0xF;
+ uint8_t A1 = (ICPU.Registers.A.W) & 0xF;
+ uint8_t A2 = (ICPU.Registers.A.W >> 4) & 0xF;
+ uint8_t W1 = Work8 & 0xF;
+ uint8_t W2 = (Work8 >> 4) & 0xF;
A1 -= W1 + !CheckCarry();
A2 -= W2;
@@ -731,7 +731,7 @@ static void SBC8(long Addr)
else
SetCarry();
- uint8 Ans8 = (A2 << 4) | A1;
+ uint8_t Ans8 = (A2 << 4) | A1;
if ((ICPU.Registers.AL ^ Work8) &
(ICPU.Registers.AL ^ Ans8) & 0x80)
SetOverflow();
@@ -742,16 +742,16 @@ static void SBC8(long Addr)
}
else
{
- int16 Int16 = (short) ICPU.Registers.AL - (short) Work8 +
+ int16_t Int16 = (short) ICPU.Registers.AL - (short) Work8 +
(short) CheckCarry() - 1;
ICPU._Carry = Int16 >= 0;
if ((ICPU.Registers.AL ^ Work8) &
- (ICPU.Registers.AL ^ (uint8) Int16) & 0x80)
+ (ICPU.Registers.AL ^ (uint8_t) Int16) & 0x80)
SetOverflow();
else
ClearOverflow();
- ICPU.Registers.AL = (uint8) Int16;
+ ICPU.Registers.AL = (uint8_t) Int16;
SetZN8(ICPU.Registers.AL);
}
}
@@ -798,7 +798,7 @@ static void STZ8(long Addr)
static void TSB16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 |= ICPU.Registers.A.W;
//S9xSetWord (Work16, Addr);
@@ -808,7 +808,7 @@ static void TSB16(long Addr)
static void TSB8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
ICPU._Zero = Work8 & ICPU.Registers.AL;
Work8 |= ICPU.Registers.AL;
S9xSetByte(Work8, Addr);
@@ -816,7 +816,7 @@ static void TSB8(long Addr)
static void TRB16(long Addr)
{
- uint16 Work16 = S9xGetWord(Addr);
+ uint16_t Work16 = S9xGetWord(Addr);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 &= ~ICPU.Registers.A.W;
//S9xSetWord (Work16, Addr);
@@ -826,7 +826,7 @@ static void TRB16(long Addr)
static void TRB8(long Addr)
{
- uint8 Work8 = S9xGetByte(Addr);
+ uint8_t Work8 = S9xGetByte(Addr);
ICPU._Zero = Work8 & ICPU.Registers.AL;
Work8 &= ~ICPU.Registers.AL;
S9xSetByte(Work8, Addr);
diff --git a/source/cpuops.c b/source/cpuops.c
index f398e0c..57c3d6c 100644
--- a/source/cpuops.c
+++ b/source/cpuops.c
@@ -371,7 +371,7 @@ static void Op29M1(void)
static void Op29M0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.A.W &= *(uint16*) CPU.PC;
+ ICPU.Registers.A.W &= *(uint16_t*) CPU.PC;
#else
ICPU.Registers.A.W &= *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -703,7 +703,7 @@ static void Op89M1(void)
static void Op89M0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU._Zero = (ICPU.Registers.A.W & *(uint16*) CPU.PC) != 0;
+ ICPU._Zero = (ICPU.Registers.A.W & *(uint16_t*) CPU.PC) != 0;
#else
ICPU._Zero = (ICPU.Registers.A.W & (*CPU.PC + (*(CPU.PC + 1) << 8))) != 0;
#endif
@@ -789,9 +789,9 @@ static void Op3CM0(void)
/* CMP *************************************************************************************** */
static void OpC9M1(void)
{
- int32 Int32 = (int) ICPU.Registers.AL - (intptr_t) * CPU.PC++;
+ int32_t Int32 = (int) ICPU.Registers.AL - (intptr_t) * CPU.PC++;
ICPU._Carry = Int32 >= 0;
- SetZN8((uint8) Int32);
+ SetZN8((uint8_t) Int32);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed;
#endif
@@ -799,15 +799,15 @@ static void OpC9M1(void)
static void OpC9M0(void)
{
- int32 Int32;
+ int32_t Int32;
#ifdef FAST_LSB_WORD_ACCESS
- Int32 = (long) ICPU.Registers.A.W - (long) * (uint16*) CPU.PC;
+ Int32 = (long) ICPU.Registers.A.W - (long) * (uint16_t*) CPU.PC;
#else
Int32 = (long) ICPU.Registers.A.W -
(long)(*CPU.PC + (*(CPU.PC + 1) << 8));
#endif
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
CPU.PC += 2;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2;
@@ -1051,9 +1051,9 @@ static void OpD3M0(void)
/* CMX *************************************************************************************** */
static void OpE0X1(void)
{
- int32 Int32 = (int) ICPU.Registers.XL - (intptr_t) * CPU.PC++;
+ int32_t Int32 = (int) ICPU.Registers.XL - (intptr_t) * CPU.PC++;
ICPU._Carry = Int32 >= 0;
- SetZN8((uint8) Int32);
+ SetZN8((uint8_t) Int32);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed;
#endif
@@ -1061,15 +1061,15 @@ static void OpE0X1(void)
static void OpE0X0(void)
{
- int32 Int32;
+ int32_t Int32;
#ifdef FAST_LSB_WORD_ACCESS
- Int32 = (long) ICPU.Registers.X.W - (long) * (uint16*) CPU.PC;
+ Int32 = (long) ICPU.Registers.X.W - (long) * (uint16_t*) CPU.PC;
#else
Int32 = (long) ICPU.Registers.X.W -
(long)(*CPU.PC + (*(CPU.PC + 1) << 8));
#endif
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
CPU.PC += 2;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2;
@@ -1113,9 +1113,9 @@ static void OpECX0(void)
/* CMY *************************************************************************************** */
static void OpC0X1(void)
{
- int32 Int32 = (int) ICPU.Registers.YL - (intptr_t) * CPU.PC++;
+ int32_t Int32 = (int) ICPU.Registers.YL - (intptr_t) * CPU.PC++;
ICPU._Carry = Int32 >= 0;
- SetZN8((uint8) Int32);
+ SetZN8((uint8_t) Int32);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed;
#endif
@@ -1123,15 +1123,15 @@ static void OpC0X1(void)
static void OpC0X0(void)
{
- int32 Int32;
+ int32_t Int32;
#ifdef FAST_LSB_WORD_ACCESS
- Int32 = (long) ICPU.Registers.Y.W - (long) * (uint16*) CPU.PC;
+ Int32 = (long) ICPU.Registers.Y.W - (long) * (uint16_t*) CPU.PC;
#else
Int32 = (long) ICPU.Registers.Y.W -
(long)(*CPU.PC + (*(CPU.PC + 1) << 8));
#endif
ICPU._Carry = Int32 >= 0;
- SetZN16((uint16) Int32);
+ SetZN16((uint16_t) Int32);
CPU.PC += 2;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2;
@@ -1270,7 +1270,7 @@ static void Op49M1(void)
static void Op49M0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.A.W ^= *(uint16*) CPU.PC;
+ ICPU.Registers.A.W ^= *(uint16_t*) CPU.PC;
#else
ICPU.Registers.A.W ^= *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -1612,7 +1612,7 @@ static void OpA9M1(void)
static void OpA9M0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.A.W = *(uint16*) CPU.PC;
+ ICPU.Registers.A.W = *(uint16_t*) CPU.PC;
#else
ICPU.Registers.A.W = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -1871,7 +1871,7 @@ static void OpA2X1(void)
static void OpA2X0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.X.W = *(uint16*) CPU.PC;
+ ICPU.Registers.X.W = *(uint16_t*) CPU.PC;
#else
ICPU.Registers.X.W = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -1968,7 +1968,7 @@ static void OpA0X1(void)
static void OpA0X0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.Y.W = *(uint16*) CPU.PC;
+ ICPU.Registers.Y.W = *(uint16_t*) CPU.PC;
#else
ICPU.Registers.Y.W = *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -2151,7 +2151,7 @@ static void Op09M1(void)
static void Op09M0(void)
{
#ifdef FAST_LSB_WORD_ACCESS
- ICPU.Registers.A.W |= *(uint16*) CPU.PC;
+ ICPU.Registers.A.W |= *(uint16_t*) CPU.PC;
#else
ICPU.Registers.A.W |= *CPU.PC + (*(CPU.PC + 1) << 8);
#endif
@@ -3315,7 +3315,7 @@ static void Op0CM0(void)
#define BranchCheck0()\
if( CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
+ CPU.BranchSkip = false;\
if (!Settings.SoundSkipMethod)\
if( CPU.PC - CPU.PCBase > OpAddress)\
return;\
@@ -3324,7 +3324,7 @@ static void Op0CM0(void)
#define BranchCheck1()\
if( CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
+ CPU.BranchSkip = false;\
if (!Settings.SoundSkipMethod) {\
if( CPU.PC - CPU.PCBase > OpAddress)\
return;\
@@ -3344,7 +3344,7 @@ static void Op0CM0(void)
#define BranchCheck2()\
if( CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
+ CPU.BranchSkip = false;\
if (!Settings.SoundSkipMethod) {\
if( CPU.PC - CPU.PCBase > OpAddress)\
return;\
@@ -3387,13 +3387,13 @@ static inline void CPUShutdown()
CPU.Cycles = CPU.NextEvent;
if (IAPU.APUExecuting)
{
- ICPU.CPUExecuting = FALSE;
+ ICPU.CPUExecuting = false;
do
{
APU_EXECUTE1();
}
while (APU.Cycles < CPU.NextEvent);
- ICPU.CPUExecuting = TRUE;
+ ICPU.CPUExecuting = true;
}
#endif
}
@@ -3410,8 +3410,8 @@ inline void CPUShutdown()
{
if (CPU.WaitCounter >= 1)
{
- SA1.Executing = FALSE;
- SA1.CPUExecuting = FALSE;
+ SA1.Executing = false;
+ SA1.CPUExecuting = false;
}
else
CPU.WaitCounter++;
@@ -4384,8 +4384,8 @@ static void OpFB(void)
CPU.Cycles += ONE_CYCLE;
#endif
- uint8 A1 = ICPU._Carry;
- uint8 A2 = ICPU.Registers.PH;
+ uint8_t A1 = ICPU._Carry;
+ uint8_t A2 = ICPU.Registers.PH;
ICPU._Carry = A2 & 1;
ICPU.Registers.PH = A1;
@@ -4408,7 +4408,7 @@ static void OpFB(void)
static void Op00(void)
{
#ifndef SA1_OPCODES
- CPU.BRKTriggered = TRUE;
+ CPU.BRKTriggered = true;
#endif
if (!CheckEmulation())
@@ -4611,7 +4611,7 @@ static void OpDC(void)
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + TWO_CYCLES;
#endif
- ICPU.Registers.PB = (uint8)(OpAddress >> 16);
+ ICPU.Registers.PB = (uint8_t)(OpAddress >> 16);
ICPU.ShiftedPB = OpAddress & 0xff0000;
S9xSetPCBase(OpAddress);
}
@@ -4622,7 +4622,7 @@ static void Op5C(void)
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + CPU.MemSpeed;
#endif
- ICPU.Registers.PB = (uint8)(OpAddress >> 16);
+ ICPU.Registers.PB = (uint8_t)(OpAddress >> 16);
ICPU.ShiftedPB = OpAddress & 0xff0000;
S9xSetPCBase(OpAddress);
}
@@ -4669,7 +4669,7 @@ static void Op22E1(void)
#endif
PushB(ICPU.Registers.PB);
PushWENew(CPU.PC - CPU.PCBase - 1);
- ICPU.Registers.PB = (uint8)(OpAddress >> 16);
+ ICPU.Registers.PB = (uint8_t)(OpAddress >> 16);
ICPU.ShiftedPB = OpAddress & 0xff0000;
S9xSetPCBase(OpAddress);
}
@@ -4682,7 +4682,7 @@ static void Op22(void)
#endif
PushB(ICPU.Registers.PB);
PushW(CPU.PC - CPU.PCBase - 1);
- ICPU.Registers.PB = (uint8)(OpAddress >> 16);
+ ICPU.Registers.PB = (uint8_t)(OpAddress >> 16);
ICPU.ShiftedPB = OpAddress & 0xff0000;
S9xSetPCBase(OpAddress);
}
@@ -4756,7 +4756,7 @@ static void Op60(void)
/* MVN/MVP *********************************************************************************** */
static void Op54X1(void)
{
- uint32 SrcBank;
+ uint32_t SrcBank;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + TWO_CYCLES;
@@ -4778,7 +4778,7 @@ static void Op54X1(void)
static void Op54X0(void)
{
- uint32 SrcBank;
+ uint32_t SrcBank;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + TWO_CYCLES;
@@ -4800,7 +4800,7 @@ static void Op54X0(void)
static void Op44X1(void)
{
- uint32 SrcBank;
+ uint32_t SrcBank;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + TWO_CYCLES;
@@ -4820,7 +4820,7 @@ static void Op44X1(void)
static void Op44X0(void)
{
- uint32 SrcBank;
+ uint32_t SrcBank;
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeedx2 + TWO_CYCLES;
@@ -4843,7 +4843,7 @@ static void Op44X0(void)
/* REP/SEP *********************************************************************************** */
static void OpC2(void)
{
- uint8 Work8 = ~*CPU.PC++;
+ uint8_t Work8 = ~*CPU.PC++;
ICPU.Registers.PL &= Work8;
ICPU._Carry &= Work8;
ICPU._Overflow &= (Work8 >> 6);
@@ -4869,7 +4869,7 @@ static void OpC2(void)
static void OpE2(void)
{
- uint8 Work8 = *CPU.PC++;
+ uint8_t Work8 = *CPU.PC++;
ICPU.Registers.PL |= Work8;
ICPU._Carry |= Work8 & 1;
ICPU._Overflow |= (Work8 >> 6) & 1;
@@ -4896,7 +4896,7 @@ static void OpE2(void)
/* XBA *************************************************************************************** */
static void OpEB(void)
{
- uint8 Work8 = ICPU.Registers.AL;
+ uint8_t Work8 = ICPU.Registers.AL;
ICPU.Registers.AL = ICPU.Registers.AH;
ICPU.Registers.AH = Work8;
@@ -4945,7 +4945,7 @@ static void OpCB(void)
// Ok, let's just C-ify the ASM versions separately.
#ifdef SA1_OPCODES
- SA1.WaitingForInterrupt = TRUE;
+ SA1.WaitingForInterrupt = true;
SA1.PC--;
#if 0
// XXX: FIXME
@@ -4954,12 +4954,12 @@ static void OpCB(void)
SA1.Cycles = SA1.NextEvent;
if (IAPU.APUExecuting)
{
- SA1.Executing = FALSE;
+ SA1.Executing = false;
do
{
APU_EXECUTE1(,
}
- while (APU.Cycles < SA1.NextEvent, SA1.Executing = TRUE;
+ while (APU.Cycles < SA1.NextEvent, SA1.Executing = true;
}
}
#endif
@@ -4976,7 +4976,7 @@ static void OpCB(void)
else
#endif
{
- CPU.WaitingForInterrupt = TRUE;
+ CPU.WaitingForInterrupt = true;
CPU.PC--;
#ifdef CPU_SHUTDOWN
if (Settings.Shutdown)
@@ -4985,13 +4985,13 @@ static void OpCB(void)
#ifndef USE_BLARGG_APU
if (IAPU.APUExecuting)
{
- ICPU.CPUExecuting = FALSE;
+ ICPU.CPUExecuting = false;
do
{
APU_EXECUTE1();
}
while (APU.Cycles < CPU.NextEvent);
- ICPU.CPUExecuting = TRUE;
+ ICPU.CPUExecuting = true;
}
#endif
}
diff --git a/source/data.c b/source/data.c
index ba52a5d..5b7954a 100644
--- a/source/data.c
+++ b/source/data.c
@@ -89,7 +89,7 @@
#include "snes9x.h"
-uint8 add32_32 [32][32] =
+uint8_t add32_32 [32][32] =
{
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
@@ -253,7 +253,7 @@ uint8 add32_32 [32][32] =
}
};
-uint8 add32_32_half [32][32] =
+uint8_t add32_32_half [32][32] =
{
{
0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07,
@@ -416,7 +416,7 @@ uint8 add32_32_half [32][32] =
0x1e, 0x1f
}
};
-uint8 sub32_32 [32][32] =
+uint8_t sub32_32 [32][32] =
{
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
@@ -580,7 +580,7 @@ uint8 sub32_32 [32][32] =
}
};
-uint8 sub32_32_half [32][32] =
+uint8_t sub32_32_half [32][32] =
{
{
0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07,
@@ -745,7 +745,7 @@ uint8 sub32_32_half [32][32] =
};
-uint8 mul_brightness [16][32] =
+uint8_t mul_brightness [16][32] =
{
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/source/display.h b/source/display.h
index beb6487..8ad5cea 100644
--- a/source/display.h
+++ b/source/display.h
@@ -97,9 +97,9 @@ char* S9xParseArgs(char** argv, int argc);
#ifdef ACCUMULATE_JOYPAD
void NDSSFCAccumulateJoypad();
#endif
-uint32 S9xReadJoypad(int port);
-bool8 S9xReadMousePosition(int which1_0_to_1, int* x, int* y, uint32* buttons);
-bool8 S9xReadSuperScopePosition(int* x, int* y, uint32* buttons);
+uint32_t S9xReadJoypad(int port);
+bool S9xReadMousePosition(int which1_0_to_1, int* x, int* y, uint32_t* buttons);
+bool S9xReadSuperScopePosition(int* x, int* y, uint32_t* buttons);
void S9xUsage();
void S9xInitDisplay(void);
@@ -110,11 +110,11 @@ void S9xToggleSoundChannel(int channel);
void S9xSetInfoString(const char* string);
int S9xMinCommandLineArgs();
void S9xNextController();
-bool8 S9xLoadROMImage(const char* string);
+bool S9xLoadROMImage(const char* string);
const char* S9xSelectFilename(const char* def, const char* dir,
const char* ext, const char* title);
-const char* S9xChooseFilename(bool8 read_only);
+const char* S9xChooseFilename(bool read_only);
const char* S9xBasename(const char* filename);
diff --git a/source/dma.c b/source/dma.c
index f02d10a..8a87868 100644
--- a/source/dma.c
+++ b/source/dma.c
@@ -107,23 +107,23 @@
#endif
#ifdef SDD1_DECOMP
-uint8 buffer[0x10000];
+uint8_t buffer[0x10000];
#endif
extern int HDMA_ModeByteCounts [8];
-extern uint8* HDMAMemPointers [8];
-extern uint8* HDMABasePointers [8];
+extern uint8_t* HDMAMemPointers [8];
+extern uint8_t* HDMABasePointers [8];
// #define SETA010_HDMA_FROM_CART
#ifdef SETA010_HDMA_FROM_CART
-uint32 HDMARawPointers[8]; // Cart address space pointer
+uint32_t HDMARawPointers[8]; // Cart address space pointer
#endif
#if defined(__linux__) || defined(__WIN32__)
static int S9xCompareSDD1IndexEntries(const void* p1, const void* p2)
{
- return (*(uint32*) p1 - * (uint32*) p2);
+ return (*(uint32_t*) p1 - * (uint32_t*) p2);
}
#endif
@@ -132,17 +132,17 @@ static int S9xCompareSDD1IndexEntries(const void* p1, const void* p2)
/* This function preforms the general dma transfer */
/**********************************************************************************************/
-void S9xDoDMA(uint8 Channel)
+void S9xDoDMA(uint8_t Channel)
{
- uint8 Work;
+ uint8_t Work;
if (Channel > 7 || CPU.InDMA)
return;
- CPU.InDMA = TRUE;
- bool8 in_sa1_dma = FALSE;
- uint8* in_sdd1_dma = NULL;
- uint8* spc7110_dma = NULL;
+ CPU.InDMA = true;
+ bool in_sa1_dma = false;
+ uint8_t* in_sdd1_dma = NULL;
+ uint8_t* spc7110_dma = NULL;
bool s7_wrap = false;
SDMA* d = &DMA[Channel];
@@ -177,14 +177,14 @@ void S9xDoDMA(uint8 Channel)
{
// Hacky support for pre-decompressed S-DD1 data
inc = !d->AAddressDecrement ? 1 : -1;
- uint32 address = (((d->ABank << 16) | d->AAddress) & 0xfffff) << 4;
+ uint32_t address = (((d->ABank << 16) | d->AAddress) & 0xfffff) << 4;
address |= Memory.FillRAM [0x4804 + ((d->ABank - 0xc0) >> 4)];
#ifdef SDD1_DECOMP
if (Settings.SDD1Pack)
{
- uint8* in_ptr = GetBasePointer(((d->ABank << 16) | d->AAddress));
+ uint8_t* in_ptr = GetBasePointer(((d->ABank << 16) | d->AAddress));
in_ptr += d->AAddress;
SDD1_decompress(buffer, in_ptr, d->TransferBytes);
@@ -194,11 +194,11 @@ void S9xDoDMA(uint8 Channel)
Memory.SDD1Entries, 12, S9xCompareSDD1IndexEntries);
if (memcmp(buffer, ptr, d->TransferBytes))
{
- uint8* p = Memory.SDD1LoggedData;
- bool8 found = FALSE;
- uint8 SDD1Bank = Memory.FillRAM [0x4804 + ((d->ABank - 0xc0) >> 4)] | 0xf0;
+ uint8_t* p = Memory.SDD1LoggedData;
+ bool found = false;
+ uint8_t SDD1Bank = Memory.FillRAM [0x4804 + ((d->ABank - 0xc0) >> 4)] | 0xf0;
- for (uint32 i = 0; i < Memory.SDD1LoggedDataCount; i++, p += 8)
+ for (uint32_t i = 0; i < Memory.SDD1LoggedDataCount; i++, p += 8)
{
if (*p == d->ABank ||
*(p + 1) == (d->AAddress >> 8) &&
@@ -206,7 +206,7 @@ void S9xDoDMA(uint8 Channel)
*(p + 3) == (count >> 8) &&
*(p + 4) == (count & 0xff) &&
*(p + 7) == SDD1Bank)
- found = TRUE;
+ found = true;
}
if (!found && Memory.SDD1LoggedDataCount < MEMMAP_MAX_SDD1_LOGGED_ENTRIES)
{
@@ -233,16 +233,16 @@ void S9xDoDMA(uint8 Channel)
void* ptr = bsearch(&address, Memory.SDD1Index,
Memory.SDD1Entries, 12, S9xCompareSDD1IndexEntries);
if (ptr)
- in_sdd1_dma = *(uint32*)((uint8*) ptr + 4) + Memory.SDD1Data;
+ in_sdd1_dma = *(uint32_t*)((uint8_t*) ptr + 4) + Memory.SDD1Data;
#else
- uint8* ptr = Memory.SDD1Index;
+ uint8_t* ptr = Memory.SDD1Index;
- uint32 e;
+ uint32_t e;
for (e = 0; e < Memory.SDD1Entries; e++, ptr += 12)
{
- if (address == *(uint32*) ptr)
+ if (address == *(uint32_t*) ptr)
{
- in_sdd1_dma = *(uint32*)(ptr + 4) + Memory.SDD1Data;
+ in_sdd1_dma = *(uint32_t*)(ptr + 4) + Memory.SDD1Data;
break;
}
}
@@ -253,11 +253,11 @@ void S9xDoDMA(uint8 Channel)
// No matching decompressed data found. Must be some new
// graphics not encountered before. Log it if it hasn't been
// already.
- uint8* p = Memory.SDD1LoggedData;
- bool8 found = FALSE;
- uint8 SDD1Bank = Memory.FillRAM [0x4804 + ((d->ABank - 0xc0) >> 4)] | 0xf0;
+ uint8_t* p = Memory.SDD1LoggedData;
+ bool found = false;
+ uint8_t SDD1Bank = Memory.FillRAM [0x4804 + ((d->ABank - 0xc0) >> 4)] | 0xf0;
- uint32 i;
+ uint32_t i;
for (i = 0; i < Memory.SDD1LoggedDataCount; i++, p += 8)
{
if (*p == d->ABank ||
@@ -267,7 +267,7 @@ void S9xDoDMA(uint8 Channel)
(*(p + 4) == (count & 0xff)) &&
(*(p + 7) == SDD1Bank)))
{
- found = TRUE;
+ found = true;
break;
}
}
@@ -291,7 +291,7 @@ void S9xDoDMA(uint8 Channel)
}
if (Settings.SPC7110 && (d->AAddress == 0x4800 || d->ABank == 0x50))
{
- uint32 i, j;
+ uint32_t i, j;
i = (s7r.reg4805 | (s7r.reg4806 << 8));
i *= s7r.AlignBy;
i += s7r.bank50Internal;
@@ -301,7 +301,7 @@ void S9xDoDMA(uint8 Channel)
spc7110_dma = &s7r.bank50[i];
else
{
- spc7110_dma = (uint8*)malloc(d->TransferBytes);
+ spc7110_dma = (uint8_t*)malloc(d->TransferBytes);
j = DECOMP_BUFFER_SIZE - i;
memcpy(spc7110_dma, &s7r.bank50[i], j);
memcpy(&spc7110_dma[j], s7r.bank50, d->TransferBytes - j);
@@ -328,14 +328,14 @@ void S9xDoDMA(uint8 Channel)
int bytes_per_char = 8 * depth;
int bytes_per_line = depth * num_chars;
int char_line_bytes = bytes_per_char * num_chars;
- uint32 addr = (d->AAddress / char_line_bytes) * char_line_bytes;
- uint8* base = GetBasePointer((d->ABank << 16) + addr) + addr;
- uint8* buffer = &Memory.ROM [MAX_ROM_SIZE - 0x10000];
- uint8* p = buffer;
- uint32 inc = char_line_bytes - (d->AAddress % char_line_bytes);
- uint32 char_count = inc / bytes_per_char;
+ uint32_t addr = (d->AAddress / char_line_bytes) * char_line_bytes;
+ uint8_t* base = GetBasePointer((d->ABank << 16) + addr) + addr;
+ uint8_t* buffer = &Memory.ROM [MAX_ROM_SIZE - 0x10000];
+ uint8_t* p = buffer;
+ uint32_t inc = char_line_bytes - (d->AAddress % char_line_bytes);
+ uint32_t char_count = inc / bytes_per_char;
- in_sa1_dma = TRUE;
+ in_sa1_dma = true;
//printf ("%08x,", base); fflush (stdout);
//printf ("depth = %d, count = %d, bytes_per_char = %d, bytes_per_line = %d, num_chars = %d, char_line_bytes = %d\n",
@@ -348,18 +348,18 @@ void S9xDoDMA(uint8 Channel)
for (i = 0; i < count; i += inc, base += char_line_bytes,
inc = char_line_bytes, char_count = num_chars)
{
- uint32 j;
- uint8* line = base + (num_chars - char_count) * 2;
+ uint32_t j;
+ uint8_t* line = base + (num_chars - char_count) * 2;
for (j = 0; j < char_count && p - buffer < count;
j++, line += 2)
{
int b, l;
- uint8* q = line;
+ uint8_t* q = line;
for (l = 0; l < 8; l++, q += bytes_per_line)
{
for (b = 0; b < 2; b++)
{
- uint8 r = *(q + b);
+ uint8_t r = *(q + b);
*(p + 0) = (*(p + 0) << 1) | ((r >> 0) & 1);
*(p + 1) = (*(p + 1) << 1) | ((r >> 1) & 1);
*(p + 0) = (*(p + 0) << 1) | ((r >> 2) & 1);
@@ -378,18 +378,18 @@ void S9xDoDMA(uint8 Channel)
for (i = 0; i < count; i += inc, base += char_line_bytes,
inc = char_line_bytes, char_count = num_chars)
{
- uint32 j;
- uint8* line = base + (num_chars - char_count) * 4;
+ uint32_t j;
+ uint8_t* line = base + (num_chars - char_count) * 4;
for (j = 0; j < char_count && p - buffer < count;
j++, line += 4)
{
- uint8* q = line;
+ uint8_t* q = line;
int b, l;
for (l = 0; l < 8; l++, q += bytes_per_line)
{
for (b = 0; b < 4; b++)
{
- uint8 r = *(q + b);
+ uint8_t r = *(q + b);
*(p + 0) = (*(p + 0) << 1) | ((r >> 0) & 1);
*(p + 1) = (*(p + 1) << 1) | ((r >> 1) & 1);
*(p + 16) = (*(p + 16) << 1) | ((r >> 2) & 1);
@@ -409,18 +409,18 @@ void S9xDoDMA(uint8 Channel)
for (i = 0; i < count; i += inc, base += char_line_bytes,
inc = char_line_bytes, char_count = num_chars)
{
- uint8* line = base + (num_chars - char_count) * 8;
- uint32 j;
+ uint8_t* line = base + (num_chars - char_count) * 8;
+ uint32_t j;
for (j = 0; j < char_count && p - buffer < count;
j++, line += 8)
{
- uint8* q = line;
+ uint8_t* q = line;
int b, l;
for (l = 0; l < 8; l++, q += bytes_per_line)
{
for (b = 0; b < 8; b++)
{
- uint8 r = *(q + b);
+ uint8_t r = *(q + b);
*(p + 0) = (*(p + 0) << 1) | ((r >> 0) & 1);
*(p + 1) = (*(p + 1) << 1) | ((r >> 1) & 1);
*(p + 16) = (*(p + 16) << 1) | ((r >> 2) & 1);
@@ -456,8 +456,8 @@ void S9xDoDMA(uint8 Channel)
//reflects extra cycle used by DMA
CPU.Cycles += SLOW_ONE_CYCLE * (count + 1);
- uint8* base = GetBasePointer((d->ABank << 16) + d->AAddress);
- uint16 p = d->AAddress;
+ uint8_t* base = GetBasePointer((d->ABank << 16) + d->AAddress);
+ uint16_t p = d->AAddress;
if (!base)
base = Memory.ROM;
@@ -499,7 +499,7 @@ void S9xDoDMA(uint8 Channel)
break;
case 0x18:
#ifndef CORRECT_VRAM_READS
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
if (!PPU.VMA.FullGraphicCount)
{
@@ -526,7 +526,7 @@ void S9xDoDMA(uint8 Channel)
break;
case 0x19:
#ifndef CORRECT_VRAM_READS
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
if (!PPU.VMA.FullGraphicCount)
{
@@ -589,7 +589,7 @@ void S9xDoDMA(uint8 Channel)
{
// Write to V-RAM
#ifndef CORRECT_VRAM_READS
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
if (!PPU.VMA.FullGraphicCount)
{
@@ -833,7 +833,7 @@ void S9xDoDMA(uint8 Channel)
update_address:
// Super Punch-Out requires that the A-BUS address be updated after the
// DMA transfer.
- Memory.FillRAM[0x4302 + (Channel << 4)] = (uint8) d->AAddress;
+ 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
@@ -844,7 +844,7 @@ update_address:
DMA[Channel].IndirectAddress = 0;
d->TransferBytes = 0;
- CPU.InDMA = FALSE;
+ CPU.InDMA = false;
}
@@ -860,16 +860,16 @@ void S9xStartHDMA()
if (IPPU.HDMA != 0)
CPU.Cycles += ONE_CYCLE * 3;
- IPPU.HDMAStarted = TRUE;
+ IPPU.HDMAStarted = true;
- uint8 i;
+ uint8_t i;
for (i = 0; i < 8; i++)
{
if (IPPU.HDMA & (1 << i))
{
CPU.Cycles += SLOW_ONE_CYCLE ;
DMA [i].LineCount = 0;
- DMA [i].FirstLine = TRUE;
+ DMA [i].FirstLine = true;
DMA [i].Address = DMA [i].AAddress;
if (DMA[i].HDMAIndirectAddressing)
CPU.Cycles += (SLOW_ONE_CYCLE << 2);
@@ -881,15 +881,15 @@ void S9xStartHDMA()
}
}
-uint8 S9xDoHDMA(uint8 byte)
+uint8_t S9xDoHDMA(uint8_t byte)
{
SDMA* p = &DMA [0];
int d = 0;
- CPU.InDMA = TRUE;
+ CPU.InDMA = true;
CPU.Cycles += ONE_CYCLE * 3;
- uint8 mask;
+ uint8_t mask;
for (mask = 1; mask; mask <<= 1, p++, d++)
{
if (byte & mask)
@@ -899,10 +899,10 @@ uint8 S9xDoHDMA(uint8 byte)
//remember, InDMA is set.
//Get/Set incur no charges!
CPU.Cycles += SLOW_ONE_CYCLE;
- uint8 line = S9xGetByte((p->ABank << 16) + p->Address);
+ uint8_t line = S9xGetByte((p->ABank << 16) + p->Address);
if (line == 0x80)
{
- p->Repeat = TRUE;
+ p->Repeat = true;
p->LineCount = 128;
}
else
@@ -923,7 +923,7 @@ uint8 S9xDoHDMA(uint8 byte)
{
byte &= ~mask;
p->IndirectAddress += HDMAMemPointers [d] - HDMABasePointers [d];
- Memory.FillRAM [0x4305 + (d << 4)] = (uint8) p->IndirectAddress;
+ Memory.FillRAM [0x4305 + (d << 4)] = (uint8_t) p->IndirectAddress;
Memory.FillRAM [0x4306 + (d << 4)] = p->IndirectAddress >> 8;
continue;
}
@@ -975,7 +975,7 @@ uint8 S9xDoHDMA(uint8 byte)
}
// Uncommenting the following line breaks Punchout - it starts
// H-DMA during the frame.
- //p->FirstLine = TRUE;
+ //p->FirstLine = true;
}
if (p->Repeat && !p->FirstLine)
{
@@ -1080,11 +1080,11 @@ uint8 S9xDoHDMA(uint8 byte)
/* XXX: Check for p->IndirectAddress crossing a mapping boundry,
* XXX: and invalidate HDMAMemPointers[d]
*/
- p->FirstLine = FALSE;
+ p->FirstLine = false;
p->LineCount--;
}
}
- CPU.InDMA = FALSE;
+ CPU.InDMA = false;
return (byte);
}
@@ -1093,10 +1093,10 @@ void S9xResetDMA()
int c, d;
for (d = 0; d < 8; d++)
{
- DMA [d].TransferDirection = FALSE;
- DMA [d].HDMAIndirectAddressing = FALSE;
- DMA [d].AAddressFixed = TRUE;
- DMA [d].AAddressDecrement = FALSE;
+ DMA [d].TransferDirection = false;
+ DMA [d].HDMAIndirectAddressing = false;
+ DMA [d].AAddressFixed = true;
+ DMA [d].AAddressDecrement = false;
DMA [d].TransferMode = 0xff;
DMA [d].ABank = 0xff;
DMA [d].AAddress = 0xffff;
diff --git a/source/dma.h b/source/dma.h
index 2d0b687..92991f9 100644
--- a/source/dma.h
+++ b/source/dma.h
@@ -91,9 +91,9 @@
#define _DMA_H_
void S9xResetDMA(void);
-uint8 S9xDoHDMA(uint8);
+uint8_t S9xDoHDMA(uint8_t);
void S9xStartHDMA();
-void S9xDoDMA(uint8);
+void S9xDoDMA(uint8_t);
#endif
diff --git a/source/dsp1.c b/source/dsp1.c
index 053631a..12a3327 100644
--- a/source/dsp1.c
+++ b/source/dsp1.c
@@ -95,17 +95,17 @@
#include "dsp1emu.c"
#include "dsp2emu.c"
-void (*SetDSP)(uint8, uint16) = &DSP1SetByte;
-uint8(*GetDSP)(uint16) = &DSP1GetByte;
+void (*SetDSP)(uint8_t, uint16_t) = &DSP1SetByte;
+uint8_t(*GetDSP)(uint16_t) = &DSP1GetByte;
void S9xInitDSP1()
{
- static bool8 init = FALSE;
+ static bool init = false;
if (!init)
{
InitDSP();
- init = TRUE;
+ init = true;
}
}
@@ -113,30 +113,30 @@ void S9xResetDSP1()
{
S9xInitDSP1();
- DSP1.waiting4command = TRUE;
+ DSP1.waiting4command = true;
DSP1.in_count = 0;
DSP1.out_count = 0;
DSP1.in_index = 0;
DSP1.out_index = 0;
- DSP1.first_parameter = TRUE;
+ DSP1.first_parameter = true;
}
-uint8 S9xGetDSP(uint16 address)
+uint8_t S9xGetDSP(uint16_t address)
{
- uint8 t;
+ uint8_t t;
t = (*GetDSP)(address);
//DSP1GetByte(address);
return (t);
}
-void S9xSetDSP(uint8 byte, uint16 address)
+void S9xSetDSP(uint8_t byte, uint16_t address)
{
(*SetDSP)(byte, address);
//DSP1SetByte(byte, address);
}
-void DSP1SetByte(uint8 byte, uint16 address)
+void DSP1SetByte(uint8_t byte, uint16_t address)
{
if ((address & 0xf000) == 0x6000 || (address & 0x7fff) < 0x4000)
{
@@ -152,8 +152,8 @@ void DSP1SetByte(uint8 byte, uint16 address)
{
DSP1.command = byte;
DSP1.in_index = 0;
- DSP1.waiting4command = FALSE;
- DSP1.first_parameter = TRUE;
+ DSP1.waiting4command = false;
+ DSP1.first_parameter = true;
// printf("Op%02X\n",byte);
// Mario Kart uses 0x00, 0x02, 0x06, 0x0c, 0x28, 0x0a
switch (byte)
@@ -291,8 +291,8 @@ void DSP1SetByte(uint8 byte, uint16 address)
//printf("Op%02X\n",byte);
case 0x80:
DSP1.in_count = 0;
- DSP1.waiting4command = TRUE;
- DSP1.first_parameter = TRUE;
+ DSP1.waiting4command = true;
+ DSP1.first_parameter = true;
break;
}
DSP1.in_count <<= 1;
@@ -300,15 +300,15 @@ void DSP1SetByte(uint8 byte, uint16 address)
else
{
DSP1.parameters [DSP1.in_index] = byte;
- DSP1.first_parameter = FALSE;
+ DSP1.first_parameter = false;
DSP1.in_index++;
}
if (DSP1.waiting4command ||
(DSP1.first_parameter && byte == 0x80))
{
- DSP1.waiting4command = TRUE;
- DSP1.first_parameter = FALSE;
+ DSP1.waiting4command = true;
+ DSP1.first_parameter = false;
}
else if (DSP1.first_parameter && (DSP1.in_count != 0 || (DSP1.in_count == 0
&& DSP1.in_index == 0)))
@@ -325,7 +325,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
if (--DSP1.in_count == 0)
{
// Actually execute the command
- DSP1.waiting4command = TRUE;
+ DSP1.waiting4command = true;
DSP1.out_index = 0;
switch (DSP1.command)
{
@@ -333,8 +333,8 @@ void DSP1SetByte(uint8 byte, uint16 address)
DSP1.out_count = 2048;
break;
case 0x00: // Multiple
- Op00Multiplicand = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op00Multiplier = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op00Multiplicand = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op00Multiplier = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp00();
@@ -344,8 +344,8 @@ void DSP1SetByte(uint8 byte, uint16 address)
break;
case 0x20: // Multiple
- Op20Multiplicand = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op20Multiplier = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op20Multiplicand = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op20Multiplier = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp20();
@@ -356,99 +356,99 @@ void DSP1SetByte(uint8 byte, uint16 address)
case 0x30:
case 0x10: // Inverse
- Op10Coefficient = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op10Exponent = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op10Coefficient = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op10Exponent = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp10();
DSP1.out_count = 4;
- DSP1.output [0] = (uint8)(((int16) Op10CoefficientR) & 0xFF);
- DSP1.output [1] = (uint8)((((int16) Op10CoefficientR) >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(((int16) Op10ExponentR) & 0xff);
- DSP1.output [3] = (uint8)((((int16) Op10ExponentR) >> 8) & 0xff);
+ DSP1.output [0] = (uint8_t)(((int16_t) Op10CoefficientR) & 0xFF);
+ DSP1.output [1] = (uint8_t)((((int16_t) Op10CoefficientR) >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(((int16_t) Op10ExponentR) & 0xff);
+ DSP1.output [3] = (uint8_t)((((int16_t) Op10ExponentR) >> 8) & 0xff);
break;
case 0x24:
case 0x04: // Sin and Cos of angle
- Op04Angle = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op04Radius = (uint16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op04Angle = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op04Radius = (uint16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp04();
DSP1.out_count = 4;
- DSP1.output [0] = (uint8)(Op04Sin & 0xFF);
- DSP1.output [1] = (uint8)((Op04Sin >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op04Cos & 0xFF);
- DSP1.output [3] = (uint8)((Op04Cos >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op04Sin & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op04Sin >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op04Cos & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op04Cos >> 8) & 0xFF);
break;
case 0x08: // Radius
- Op08X = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op08Y = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op08Z = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp08();
DSP1.out_count = 4;
- DSP1.output [0] = (uint8)(((int16) Op08Ll) & 0xFF);
- DSP1.output [1] = (uint8)((((int16) Op08Ll) >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(((int16) Op08Lh) & 0xFF);
- DSP1.output [3] = (uint8)((((int16) Op08Lh) >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(((int16_t) Op08Ll) & 0xFF);
+ DSP1.output [1] = (uint8_t)((((int16_t) Op08Ll) >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(((int16_t) Op08Lh) & 0xFF);
+ DSP1.output [3] = (uint8_t)((((int16_t) Op08Lh) >> 8) & 0xFF);
break;
case 0x18: // Range
- Op18X = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op18Y = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op18Z = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op18R = (int16)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
+ 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));
+ Op18R = (int16_t)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
DSPOp18();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op18D & 0xFF);
- DSP1.output [1] = (uint8)((Op18D >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op18D & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op18D >> 8) & 0xFF);
break;
case 0x38: // Range
- Op38X = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op38Y = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op38Z = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op38R = (int16)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
+ 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));
+ Op38R = (int16_t)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
DSPOp38();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op38D & 0xFF);
- DSP1.output [1] = (uint8)((Op38D >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op38D & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op38D >> 8) & 0xFF);
break;
case 0x28: // Distance (vector length)
- Op28X = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op28Y = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op28Z = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp28();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op28R & 0xFF);
- DSP1.output [1] = (uint8)((Op28R >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op28R & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op28R >> 8) & 0xFF);
break;
case 0x2c:
case 0x0c: // Rotate (2D rotate)
- Op0CA = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op0CX1 = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op0CY1 = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp0C();
DSP1.out_count = 4;
- DSP1.output [0] = (uint8)(Op0CX2 & 0xFF);
- DSP1.output [1] = (uint8)((Op0CX2 >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op0CY2 & 0xFF);
- DSP1.output [3] = (uint8)((Op0CY2 >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0CX2 & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0CX2 >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op0CY2 & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op0CY2 >> 8) & 0xFF);
break;
case 0x3c:
@@ -464,12 +464,12 @@ void DSP1SetByte(uint8 byte, uint16 address)
DSPOp1C();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op1CXAR & 0xFF);
- DSP1.output [1] = (uint8)((Op1CXAR >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op1CYAR & 0xFF);
- DSP1.output [3] = (uint8)((Op1CYAR >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op1CZAR & 0xFF);
- DSP1.output [5] = (uint8)((Op1CZAR >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op1CXAR & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op1CXAR >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op1CYAR & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op1CYAR >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op1CZAR & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op1CZAR >> 8) & 0xFF);
break;
case 0x32:
@@ -487,14 +487,14 @@ void DSP1SetByte(uint8 byte, uint16 address)
DSPOp02();
DSP1.out_count = 8;
- DSP1.output [0] = (uint8)(Op02VOF & 0xFF);
- DSP1.output [1] = (uint8)((Op02VOF >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op02VVA & 0xFF);
- DSP1.output [3] = (uint8)((Op02VVA >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op02CX & 0xFF);
- DSP1.output [5] = (uint8)((Op02CX >> 8) & 0xFF);
- DSP1.output [6] = (uint8)(Op02CY & 0xFF);
- DSP1.output [7] = (uint8)((Op02CY >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op02VOF & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op02VOF >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op02VVA & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op02VVA >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op02CX & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op02CX >> 8) & 0xFF);
+ DSP1.output [6] = (uint8_t)(Op02CY & 0xFF);
+ DSP1.output [7] = (uint8_t)((Op02CY >> 8) & 0xFF);
break;
case 0x3a: //1a Mirror
@@ -506,14 +506,14 @@ void DSP1SetByte(uint8 byte, uint16 address)
DSPOp0A();
DSP1.out_count = 8;
- DSP1.output [0] = (uint8)(Op0AA & 0xFF);
- DSP1.output [2] = (uint8)(Op0AB & 0xFF);
- DSP1.output [4] = (uint8)(Op0AC & 0xFF);
- DSP1.output [6] = (uint8)(Op0AD & 0xFF);
- DSP1.output [1] = (uint8)((Op0AA >> 8) & 0xFF);
- DSP1.output [3] = (uint8)((Op0AB >> 8) & 0xFF);
- DSP1.output [5] = (uint8)((Op0AC >> 8) & 0xFF);
- DSP1.output [7] = (uint8)((Op0AD >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0AA & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op0AB & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op0AC & 0xFF);
+ DSP1.output [6] = (uint8_t)(Op0AD & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0AA >> 8) & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op0AB >> 8) & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op0AC >> 8) & 0xFF);
+ DSP1.output [7] = (uint8_t)((Op0AD >> 8) & 0xFF);
DSP1.in_index = 0;
break;
@@ -521,35 +521,35 @@ void DSP1SetByte(uint8 byte, uint16 address)
case 0x26:
case 0x36:
case 0x06: // Project object
- Op06X = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op06Y = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op06Z = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp06();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op06H & 0xff);
- DSP1.output [1] = (uint8)((Op06H >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op06V & 0xFF);
- DSP1.output [3] = (uint8)((Op06V >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op06S & 0xFF);
- DSP1.output [5] = (uint8)((Op06S >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op06H & 0xff);
+ DSP1.output [1] = (uint8_t)((Op06H >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op06V & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op06V >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op06S & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op06S >> 8) & 0xFF);
break;
case 0x1e:
case 0x2e:
case 0x3e:
case 0x0e: // Target
- Op0EH = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op0EV = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op0EH = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op0EV = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
DSPOp0E();
DSP1.out_count = 4;
- DSP1.output [0] = (uint8)(Op0EX & 0xFF);
- DSP1.output [1] = (uint8)((Op0EX >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op0EY & 0xFF);
- DSP1.output [3] = (uint8)((Op0EY >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0EX & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0EX >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op0EY & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op0EY >> 8) & 0xFF);
break;
// Extra commands used by Pilot Wings
@@ -557,30 +557,30 @@ void DSP1SetByte(uint8 byte, uint16 address)
case 0x35:
case 0x31:
case 0x01: // Set attitude matrix A
- Op01m = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op01Zr = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op01Yr = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op01Xr = (int16)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
+ 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));
+ Op01Xr = (int16_t)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
DSPOp01();
break;
case 0x15:
case 0x11: // Set attitude matrix B
- Op11m = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op11Zr = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op11Yr = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op11Xr = (int16)(DSP1.parameters [7] | (DSP1.parameters[7] << 8));
+ 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));
+ Op11Xr = (int16_t)(DSP1.parameters [7] | (DSP1.parameters[7] << 8));
DSPOp11();
break;
case 0x25:
case 0x21: // Set attitude matrix C
- Op21m = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op21Zr = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op21Yr = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op21Xr = (int16)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
+ 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));
+ Op21Xr = (int16_t)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
DSPOp21();
break;
@@ -589,182 +589,182 @@ void DSP1SetByte(uint8 byte, uint16 address)
case 0x39:
case 0x3d:
case 0x0d: // Objective matrix A
- Op0DX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op0DY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op0DZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp0D();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op0DF & 0xFF);
- DSP1.output [1] = (uint8)((Op0DF >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op0DL & 0xFF);
- DSP1.output [3] = (uint8)((Op0DL >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op0DU & 0xFF);
- DSP1.output [5] = (uint8)((Op0DU >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0DF & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0DF >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op0DL & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op0DL >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op0DU & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op0DU >> 8) & 0xFF);
break;
case 0x19:
case 0x1d: // Objective matrix B
- Op1DX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op1DY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op1DZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp1D();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op1DF & 0xFF);
- DSP1.output [1] = (uint8)((Op1DF >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op1DL & 0xFF);
- DSP1.output [3] = (uint8)((Op1DL >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op1DU & 0xFF);
- DSP1.output [5] = (uint8)((Op1DU >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op1DF & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op1DF >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op1DL & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op1DL >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op1DU & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op1DU >> 8) & 0xFF);
break;
case 0x29:
case 0x2d: // Objective matrix C
- Op2DX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op2DY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op2DZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp2D();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op2DF & 0xFF);
- DSP1.output [1] = (uint8)((Op2DF >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op2DL & 0xFF);
- DSP1.output [3] = (uint8)((Op2DL >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op2DU & 0xFF);
- DSP1.output [5] = (uint8)((Op2DU >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op2DF & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op2DF >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op2DL & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op2DL >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op2DU & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op2DU >> 8) & 0xFF);
break;
case 0x33:
case 0x03: // Subjective matrix A
- Op03F = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op03L = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op03U = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp03();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op03X & 0xFF);
- DSP1.output [1] = (uint8)((Op03X >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op03Y & 0xFF);
- DSP1.output [3] = (uint8)((Op03Y >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op03Z & 0xFF);
- DSP1.output [5] = (uint8)((Op03Z >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op03X & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op03X >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op03Y & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op03Y >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op03Z & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op03Z >> 8) & 0xFF);
break;
case 0x13: // Subjective matrix B
- Op13F = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op13L = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op13U = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp13();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op13X & 0xFF);
- DSP1.output [1] = (uint8)((Op13X >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op13Y & 0xFF);
- DSP1.output [3] = (uint8)((Op13Y >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op13Z & 0xFF);
- DSP1.output [5] = (uint8)((Op13Z >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op13X & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op13X >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op13Y & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op13Y >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op13Z & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op13Z >> 8) & 0xFF);
break;
case 0x23: // Subjective matrix C
- Op23F = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op23L = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op23U = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ 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));
DSPOp23();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op23X & 0xFF);
- DSP1.output [1] = (uint8)((Op23X >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op23Y & 0xFF);
- DSP1.output [3] = (uint8)((Op23Y >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op23Z & 0xFF);
- DSP1.output [5] = (uint8)((Op23Z >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op23X & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op23X >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op23Y & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op23Y >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op23Z & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op23Z >> 8) & 0xFF);
break;
case 0x3b:
case 0x0b:
- Op0BX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op0BY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op0BZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ Op0BX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op0BY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op0BZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
DSPOp0B();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op0BS & 0xFF);
- DSP1.output [1] = (uint8)((Op0BS >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0BS & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0BS >> 8) & 0xFF);
break;
case 0x1b:
- Op1BX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op1BY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op1BZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ Op1BX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op1BY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op1BZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
DSPOp1B();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op1BS & 0xFF);
- DSP1.output [1] = (uint8)((Op1BS >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op1BS & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op1BS >> 8) & 0xFF);
break;
case 0x2b:
- Op2BX = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op2BY = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op2BZ = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ Op2BX = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op2BY = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op2BZ = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
DSPOp2B();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op2BS & 0xFF);
- DSP1.output [1] = (uint8)((Op2BS >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op2BS & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op2BS >> 8) & 0xFF);
break;
case 0x34:
case 0x14:
- Op14Zr = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
- Op14Xr = (int16)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
- Op14Yr = (int16)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
- Op14U = (int16)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
- Op14F = (int16)(DSP1.parameters [8] | (DSP1.parameters[9] << 8));
- Op14L = (int16)(DSP1.parameters [10] | (DSP1.parameters[11] << 8));
+ Op14Zr = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op14Xr = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
+ Op14Yr = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
+ Op14U = (int16_t)(DSP1.parameters [6] | (DSP1.parameters[7] << 8));
+ Op14F = (int16_t)(DSP1.parameters [8] | (DSP1.parameters[9] << 8));
+ Op14L = (int16_t)(DSP1.parameters [10] | (DSP1.parameters[11] << 8));
DSPOp14();
DSP1.out_count = 6;
- DSP1.output [0] = (uint8)(Op14Zrr & 0xFF);
- DSP1.output [1] = (uint8)((Op14Zrr >> 8) & 0xFF);
- DSP1.output [2] = (uint8)(Op14Xrr & 0xFF);
- DSP1.output [3] = (uint8)((Op14Xrr >> 8) & 0xFF);
- DSP1.output [4] = (uint8)(Op14Yrr & 0xFF);
- DSP1.output [5] = (uint8)((Op14Yrr >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op14Zrr & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op14Zrr >> 8) & 0xFF);
+ DSP1.output [2] = (uint8_t)(Op14Xrr & 0xFF);
+ DSP1.output [3] = (uint8_t)((Op14Xrr >> 8) & 0xFF);
+ DSP1.output [4] = (uint8_t)(Op14Yrr & 0xFF);
+ DSP1.output [5] = (uint8_t)((Op14Yrr >> 8) & 0xFF);
break;
case 0x27:
case 0x2F:
- Op2FUnknown = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op2FUnknown = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
DSPOp2F();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op2FSize & 0xFF);
- DSP1.output [1] = (uint8)((Op2FSize >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op2FSize & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op2FSize >> 8) & 0xFF);
break;
case 0x07:
case 0x0F:
- Op0FRamsize = (int16)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
+ Op0FRamsize = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
DSPOp0F();
DSP1.out_count = 2;
- DSP1.output [0] = (uint8)(Op0FPass & 0xFF);
- DSP1.output [1] = (uint8)((Op0FPass >> 8) & 0xFF);
+ DSP1.output [0] = (uint8_t)(Op0FPass & 0xFF);
+ DSP1.output [1] = (uint8_t)((Op0FPass >> 8) & 0xFF);
break;
default:
@@ -776,9 +776,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
}
}
-uint8 DSP1GetByte(uint16 address)
+uint8_t DSP1GetByte(uint16_t address)
{
- uint8 t;
+ uint8_t t;
if ((address & 0xf000) == 0x6000 ||
// (address >= 0x8000 && address < 0xc000))
(address & 0x7fff) < 0x4000)
@@ -786,10 +786,10 @@ uint8 DSP1GetByte(uint16 address)
if (DSP1.out_count)
{
//if ((address & 1) == 0)
- t = (uint8) DSP1.output [DSP1.out_index];
+ t = (uint8_t) DSP1.output [DSP1.out_index];
//else
//{
- // t = (uint8) (DSP1.output [DSP1.out_index] >> 8);
+ // t = (uint8_t) (DSP1.output [DSP1.out_index] >> 8);
DSP1.out_index++;
if (--DSP1.out_count == 0)
{
@@ -810,12 +810,12 @@ uint8 DSP1GetByte(uint16 address)
if (DSP1.command == 0x1f)
{
if ((DSP1.out_index % 2) != 0)
- t = (uint8)DSP1ROM[DSP1.out_index >> 1];
+ t = (uint8_t)DSP1ROM[DSP1.out_index >> 1];
else
t = DSP1ROM[DSP1.out_index >> 1] >> 8;
}
}
- DSP1.waiting4command = TRUE;
+ DSP1.waiting4command = true;
//}
}
else
@@ -831,7 +831,7 @@ uint8 DSP1GetByte(uint16 address)
return t;
}
-void DSP2SetByte(uint8 byte, uint16 address)
+void DSP2SetByte(uint8_t byte, uint16_t address)
{
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
@@ -840,8 +840,8 @@ void DSP2SetByte(uint8 byte, uint16 address)
{
DSP1.command = byte;
DSP1.in_index = 0;
- DSP1.waiting4command = FALSE;
- // DSP1.first_parameter = TRUE;
+ DSP1.waiting4command = false;
+ // DSP1.first_parameter = true;
// printf("Op%02X\n",byte);
switch (byte)
{
@@ -873,7 +873,7 @@ void DSP2SetByte(uint8 byte, uint16 address)
else
{
DSP1.parameters [DSP1.in_index] = byte;
- // DSP1.first_parameter = FALSE;
+ // DSP1.first_parameter = false;
DSP1.in_index++;
}
@@ -881,7 +881,7 @@ void DSP2SetByte(uint8 byte, uint16 address)
{
//DSP1.parameters [DSP1.in_index] |= (byte << 8);
// Actually execute the command
- DSP1.waiting4command = TRUE;
+ DSP1.waiting4command = true;
DSP1.out_index = 0;
switch (DSP1.command)
{
@@ -932,9 +932,9 @@ void DSP2SetByte(uint8 byte, uint16 address)
DSP2Op09Word2 = DSP1.parameters[2] | (DSP1.parameters[3] << 8);
DSP1.out_count = 4;
#ifdef FAST_LSB_WORD_ACCESS
- *(uint32*)DSP1.output = DSP2Op09Word1 * DSP2Op09Word2;
+ *(uint32_t*)DSP1.output = DSP2Op09Word1 * DSP2Op09Word2;
#else
- uint32 temp;
+ uint32_t temp;
temp = DSP2Op09Word1 * DSP2Op09Word2;
DSP1.output[0] = temp & 0xFF;
DSP1.output[1] = (temp >> 8) & 0xFF;
@@ -973,15 +973,15 @@ void DSP2SetByte(uint8 byte, uint16 address)
}
}
-uint8 DSP2GetByte(uint16 address)
+uint8_t DSP2GetByte(uint16_t address)
{
- uint8 t;
+ uint8_t t;
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
if (DSP1.out_count)
{
- t = (uint8) DSP1.output [DSP1.out_index];
+ t = (uint8_t) DSP1.output [DSP1.out_index];
DSP1.out_index++;
if (DSP1.out_count == DSP1.out_index)
DSP1.out_count = 0;
@@ -995,8 +995,8 @@ uint8 DSP2GetByte(uint16 address)
//Disable non-working chips?
#ifdef DSP_DUMMY_LOOPS
-//static const uint16 DSP1ROM[1024] from SNES9X v1.53
-uint16 Dsp3Rom[1024] =
+//static const uint16_t DSP1ROM[1024] from SNES9X v1.53
+uint16_t Dsp3Rom[1024] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -1129,7 +1129,7 @@ uint16 Dsp3Rom[1024] =
};
-void DSP3SetByte(uint8 byte, uint16 address)
+void DSP3SetByte(uint8_t byte, uint16_t address)
{
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
@@ -1138,8 +1138,8 @@ void DSP3SetByte(uint8 byte, uint16 address)
{
DSP1.command = byte;
DSP1.in_index = 0;
- DSP1.waiting4command = FALSE;
- // DSP1.first_parameter = TRUE;
+ DSP1.waiting4command = false;
+ // DSP1.first_parameter = true;
// printf("Op%02X\n",byte);
switch (byte)
{
@@ -1163,7 +1163,7 @@ void DSP3SetByte(uint8 byte, uint16 address)
else
{
DSP1.parameters [DSP1.in_index] = byte;
- // DSP1.first_parameter = FALSE;
+ // DSP1.first_parameter = false;
DSP1.in_index++;
}
@@ -1171,7 +1171,7 @@ void DSP3SetByte(uint8 byte, uint16 address)
{
//DSP1.parameters [DSP1.in_index] |= (byte << 8);
// Actually execute the command
- DSP1.waiting4command = TRUE;
+ DSP1.waiting4command = true;
DSP1.out_index = 0;
switch (DSP1.command)
{
@@ -1202,9 +1202,9 @@ void DSP3SetByte(uint8 byte, uint16 address)
}
}
-uint8 DSP3GetByte(uint16 address)
+uint8_t DSP3GetByte(uint16_t address)
{
- uint8 t;
+ uint8_t t;
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
@@ -1216,7 +1216,7 @@ uint8 DSP3GetByte(uint16 address)
if (DSP1.command == 0x1f)
{
if ((DSP1.out_index % 2) != 0)
- t = (uint8)Dsp3Rom[DSP1.out_index >> 1];
+ t = (uint8_t)Dsp3Rom[DSP1.out_index >> 1];
else
t = Dsp3Rom[DSP1.out_index >> 1] >> 8;
// t=Dsp3Rom[DSP1.out_index];
@@ -1224,7 +1224,7 @@ uint8 DSP3GetByte(uint16 address)
}
else
{
- t = (uint8) DSP1.output [DSP1.out_index];
+ t = (uint8_t) DSP1.output [DSP1.out_index];
DSP1.out_index++;
DSP1.out_index %= 512;
if (DSP1.out_count == DSP1.out_index)
@@ -1257,30 +1257,30 @@ uint8 DSP3GetByte(uint16 address)
typedef struct
{
- bool8 waiting4command;
- bool8 half_command;
- uint16 command;
- uint32 in_count;
- uint32 in_index;
- uint32 out_count;
- uint32 out_index;
- uint8 parameters [512];
- uint8 output [512];
+ bool waiting4command;
+ bool half_command;
+ uint16_t command;
+ uint32_t in_count;
+ uint32_t in_index;
+ uint32_t out_count;
+ uint32_t out_index;
+ uint8_t parameters [512];
+ uint8_t output [512];
} SDSP4;
SDSP4 DSP4;
#include "dsp4emu.c"
-bool DSP4_init = FALSE;
+bool DSP4_init = false;
-void DSP4SetByte(uint8 byte, uint16 address)
+void DSP4SetByte(uint8_t byte, uint16_t address)
{
if (!DSP4_init)
{
// bootup
DSP4.waiting4command = 1;
- DSP4_init = TRUE;
+ DSP4_init = true;
}
if ((address & 0xf000) == 0x6000 ||
@@ -1298,8 +1298,8 @@ void DSP4SetByte(uint8 byte, uint16 address)
{
DSP4.command |= (byte << 8);
DSP4.in_index = 0;
- DSP4.waiting4command = FALSE;
- // DSP4.first_parameter = TRUE;
+ DSP4.waiting4command = false;
+ // DSP4.first_parameter = true;
DSP4.half_command = 0;
DSP4.out_count = 0;
DSP4.out_index = 0;
@@ -1347,7 +1347,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
DSP4.in_count = 8;
break;
default:
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
//printf("(line %d) Unknown Op%02X\n",line,DSP4.command);
break;
}
@@ -1361,7 +1361,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
else
{
DSP4.parameters [DSP4.in_index] = byte;
- // DSP4.first_parameter = FALSE;
+ // DSP4.first_parameter = false;
DSP4.in_index++;
}
@@ -1369,7 +1369,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
{
//DSP4.parameters [DSP4.in_index] |= (byte << 8);
// Actually execute the command
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_index = 0;
DSP4.in_index = 0;
switch (DSP4.command)
@@ -1377,7 +1377,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
// 16-bit multiplication
case 0x0000:
{
- int16 multiplier, multiplicand;
+ int16_t multiplier, multiplicand;
int product;
multiplier = DSP4_READ_WORD(0);
@@ -1394,7 +1394,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
// unknown: horizontal mapping command
case 0x0011:
{
- int16 a, b, c, d, m;
+ int16_t a, b, c, d, m;
a = DSP4_READ_WORD(6);
b = DSP4_READ_WORD(4);
@@ -1474,10 +1474,10 @@ void DSP4SetByte(uint8 byte, uint16 address)
// unknown
case 0x000A:
{
- int16 in1a = DSP4_READ_WORD(0);
- int16 in2a = DSP4_READ_WORD(2);
- int16 in3a = DSP4_READ_WORD(4);
- int16 out1a, out2a;
+ int16_t in1a = DSP4_READ_WORD(0);
+ int16_t in2a = DSP4_READ_WORD(2);
+ int16_t in3a = DSP4_READ_WORD(4);
+ int16_t out1a, out2a;
out1a = (short)0xff40;
out2a = (short)0x00c0;
@@ -1494,9 +1494,9 @@ void DSP4SetByte(uint8 byte, uint16 address)
// render player positions around track
case 0x000B:
{
- int16 sp_x = DSP4_READ_WORD(0);
- int16 sp_y = DSP4_READ_WORD(2);
- int16 oam = DSP4_READ_WORD(4);
+ int16_t sp_x = DSP4_READ_WORD(0);
+ int16_t sp_y = DSP4_READ_WORD(2);
+ int16_t oam = DSP4_READ_WORD(4);
// Only allow 1p/1p-split to yield output (???)
if (!op09_mode)
@@ -1530,15 +1530,15 @@ void DSP4SetByte(uint8 byte, uint16 address)
}
}
-uint8 DSP4GetByte(uint16 address)
+uint8_t DSP4GetByte(uint16_t address)
{
- uint8 t;
+ uint8_t t;
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
if (DSP4.out_count)
{
- t = (uint8) DSP4.output [DSP4.out_index];
+ t = (uint8_t) DSP4.output [DSP4.out_index];
DSP4.out_index++;
if (DSP4.out_count == DSP4.out_index)
DSP4.out_count = 0;
diff --git a/source/dsp1.h b/source/dsp1.h
index 5eba950..f631cfd 100644
--- a/source/dsp1.h
+++ b/source/dsp1.h
@@ -90,38 +90,38 @@
#ifndef _DSP1_H_
#define _DSP1_H_
-extern void (*SetDSP)(uint8, uint16);
-extern uint8(*GetDSP)(uint16);
+extern void (*SetDSP)(uint8_t, uint16_t);
+extern uint8_t(*GetDSP)(uint16_t);
-void DSP1SetByte(uint8 byte, uint16 address);
-uint8 DSP1GetByte(uint16 address);
+void DSP1SetByte(uint8_t byte, uint16_t address);
+uint8_t DSP1GetByte(uint16_t address);
-void DSP2SetByte(uint8 byte, uint16 address);
-uint8 DSP2GetByte(uint16 address);
+void DSP2SetByte(uint8_t byte, uint16_t address);
+uint8_t DSP2GetByte(uint16_t address);
-void DSP3SetByte(uint8 byte, uint16 address);
-uint8 DSP3GetByte(uint16 address);
+void DSP3SetByte(uint8_t byte, uint16_t address);
+uint8_t DSP3GetByte(uint16_t address);
-void DSP4SetByte(uint8 byte, uint16 address);
-uint8 DSP4GetByte(uint16 address);
+void DSP4SetByte(uint8_t byte, uint16_t address);
+uint8_t DSP4GetByte(uint16_t address);
typedef struct
{
- bool8 waiting4command;
- bool8 first_parameter;
- uint8 command;
- uint32 in_count;
- uint32 in_index;
- uint32 out_count;
- uint32 out_index;
- uint8 parameters [512];
+ bool waiting4command;
+ bool first_parameter;
+ uint8_t command;
+ uint32_t in_count;
+ uint32_t in_index;
+ uint32_t out_count;
+ uint32_t out_index;
+ uint8_t parameters [512];
//output was 512 for DSP-2 work, updated to reflect current thinking on DSP-3
- uint8 output [512];
+ uint8_t output [512];
} SDSP1;
void S9xResetDSP1();
-uint8 S9xGetDSP(uint16 Address);
-void S9xSetDSP(uint8 Byte, uint16 Address);
+uint8_t S9xGetDSP(uint16_t Address);
+void S9xSetDSP(uint8_t Byte, uint16_t Address);
extern SDSP1 DSP1;
//extern struct SDSP1 DSP1;
diff --git a/source/dsp2emu.c b/source/dsp2emu.c
index 8e31d04..0859fc9 100644
--- a/source/dsp2emu.c
+++ b/source/dsp2emu.c
@@ -88,17 +88,17 @@
*******************************************************************************/
-uint16 DSP2Op09Word1 = 0;
-uint16 DSP2Op09Word2 = 0;
+uint16_t DSP2Op09Word1 = 0;
+uint16_t DSP2Op09Word2 = 0;
bool DSP2Op05HasLen = false;
int DSP2Op05Len = 0;
bool DSP2Op06HasLen = false;
int DSP2Op06Len = 0;
-uint8 DSP2Op05Transparent = 0;
+uint8_t DSP2Op05Transparent = 0;
void DSP2_Op05()
{
- uint8 color;
+ uint8_t color;
// Overlay bitmap with transparency.
// Input:
//
@@ -234,7 +234,7 @@ void DSP2_Op0D()
int i;
int pixel_offset;
- uint8 pixelarray[512];
+ uint8_t pixelarray[512];
for (i = 0; i < DSP2Op0DOutLen * 2; i++)
{
@@ -268,10 +268,10 @@ void DSP2_Op0D()
// If it does we can adjust the parameters and code to work with it
- uint32 multiplier; // Any size int >= 32-bits
- uint32 pixloc; // match size of multiplier
+ uint32_t multiplier; // Any size int >= 32-bits
+ uint32_t pixloc; // match size of multiplier
int i, j;
- uint8 pixelarray[512];
+ uint8_t pixelarray[512];
if (DSP2Op0DInLen <= DSP2Op0DOutLen)
multiplier = 0x10000; // In our self defined fixed point 0x10000 == 1
@@ -311,7 +311,7 @@ void DSP2_Op0D()
float multiplier;
float pixloc;
int i, j;
- uint8 pixelarray[512];
+ uint8_t pixelarray[512];
if (DSP2Op0DInLen <= DSP2Op0DOutLen)
multiplier = (float) 1.0;
diff --git a/source/dsp4.h b/source/dsp4.h
index a214db6..214fe34 100644
--- a/source/dsp4.h
+++ b/source/dsp4.h
@@ -95,80 +95,80 @@ int block; // current block number
extern int c;
// op control
-int8 DSP4_Logic; // controls op flow
+int8_t DSP4_Logic; // controls op flow
// projection format
-const int16 PLANE_START = 0x7fff; // starting distance
+const int16_t PLANE_START = 0x7fff; // starting distance
-int16 view_plane; // viewer location
-int16 far_plane; // next milestone into screen
-int16 segments; // # raster segments to draw
-int16 raster; // current raster line
+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 project_x; // current x-position
-int16 project_y; // current y-position
+int16_t project_x; // current x-position
+int16_t project_y; // current y-position
-int16 project_centerx; // x-target of projection
-int16 project_centery; // y-target of projection
+int16_t project_centerx; // x-target of projection
+int16_t project_centery; // y-target of projection
-int16 project_x1; // current x-distance
-int16 project_x1low; // lower 16-bits
-int16 project_y1; // current y-distance
-int16 project_y1low; // lower 16-bits
+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 project_x2; // next projected x-distance
-int16 project_y2; // next projected y-distance
+int16_t project_x2; // next projected x-distance
+int16_t project_y2; // next projected y-distance
-int16 project_pitchx; // delta center
-int16 project_pitchxlow; // lower 16-bits
-int16 project_pitchy; // delta center
-int16 project_pitchylow; // lower 16-bits
+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 project_focalx; // x-point of projection at viewer plane
-int16 project_focaly; // y-point of projection at viewer plane
+int16_t project_focalx; // x-point of projection at viewer plane
+int16_t project_focaly; // y-point of projection at viewer plane
-int16 project_ptr; // data structure pointer
+int16_t project_ptr; // data structure pointer
// render window
-int16 center_x; // x-center of viewport
-int16 center_y; // y-center of viewport
-int16 viewport_left; // x-left of viewport
-int16 viewport_right; // x-right of viewport
-int16 viewport_top; // y-top of viewport
-int16 viewport_bottom; // y-bottom of viewport
+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 sprite_x; // projected x-pos of sprite
-int16 sprite_y; // projected y-pos of sprite
-int16 sprite_offset; // data pointer offset
-int8 sprite_type; // vehicle, terrain
-bool8 sprite_size; // sprite size: 8x8 or 16x16
+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 path_clipRight[4]; // value to clip to for x>b
-int16 path_clipLeft[4]; // value to clip to for x<a
-int16 path_pos[4]; // x-positions of lanes
-int16 path_ptr[4]; // data structure pointers
-int16 path_raster[4]; // current raster
-int16 path_top[4]; // viewport_top
+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 path_y[2]; // current y-position
-int16 path_x[2]; // current focals
-int16 path_plane[2]; // previous plane
+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 multi_index1; // index counter
-int16 multi_index2; // index counter
-bool8 op09_mode; // window mode
+int16_t multi_index1; // index counter
+int16_t multi_index2; // index counter
+bool op09_mode; // window mode
// multi-op storage
-int16 multi_focaly[64]; // focal_y values
-int16 multi_farplane[4]; // farthest drawn distance
-int16 multi_raster[4]; // line where track stops
+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 op06_OAM[32]; // OAM (size,MSB) data
-int8 op06_index; // index into OAM table
-int8 op06_offset; // offset into OAM table
+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/dsp4emu.c b/source/dsp4emu.c
index 712310f..666656b 100644
--- a/source/dsp4emu.c
+++ b/source/dsp4emu.c
@@ -117,7 +117,7 @@ short DSP4_UnknownOP11(short A, short B, short C, short D)
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
-void DSP4_Op06(bool8 size, bool8 msb)
+void DSP4_Op06(bool size, bool msb)
{
// save post-oam table data for future retrieval
op06_OAM[op06_index] |= (msb << (op06_offset + 0));
@@ -138,9 +138,9 @@ void DSP4_Op06(bool8 size, bool8 msb)
void DSP4_Op01()
{
- uint16 command;
+ uint16_t command;
- DSP4.waiting4command = FALSE;
+ DSP4.waiting4command = false;
// op flow control
switch (DSP4_Logic)
@@ -217,11 +217,11 @@ DSP4_WAIT(1) resume1:
// process one iteration of projection
// inspect inputs
- int16 plane;
+ int16_t plane;
- int16 index, lcv;
- int16 py_dy, px_dx;
- int16 y_out, x_out;
+ int16_t index, lcv;
+ int16_t py_dy, px_dx;
+ int16_t y_out, x_out;
resume2:
plane = DSP4_READ_WORD(0);
@@ -229,7 +229,7 @@ resume2:
px_dx = 0;
// ignore invalid data
- if ((uint16) plane == 0x8001) continue;
+ if ((uint16_t) plane == 0x8001) continue;
// one-time init
if (far_plane)
@@ -275,7 +275,7 @@ resume2:
++block;
#ifdef PRINT
printf("(line %d) Op01 check %02X, plane %04X, focal_y %04X, y2 %04X\n", c,
- (uint16)segments, (uint16)(plane), (uint16)project_focaly, (uint16)project_y2);
+ (uint16_t)segments, (uint16_t)(plane), (uint16_t)project_focaly, (uint16_t)project_y2);
#endif
// prepare output
@@ -338,8 +338,8 @@ resume2:
}
// update projection points
- project_pitchy += (int8)DSP4.parameters[3];
- project_pitchx += (int8)DSP4.parameters[5];
+ project_pitchy += (int8_t)DSP4.parameters[3];
+ project_pitchx += (int8_t)DSP4.parameters[5];
project_focaly += project_pitchy;
project_focalx += project_pitchx;
@@ -347,7 +347,7 @@ resume2:
while (1);
// terminate op
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_count = 0;
}
@@ -359,9 +359,9 @@ resume2:
void DSP4_Op07()
{
- uint16 command;
+ uint16_t command;
- DSP4.waiting4command = FALSE;
+ DSP4.waiting4command = false;
// op flow control
switch (DSP4_Logic)
@@ -404,7 +404,7 @@ void DSP4_Op07()
block = 0;
#ifdef PRINT
- printf("(line %d) Op07 data %04X\n", c, (uint16)project_y1);
+ printf("(line %d) Op07 data %04X\n", c, (uint16_t)project_y1);
#endif
////////////////////////////////////////////////////
@@ -432,10 +432,10 @@ DSP4_WAIT(1) resume1:
////////////////////////////////////////////////////
// process one loop of projection
- int16 plane;
- int16 index, lcv;
- int16 y_out, x_out;
- int16 py_dy, px_dx;
+ int16_t plane;
+ int16_t index, lcv;
+ int16_t y_out, x_out;
+ int16_t py_dy, px_dx;
resume2:
py_dy = 0;
@@ -451,7 +451,7 @@ resume2:
project_x2 = DSP4_READ_WORD(6);
// ignore invalid data
- if ((uint16) plane == 0x8001) continue;
+ if ((uint16_t) plane == 0x8001) continue;
// multi-op storage
project_focaly = multi_focaly[multi_index2];
@@ -483,7 +483,7 @@ resume2:
#ifdef PRINT
printf("(line %d) Op07 block %d, loc %04X, out %02X, project_x2 %04X\n", c,
- block, plane, segments, (uint16)project_x2);
+ block, plane, segments, (uint16_t)project_x2);
#endif
// prepare pre-output
@@ -538,7 +538,7 @@ resume2:
}
while (1);
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_count = 0;
}
@@ -550,9 +550,9 @@ resume2:
void DSP4_Op08()
{
- uint16 command;
+ uint16_t command;
- DSP4.waiting4command = FALSE;
+ DSP4.waiting4command = false;
// op flow control
switch (DSP4_Logic)
@@ -642,22 +642,22 @@ DSP4_WAIT(2) resume2:
++block;
// used in envelope shaping
- int16 x1_final;
- int16 x2_final;
+ int16_t x1_final;
+ int16_t x2_final;
// look at guidelines
- int16 plane = DSP4_READ_WORD(0x00);
- int16 x_left = DSP4_READ_WORD(0x02);
- int16 y_left = DSP4_READ_WORD(0x04);
- int16 x_right = DSP4_READ_WORD(0x06);
- int16 y_right = DSP4_READ_WORD(0x08);
+ int16_t plane = DSP4_READ_WORD(0x00);
+ int16_t x_left = DSP4_READ_WORD(0x02);
+ int16_t y_left = DSP4_READ_WORD(0x04);
+ int16_t x_right = DSP4_READ_WORD(0x06);
+ int16_t y_right = DSP4_READ_WORD(0x08);
// envelope guidelines (one frame only)
- int16 envelope1 = DSP4_READ_WORD(0x0a);
- int16 envelope2 = DSP4_READ_WORD(0x0c);
+ int16_t envelope1 = DSP4_READ_WORD(0x0a);
+ int16_t envelope2 = DSP4_READ_WORD(0x0c);
// ignore invalid data
- if ((uint16) plane == 0x8001) continue;
+ if ((uint16_t) plane == 0x8001) continue;
// first init
if (plane == 0x7fff)
@@ -700,15 +700,15 @@ DSP4_WAIT(2) resume2:
DSP4.output[1] = pos2 & 0xFF;
#ifdef PRINT
- printf("(line %d) Op08 x_left %04X\n", c, (uint16)x_left);
+ printf("(line %d) Op08 x_left %04X\n", c, (uint16_t)x_left);
#endif
}
// proceed with projection
else
{
- int16 index = 0, lcv;
- int16 left_inc = 0, right_inc = 0;
- int16 dx1 = 0, dx2 = 0, dx3, dx4;
+ int16_t index = 0, lcv;
+ int16_t left_inc = 0, right_inc = 0;
+ int16_t dx1 = 0, dx2 = 0, dx3, dx4;
// # segments to traverse
segments = abs(y_left - path_y[0]);
@@ -750,7 +750,7 @@ DSP4_WAIT(2) resume2:
#ifdef PRINT
printf("(line %d) Op08 block %d, out %02X, raster %02X\n", c, block, segments,
- (uint16)y_left);
+ (uint16_t)y_left);
#endif
// zone 1
@@ -760,7 +760,7 @@ DSP4_WAIT(2) resume2:
for (lcv = 1; lcv <= segments; lcv++)
{
- int16 pos1, pos2;
+ int16_t pos1, pos2;
// pre-compute
pos1 = path_pos[0] + ((left_inc * lcv) >> 8) + dx1;
@@ -795,7 +795,7 @@ DSP4_WAIT(2) resume2:
if (segments > 0)
{
// project points w/out the envelopes
- int16 inc = ((path_x[0] - x_left) << 8) / segments;
+ int16_t inc = ((path_x[0] - x_left) << 8) / segments;
// post-store
path_pos[0] += ((inc * lcv) >> 8);
@@ -851,7 +851,7 @@ DSP4_WAIT(2) resume2:
for (lcv = 1; lcv <= segments; lcv++)
{
- int16 pos1, pos2;
+ int16_t pos1, pos2;
// pre-compute
pos1 = path_pos[2] + ((left_inc * lcv) >> 8) + dx1;
@@ -886,7 +886,7 @@ DSP4_WAIT(2) resume2:
if (segments > 0)
{
// project points w/out the envelopes
- int16 inc = ((path_x[1] - x_right) << 8) / segments;
+ int16_t inc = ((path_x[1] - x_right) << 8) / segments;
// post-store
path_pos[2] += ((inc * lcv) >> 8);
@@ -899,7 +899,7 @@ DSP4_WAIT(2) resume2:
}
while (1);
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_count = 2;
DSP4_WRITE_WORD(0, 0);
}
@@ -912,9 +912,9 @@ DSP4_WAIT(2) resume2:
void DSP4_Op0D()
{
- uint16 command;
+ uint16_t command;
- DSP4.waiting4command = FALSE;
+ DSP4.waiting4command = false;
// op flow control
switch (DSP4_Logic)
@@ -1011,10 +1011,10 @@ DSP4_WAIT(1) resume1:
// project section of the track
// inspect inputs
- int16 plane;
- int16 index, lcv;
- int16 py_dy, px_dx;
- int16 y_out, x_out;
+ int16_t plane;
+ int16_t index, lcv;
+ int16_t py_dy, px_dx;
+ int16_t y_out, x_out;
resume2:
@@ -1024,7 +1024,7 @@ resume2:
// ignore invalid data
- if ((uint16) plane == 0x8001) continue;
+ if ((uint16_t) plane == 0x8001) continue;
// one-time init
if (far_plane)
@@ -1070,8 +1070,8 @@ resume2:
++block;
#ifdef PRINT
- printf("(line %d) Op0D check %02X, plane %04X\n", c, (uint16)segments,
- (uint16)(plane));
+ printf("(line %d) Op0D check %02X, plane %04X\n", c, (uint16_t)segments,
+ (uint16_t)(plane));
#endif
// prepare output
@@ -1130,15 +1130,15 @@ resume2:
}
// update focal projection points
- project_pitchy += (int8)DSP4.parameters[3];
- project_pitchx += (int8)DSP4.parameters[5];
+ project_pitchy += (int8_t)DSP4.parameters[3];
+ project_pitchx += (int8_t)DSP4.parameters[5];
project_focaly += project_pitchy;
project_focalx += project_pitchx;
}
while (1);
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_count = 0;
}
@@ -1154,9 +1154,9 @@ resume2:
void DSP4_Op09()
{
- uint16 command;
+ uint16_t command;
- DSP4.waiting4command = FALSE;
+ DSP4.waiting4command = false;
// op flow control
switch (DSP4_Logic)
@@ -1228,7 +1228,7 @@ void DSP4_Op09()
do
{
- uint16 second;
+ uint16_t second;
DSP4.in_count = 4;
DSP4.in_index = 2;
@@ -1274,11 +1274,11 @@ sprite_found:
// vehicle sprite
if (sprite_type == 1)
{
- int16 plane;
- int16 car_left, car_right;
- // int16 car_left_a;
- int16 focal_back;
-// int16 focal_front;
+ int16_t plane;
+ int16_t car_left, car_right;
+ // int16_t car_left_a;
+ int16_t focal_back;
+// int16_t focal_front;
// we already have 4 bytes we want
DSP4.in_count = 6 + 12;
@@ -1334,7 +1334,7 @@ resume4:
// terrain sprite
else if (sprite_type == 2)
{
- int16 plane;
+ int16_t plane;
// we already have 4 bytes we want
DSP4.in_count = 6 + 6 + 2;
@@ -1386,7 +1386,7 @@ DSP4_WAIT(6) resume6:
{
sprite_size = !sprite_size;
#ifdef PRINT
- printf("TOGGLE=%02X\n", (uint8)sprite_size);
+ printf("TOGGLE=%02X\n", (uint8_t)sprite_size);
#endif
continue;
}
@@ -1406,9 +1406,9 @@ DSP4_WAIT(6) resume6:
/////////////////////////////////////
// process tile data
- bool8 clip;
- int16 sp_x, sp_y, sp_oam, sp_msb;
- int16 sp_dx, sp_dy;
+ bool clip;
+ int16_t sp_x, sp_y, sp_oam, sp_msb;
+ int16_t sp_dx, sp_dy;
resume7:
@@ -1421,26 +1421,26 @@ resume7:
sp_x = sprite_x + sp_dx;
// reject points outside the clipping window
- clip = FALSE;
- if (sp_x < viewport_left || sp_x > viewport_right) clip = TRUE;
- if (sp_y < viewport_top || sp_y > viewport_bottom) clip = TRUE;
+ clip = false;
+ if (sp_x < viewport_left || sp_x > viewport_right) clip = true;
+ if (sp_y < viewport_top || sp_y > viewport_bottom) clip = true;
// track depth sorting
if (far_plane <= multi_farplane[multi_index1] &&
- sp_y >= project_y2) clip = TRUE;
+ sp_y >= project_y2) clip = true;
#ifdef PRINT2
printf("(line %d) %04X, %04X, %04X / %04X %04X\n", line,
- (uint16)sp_x, (uint16)sp_y, (uint16)far_plane,
- (uint16)multi_farplane[multi_index1], (uint16)project_y2);
+ (uint16_t)sp_x, (uint16_t)sp_y, (uint16_t)far_plane,
+ (uint16_t)multi_farplane[multi_index1], (uint16_t)project_y2);
#endif
// don't draw offscreen coordinates
DSP4.out_count = 0;
if (!clip)
{
- int16 out_index = 0;
- int16 offset = DSP4_READ_WORD(0);
+ int16_t out_index = 0;
+ int16_t offset = DSP4_READ_WORD(0);
// update sprite nametable/attribute information
sp_oam = sprite_offset + offset;
@@ -1448,8 +1448,8 @@ resume7:
#ifdef PRINT
printf("(line %d) %04X, %04X, %04X, %04X, %04X\n", line,
- (uint16)sp_oam, (uint16)sprite_offset, (uint16)offset,
- (uint16)sp_x, (uint16)sp_y);
+ (uint16_t)sp_oam, (uint16_t)sprite_offset, (uint16_t)offset,
+ (uint16_t)sp_x, (uint16_t)sp_y);
#endif
// emit transparency information
@@ -1545,7 +1545,7 @@ resume7:
while (1);
terminate:
- DSP4.waiting4command = TRUE;
+ DSP4.waiting4command = true;
DSP4.out_count = 0;
}
diff --git a/source/fxdbg.c b/source/fxdbg.c
index 75af980..bdfac1f 100644
--- a/source/fxdbg.c
+++ b/source/fxdbg.c
@@ -123,10 +123,10 @@ extern struct FxRegs_s GSU;
void FxPipeString(char* pvString)
{
char* p;
- uint32 vOpcode = (GSU.vStatusReg & 0x300) | ((uint32)PIPE);
+ uint32_t vOpcode = (GSU.vStatusReg & 0x300) | ((uint32_t)PIPE);
const char* m = fx_apvMnemonicTable[vOpcode];
- uint8 vPipe1, vPipe2, vByte1, vByte2;
- uint8 vPipeBank = GSU.vPipeAdr >> 16;
+ uint8_t vPipe1, vPipe2, vByte1, vByte2;
+ uint8_t vPipeBank = GSU.vPipeAdr >> 16;
/* The next two bytes after the pipe's address */
vPipe1 = GSU.apvRomBank[vPipeBank][USEX16(GSU.vPipeAdr + 1)];
diff --git a/source/fxemu.c b/source/fxemu.c
index b0ec6c7..ad146c7 100644
--- a/source/fxemu.c
+++ b/source/fxemu.c
@@ -95,32 +95,32 @@
/* The FxChip Emulator's internal variables */
struct FxRegs_s GSU = FxRegs_s_null;
-uint32(**fx_ppfFunctionTable)(uint32) = 0;
+uint32_t(**fx_ppfFunctionTable)(uint32_t) = 0;
void (**fx_ppfPlotTable)() = 0;
void (**fx_ppfOpcodeTable)() = 0;
#if 0
void fx_setCache()
{
- uint32 c;
- GSU.bCacheActive = TRUE;
+ uint32_t c;
+ GSU.bCacheActive = true;
GSU.pvRegisters[0x3e] &= 0xf0;
- c = (uint32)GSU.pvRegisters[0x3e];
- c |= ((uint32)GSU.pvRegisters[0x3f]) << 8;
+ c = (uint32_t)GSU.pvRegisters[0x3e];
+ c |= ((uint32_t)GSU.pvRegisters[0x3f]) << 8;
if (c == GSU.vCacheBaseReg)
return;
GSU.vCacheBaseReg = c;
GSU.vCacheFlags = 0;
if (c < (0x10000 - 512))
{
- uint8 const* t = &ROM(c);
+ uint8_t const* t = &ROM(c);
memcpy(GSU.pvCache, t, 512);
}
else
{
- uint8 const* t1;
- uint8 const* t2;
- uint32 i = 0x10000 - c;
+ uint8_t const* t1;
+ uint8_t const* t2;
+ uint32_t i = 0x10000 - c;
t1 = &ROM(c);
t2 = &ROM(0);
memcpy(GSU.pvCache, t1, i);
@@ -129,12 +129,12 @@ void fx_setCache()
}
#endif
-void FxCacheWriteAccess(uint16 vAddress)
+void FxCacheWriteAccess(uint16_t vAddress)
{
#if 0
if (!GSU.bCacheActive)
{
- uint8 v = GSU.pvCache[GSU.pvCache[vAddress & 0x1ff];
+ uint8_t v = GSU.pvCache[GSU.pvCache[vAddress & 0x1ff];
fx_setCache();
GSU.pvCache[GSU.pvCache[vAddress & 0x1ff] = v;
}
@@ -147,16 +147,16 @@ void FxCacheWriteAccess(uint16 vAddress)
{
GSU.vCacheFlags = 0;
GSU.vCacheBaseReg = 0;
- GSU.bCacheActive = FALSE;
+ GSU.bCacheActive = false;
// GSU.vPipe = 0x1;
}
static void fx_backupCache()
{
#if 0
- uint32 i;
- uint32 v = GSU.vCacheFlags;
- uint32 c = USEX16(GSU.vCacheBaseReg);
+ uint32_t i;
+ uint32_t v = GSU.vCacheFlags;
+ uint32_t c = USEX16(GSU.vCacheBaseReg);
if (v)
for (i = 0; i < 32; i++)
{
@@ -164,15 +164,15 @@ static void fx_backupCache()
{
if (c < (0x10000 - 16))
{
- uint8* t = &GSU.pvPrgBank[c];
+ uint8_t* t = &GSU.pvPrgBank[c];
memcpy(&GSU.avCacheBackup[i << 4], t, 16);
memcpy(t, &GSU.pvCache[i << 4], 16);
}
else
{
- uint8* t1;
- uint8* t2;
- uint32 a = 0x10000 - c;
+ uint8_t* t1;
+ uint8_t* t2;
+ uint32_t a = 0x10000 - c;
t1 = &GSU.pvPrgBank[c];
t2 = &GSU.pvPrgBank[0];
memcpy(&GSU.avCacheBackup[i << 4], t1, a);
@@ -190,9 +190,9 @@ static void fx_backupCache()
static void fx_restoreCache()
{
#if 0
- uint32 i;
- uint32 v = GSU.vCacheFlags;
- uint32 c = USEX16(GSU.vCacheBaseReg);
+ uint32_t i;
+ uint32_t v = GSU.vCacheFlags;
+ uint32_t c = USEX16(GSU.vCacheBaseReg);
if (v)
for (i = 0; i < 32; i++)
{
@@ -200,15 +200,15 @@ static void fx_restoreCache()
{
if (c < (0x10000 - 16))
{
- uint8* t = &GSU.pvPrgBank[c];
+ uint8_t* t = &GSU.pvPrgBank[c];
memcpy(t, &GSU.avCacheBackup[i << 4], 16);
memcpy(&GSU.pvCache[i << 4], t, 16);
}
else
{
- uint8* t1;
- uint8* t2;
- uint32 a = 0x10000 - c;
+ uint8_t* t1;
+ uint8_t* t2;
+ uint32_t a = 0x10000 - c;
t1 = &GSU.pvPrgBank[c];
t2 = &GSU.pvPrgBank[0];
memcpy(t1, &GSU.avCacheBackup[i << 4], a);
@@ -227,14 +227,14 @@ void fx_flushCache()
{
fx_restoreCache();
GSU.vCacheFlags = 0;
- GSU.bCacheActive = FALSE;
+ GSU.bCacheActive = false;
}
-void fx_updateRamBank(uint8 Byte)
+void fx_updateRamBank(uint8_t Byte)
{
// Update BankReg and Bank pointer
- GSU.vRamBankReg = (uint32)Byte & (FX_RAM_BANKS - 1);
+ GSU.vRamBankReg = (uint32_t)Byte & (FX_RAM_BANKS - 1);
GSU.pvRamBank = GSU.apvRamBank[Byte & 0x3];
}
@@ -242,9 +242,9 @@ void fx_updateRamBank(uint8 Byte)
static void fx_readRegisterSpace()
{
int i;
- uint8* p;
- static uint32 avHeight[] = { 128, 160, 192, 256 };
- static uint32 avMult[] = { 16, 32, 32, 64 };
+ uint8_t* p;
+ static uint32_t avHeight[] = { 128, 160, 192, 256 };
+ static uint32_t avMult[] = { 16, 32, 32, 64 };
GSU.vErrorCode = 0;
@@ -253,18 +253,18 @@ static void fx_readRegisterSpace()
for (i = 0; i < 16; i++)
{
GSU.avReg[i] = *p++;
- GSU.avReg[i] += ((uint32)(*p++)) << 8;
+ GSU.avReg[i] += ((uint32_t)(*p++)) << 8;
}
/* Update other registers */
p = GSU.pvRegisters;
- GSU.vStatusReg = (uint32)p[GSU_SFR];
- GSU.vStatusReg |= ((uint32)p[GSU_SFR + 1]) << 8;
- GSU.vPrgBankReg = (uint32)p[GSU_PBR];
- GSU.vRomBankReg = (uint32)p[GSU_ROMBR];
- GSU.vRamBankReg = ((uint32)p[GSU_RAMBR]) & (FX_RAM_BANKS - 1);
- GSU.vCacheBaseReg = (uint32)p[GSU_CBR];
- GSU.vCacheBaseReg |= ((uint32)p[GSU_CBR + 1]) << 8;
+ GSU.vStatusReg = (uint32_t)p[GSU_SFR];
+ GSU.vStatusReg |= ((uint32_t)p[GSU_SFR + 1]) << 8;
+ GSU.vPrgBankReg = (uint32_t)p[GSU_PBR];
+ GSU.vRomBankReg = (uint32_t)p[GSU_ROMBR];
+ GSU.vRamBankReg = ((uint32_t)p[GSU_RAMBR]) & (FX_RAM_BANKS - 1);
+ GSU.vCacheBaseReg = (uint32_t)p[GSU_CBR];
+ GSU.vCacheBaseReg |= ((uint32_t)p[GSU_CBR + 1]) << 8;
/* Update status register variables */
GSU.vZero = !(GSU.vStatusReg & FLG_Z);
@@ -318,7 +318,7 @@ static void fx_readRegisterSpace()
void fx_dirtySCBR()
{
- GSU.vSCBRDirty = TRUE;
+ GSU.vSCBRDirty = true;
}
void fx_computeScreenPointers()
@@ -329,7 +329,7 @@ void fx_computeScreenPointers()
{
int i;
- GSU.vSCBRDirty = FALSE;
+ GSU.vSCBRDirty = false;
/* Make a list of pointers to the start of each screen column */
switch (GSU.vScreenHeight)
@@ -454,13 +454,13 @@ void fx_computeScreenPointers()
static void fx_writeRegisterSpace()
{
int i;
- uint8* p;
+ uint8_t* p;
p = GSU.pvRegisters;
for (i = 0; i < 16; i++)
{
- *p++ = (uint8)GSU.avReg[i];
- *p++ = (uint8)(GSU.avReg[i] >> 8);
+ *p++ = (uint8_t)GSU.avReg[i];
+ *p++ = (uint8_t)(GSU.avReg[i] >> 8);
}
/* Update status register */
@@ -474,13 +474,13 @@ static void fx_writeRegisterSpace()
else CF(CY);
p = GSU.pvRegisters;
- p[GSU_SFR] = (uint8)GSU.vStatusReg;
- p[GSU_SFR + 1] = (uint8)(GSU.vStatusReg >> 8);
- p[GSU_PBR] = (uint8)GSU.vPrgBankReg;
- p[GSU_ROMBR] = (uint8)GSU.vRomBankReg;
- p[GSU_RAMBR] = (uint8)GSU.vRamBankReg;
- p[GSU_CBR] = (uint8)GSU.vCacheBaseReg;
- p[GSU_CBR + 1] = (uint8)(GSU.vCacheBaseReg >> 8);
+ p[GSU_SFR] = (uint8_t)GSU.vStatusReg;
+ p[GSU_SFR + 1] = (uint8_t)(GSU.vStatusReg >> 8);
+ p[GSU_PBR] = (uint8_t)GSU.vPrgBankReg;
+ p[GSU_ROMBR] = (uint8_t)GSU.vRomBankReg;
+ p[GSU_RAMBR] = (uint8_t)GSU.vRamBankReg;
+ p[GSU_CBR] = (uint8_t)GSU.vCacheBaseReg;
+ p[GSU_CBR + 1] = (uint8_t)(GSU.vCacheBaseReg >> 8);
fx_restoreCache();
}
@@ -489,7 +489,7 @@ static void fx_writeRegisterSpace()
void FxReset(struct FxInit_s* psFxInfo)
{
int i;
- static uint32(**appfFunction[])(uint32) =
+ static uint32_t(**appfFunction[])(uint32_t) =
{
&fx_apfFunctionTable[0],
#if 0
@@ -523,7 +523,7 @@ void FxReset(struct FxInit_s* psFxInfo)
fx_ppfOpcodeTable = appfOpcode[psFxInfo->vFlags & 0x3];
/* Clear all internal variables */
- memset((uint8*)&GSU, 0, sizeof(struct FxRegs_s));
+ memset((uint8_t*)&GSU, 0, sizeof(struct FxRegs_s));
/* Set default registers */
GSU.pvSreg = GSU.pvDreg = &R0;
@@ -550,7 +550,7 @@ void FxReset(struct FxInit_s* psFxInfo)
/* Make ROM bank table */
for (i = 0; i < 256; i++)
{
- uint32 b = i & 0x7f;
+ uint32_t b = i & 0x7f;
if (b >= 0x40)
{
if (GSU.nRomBanks > 1)
@@ -583,36 +583,36 @@ void FxReset(struct FxInit_s* psFxInfo)
fx_readRegisterSpace();
}
-static uint8 fx_checkStartAddress()
+static bool fx_checkStartAddress()
{
/* Check if we start inside the cache */
if (GSU.bCacheActive && R15 >= GSU.vCacheBaseReg
&& R15 < (GSU.vCacheBaseReg + 512))
- return TRUE;
+ return true;
/* Check if we're in an unused area */
if (GSU.vPrgBankReg < 0x40 && R15 < 0x8000)
- return FALSE;
+ return false;
if (GSU.vPrgBankReg >= 0x60 && GSU.vPrgBankReg <= 0x6f)
- return FALSE;
+ return false;
if (GSU.vPrgBankReg >= 0x74)
- return FALSE;
+ return false;
/* Check if we're in RAM and the RAN flag is not set */
if (GSU.vPrgBankReg >= 0x70 && GSU.vPrgBankReg <= 0x73 && !(SCMR & (1 << 3)))
- return FALSE;
+ return false;
/* If not, we're in ROM, so check if the RON flag is set */
if (!(SCMR & (1 << 4)))
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
/* Execute until the next stop instruction */
-int FxEmulate(uint32 nInstructions)
+int FxEmulate(uint32_t nInstructions)
{
- uint32 vCount;
+ uint32_t vCount;
/* Read registers and initialize GSU session */
fx_readRegisterSpace();
@@ -649,20 +649,20 @@ int FxEmulate(uint32 nInstructions)
}
/* Breakpoints */
-void FxBreakPointSet(uint32 vAddress)
+void FxBreakPointSet(uint32_t vAddress)
{
- GSU.bBreakPoint = TRUE;
+ GSU.bBreakPoint = true;
GSU.vBreakPoint = USEX16(vAddress);
}
void FxBreakPointClear()
{
- GSU.bBreakPoint = FALSE;
+ GSU.bBreakPoint = false;
}
/* Step by step execution */
-int FxStepOver(uint32 nInstructions)
+int FxStepOver(uint32_t nInstructions)
{
- uint32 vCount;
+ uint32_t vCount;
fx_readRegisterSpace();
/* Check if the start address is valid */
@@ -703,27 +703,27 @@ int FxGetIllegalAddress()
}
/* Access to internal registers */
-uint32 FxGetColorRegister()
+uint32_t FxGetColorRegister()
{
return GSU.vColorReg & 0xff;
}
-uint32 FxGetPlotOptionRegister()
+uint32_t FxGetPlotOptionRegister()
{
return GSU.vPlotOptionReg & 0x1f;
}
-uint32 FxGetSourceRegisterIndex()
+uint32_t FxGetSourceRegisterIndex()
{
return GSU.pvSreg - GSU.avReg;
}
-uint32 FxGetDestinationRegisterIndex()
+uint32_t FxGetDestinationRegisterIndex()
{
return GSU.pvDreg - GSU.avReg;
}
-uint8 FxPipe()
+uint8_t FxPipe()
{
return GSU.vPipe;
}
diff --git a/source/fxemu.h b/source/fxemu.h
index f7943ab..7170956 100644
--- a/source/fxemu.h
+++ b/source/fxemu.h
@@ -89,77 +89,58 @@
#ifndef _FXEMU_H_
#define _FXEMU_H_ 1
-/* Types used by structures and code */
-#ifndef snes9x_types_defined
-#define snes9x_types_defined
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned char bool8;
-typedef signed char int8;
-typedef short int16;
-typedef int int32;
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
+#include "snes9x.h"
/* The FxInfo_s structure, the link between the FxEmulator and the Snes Emulator */
struct FxInit_s
{
- uint32 vFlags;
- uint8* pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
- uint32 nRamBanks; /* Number of 64kb-banks in GSU-RAM/BackupRAM (banks 0x70-0x73) */
- uint8* pvRam; /* Pointer to GSU-RAM */
- uint32 nRomBanks; /* Number of 32kb-banks in Cart-ROM */
- uint8* pvRom; /* Pointer to Cart-ROM */
+ uint32_t vFlags;
+ uint8_t* pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
+ uint32_t nRamBanks; /* Number of 64kb-banks in GSU-RAM/BackupRAM (banks 0x70-0x73) */
+ uint8_t* pvRam; /* Pointer to GSU-RAM */
+ uint32_t nRomBanks; /* Number of 32kb-banks in Cart-ROM */
+ uint8_t* pvRom; /* Pointer to Cart-ROM */
};
/* Reset the FxChip */
extern void FxReset(struct FxInit_s* psFxInfo);
/* Execute until the next stop instruction */
-extern int FxEmulate(uint32 nInstructions);
+extern int FxEmulate(uint32_t nInstructions);
/* Write access to the cache */
-extern void FxCacheWriteAccess(uint16 vAddress);
+extern void FxCacheWriteAccess(uint16_t vAddress);
extern void
FxFlushCache(); /* Callled when the G flag in SFR is set to zero */
/* Breakpoint */
-extern void FxBreakPointSet(uint32 vAddress);
+extern void FxBreakPointSet(uint32_t vAddress);
extern void FxBreakPointClear();
/* Step by step execution */
-extern int FxStepOver(uint32 nInstructions);
+extern int FxStepOver(uint32_t nInstructions);
/* Errors */
extern int FxGetErrorCode();
extern int FxGetIllegalAddress();
/* Access to internal registers */
-extern uint32 FxGetColorRegister();
-extern uint32 FxGetPlotOptionRegister();
-extern uint32 FxGetSourceRegisterIndex();
-extern uint32 FxGetDestinationRegisterIndex();
+extern uint32_t FxGetColorRegister();
+extern uint32_t FxGetPlotOptionRegister();
+extern uint32_t FxGetSourceRegisterIndex();
+extern uint32_t FxGetDestinationRegisterIndex();
/* Get string for opcode currently in the pipe */
extern void FxPipeString(char* pvString);
/* Get the byte currently in the pipe */
-extern uint8 FxPipe();
+extern uint8_t FxPipe();
/* SCBR write seen. We need to update our cached screen pointers */
extern void fx_dirtySCBR(void);
/* Update RamBankReg and RAM Bank pointer */
-extern void fx_updateRamBank(uint8 Byte);
+extern void fx_updateRamBank(uint8_t Byte);
/* Option flags */
#define FX_FLAG_ADDRESS_CHECKING 0x01
diff --git a/source/fxinst.c b/source/fxinst.c
index 9481284..cc8cae0 100644
--- a/source/fxinst.c
+++ b/source/fxinst.c
@@ -140,23 +140,23 @@ extern void fx_flushCache();
/* 02 - cache - reintialize GSU cache */
static void fx_cache()
{
- uint32 c = R15 & 0xfff0;
+ uint32_t c = R15 & 0xfff0;
if (GSU.vCacheBaseReg != c || !GSU.bCacheActive)
{
fx_flushCache();
GSU.vCacheBaseReg = c;
- GSU.bCacheActive = TRUE;
+ GSU.bCacheActive = true;
#if 0
if (c < (0x10000 - 512))
{
- uint8 const* t = &ROM(c);
+ uint8_t const* t = &ROM(c);
memcpy(GSU.pvCache, t, 512);
}
else
{
- uint8 const* t1;
- uint8 const* t2;
- uint32 i = 0x10000 - c;
+ uint8_t const* t1;
+ uint8_t const* t2;
+ uint32_t i = 0x10000 - c;
t1 = &ROM(c);
t2 = &ROM(0);
memcpy(GSU.pvCache, t1, i);
@@ -171,7 +171,7 @@ static void fx_cache()
/* 03 - lsr - logic shift right */
static void fx_lsr()
{
- uint32 v;
+ uint32_t v;
GSU.vCarry = SREG & 1;
v = USEX16(SREG) >> 1;
R15++;
@@ -185,7 +185,7 @@ static void fx_lsr()
/* 04 - rol - rotate left */
static void fx_rol()
{
- uint32 v = USEX16((SREG << 1) + GSU.vCarry);
+ uint32_t v = USEX16((SREG << 1) + GSU.vCarry);
GSU.vCarry = (SREG >> 15) & 1;
R15++;
DREG = v;
@@ -198,14 +198,14 @@ static void fx_rol()
/* 05 - bra - branch always */
static void fx_bra()
{
- uint8 v = PIPE;
+ uint8_t v = PIPE;
R15++;
FETCHPIPE;
R15 += SEX8(v);
}
/* Branch on condition */
-#define BRA_COND(cond) uint8 v = PIPE; R15++; FETCHPIPE; if(cond) R15 += SEX8(v); else R15++;
+#define BRA_COND(cond) uint8_t v = PIPE; R15++; FETCHPIPE; if(cond) R15 += SEX8(v); else R15++;
#define TEST_S (GSU.vSign & 0x8000)
#define TEST_Z (USEX16(GSU.vZero) == 0)
@@ -418,8 +418,8 @@ static void fx_with_r15()
/* 30-3b - stw (rn) - store word */
#define FX_STW(reg) \
GSU.vLastRamAdr = GSU.avReg[reg]; \
-RAM(GSU.avReg[reg]) = (uint8)SREG; \
-RAM(GSU.avReg[reg]^1) = (uint8)(SREG>>8); \
+RAM(GSU.avReg[reg]) = (uint8_t)SREG; \
+RAM(GSU.avReg[reg]^1) = (uint8_t)(SREG>>8); \
CLRFLAGS; R15++
static void fx_stw_r0()
{
@@ -473,7 +473,7 @@ static void fx_stw_r11()
/* 30-3b(ALT1) - stb (rn) - store byte */
#define FX_STB(reg) \
GSU.vLastRamAdr = GSU.avReg[reg]; \
-RAM(GSU.avReg[reg]) = (uint8)SREG; \
+RAM(GSU.avReg[reg]) = (uint8_t)SREG; \
CLRFLAGS; R15++
static void fx_stb_r0()
{
@@ -528,7 +528,7 @@ static void fx_stb_r11()
static void fx_loop()
{
GSU.vSign = GSU.vZero = --R12;
- if ((uint16) R12 != 0)
+ if ((uint16_t) R12 != 0)
R15 = R13;
else
R15++;
@@ -562,10 +562,10 @@ static void fx_alt3()
}
/* 40-4b - ldw (rn) - load word from RAM */
-#define FX_LDW(reg) uint32 v; \
+#define FX_LDW(reg) uint32_t v; \
GSU.vLastRamAdr = GSU.avReg[reg]; \
-v = (uint32)RAM(GSU.avReg[reg]); \
-v |= ((uint32)RAM(GSU.avReg[reg]^1))<<8; \
+v = (uint32_t)RAM(GSU.avReg[reg]); \
+v |= ((uint32_t)RAM(GSU.avReg[reg]^1))<<8; \
R15++; DREG = v; \
TESTR14; \
CLRFLAGS
@@ -619,9 +619,9 @@ static void fx_ldw_r11()
}
/* 40-4b(ALT1) - ldb (rn) - load byte */
-#define FX_LDB(reg) uint32 v; \
+#define FX_LDB(reg) uint32_t v; \
GSU.vLastRamAdr = GSU.avReg[reg]; \
-v = (uint32)RAM(GSU.avReg[reg]); \
+v = (uint32_t)RAM(GSU.avReg[reg]); \
R15++; DREG = v; \
TESTR14; \
CLRFLAGS
@@ -677,10 +677,10 @@ static void fx_ldb_r11()
/* 4c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
static void fx_plot_2bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v, c;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v, c;
R15++;
CLRFLAGS;
@@ -690,9 +690,9 @@ static void fx_plot_2bit()
if (y >= GSU.vScreenHeight) return;
#endif
if (GSU.vPlotOptionReg & 0x02)
- c = (x ^ y) & 1 ? (uint8)(GSU.vColorReg >> 4) : (uint8)GSU.vColorReg;
+ c = (x ^ y) & 1 ? (uint8_t)(GSU.vColorReg >> 4) : (uint8_t)GSU.vColorReg;
else
- c = (uint8)GSU.vColorReg;
+ c = (uint8_t)GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) return;
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
@@ -707,10 +707,10 @@ static void fx_plot_2bit()
/* 2c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
static void fx_rpix_2bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v;
R15++;
CLRFLAGS;
@@ -722,18 +722,18 @@ static void fx_rpix_2bit()
v = 128 >> (x & 7);
DREG = 0;
- DREG |= ((uint32)((a[0] & v) != 0)) << 0;
- DREG |= ((uint32)((a[1] & v) != 0)) << 1;
+ DREG |= ((uint32_t)((a[0] & v) != 0)) << 0;
+ DREG |= ((uint32_t)((a[1] & v) != 0)) << 1;
TESTR14;
}
/* 4c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
static void fx_plot_4bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v, c;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v, c;
R15++;
CLRFLAGS;
@@ -743,9 +743,9 @@ static void fx_plot_4bit()
if (y >= GSU.vScreenHeight) return;
#endif
if (GSU.vPlotOptionReg & 0x02)
- c = (x ^ y) & 1 ? (uint8)(GSU.vColorReg >> 4) : (uint8)GSU.vColorReg;
+ c = (x ^ y) & 1 ? (uint8_t)(GSU.vColorReg >> 4) : (uint8_t)GSU.vColorReg;
else
- c = (uint8)GSU.vColorReg;
+ c = (uint8_t)GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) return;
@@ -765,10 +765,10 @@ static void fx_plot_4bit()
/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
static void fx_rpix_4bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v;
R15++;
CLRFLAGS;
@@ -781,20 +781,20 @@ static void fx_rpix_4bit()
v = 128 >> (x & 7);
DREG = 0;
- DREG |= ((uint32)((a[0x00] & v) != 0)) << 0;
- DREG |= ((uint32)((a[0x01] & v) != 0)) << 1;
- DREG |= ((uint32)((a[0x10] & v) != 0)) << 2;
- DREG |= ((uint32)((a[0x11] & v) != 0)) << 3;
+ DREG |= ((uint32_t)((a[0x00] & v) != 0)) << 0;
+ DREG |= ((uint32_t)((a[0x01] & v) != 0)) << 1;
+ DREG |= ((uint32_t)((a[0x10] & v) != 0)) << 2;
+ DREG |= ((uint32_t)((a[0x11] & v) != 0)) << 3;
TESTR14;
}
/* 8c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
static void fx_plot_8bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v, c;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v, c;
R15++;
CLRFLAGS;
@@ -803,7 +803,7 @@ static void fx_plot_8bit()
#ifdef CHECK_LIMITS
if (y >= GSU.vScreenHeight) return;
#endif
- c = (uint8)GSU.vColorReg;
+ c = (uint8_t)GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x10))
{
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) return;
@@ -834,10 +834,10 @@ static void fx_plot_8bit()
/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
static void fx_rpix_8bit()
{
- uint32 x = USEX8(R1);
- uint32 y = USEX8(R2);
- uint8* a;
- uint8 v;
+ uint32_t x = USEX8(R1);
+ uint32_t y = USEX8(R2);
+ uint8_t* a;
+ uint8_t v;
R15++;
CLRFLAGS;
@@ -849,14 +849,14 @@ static void fx_rpix_8bit()
v = 128 >> (x & 7);
DREG = 0;
- DREG |= ((uint32)((a[0x00] & v) != 0)) << 0;
- DREG |= ((uint32)((a[0x01] & v) != 0)) << 1;
- DREG |= ((uint32)((a[0x10] & v) != 0)) << 2;
- DREG |= ((uint32)((a[0x11] & v) != 0)) << 3;
- DREG |= ((uint32)((a[0x20] & v) != 0)) << 4;
- DREG |= ((uint32)((a[0x21] & v) != 0)) << 5;
- DREG |= ((uint32)((a[0x30] & v) != 0)) << 6;
- DREG |= ((uint32)((a[0x31] & v) != 0)) << 7;
+ DREG |= ((uint32_t)((a[0x00] & v) != 0)) << 0;
+ DREG |= ((uint32_t)((a[0x01] & v) != 0)) << 1;
+ DREG |= ((uint32_t)((a[0x10] & v) != 0)) << 2;
+ DREG |= ((uint32_t)((a[0x11] & v) != 0)) << 3;
+ DREG |= ((uint32_t)((a[0x20] & v) != 0)) << 4;
+ DREG |= ((uint32_t)((a[0x21] & v) != 0)) << 5;
+ DREG |= ((uint32_t)((a[0x30] & v) != 0)) << 6;
+ DREG |= ((uint32_t)((a[0x31] & v) != 0)) << 7;
GSU.vZero = DREG;
TESTR14;
}
@@ -876,9 +876,9 @@ static void fx_rpix_obj()
/* 4d - swap - swap upper and lower byte of a register */
static void fx_swap()
{
- uint8 c = (uint8)SREG;
- uint8 d = (uint8)(SREG >> 8);
- uint32 v = (((uint32)c) << 8) | ((uint32)d);
+ uint8_t c = (uint8_t)SREG;
+ uint8_t d = (uint8_t)(SREG >> 8);
+ uint32_t v = (((uint32_t)c) << 8) | ((uint32_t)d);
R15++;
DREG = v;
GSU.vSign = v;
@@ -890,7 +890,7 @@ static void fx_swap()
/* 4e - color - copy source register to color register */
static void fx_color()
{
- uint8 c = (uint8)SREG;
+ uint8_t c = (uint8_t)SREG;
if (GSU.vPlotOptionReg & 0x04)
c = (c & 0xf0) | (c >> 4);
if (GSU.vPlotOptionReg & 0x08)
@@ -925,7 +925,7 @@ static void fx_cmode()
/* 4f - not - perform exclusive exor with 1 on all bits */
static void fx_not()
{
- uint32 v = ~SREG;
+ uint32_t v = ~SREG;
R15++;
DREG = v;
GSU.vSign = v;
@@ -936,7 +936,7 @@ static void fx_not()
/* 50-5f - add rn - add, register + register */
#define FX_ADD(reg) \
-int32 s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]); \
+int32_t s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]); \
GSU.vCarry = s >= 0x10000; \
GSU.vOverflow = ~(SREG ^ GSU.avReg[reg]) & (GSU.avReg[reg] ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1011,7 +1011,7 @@ static void fx_add_r15()
/* 50-5f(ALT1) - adc rn - add with carry, register + register */
#define FX_ADC(reg) \
-int32 s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]) + SEX16(GSU.vCarry); \
+int32_t s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]) + SEX16(GSU.vCarry); \
GSU.vCarry = s >= 0x10000; \
GSU.vOverflow = ~(SREG ^ GSU.avReg[reg]) & (GSU.avReg[reg] ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1086,7 +1086,7 @@ static void fx_adc_r15()
/* 50-5f(ALT2) - add #n - add, register + immediate */
#define FX_ADD_I(imm) \
-int32 s = SUSEX16(SREG) + imm; \
+int32_t s = SUSEX16(SREG) + imm; \
GSU.vCarry = s >= 0x10000; \
GSU.vOverflow = ~(SREG ^ imm) & (imm ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1161,7 +1161,7 @@ static void fx_add_i15()
/* 50-5f(ALT3) - adc #n - add with carry, register + immediate */
#define FX_ADC_I(imm) \
-int32 s = SUSEX16(SREG) + imm + SUSEX16(GSU.vCarry); \
+int32_t s = SUSEX16(SREG) + imm + SUSEX16(GSU.vCarry); \
GSU.vCarry = s >= 0x10000; \
GSU.vOverflow = ~(SREG ^ imm) & (imm ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1236,7 +1236,7 @@ static void fx_adc_i15()
/* 60-6f - sub rn - subtract, register - register */
#define FX_SUB(reg) \
-int32 s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]); \
+int32_t s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]); \
GSU.vCarry = s >= 0; \
GSU.vOverflow = (SREG ^ GSU.avReg[reg]) & (SREG ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1311,7 +1311,7 @@ static void fx_sub_r15()
/* 60-6f(ALT1) - sbc rn - subtract with carry, register - register */
#define FX_SBC(reg) \
-int32 s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]) - (SUSEX16(GSU.vCarry^1)); \
+int32_t s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]) - (SUSEX16(GSU.vCarry^1)); \
GSU.vCarry = s >= 0; \
GSU.vOverflow = (SREG ^ GSU.avReg[reg]) & (SREG ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1386,7 +1386,7 @@ static void fx_sbc_r15()
/* 60-6f(ALT2) - sub #n - subtract, register - immediate */
#define FX_SUB_I(imm) \
-int32 s = SUSEX16(SREG) - imm; \
+int32_t s = SUSEX16(SREG) - imm; \
GSU.vCarry = s >= 0; \
GSU.vOverflow = (SREG ^ imm) & (SREG ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1461,7 +1461,7 @@ static void fx_sub_i15()
/* 60-6f(ALT3) - cmp rn - compare, register, register */
#define FX_CMP(reg) \
-int32 s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]); \
+int32_t s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]); \
GSU.vCarry = s >= 0; \
GSU.vOverflow = (SREG ^ GSU.avReg[reg]) & (SREG ^ s) & 0x8000; \
GSU.vSign = s; \
@@ -1536,7 +1536,7 @@ static void fx_cmp_r15()
/* 70 - merge - R7 as upper byte, R8 as lower byte (used for texture-mapping) */
static void fx_merge()
{
- uint32 v = (R7 & 0xff00) | ((R8 & 0xff00) >> 8);
+ uint32_t v = (R7 & 0xff00) | ((R8 & 0xff00) >> 8);
R15++;
DREG = v;
GSU.vOverflow = (v & 0xc0c0) << 16;
@@ -1549,7 +1549,7 @@ static void fx_merge()
/* 71-7f - and rn - reister & register */
#define FX_AND(reg) \
-uint32 v = SREG & GSU.avReg[reg]; \
+uint32_t v = SREG & GSU.avReg[reg]; \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1618,7 +1618,7 @@ static void fx_and_r15()
/* 71-7f(ALT1) - bic rn - reister & ~register */
#define FX_BIC(reg) \
-uint32 v = SREG & ~GSU.avReg[reg]; \
+uint32_t v = SREG & ~GSU.avReg[reg]; \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1687,7 +1687,7 @@ static void fx_bic_r15()
/* 71-7f(ALT2) - and #n - reister & immediate */
#define FX_AND_I(imm) \
-uint32 v = SREG & imm; \
+uint32_t v = SREG & imm; \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1756,7 +1756,7 @@ static void fx_and_i15()
/* 71-7f(ALT3) - bic #n - reister & ~immediate */
#define FX_BIC_I(imm) \
-uint32 v = SREG & ~imm; \
+uint32_t v = SREG & ~imm; \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1825,7 +1825,7 @@ static void fx_bic_i15()
/* 80-8f - mult rn - 8 bit to 16 bit signed multiply, register * register */
#define FX_MULT(reg) \
-uint32 v = (uint32)(SEX8(SREG) * SEX8(GSU.avReg[reg])); \
+uint32_t v = (uint32_t)(SEX8(SREG) * SEX8(GSU.avReg[reg])); \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1898,7 +1898,7 @@ static void fx_mult_r15()
/* 80-8f(ALT1) - umult rn - 8 bit to 16 bit unsigned multiply, register * register */
#define FX_UMULT(reg) \
-uint32 v = USEX8(SREG) * USEX8(GSU.avReg[reg]); \
+uint32_t v = USEX8(SREG) * USEX8(GSU.avReg[reg]); \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -1971,7 +1971,7 @@ static void fx_umult_r15()
/* 80-8f(ALT2) - mult #n - 8 bit to 16 bit signed multiply, register * immediate */
#define FX_MULT_I(imm) \
-uint32 v = (uint32) (SEX8(SREG) * ((int32)imm)); \
+uint32_t v = (uint32_t) (SEX8(SREG) * ((int32_t)imm)); \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -2044,7 +2044,7 @@ static void fx_mult_i15()
/* 80-8f(ALT3) - umult #n - 8 bit to 16 bit unsigned multiply, register * immediate */
#define FX_UMULT_I(imm) \
-uint32 v = USEX8(SREG) * ((uint32)imm); \
+uint32_t v = USEX8(SREG) * ((uint32_t)imm); \
R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
@@ -2118,8 +2118,8 @@ static void fx_umult_i15()
/* 90 - sbk - store word to last accessed RAM address */
static void fx_sbk()
{
- RAM(GSU.vLastRamAdr) = (uint8)SREG;
- RAM(GSU.vLastRamAdr ^ 1) = (uint8)(SREG >> 8);
+ RAM(GSU.vLastRamAdr) = (uint8_t)SREG;
+ RAM(GSU.vLastRamAdr ^ 1) = (uint8_t)(SREG >> 8);
CLRFLAGS;
R15++;
}
@@ -2146,7 +2146,7 @@ static void fx_link_i4()
/* 95 - sex - sign extend 8 bit to 16 bit */
static void fx_sex()
{
- uint32 v = (uint32)SEX8(SREG);
+ uint32_t v = (uint32_t)SEX8(SREG);
R15++;
DREG = v;
GSU.vSign = v;
@@ -2158,9 +2158,9 @@ static void fx_sex()
/* 96 - asr - aritmetric shift right by one */
static void fx_asr()
{
- uint32 v;
+ uint32_t v;
GSU.vCarry = SREG & 1;
- v = (uint32)(SEX16(SREG) >> 1);
+ v = (uint32_t)(SEX16(SREG) >> 1);
R15++;
DREG = v;
GSU.vSign = v;
@@ -2172,13 +2172,13 @@ static void fx_asr()
/* 96(ALT1) - div2 - aritmetric shift right by one */
static void fx_div2()
{
- uint32 v;
- int32 s = SEX16(SREG);
+ uint32_t v;
+ int32_t s = SEX16(SREG);
GSU.vCarry = s & 1;
if (s == -1)
v = 0;
else
- v = (uint32)(s >> 1);
+ v = (uint32_t)(s >> 1);
R15++;
DREG = v;
GSU.vSign = v;
@@ -2190,7 +2190,7 @@ static void fx_div2()
/* 97 - ror - rotate right by one */
static void fx_ror()
{
- uint32 v = (USEX16(SREG) >> 1) | (GSU.vCarry << 15);
+ uint32_t v = (USEX16(SREG) >> 1) | (GSU.vCarry << 15);
GSU.vCarry = SREG & 1;
R15++;
DREG = v;
@@ -2234,7 +2234,7 @@ static void fx_jmp_r13()
GSU.vPrgBankReg = GSU.avReg[reg] & 0x7f; \
GSU.pvPrgBank = GSU.apvRomBank[GSU.vPrgBankReg]; \
R15 = SREG; \
-GSU.bCacheActive = FALSE; fx_cache(); R15--;
+GSU.bCacheActive = false; fx_cache(); R15--;
static void fx_ljmp_r8()
{
FX_LJMP(8);
@@ -2263,7 +2263,7 @@ static void fx_ljmp_r13()
/* 9e - lob - set upper byte to zero (keep low byte) */
static void fx_lob()
{
- uint32 v = USEX8(SREG);
+ uint32_t v = USEX8(SREG);
R15++;
DREG = v;
GSU.vSign = v << 8;
@@ -2275,8 +2275,8 @@ static void fx_lob()
/* 9f - fmult - 16 bit to 32 bit signed multiplication, upper 16 bits only */
static void fx_fmult()
{
- uint32 v;
- uint32 c = (uint32)(SEX16(SREG) * SEX16(R6));
+ uint32_t v;
+ uint32_t c = (uint32_t)(SEX16(SREG) * SEX16(R6));
v = c >> 16;
R15++;
DREG = v;
@@ -2290,8 +2290,8 @@ static void fx_fmult()
/* 9f(ALT1) - lmult - 16 bit to 32 bit signed multiplication */
static void fx_lmult()
{
- uint32 v;
- uint32 c = (uint32)(SEX16(SREG) * SEX16(R6));
+ uint32_t v;
+ uint32_t c = (uint32_t)(SEX16(SREG) * SEX16(R6));
R4 = c;
v = c >> 16;
R15++;
@@ -2306,7 +2306,7 @@ static void fx_lmult()
/* a0-af - ibt rn,#pp - immediate byte transfer */
#define FX_IBT(reg) \
-uint8 v = PIPE; R15++; \
+uint8_t v = PIPE; R15++; \
FETCHPIPE; R15++; \
GSU.avReg[reg] = SEX8(v); \
CLRFLAGS;
@@ -2378,10 +2378,10 @@ static void fx_ibt_r15()
/* a0-af(ALT1) - lms rn,(yy) - load word from RAM (short address) */
#define FX_LMS(reg) \
-GSU.vLastRamAdr = ((uint32)PIPE) << 1; \
+GSU.vLastRamAdr = ((uint32_t)PIPE) << 1; \
R15++; FETCHPIPE; R15++; \
-GSU.avReg[reg] = (uint32)RAM(GSU.vLastRamAdr); \
-GSU.avReg[reg] |= ((uint32)RAM(GSU.vLastRamAdr+1))<<8; \
+GSU.avReg[reg] = (uint32_t)RAM(GSU.vLastRamAdr); \
+GSU.avReg[reg] |= ((uint32_t)RAM(GSU.vLastRamAdr+1))<<8; \
CLRFLAGS;
static void fx_lms_r0()
{
@@ -2452,11 +2452,11 @@ static void fx_lms_r15()
/* a0-af(ALT2) - sms (yy),rn - store word in RAM (short address) */
/* If rn == r15, is the value of r15 before or after the extra byte is read? */
#define FX_SMS(reg) \
-uint32 v = GSU.avReg[reg]; \
-GSU.vLastRamAdr = ((uint32)PIPE) << 1; \
+uint32_t v = GSU.avReg[reg]; \
+GSU.vLastRamAdr = ((uint32_t)PIPE) << 1; \
R15++; FETCHPIPE; \
-RAM(GSU.vLastRamAdr) = (uint8)v; \
-RAM(GSU.vLastRamAdr+1) = (uint8)(v>>8); \
+RAM(GSU.vLastRamAdr) = (uint8_t)v; \
+RAM(GSU.vLastRamAdr+1) = (uint8_t)(v>>8); \
CLRFLAGS; R15++;
static void fx_sms_r0()
{
@@ -2526,7 +2526,7 @@ static void fx_sms_r15()
/* b0-bf - from rn - set source register */
/* b0-bf(B) - moves rn - move register to register, and set flags, (if B flag is set) */
#define FX_FROM(reg) \
-if(TF(B)) { uint32 v = GSU.avReg[reg]; R15++; DREG = v; \
+if(TF(B)) { uint32_t v = GSU.avReg[reg]; R15++; DREG = v; \
GSU.vOverflow = (v&0x80) << 16; GSU.vSign = v; GSU.vZero = v; TESTR14; CLRFLAGS; } \
else { GSU.pvSreg = &GSU.avReg[reg]; R15++; }
static void fx_from_r0()
@@ -2597,7 +2597,7 @@ static void fx_from_r15()
/* c0 - hib - move high-byte to low-byte */
static void fx_hib()
{
- uint32 v = USEX8(SREG >> 8);
+ uint32_t v = USEX8(SREG >> 8);
R15++;
DREG = v;
GSU.vSign = v << 8;
@@ -2608,7 +2608,7 @@ static void fx_hib()
/* c1-cf - or rn */
#define FX_OR(reg) \
-uint32 v = SREG | GSU.avReg[reg]; R15++; DREG = v; \
+uint32_t v = SREG | GSU.avReg[reg]; R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
TESTR14; \
@@ -2676,7 +2676,7 @@ static void fx_or_r15()
/* c1-cf(ALT1) - xor rn */
#define FX_XOR(reg) \
-uint32 v = SREG ^ GSU.avReg[reg]; R15++; DREG = v; \
+uint32_t v = SREG ^ GSU.avReg[reg]; R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
TESTR14; \
@@ -2744,7 +2744,7 @@ static void fx_xor_r15()
/* c1-cf(ALT2) - or #n */
#define FX_OR_I(imm) \
-uint32 v = SREG | imm; R15++; DREG = v; \
+uint32_t v = SREG | imm; R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
TESTR14; \
@@ -2812,7 +2812,7 @@ static void fx_or_i15()
/* c1-cf(ALT3) - xor #n */
#define FX_XOR_I(imm) \
-uint32 v = SREG ^ imm; R15++; DREG = v; \
+uint32_t v = SREG ^ imm; R15++; DREG = v; \
GSU.vSign = v; \
GSU.vZero = v; \
TESTR14; \
@@ -2950,10 +2950,10 @@ static void fx_inc_r14()
static void fx_getc()
{
#ifndef FX_DO_ROMBUFFER
- uint8 c;
+ uint8_t c;
c = ROM(R14);
#else
- uint8 c = GSU.vRomBuffer;
+ uint8_t c = GSU.vRomBuffer;
#endif
if (GSU.vPlotOptionReg & 0x04)
c = (c & 0xf0) | (c >> 4);
@@ -3057,11 +3057,11 @@ static void fx_dec_r14()
/* ef - getb - get byte from ROM at address R14 */
static void fx_getb()
{
- uint32 v;
+ uint32_t v;
#ifndef FX_DO_ROMBUFFER
- v = (uint32)ROM(R14);
+ v = (uint32_t)ROM(R14);
#else
- v = (uint32)GSU.vRomBuffer;
+ v = (uint32_t)GSU.vRomBuffer;
#endif
R15++;
DREG = v;
@@ -3072,12 +3072,12 @@ static void fx_getb()
/* ef(ALT1) - getbh - get high-byte from ROM at address R14 */
static void fx_getbh()
{
- uint32 v;
+ uint32_t v;
#ifndef FX_DO_ROMBUFFER
- uint32 c;
- c = (uint32)ROM(R14);
+ uint32_t c;
+ c = (uint32_t)ROM(R14);
#else
- uint32 c = USEX8(GSU.vRomBuffer);
+ uint32_t c = USEX8(GSU.vRomBuffer);
#endif
v = USEX8(SREG) | (c << 8);
R15++;
@@ -3089,12 +3089,12 @@ static void fx_getbh()
/* ef(ALT2) - getbl - get low-byte from ROM at address R14 */
static void fx_getbl()
{
- uint32 v;
+ uint32_t v;
#ifndef FX_DO_ROMBUFFER
- uint32 c;
- c = (uint32)ROM(R14);
+ uint32_t c;
+ c = (uint32_t)ROM(R14);
#else
- uint32 c = USEX8(GSU.vRomBuffer);
+ uint32_t c = USEX8(GSU.vRomBuffer);
#endif
v = (SREG & 0xff00) | c;
R15++;
@@ -3106,9 +3106,9 @@ static void fx_getbl()
/* ef(ALT3) - getbs - get sign extended byte from ROM at address R14 */
static void fx_getbs()
{
- uint32 v;
+ uint32_t v;
#ifndef FX_DO_ROMBUFFER
- int8 c;
+ int8_t c;
c = ROM(R14);
v = SEX8(c);
#else
@@ -3122,7 +3122,7 @@ static void fx_getbs()
/* f0-ff - iwt rn,#xx - immediate word transfer to register */
#define FX_IWT(reg) \
-uint32 v = PIPE; R15++; FETCHPIPE; R15++; \
+uint32_t v = PIPE; R15++; FETCHPIPE; R15++; \
v |= USEX8(PIPE) << 8; FETCHPIPE; R15++; \
GSU.avReg[reg] = v; \
CLRFLAGS;
@@ -3268,11 +3268,11 @@ static void fx_lm_r15()
/* f0-ff(ALT2) - sm (xx),rn - store word in RAM */
/* If rn == r15, is the value of r15 before or after the extra bytes are read? */
#define FX_SM(reg) \
-uint32 v = GSU.avReg[reg]; \
+uint32_t v = GSU.avReg[reg]; \
GSU.vLastRamAdr = PIPE; R15++; FETCHPIPE; R15++; \
GSU.vLastRamAdr |= USEX8(PIPE) << 8; FETCHPIPE; \
-RAM(GSU.vLastRamAdr) = (uint8)v; \
-RAM(GSU.vLastRamAdr^1) = (uint8)(v>>8); \
+RAM(GSU.vLastRamAdr) = (uint8_t)v; \
+RAM(GSU.vLastRamAdr^1) = (uint8_t)(v>>8); \
CLRFLAGS; R15++;
static void fx_sm_r0()
{
@@ -3341,7 +3341,7 @@ static void fx_sm_r15()
/*** GSU executions functions ***/
-static uint32 fx_run(uint32 nInstructions)
+static uint32_t fx_run(uint32_t nInstructions)
{
GSU.vCounter = nInstructions;
READR14;
@@ -3355,9 +3355,9 @@ static uint32 fx_run(uint32 nInstructions)
return (nInstructions - GSU.vInstCount);
}
-static uint32 fx_run_to_breakpoint(uint32 nInstructions)
+static uint32_t fx_run_to_breakpoint(uint32_t nInstructions)
{
- uint32 vCounter = 0;
+ uint32_t vCounter = 0;
while (TF(G) && vCounter < nInstructions)
{
vCounter++;
@@ -3376,9 +3376,9 @@ static uint32 fx_run_to_breakpoint(uint32 nInstructions)
return vCounter;
}
-static uint32 fx_step_over(uint32 nInstructions)
+static uint32_t fx_step_over(uint32_t nInstructions)
{
- uint32 vCounter = 0;
+ uint32_t vCounter = 0;
while (TF(G) && vCounter < nInstructions)
{
vCounter++;
@@ -3400,9 +3400,9 @@ static uint32 fx_step_over(uint32 nInstructions)
}
#ifdef FX_FUNCTION_TABLE
-uint32(*FX_FUNCTION_TABLE[])(uint32) =
+uint32_t(*FX_FUNCTION_TABLE[])(uint32_t) =
#else
-uint32(*fx_apfFunctionTable[])(uint32) =
+uint32_t(*fx_apfFunctionTable[])(uint32_t) =
#endif
{
&fx_run,
diff --git a/source/fxinst.h b/source/fxinst.h
index ff9a044..b795b0a 100644
--- a/source/fxinst.h
+++ b/source/fxinst.h
@@ -219,68 +219,68 @@
struct FxRegs_s
{
/* FxChip registers */
- uint32 avReg[16]; /* 16 Generic registers */
- uint32 vColorReg; /* Internal color register */
- uint32 vPlotOptionReg; /* Plot option register */
- uint32 vStatusReg; /* Status register */
- uint32 vPrgBankReg; /* Program bank index register */
- uint32 vRomBankReg; /* Rom bank index register */
- uint32 vRamBankReg; /* Ram bank index register */
- uint32 vCacheBaseReg; /* Cache base address register */
- uint32 vCacheFlags; /* Saying what parts of the cache was written to */
- uint32 vLastRamAdr; /* Last RAM address accessed */
- uint32* pvDreg; /* Pointer to current destination register */
- uint32* pvSreg; /* Pointer to current source register */
- uint8 vRomBuffer; /* Current byte read by R14 */
- uint8 vPipe; /* Instructionset pipe */
- uint32 vPipeAdr; /* The address of where the pipe was read from */
+ uint32_t avReg[16]; /* 16 Generic registers */
+ uint32_t vColorReg; /* Internal color register */
+ uint32_t vPlotOptionReg; /* Plot option register */
+ uint32_t vStatusReg; /* Status register */
+ uint32_t vPrgBankReg; /* Program bank index register */
+ uint32_t vRomBankReg; /* Rom bank index register */
+ uint32_t vRamBankReg; /* Ram bank index register */
+ uint32_t vCacheBaseReg; /* Cache base address register */
+ uint32_t vCacheFlags; /* Saying what parts of the cache was written to */
+ uint32_t vLastRamAdr; /* Last RAM address accessed */
+ uint32_t* pvDreg; /* Pointer to current destination register */
+ uint32_t* pvSreg; /* Pointer to current source register */
+ uint8_t vRomBuffer; /* Current byte read by R14 */
+ uint8_t vPipe; /* Instructionset pipe */
+ uint32_t vPipeAdr; /* The address of where the pipe was read from */
/* status register optimization stuff */
- uint32 vSign; /* v & 0x8000 */
- uint32 vZero; /* v == 0 */
- uint32 vCarry; /* a value of 1 or 0 */
- int32 vOverflow; /* (v >= 0x8000 || v < -0x8000) */
+ uint32_t vSign; /* v & 0x8000 */
+ uint32_t vZero; /* v == 0 */
+ uint32_t vCarry; /* a value of 1 or 0 */
+ int32_t vOverflow; /* (v >= 0x8000 || v < -0x8000) */
/* Other emulator variables */
- int32 vErrorCode;
- uint32 vIllegalAddress;
+ int32_t vErrorCode;
+ uint32_t vIllegalAddress;
- uint8 bBreakPoint;
- uint32 vBreakPoint;
- uint32 vStepPoint;
+ uint8_t bBreakPoint;
+ uint32_t vBreakPoint;
+ uint32_t vStepPoint;
- uint8* pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
- uint32 nRamBanks; /* Number of 64kb-banks in FxRam (Don't confuse it with SNES-Ram!!!) */
- uint8* pvRam; /* Pointer to FxRam */
- uint32 nRomBanks; /* Number of 32kb-banks in Cart-ROM */
- uint8* pvRom; /* Pointer to Cart-ROM */
+ uint8_t* pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
+ uint32_t nRamBanks; /* Number of 64kb-banks in FxRam (Don't confuse it with SNES-Ram!!!) */
+ uint8_t* pvRam; /* Pointer to FxRam */
+ uint32_t nRomBanks; /* Number of 32kb-banks in Cart-ROM */
+ uint8_t* pvRom; /* Pointer to Cart-ROM */
- uint32 vMode; /* Color depth/mode */
- uint32 vPrevMode; /* Previous depth */
- uint8* pvScreenBase;
- uint8* apvScreen[32]; /* Pointer to each of the 32 screen colums */
+ uint32_t vMode; /* Color depth/mode */
+ uint32_t vPrevMode; /* Previous depth */
+ uint8_t* pvScreenBase;
+ uint8_t* apvScreen[32]; /* Pointer to each of the 32 screen colums */
int x[32];
- uint32 vScreenHeight; /* 128, 160, 192 or 256 (could be overriden by cmode) */
- uint32 vScreenRealHeight; /* 128, 160, 192 or 256 */
- uint32 vPrevScreenHeight;
- uint32 vScreenSize;
+ uint32_t vScreenHeight; /* 128, 160, 192 or 256 (could be overriden by cmode) */
+ uint32_t vScreenRealHeight; /* 128, 160, 192 or 256 */
+ uint32_t vPrevScreenHeight;
+ uint32_t vScreenSize;
void (*pfPlot)();
void (*pfRpix)();
- uint8* pvRamBank; /* Pointer to current RAM-bank */
- uint8* pvRomBank; /* Pointer to current ROM-bank */
- uint8* pvPrgBank; /* Pointer to current program ROM-bank */
+ uint8_t* pvRamBank; /* Pointer to current RAM-bank */
+ uint8_t* pvRomBank; /* Pointer to current ROM-bank */
+ uint8_t* pvPrgBank; /* Pointer to current program ROM-bank */
- uint8* apvRamBank[FX_RAM_BANKS];/* Ram bank table (max 256kb) */
- uint8* apvRomBank[256]; /* Rom bank table */
+ uint8_t* apvRamBank[FX_RAM_BANKS];/* Ram bank table (max 256kb) */
+ uint8_t* apvRomBank[256]; /* Rom bank table */
- uint8 bCacheActive;
- uint8* pvCache; /* Pointer to the GSU cache */
- uint8 avCacheBackup[512]; /* Backup of ROM when the cache has replaced it */
- uint32 vCounter;
- uint32 vInstCount;
- uint32 vSCBRDirty; /* if SCBR is written, our cached screen pointers need updating */
+ uint8_t bCacheActive;
+ uint8_t* pvCache; /* Pointer to the GSU cache */
+ uint8_t avCacheBackup[512]; /* Backup of ROM when the cache has replaced it */
+ uint32_t vCounter;
+ uint32_t vInstCount;
+ uint32_t vSCBRDirty; /* if SCBR is written, our cached screen pointers need updating */
};
#define FxRegs_s_null { \
@@ -350,14 +350,14 @@ struct FxRegs_s
#define ALT3 (TF(ALT1)&&TF(ALT2))
/* Sign extend from 8/16 bit to 32 bit */
-#define SEX16(a) ((int32)((int16)(a)))
-#define SEX8(a) ((int32)((int8)(a)))
+#define SEX16(a) ((int32_t)((int16_t)(a)))
+#define SEX8(a) ((int32_t)((int8_t)(a)))
/* Unsign extend from 8/16 bit to 32 bit */
-#define USEX16(a) ((uint32)((uint16)(a)))
-#define USEX8(a) ((uint32)((uint8)(a)))
+#define USEX16(a) ((uint32_t)((uint16_t)(a)))
+#define USEX8(a) ((uint32_t)((uint8_t)(a)))
-#define SUSEX16(a) ((int32)((uint16)(a)))
+#define SUSEX16(a) ((int32_t)((uint16_t)(a)))
/* Set/Clr Sign and Zero flag */
#define TSZ(num) TS(S, (num & 0x8000)); TS(Z, (!USEX16(num)) )
@@ -443,27 +443,27 @@ struct FxRegs_s
#define CLSR USEX8(GSU.pvRegisters[GSU_CLSR])
/* Execute instruction from the pipe, and fetch next byte to the pipe */
-#define FX_STEP { uint32 vOpcode = (uint32)PIPE; FETCHPIPE; \
+#define FX_STEP { uint32_t vOpcode = (uint32_t)PIPE; FETCHPIPE; \
(*fx_ppfOpcodeTable[ (GSU.vStatusReg & 0x300) | vOpcode ])(); } \
#define FX_FUNCTION_RUN 0
#define FX_FUNCTION_RUN_TO_BREAKPOINT 1
#define FX_FUNCTION_STEP_OVER 2
-extern uint32(**fx_ppfFunctionTable)(uint32);
+extern uint32_t(**fx_ppfFunctionTable)(uint32_t);
extern void (**fx_ppfPlotTable)();
extern void (**fx_ppfOpcodeTable)();
-extern uint32(*fx_apfFunctionTable[])(uint32);
+extern uint32_t(*fx_apfFunctionTable[])(uint32_t);
extern void (*fx_apfOpcodeTable[])();
extern void (*fx_apfPlotTable[])();
-extern uint32(*fx_a_apfFunctionTable[])(uint32);
+extern uint32_t(*fx_a_apfFunctionTable[])(uint32_t);
extern void (*fx_a_apfOpcodeTable[])();
extern void (*fx_a_apfPlotTable[])();
-extern uint32(*fx_r_apfFunctionTable[])(uint32);
+extern uint32_t(*fx_r_apfFunctionTable[])(uint32_t);
extern void (*fx_r_apfOpcodeTable[])();
extern void (*fx_r_apfPlotTable[])();
-extern uint32(*fx_ar_apfFunctionTable[])(uint32);
+extern uint32_t(*fx_ar_apfFunctionTable[])(uint32_t);
extern void (*fx_ar_apfOpcodeTable[])();
extern void (*fx_ar_apfPlotTable[])();
diff --git a/source/getset.h b/source/getset.h
index 3d5c529..51cea44 100644
--- a/source/getset.h
+++ b/source/getset.h
@@ -98,18 +98,18 @@
#include "obc1.h"
#include "seta.h"
-extern uint8 OpenBus;
+extern uint8_t OpenBus;
-INLINE uint8 S9xGetByte(uint32 Address)
+INLINE uint8_t S9xGetByte(uint32_t Address)
{
int block;
- uint8* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
+ uint8_t* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
MEMMAP_MASK];
if (!CPU.InDMA)
CPU.Cycles += Memory.MemorySpeed [block];
- if (GetAddress >= (uint8*) MAP_LAST)
+ if (GetAddress >= (uint8_t*) MAP_LAST)
{
#ifdef CPU_SHUTDOWN
if (Memory.BlockIsRAM [block])
@@ -183,7 +183,7 @@ INLINE uint8 S9xGetByte(uint32 Address)
}
}
-INLINE uint16 S9xGetWord(uint32 Address)
+INLINE uint16_t S9xGetWord(uint32_t Address)
{
if ((Address & 0x0fff) == 0x0fff)
{
@@ -191,21 +191,21 @@ INLINE uint16 S9xGetWord(uint32 Address)
return (OpenBus | (S9xGetByte(Address + 1) << 8));
}
int block;
- uint8* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
+ uint8_t* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
MEMMAP_MASK];
if (!CPU.InDMA)
CPU.Cycles += (Memory.MemorySpeed [block] << 1);
- if (GetAddress >= (uint8*) MAP_LAST)
+ if (GetAddress >= (uint8_t*) MAP_LAST)
{
#ifdef CPU_SHUTDOWN
if (Memory.BlockIsRAM [block])
CPU.WaitAddress = CPU.PCAtOpcodeStart;
#endif
#ifdef FAST_LSB_WORD_ACCESS
- return (*(uint16*)(GetAddress + (Address & 0xffff)));
+ return (*(uint16_t*)(GetAddress + (Address & 0xffff)));
#else
return (*(GetAddress + (Address & 0xffff)) |
(*(GetAddress + (Address & 0xffff) + 1) << 8));
@@ -240,7 +240,7 @@ INLINE uint16 S9xGetWord(uint32 Address)
((*(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | ((
Address + 1) & 0x7FFF)) &Memory.SRAMMask))) << 8);
- //return (*(uint16*)(Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask));// |
+ //return (*(uint16_t*)(Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask));// |
// (*(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) << 8));
case MAP_RONLY_SRAM:
@@ -256,7 +256,7 @@ INLINE uint16 S9xGetWord(uint32 Address)
case MAP_BWRAM:
#ifdef FAST_LSB_WORD_ACCESS
- return (*(uint16*)(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)));
+ return (*(uint16_t*)(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)));
#else
return (*(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) |
(*(Memory.BWRAM + (((Address + 1) & 0x7fff) - 0x6000)) << 8));
@@ -296,20 +296,20 @@ INLINE uint16 S9xGetWord(uint32 Address)
}
}
-INLINE void S9xSetByte(uint8 Byte, uint32 Address)
+INLINE void S9xSetByte(uint8_t Byte, uint32_t Address)
{
#if defined(CPU_SHUTDOWN)
CPU.WaitAddress = NULL;
#endif
int block;
- uint8* SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) &
+ uint8_t* SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) &
MEMMAP_MASK)];
if (!CPU.InDMA)
CPU.Cycles += Memory.MemorySpeed [block];
- if (SetAddress >= (uint8*) MAP_LAST)
+ if (SetAddress >= (uint8_t*) MAP_LAST)
{
#ifdef CPU_SHUTDOWN
SetAddress += Address & 0xffff;
@@ -349,7 +349,7 @@ INLINE void S9xSetByte(uint8 Byte, uint32 Address)
*(Memory.SRAM + ((((Address & 0xFF0000) >> 1) | (Address & 0x7FFF))&
Memory.SRAMMask)) = Byte;
// *(Memory.SRAM + (Address & Memory.SRAMMask)) = Byte;
- CPU.SRAMModified = TRUE;
+ CPU.SRAMModified = true;
}
return;
@@ -358,13 +358,13 @@ INLINE void S9xSetByte(uint8 Byte, uint32 Address)
{
*(Memory.SRAM + (((Address & 0x7fff) - 0x6000 +
((Address & 0xf0000) >> 3)) & Memory.SRAMMask)) = Byte;
- CPU.SRAMModified = TRUE;
+ CPU.SRAMModified = true;
}
return;
case MAP_BWRAM:
*(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) = Byte;
- CPU.SRAMModified = TRUE;
+ CPU.SRAMModified = true;
return;
case MAP_DEBUG:
@@ -379,7 +379,7 @@ INLINE void S9xSetByte(uint8 Byte, uint32 Address)
return;
case MAP_SPC7110_DRAM:
- s7r.bank50[(Address & 0xffff)] = (uint8) Byte;
+ s7r.bank50[(Address & 0xffff)] = (uint8_t) Byte;
break;
case MAP_OBC_RAM:
@@ -405,7 +405,7 @@ INLINE void S9xSetByte(uint8 Byte, uint32 Address)
}
}
-INLINE void S9xSetWord(uint16 Word, uint32 Address)
+INLINE void S9xSetWord(uint16_t Word, uint32_t Address)
{
if ((Address & 0x0FFF) == 0x0FFF)
{
@@ -418,14 +418,14 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
CPU.WaitAddress = NULL;
#endif
int block;
- uint8* SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) &
+ uint8_t* SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) &
MEMMAP_MASK)];
if (!CPU.InDMA)
CPU.Cycles += Memory.MemorySpeed [block] << 1;
- if (SetAddress >= (uint8*) MAP_LAST)
+ if (SetAddress >= (uint8_t*) MAP_LAST)
{
#ifdef CPU_SHUTDOWN
SetAddress += Address & 0xffff;
@@ -436,16 +436,16 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
SA1.WaitCounter = 0;
}
#ifdef FAST_LSB_WORD_ACCESS
- *(uint16*) SetAddress = Word;
+ *(uint16_t*) SetAddress = Word;
#else
- *SetAddress = (uint8) Word;
+ *SetAddress = (uint8_t) Word;
*(SetAddress + 1) = Word >> 8;
#endif
#else
#ifdef FAST_LSB_WORD_ACCESS
- *(uint16*)(SetAddress + (Address & 0xffff)) = Word;
+ *(uint16_t*)(SetAddress + (Address & 0xffff)) = Word;
#else
- *(SetAddress + (Address & 0xffff)) = (uint8) Word;
+ *(SetAddress + (Address & 0xffff)) = (uint8_t) Word;
*(SetAddress + ((Address + 1) & 0xffff)) = Word >> 8;
#endif
#endif
@@ -455,12 +455,12 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
switch ((intptr_t) SetAddress)
{
case MAP_PPU:
- S9xSetPPU((uint8) Word, Address & 0xffff);
+ S9xSetPPU((uint8_t) Word, Address & 0xffff);
S9xSetPPU(Word >> 8, (Address & 0xffff) + 1);
return;
case MAP_CPU:
- S9xSetCPU((uint8) Word, (Address & 0xffff));
+ S9xSetCPU((uint8_t) Word, (Address & 0xffff));
S9xSetCPU(Word >> 8, (Address & 0xffff) + 1);
return;
@@ -468,7 +468,7 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
#ifdef DSP_DUMMY_LOOPS
printf("DSP Word: %04X to %06X\n", Word, Address);
#endif
- S9xSetDSP((uint8) Word, (Address & 0xffff));
+ S9xSetDSP((uint8_t) Word, (Address & 0xffff));
S9xSetDSP(Word >> 8, (Address & 0xffff) + 1);
return;
@@ -478,13 +478,13 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
/* BJ: no FAST_LSB_WORD_ACCESS here, since if Memory.SRAMMask=0x7ff
* then the high byte doesn't follow the low byte. */
*(Memory.SRAM + ((((Address & 0xFF0000) >> 1) | (Address & 0x7FFF))&
- Memory.SRAMMask)) = (uint8) Word;
+ Memory.SRAMMask)) = (uint8_t) Word;
*(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | ((
Address + 1) & 0x7FFF))& Memory.SRAMMask)) = Word >> 8;
- // *(Memory.SRAM + (Address & Memory.SRAMMask)) = (uint8) Word;
+ // *(Memory.SRAM + (Address & Memory.SRAMMask)) = (uint8_t) Word;
// *(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) = Word >> 8;
- CPU.SRAMModified = TRUE;
+ CPU.SRAMModified = true;
}
return;
@@ -495,54 +495,54 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
* then the high byte doesn't follow the low byte. */
*(Memory.SRAM +
(((((Address & 0x7fff) - 0x6000) +
- ((Address & 0xf0000) >> 3)) & Memory.SRAMMask))) = (uint8) Word;
+ ((Address & 0xf0000) >> 3)) & Memory.SRAMMask))) = (uint8_t) Word;
*(Memory.SRAM +
((((((Address + 1) & 0x7fff) - 0x6000) +
- (((Address + 1) & 0xf0000) >> 3)) & Memory.SRAMMask))) = (uint8)(Word >> 8);
- CPU.SRAMModified = TRUE;
+ (((Address + 1) & 0xf0000) >> 3)) & Memory.SRAMMask))) = (uint8_t)(Word >> 8);
+ CPU.SRAMModified = true;
}
return;
case MAP_BWRAM:
#ifdef FAST_LSB_WORD_ACCESS
- *(uint16*)(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) = Word;
+ *(uint16_t*)(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) = Word;
#else
- *(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) = (uint8) Word;
- *(Memory.BWRAM + (((Address + 1) & 0x7fff) - 0x6000)) = (uint8)(Word >> 8);
+ *(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)) = (uint8_t) Word;
+ *(Memory.BWRAM + (((Address + 1) & 0x7fff) - 0x6000)) = (uint8_t)(Word >> 8);
#endif
- CPU.SRAMModified = TRUE;
+ CPU.SRAMModified = true;
return;
case MAP_DEBUG:
case MAP_SPC7110_DRAM:
- s7r.bank50[(Address & 0xffff)] = (uint8) Word;
- s7r.bank50[((Address + 1) & 0xffff)] = (uint8) Word;
+ s7r.bank50[(Address & 0xffff)] = (uint8_t) Word;
+ s7r.bank50[((Address + 1) & 0xffff)] = (uint8_t) Word;
break;
case MAP_SA1RAM:
- *(Memory.SRAM + (Address & 0xffff)) = (uint8) Word;
- *(Memory.SRAM + ((Address + 1) & 0xffff)) = (uint8)(Word >> 8);
+ *(Memory.SRAM + (Address & 0xffff)) = (uint8_t) Word;
+ *(Memory.SRAM + ((Address + 1) & 0xffff)) = (uint8_t)(Word >> 8);
SA1.Executing = !SA1.Waiting;
break;
case MAP_C4:
S9xSetC4(Word & 0xff, Address & 0xffff);
- S9xSetC4((uint8)(Word >> 8), (Address + 1) & 0xffff);
+ S9xSetC4((uint8_t)(Word >> 8), (Address + 1) & 0xffff);
return;
case MAP_OBC_RAM:
SetOBC1(Word & 0xff, Address & 0xFFFF);
- SetOBC1((uint8)(Word >> 8), (Address + 1) & 0xffff);
+ SetOBC1((uint8_t)(Word >> 8), (Address + 1) & 0xffff);
return;
case MAP_SETA_DSP:
S9xSetSetaDSP(Word & 0xff, Address);
- S9xSetSetaDSP((uint8)(Word >> 8), (Address + 1));
+ S9xSetSetaDSP((uint8_t)(Word >> 8), (Address + 1));
return;
case MAP_SETA_RISC:
S9xSetST018(Word & 0xff, Address);
- S9xSetST018((uint8)(Word >> 8), (Address + 1));
+ S9xSetST018((uint8_t)(Word >> 8), (Address + 1));
return;
default:
@@ -557,10 +557,10 @@ INLINE void S9xSetWord(uint16 Word, uint32 Address)
}
}
-INLINE uint8* GetBasePointer(uint32 Address)
+INLINE uint8_t* GetBasePointer(uint32_t Address)
{
- uint8* GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (GetAddress >= (uint8*) MAP_LAST)
+ uint8_t* GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
+ if (GetAddress >= (uint8_t*) MAP_LAST)
return (GetAddress);
if (Settings.SPC7110 && ((Address & 0x7FFFFF) == 0x4800))
return s7r.bank50;
@@ -609,10 +609,10 @@ INLINE uint8* GetBasePointer(uint32 Address)
}
}
-INLINE uint8* S9xGetMemPointer(uint32 Address)
+INLINE uint8_t* S9xGetMemPointer(uint32_t Address)
{
- uint8* GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (GetAddress >= (uint8*) MAP_LAST)
+ uint8_t* GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
+ if (GetAddress >= (uint8_t*) MAP_LAST)
return (GetAddress + (Address & 0xffff));
if (Settings.SPC7110 && ((Address & 0x7FFFFF) == 0x4800))
@@ -654,16 +654,16 @@ INLINE uint8* S9xGetMemPointer(uint32 Address)
}
}
-INLINE void S9xSetPCBase(uint32 Address)
+INLINE void S9xSetPCBase(uint32_t Address)
{
int block;
- uint8* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
+ uint8_t* GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) &
MEMMAP_MASK];
CPU.MemSpeed = Memory.MemorySpeed [block];
CPU.MemSpeedx2 = CPU.MemSpeed << 1;
- if (GetAddress >= (uint8*) MAP_LAST)
+ if (GetAddress >= (uint8_t*) MAP_LAST)
{
CPU.PCBase = GetAddress;
CPU.PC = GetAddress + (Address & 0xffff);
diff --git a/source/gfx.c b/source/gfx.c
index 5e8d350..9ca3dc5 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -105,12 +105,12 @@ void ComputeClipWindows();
static void S9xDisplayFrameRate();
static void S9xDisplayString(const char* string);
-extern uint8 BitShifts[8][4];
-extern uint8 TileShifts[8][4];
-extern uint8 PaletteShifts[8][4];
-extern uint8 PaletteMasks[8][4];
-extern uint8 Depths[8][4];
-extern uint8 BGSizes [2];
+extern uint8_t BitShifts[8][4];
+extern uint8_t TileShifts[8][4];
+extern uint8_t PaletteShifts[8][4];
+extern uint8_t PaletteMasks[8][4];
+extern uint8_t Depths[8][4];
+extern uint8_t BGSizes [2];
extern NormalTileRenderer DrawTilePtr;
extern ClippedTileRenderer DrawClippedTilePtr;
@@ -123,7 +123,7 @@ extern SBG BG;
extern struct SLineData LineData[240];
extern struct SLineMatrixData LineMatrixData [240];
-extern uint8 Mode7Depths [2];
+extern uint8_t Mode7Depths [2];
#define CLIP_10_BIT_SIGNED(a) \
((a) & ((1 << 10) - 1)) + (((((a) & (1 << 13)) ^ (1 << 13)) - (1 << 13)) >> 3)
@@ -150,7 +150,7 @@ extern uint8 Mode7Depths [2];
(GFX.r2131 & 0x3f)
#define FIX_INTERLACE(SCREEN, DO_DEPTH, DEPTH) \
- uint32 y; \
+ uint32_t y; \
if (IPPU.DoubleHeightPixels && ((PPU.BGMode != 5 && PPU.BGMode != 6) || !IPPU.Interlace)) \
for (y = GFX.StartY; y <= GFX.EndY; y++) \
{ \
@@ -169,104 +169,104 @@ extern uint8 Mode7Depths [2];
#define BLACK BUILD_PIXEL(0,0,0)
-void DrawTile16(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTile16(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTile16HalfWidth(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTile16HalfWidth(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTile16x2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTile16x2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTile16x2x2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTile16x2x2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawLargePixel16(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-void DrawLargePixel16HalfWidth(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16Add(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16Add1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16Add1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16FixedAdd1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16FixedAdd1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16Sub(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16Sub(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16Sub1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16Sub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawTile16FixedSub1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-
-void DrawClippedTile16FixedSub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-
-void DrawLargePixel16Add(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-
-void DrawLargePixel16Add1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-
-void DrawLargePixel16Sub(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-
-void DrawLargePixel16Sub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-
-bool8 S9xInitGFX()
+void DrawTile16(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+void DrawClippedTile16(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+void DrawTile16HalfWidth(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+void DrawClippedTile16HalfWidth(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+void DrawTile16x2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+void DrawClippedTile16x2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+void DrawTile16x2x2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+void DrawClippedTile16x2x2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+void DrawLargePixel16(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+void DrawLargePixel16HalfWidth(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16Add(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16Add(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16Add1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16Add1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16FixedAdd1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16FixedAdd1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16Sub(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16Sub(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16Sub1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16Sub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawTile16FixedSub1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount);
+
+void DrawClippedTile16FixedSub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawLargePixel16Add(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawLargePixel16Add1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawLargePixel16Sub(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+
+void DrawLargePixel16Sub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
+
+bool S9xInitGFX()
{
- register uint32 PixelOdd = 1;
- register uint32 PixelEven = 2;
+ register uint32_t PixelOdd = 1;
+ register uint32_t PixelEven = 2;
- uint8 bitshift;
+ uint8_t bitshift;
for (bitshift = 0; bitshift < 4; bitshift++)
{
register int i;
for (i = 0; i < 16; i++)
{
- register uint32 h = 0;
- register uint32 l = 0;
+ register uint32_t h = 0;
+ register uint32_t l = 0;
#if defined(LSB_FIRST)
if (i & 8)
@@ -360,9 +360,9 @@ bool8 S9xInitGFX()
//GFX.InfoString = NULL;
PPU.BG_Forced = 0;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
- IPPU.DirectColourMapsNeedRebuild = TRUE;
+ IPPU.DirectColourMapsNeedRebuild = true;
GFX.PixSize = 1;
DrawTilePtr = DrawTile16;
DrawClippedTilePtr = DrawClippedTile16;
@@ -381,11 +381,11 @@ bool8 S9xInitGFX()
GFX.PPLx2 = GFX.Pitch;
S9xFixColourBrightness();
- if (!(GFX.X2 = (uint16*) malloc(sizeof(uint16) * 0x10000)))
- return (FALSE);
+ if (!(GFX.X2 = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000)))
+ return (false);
- if (!(GFX.ZERO_OR_X2 = (uint16*) malloc(sizeof(uint16) * 0x10000)) ||
- !(GFX.ZERO = (uint16*) malloc(sizeof(uint16) * 0x10000)))
+ if (!(GFX.ZERO_OR_X2 = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000)) ||
+ !(GFX.ZERO = (uint16_t*) malloc(sizeof(uint16_t) * 0x10000)))
{
if (GFX.ZERO_OR_X2)
{
@@ -397,25 +397,25 @@ bool8 S9xInitGFX()
free((char*) GFX.X2);
GFX.X2 = NULL;
}
- return (FALSE);
+ return (false);
}
- uint32 r, g, b;
+ uint32_t r, g, b;
// Build a lookup table that multiplies a packed RGB value by 2 with
// saturation.
for (r = 0; r <= MAX_RED; r++)
{
- uint32 r2 = r << 1;
+ uint32_t r2 = r << 1;
if (r2 > MAX_RED)
r2 = MAX_RED;
for (g = 0; g <= MAX_GREEN; g++)
{
- uint32 g2 = g << 1;
+ uint32_t g2 = g << 1;
if (g2 > MAX_GREEN)
g2 = MAX_GREEN;
for (b = 0; b <= MAX_BLUE; b++)
{
- uint32 b2 = b << 1;
+ uint32_t b2 = b << 1;
if (b2 > MAX_BLUE)
b2 = MAX_BLUE;
GFX.X2 [BUILD_PIXEL2(r, g, b)] = BUILD_PIXEL2(r2, g2, b2);
@@ -423,8 +423,8 @@ bool8 S9xInitGFX()
}
}
}
- memset(GFX.ZERO, 0, 0x10000 * sizeof(uint16));
- memset(GFX.ZERO_OR_X2, 0, 0x10000 * sizeof(uint16));
+ 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.
@@ -432,7 +432,7 @@ bool8 S9xInitGFX()
#if defined(OLD_COLOUR_BLENDING)
for (r = 0; r <= MAX_RED; r++)
{
- uint32 r2 = r;
+ uint32_t r2 = r;
if ((r2 & 0x10) == 0)
r2 = 0;
else
@@ -440,7 +440,7 @@ bool8 S9xInitGFX()
for (g = 0; g <= MAX_GREEN; g++)
{
- uint32 g2 = g;
+ uint32_t g2 = g;
if ((g2 & GREEN_HI_BIT) == 0)
g2 = 0;
else
@@ -448,7 +448,7 @@ bool8 S9xInitGFX()
for (b = 0; b <= MAX_BLUE; b++)
{
- uint32 b2 = b;
+ uint32_t b2 = b;
if ((b2 & 0x10) == 0)
b2 = 0;
else
@@ -463,7 +463,7 @@ bool8 S9xInitGFX()
#else
for (r = 0; r <= MAX_RED; r++)
{
- uint32 r2 = r;
+ uint32_t r2 = r;
if ((r2 & 0x10) == 0)
r2 = 0;
else
@@ -473,7 +473,7 @@ bool8 S9xInitGFX()
r2 = 1;
for (g = 0; g <= MAX_GREEN; g++)
{
- uint32 g2 = g;
+ uint32_t g2 = g;
if ((g2 & GREEN_HI_BIT) == 0)
g2 = 0;
else
@@ -483,7 +483,7 @@ bool8 S9xInitGFX()
g2 = 1;
for (b = 0; b <= MAX_BLUE; b++)
{
- uint32 b2 = b;
+ uint32_t b2 = b;
if ((b2 & 0x10) == 0)
b2 = 0;
else
@@ -503,7 +503,7 @@ bool8 S9xInitGFX()
// then the value is zero, otherwise its just the value.
for (r = 0; r <= MAX_RED; r++)
{
- uint32 r2 = r;
+ uint32_t r2 = r;
if ((r2 & 0x10) == 0)
r2 = 0;
else
@@ -511,14 +511,14 @@ bool8 S9xInitGFX()
for (g = 0; g <= MAX_GREEN; g++)
{
- uint32 g2 = g;
+ uint32_t g2 = g;
if ((g2 & GREEN_HI_BIT) == 0)
g2 = 0;
else
g2 &= ~GREEN_HI_BIT;
for (b = 0; b <= MAX_BLUE; b++)
{
- uint32 b2 = b;
+ uint32_t b2 = b;
if ((b2 & 0x10) == 0)
b2 = 0;
else
@@ -529,7 +529,7 @@ bool8 S9xInitGFX()
}
}
}
- return (TRUE);
+ return (true);
}
void S9xDeinitGFX(void)
@@ -554,7 +554,7 @@ void S9xDeinitGFX(void)
void S9xBuildDirectColourMaps()
{
- uint32 p, c;
+ uint32_t p, c;
for (p = 0; p < 8; p++)
{
for (c = 0; c < 256; c++)
@@ -565,7 +565,7 @@ void S9xBuildDirectColourMaps()
((c & 0xc0) >> 3) | (p & 4));
}
}
- IPPU.DirectColourMapsNeedRebuild = FALSE;
+ IPPU.DirectColourMapsNeedRebuild = false;
}
void S9xStartScreenRefresh()
@@ -577,7 +577,7 @@ void S9xStartScreenRefresh()
{
if (!S9xInitUpdate())
{
- IPPU.RenderThisFrame = FALSE;
+ IPPU.RenderThisFrame = false;
return;
}
@@ -592,13 +592,13 @@ void S9xStartScreenRefresh()
|| IPPU.Interlace))
{
IPPU.RenderedScreenWidth = 512;
- IPPU.DoubleWidthPixels = TRUE;
- IPPU.HalfWidthPixels = FALSE;
+ IPPU.DoubleWidthPixels = true;
+ IPPU.HalfWidthPixels = false;
if (IPPU.Interlace)
{
IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1;
- IPPU.DoubleHeightPixels = TRUE;
+ IPPU.DoubleHeightPixels = true;
GFX.Pitch2 = GFX.RealPitch;
GFX.Pitch = GFX.RealPitch * 2;
GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
@@ -607,7 +607,7 @@ void S9xStartScreenRefresh()
{
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
GFX.Pitch2 = GFX.Pitch = GFX.RealPitch;
- IPPU.DoubleHeightPixels = FALSE;
+ IPPU.DoubleHeightPixels = false;
GFX.PPL = GFX.Pitch >> 1;
GFX.PPLx2 = GFX.PPL << 1;
}
@@ -616,18 +616,18 @@ void S9xStartScreenRefresh()
|| IPPU.Interlace))
{
IPPU.RenderedScreenWidth = 256;
- IPPU.DoubleWidthPixels = FALSE;
+ IPPU.DoubleWidthPixels = false;
// Secret of Mana displays menus with mode 5.
// Make them readable.
- IPPU.HalfWidthPixels = TRUE;
+ IPPU.HalfWidthPixels = true;
}
else
{
IPPU.RenderedScreenWidth = 256;
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
- IPPU.DoubleWidthPixels = FALSE;
- IPPU.HalfWidthPixels = FALSE;
- IPPU.DoubleHeightPixels = FALSE;
+ IPPU.DoubleWidthPixels = false;
+ IPPU.HalfWidthPixels = false;
+ IPPU.DoubleHeightPixels = false;
{
GFX.Pitch2 = GFX.Pitch = GFX.RealPitch;
GFX.PPL = GFX.PPLx2 >> 1;
@@ -636,7 +636,7 @@ void S9xStartScreenRefresh()
}
}
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
GFX.DepthDelta = GFX.SubZBuffer - GFX.ZBuffer;
GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
}
@@ -649,7 +649,7 @@ void S9xStartScreenRefresh()
}
}
-void RenderLine(uint8 C)
+void RenderLine(uint8_t C)
{
if (IPPU.RenderThisFrame)
{
@@ -697,14 +697,14 @@ void RenderLine(uint8 C)
void S9xEndScreenRefresh()
{
- IPPU.HDMAStarted = FALSE;
+ IPPU.HDMAStarted = false;
if (IPPU.RenderThisFrame)
{
FLUSH_REDRAW();
if (IPPU.ColorsChanged)
{
- uint32 saved = PPU.CGDATA[0];
- IPPU.ColorsChanged = FALSE;
+ uint32_t saved = PPU.CGDATA[0];
+ IPPU.ColorsChanged = false;
PPU.CGDATA[0] = saved;
}
@@ -719,7 +719,7 @@ void S9xEndScreenRefresh()
if (CPU.SRAMModified)
{
S9xAutoSaveSRAM();
- CPU.SRAMModified = FALSE;
+ CPU.SRAMModified = false;
}
}
@@ -730,7 +730,7 @@ void S9xSetInfoString(const char* string)
GFX.InfoStringTimeout = 120;
}
-inline void SelectTileRenderer(bool8 normal)
+inline void SelectTileRenderer(bool normal)
{
if (normal)
{
@@ -855,7 +855,7 @@ void S9xSetupOBJ()
* easy, the last is somewhat more ... interesting. So we split them up. */
int Height;
- uint8 S;
+ uint8_t S;
#ifdef MK_DEBUG_RTO
if (Settings.BGLayering) fprintf(stderr, "Priority rotation=%d, OAMAddr=%d -> ",
@@ -868,7 +868,7 @@ void S9xSetupOBJ()
PPU.FirstSprite);
#endif
/* normal case */
- uint8 LineOBJ[SNES_HEIGHT_EXTENDED];
+ uint8_t LineOBJ[SNES_HEIGHT_EXTENDED];
memset(LineOBJ, 0, sizeof(LineOBJ));
int i;
for (i = 0; i < SNES_HEIGHT_EXTENDED; i++)
@@ -876,7 +876,7 @@ void S9xSetupOBJ()
GFX.OBJLines[i].RTOFlags = 0;
GFX.OBJLines[i].Tiles = 34;
}
- uint8 FirstSprite = PPU.FirstSprite;
+ uint8_t FirstSprite = PPU.FirstSprite;
S = FirstSprite;
do
{
@@ -900,8 +900,8 @@ void S9xSetupOBJ()
GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3;
else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
- uint8 line, Y;
- for (line = 0, Y = (uint8)(PPU.OBJ[S].VPos & 0xff); line < Height; Y++, line++)
+ uint8_t line, Y;
+ for (line = 0, Y = (uint8_t)(PPU.OBJ[S].VPos & 0xff); line < Height; Y++, line++)
{
if (Y >= SNES_HEIGHT_EXTENDED) continue;
if (LineOBJ[Y] >= 32)
@@ -947,14 +947,14 @@ void S9xSetupOBJ()
#endif
/* First, find out which sprites are on which lines */
- uint8 OBJOnLine[SNES_HEIGHT_EXTENDED][128];
+ uint8_t OBJOnLine[SNES_HEIGHT_EXTENDED][128];
// memset(OBJOnLine, 0, sizeof(OBJOnLine));
/* Hold on here, that's a lot of bytes to initialise at once!
* So we only initialise them per line, as needed. [Neb]
* Bonus: We can quickly avoid looping if a line has no OBJs.
*/
- bool8 AnyOBJOnLine[SNES_HEIGHT_EXTENDED];
- memset(AnyOBJOnLine, FALSE, sizeof(AnyOBJOnLine)); // better
+ bool AnyOBJOnLine[SNES_HEIGHT_EXTENDED];
+ memset(AnyOBJOnLine, false, sizeof(AnyOBJOnLine)); // better
for (S = 0; S < 128; S++)
{
@@ -978,14 +978,14 @@ void S9xSetupOBJ()
GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3;
else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
- uint8 line, Y;
- for (line = 0, Y = (uint8)(PPU.OBJ[S].VPos & 0xff); line < Height; Y++, line++)
+ uint8_t line, Y;
+ for (line = 0, Y = (uint8_t)(PPU.OBJ[S].VPos & 0xff); line < Height; Y++, line++)
{
if (Y >= SNES_HEIGHT_EXTENDED) continue;
if (!AnyOBJOnLine[Y])
{
memset(OBJOnLine[Y], 0, 128);
- AnyOBJOnLine[Y] = TRUE;
+ AnyOBJOnLine[Y] = true;
}
if (PPU.OBJ[S].VFlip)
{
@@ -1009,7 +1009,7 @@ void S9xSetupOBJ()
j = 0;
if (AnyOBJOnLine[Y])
{
- uint8 FirstSprite = (PPU.FirstSprite + Y) & 0x7F;
+ uint8_t FirstSprite = (PPU.FirstSprite + Y) & 0x7F;
S = FirstSprite;
do
{
@@ -1054,10 +1054,10 @@ void S9xSetupOBJ()
}
#endif
- IPPU.OBJChanged = FALSE;
+ IPPU.OBJChanged = false;
}
-static void DrawOBJS(bool8 OnMain, uint8 D)
+static void DrawOBJS(bool OnMain, uint8_t D)
{
#ifdef ACCUMULATE_JOYPAD
/*
@@ -1082,29 +1082,29 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
BG.Buffer = IPPU.TileCache [TILE_4BIT];
BG.Buffered = IPPU.TileCached [TILE_4BIT];
BG.NameSelect = PPU.OBJNameSelect;
- BG.DirectColourMode = FALSE;
+ BG.DirectColourMode = false;
GFX.PixSize = 1;
struct
{
- uint16 Pos;
- bool8 Value;
+ uint16_t Pos;
+ bool Value;
} Windows[7];
int clipcount = GFX.pCurrentClip->Count [4];
if (!clipcount)
{
Windows[0].Pos = 0;
- Windows[0].Value = TRUE;
+ Windows[0].Value = true;
Windows[1].Pos = 256;
- Windows[1].Value = FALSE;
+ Windows[1].Value = false;
Windows[2].Pos = 1000;
- Windows[2].Value = FALSE;
+ Windows[2].Value = false;
}
else
{
Windows[0].Pos = 1000;
- Windows[0].Value = FALSE;
+ Windows[0].Value = false;
int clip, i;
for (clip = 0, i = 1; clip < clipcount; clip++)
{
@@ -1113,13 +1113,13 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
int j;
for (j = 0; j < i && Windows[j].Pos < GFX.pCurrentClip->Left[clip][4]; j++);
if (j < i && Windows[j].Pos == GFX.pCurrentClip->Left[clip][4])
- Windows[j].Value = TRUE;
+ Windows[j].Value = true;
else
{
// 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];
- Windows[j].Value = TRUE;
+ Windows[j].Value = true;
i++;
}
for (j = 0; j < i && Windows[j].Pos < GFX.pCurrentClip->Right[clip][4]; j++);
@@ -1128,7 +1128,7 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
// 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];
- Windows[j].Value = FALSE;
+ Windows[j].Value = false;
i++;
}
}
@@ -1151,7 +1151,7 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
// SelectTileRenderer is necessary. So let's hack it to false here
// to stop SelectTileRenderer from being called when it causes
// problems.
- OnMain = FALSE;
+ OnMain = false;
GFX.PixSize = 2;
if (IPPU.DoubleHeightPixels)
{
@@ -1178,19 +1178,19 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
// SelectTileRenderer is necessary. So let's hack it to false here
// to stop SelectTileRenderer from being called when it causes
// problems.
- OnMain = FALSE;
+ OnMain = false;
}
DrawTilePtr = DrawTile16;
DrawClippedTilePtr = DrawClippedTile16;
}
GFX.Z1 = D + 2;
- uint32 Y, Offset;
+ uint32_t Y, Offset;
for (Y = GFX.StartY, Offset = Y * GFX.PPL; Y <= GFX.EndY;
Y++, Offset += GFX.PPL)
{
#ifdef MK_DEBUG_RTO
- bool8 Flag = 0;
+ bool Flag = 0;
#endif
int I = 0;
#ifdef MK_DISABLE_TIME_OVER
@@ -1249,7 +1249,7 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
GFX.Z2 = (PPU.OBJ[S].Priority + 1) * 4 + D;
- bool8 WinStat = TRUE;
+ bool WinStat = true;
int WinIdx = 0, NextPos = -1000;
int X = PPU.OBJ[S].HPos;
if (X == -256) X = 256;
@@ -1270,7 +1270,7 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
if (X >= NextPos)
{
for (; WinIdx < 7 && Windows[WinIdx].Pos <= X; WinIdx++);
- if (WinIdx == 0) WinStat = FALSE;
+ if (WinIdx == 0) WinStat = false;
else WinStat = Windows[WinIdx - 1].Value;
NextPos = (WinIdx < 7) ? Windows[WinIdx].Pos : 1000;
}
@@ -1288,7 +1288,7 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
TileLine, 1);
x = NextPos;
for (; WinIdx < 7 && Windows[WinIdx].Pos <= x; WinIdx++);
- if (WinIdx == 0) WinStat = FALSE;
+ if (WinIdx == 0) WinStat = false;
else WinStat = Windows[WinIdx - 1].Value;
NextPos = (WinIdx < 7) ? Windows[WinIdx].Pos : 1000;
if (NextPos > X + 8) NextPos = X + 8;
@@ -1306,30 +1306,30 @@ static void DrawOBJS(bool8 OnMain, uint8 D)
#endif
}
-static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
+static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{
CHECK_SOUND();
- uint32 Tile;
- uint16* SC0;
- uint16* SC1;
- uint16* SC2;
- uint16* SC3;
- uint8 depths [2] = {Z1, Z2};
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint8_t depths [2] = {Z1, Z2};
if (BGMode == 0)
BG.StartPalette = bg << 5;
else
BG.StartPalette = 0;
- SC0 = (uint16*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
+ SC0 = (uint16_t*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
if (PPU.BG[bg].SCSize & 1)
SC1 = SC0 + 1024;
else
SC1 = SC0;
- if (((uint8*)SC1 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC1 - Memory.VRAM) >= 0x10000)
SC1 -= 0x08000;
@@ -1338,7 +1338,7 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
SC2 = SC0;
- if (((uint8*)SC2 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC2 - Memory.VRAM) >= 0x10000)
SC2 -= 0x08000;
@@ -1347,12 +1347,12 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
SC3 = SC2;
- if (((uint8*)SC3 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
- uint32 Lines;
- uint32 OffsetMask;
- uint32 OffsetShift;
+ uint32_t Lines;
+ uint32_t OffsetMask;
+ uint32_t OffsetShift;
if (BG.TileSize == 16)
{
@@ -1367,29 +1367,29 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
int m5 = (BGMode == 5 || BGMode == 6) ? 1 : 0;
- uint32 Y;
+ uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y += Lines)
{
- uint32 VOffset = LineData [Y].BG[bg].VOffset;
- uint32 HOffset = LineData [Y].BG[bg].HOffset;
- uint32 MosaicOffset = Y % PPU.Mosaic;
+ uint32_t VOffset = LineData [Y].BG[bg].VOffset;
+ uint32_t HOffset = LineData [Y].BG[bg].HOffset;
+ uint32_t MosaicOffset = Y % PPU.Mosaic;
for (Lines = 1; Lines < PPU.Mosaic - MosaicOffset; Lines++)
if ((VOffset != LineData [Y + Lines].BG[bg].VOffset) ||
(HOffset != LineData [Y + Lines].BG[bg].HOffset))
break;
- uint32 MosaicLine = VOffset + Y - MosaicOffset;
+ uint32_t MosaicLine = VOffset + Y - MosaicOffset;
if (Y + Lines > GFX.EndY)
Lines = GFX.EndY + 1 - Y;
- uint32 VirtAlign = (MosaicLine & 7) << 3;
+ uint32_t VirtAlign = (MosaicLine & 7) << 3;
- uint16* b1;
- uint16* b2;
+ uint16_t* b1;
+ uint16_t* b2;
- uint32 ScreenLine = MosaicLine >> OffsetShift;
- uint32 Rem16 = MosaicLine & 15;
+ uint32_t ScreenLine = MosaicLine >> OffsetShift;
+ uint32_t Rem16 = MosaicLine & 15;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -1398,21 +1398,21 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
b1 += (ScreenLine & 0x1f) << 5;
b2 += (ScreenLine & 0x1f) << 5;
- uint16* t;
- uint32 Left = 0;
- uint32 Right = 256 << m5;
+ uint16_t* t;
+ uint32_t Left = 0;
+ uint32_t Right = 256 << m5;
HOffset <<= m5;
- uint32 ClipCount = GFX.pCurrentClip->Count [bg];
- uint32 HPos = HOffset;
- uint32 PixWidth = (PPU.Mosaic << m5);
+ uint32_t ClipCount = GFX.pCurrentClip->Count [bg];
+ uint32_t HPos = HOffset;
+ uint32_t PixWidth = (PPU.Mosaic << m5);
if (!ClipCount)
ClipCount = 1;
- uint32 clip;
+ uint32_t clip;
for (clip = 0; clip < ClipCount; clip++)
{
if (GFX.pCurrentClip->Count [bg])
@@ -1420,17 +1420,17 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
Left = GFX.pCurrentClip->Left [clip][bg] << m5;
Right = GFX.pCurrentClip->Right [clip][bg] << m5;
- uint32 r = Left % (PPU.Mosaic << m5);
+ uint32_t r = Left % (PPU.Mosaic << m5);
HPos = HOffset + Left;
PixWidth = (PPU.Mosaic << m5) - r;
}
- uint32 s = Y * GFX.PPL + Left * GFX.PixSize;
- uint32 x;
+ uint32_t s = Y * GFX.PPL + Left * GFX.PixSize;
+ uint32_t x;
for (x = Left; x < Right; x += PixWidth,
s += (IPPU.HalfWidthPixels ? PixWidth >> 1 : PixWidth) * GFX.PixSize,
HPos += PixWidth, PixWidth = (PPU.Mosaic << m5))
{
- uint32 Quot = (HPos & OffsetMask) >> 3;
+ uint32_t Quot = (HPos & OffsetMask) >> 3;
if (x + PixWidth >= Right)
PixWidth = Right - x;
@@ -1537,26 +1537,26 @@ static void DrawBackgroundMosaic(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
}
}
-static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
+static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{
CHECK_SOUND();
- uint32 Tile;
- uint16* SC0;
- uint16* SC1;
- uint16* SC2;
- uint16* SC3;
- uint16* BPS0;
- uint16* BPS1;
- uint16* BPS2;
- uint16* BPS3;
- uint32 Width;
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint16_t* BPS0;
+ uint16_t* BPS1;
+ uint16_t* BPS2;
+ uint16_t* BPS3;
+ uint32_t Width;
int VOffsetOffset = BGMode == 4 ? 0 : 32;
- uint8 depths [2] = {Z1, Z2};
+ uint8_t depths [2] = {Z1, Z2};
BG.StartPalette = 0;
- BPS0 = (uint16*) &Memory.VRAM[PPU.BG[2].SCBase << 1];
+ BPS0 = (uint16_t*) &Memory.VRAM[PPU.BG[2].SCBase << 1];
if (PPU.BG[2].SCSize & 1)
BPS1 = BPS0 + 1024;
@@ -1573,14 +1573,14 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
BPS3 = BPS2;
- SC0 = (uint16*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
+ SC0 = (uint16_t*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
if (PPU.BG[bg].SCSize & 1)
SC1 = SC0 + 1024;
else
SC1 = SC0;
- if (((uint8*)SC1 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC1 - Memory.VRAM) >= 0x10000)
SC1 -= 0x08000;
@@ -1589,7 +1589,7 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
SC2 = SC0;
- if (((uint8*)SC2 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC2 - Memory.VRAM) >= 0x10000)
SC2 -= 0x08000;
@@ -1598,7 +1598,7 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
SC3 = SC2;
- if (((uint8*)SC3 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
@@ -1618,20 +1618,20 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
OffsetShift = 3;
}
- uint32 Y;
+ uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y++)
{
- uint32 VOff = LineData [Y].BG[2].VOffset - 1;
- // uint32 VOff = LineData [Y].BG[2].VOffset;
- uint32 HOff = LineData [Y].BG[2].HOffset;
+ uint32_t VOff = LineData [Y].BG[2].VOffset - 1;
+ // uint32_t VOff = LineData [Y].BG[2].VOffset;
+ uint32_t HOff = LineData [Y].BG[2].HOffset;
int VirtAlign;
int ScreenLine = VOff >> 3;
int t1;
int t2;
- uint16* s0;
- uint16* s1;
- uint16* s2;
+ uint16_t* s0;
+ uint16_t* s1;
+ uint16_t* s2;
if (ScreenLine & 0x20)
s1 = BPS2, s2 = BPS3;
@@ -1661,8 +1661,8 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
int clip;
for (clip = 0; clip < clipcount; clip++)
{
- uint32 Left;
- uint32 Right;
+ uint32_t Left;
+ uint32_t Right;
if (!GFX.pCurrentClip->Count [bg])
{
@@ -1678,26 +1678,26 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
continue;
}
- uint32 VOffset;
- uint32 HOffset;
+ uint32_t VOffset;
+ uint32_t HOffset;
//added:
- uint32 LineHOffset = LineData [Y].BG[bg].HOffset;
-
- uint32 Offset;
- uint32 HPos;
- uint32 Quot;
- uint32 Count;
- uint16* t;
- uint32 Quot2;
- uint32 VCellOffset;
- uint32 HCellOffset;
- uint16* b1;
- uint16* b2;
- uint32 TotalCount = 0;
- uint32 MaxCount = 8;
-
- uint32 s = Left * GFX.PixSize + Y * GFX.PPL;
- bool8 left_hand_edge = (Left == 0);
+ uint32_t LineHOffset = LineData [Y].BG[bg].HOffset;
+
+ uint32_t Offset;
+ uint32_t HPos;
+ uint32_t Quot;
+ uint32_t Count;
+ uint16_t* t;
+ uint32_t Quot2;
+ uint32_t VCellOffset;
+ uint32_t HCellOffset;
+ uint16_t* b1;
+ uint16_t* b2;
+ uint32_t TotalCount = 0;
+ uint32_t MaxCount = 8;
+
+ uint32_t s = Left * GFX.PixSize + Y * GFX.PPL;
+ bool left_hand_edge = (Left == 0);
Width = Right - Left;
if (Left & 7)
@@ -1718,7 +1718,7 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
HOffset = LineHOffset;
//End MK
- left_hand_edge = FALSE;
+ left_hand_edge = false;
}
else
@@ -1874,7 +1874,7 @@ static void DrawBackgroundOffset(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
}
}
-static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
+static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
{
CHECK_SOUND();
@@ -1884,18 +1884,18 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
GFX.PPL = GFX.PPLx2 >> 1;
}
GFX.PixSize = 1;
- uint8 depths [2] = {Z1, Z2};
+ uint8_t depths [2] = {Z1, Z2};
- uint32 Tile;
- uint16* SC0;
- uint16* SC1;
- uint16* SC2;
- uint16* SC3;
- uint32 Width;
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint32_t Width;
BG.StartPalette = 0;
- SC0 = (uint16*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
+ SC0 = (uint16_t*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
if ((PPU.BG[bg].SCSize & 1))
SC1 = SC0 + 1024;
@@ -1903,13 +1903,13 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
SC1 = SC0;
if ((SC1 - (unsigned short*)Memory.VRAM) > 0x10000)
- SC1 = (uint16*)&Memory.VRAM[(((uint8*)SC1) - Memory.VRAM) % 0x10000];
+ SC1 = (uint16_t*)&Memory.VRAM[(((uint8_t*)SC1) - Memory.VRAM) % 0x10000];
if ((PPU.BG[bg].SCSize & 2))
SC2 = SC1 + 1024;
else SC2 = SC0;
- if (((uint8*)SC2 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC2 - Memory.VRAM) >= 0x10000)
SC2 -= 0x08000;
@@ -1919,7 +1919,7 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
else
SC3 = SC2;
- if (((uint8*)SC3 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
@@ -1944,8 +1944,8 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
for (Y = IPPU.Interlace ? GFX.StartY << 1 : GFX.StartY; Y <= endy; Y += Lines)
{
int y = IPPU.Interlace ? (Y >> 1) : Y;
- uint32 VOffset = LineData [y].BG[bg].VOffset;
- uint32 HOffset = LineData [y].BG[bg].HOffset;
+ uint32_t VOffset = LineData [y].BG[bg].VOffset;
+ uint32_t HOffset = LineData [y].BG[bg].HOffset;
int VirtAlign = (Y + VOffset) & 7;
for (Lines = 1; Lines < 8 - VirtAlign; Lines++)
@@ -1971,8 +1971,8 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
t1 = 0;
t2 = 16;
}
- uint16* b1;
- uint16* b2;
+ uint16_t* b1;
+ uint16_t* b2;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -2006,14 +2006,14 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
continue;
}
- uint32 s = (IPPU.HalfWidthPixels ? Left >> 1 : Left) * GFX.PixSize + Y *
+ uint32_t s = (IPPU.HalfWidthPixels ? Left >> 1 : Left) * GFX.PixSize + Y *
GFX.PPL;
- uint32 HPos = (HOffset + Left * GFX.PixSize) & 0x3ff;
+ uint32_t HPos = (HOffset + Left * GFX.PixSize) & 0x3ff;
- uint32 Quot = HPos >> 3;
- uint32 Count = 0;
+ uint32_t Quot = HPos >> 3;
+ uint32_t Count = 0;
- uint16* t;
+ uint16_t* t;
if (Quot > 63)
t = b2 + ((Quot >> 1) & 0x1f);
else
@@ -2207,7 +2207,7 @@ static void DrawBackgroundMode5(uint32 bg, uint8 Z1, uint8 Z2)
}
-static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
+static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{
#ifdef ACCUMULATE_JOYPAD
/*
@@ -2249,7 +2249,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
// if (Settings.SupportHiRes)
// {
if (!Settings.SupportHiRes)
- SelectTileRenderer(TRUE /* normal */);
+ SelectTileRenderer(true /* normal */);
DrawBackgroundMode5(bg, Z1, Z2);
return;
// }
@@ -2257,19 +2257,19 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
}
CHECK_SOUND();
- uint32 Tile;
- uint16* SC0;
- uint16* SC1;
- uint16* SC2;
- uint16* SC3;
- uint32 Width;
- uint8 depths [2] = {Z1, Z2};
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint32_t Width;
+ uint8_t depths [2] = {Z1, Z2};
if (BGMode == 0)
BG.StartPalette = bg << 5;
else BG.StartPalette = 0;
- SC0 = (uint16*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
+ SC0 = (uint16_t*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
if (PPU.BG[bg].SCSize & 1)
SC1 = SC0 + 1024;
@@ -2277,14 +2277,14 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
SC1 = SC0;
if (SC1 >= (unsigned short*)(Memory.VRAM + 0x10000))
- SC1 = (uint16*)&Memory.VRAM[((uint8*)SC1 - &Memory.VRAM[0]) % 0x10000];
+ SC1 = (uint16_t*)&Memory.VRAM[((uint8_t*)SC1 - &Memory.VRAM[0]) % 0x10000];
if (PPU.BG[bg].SCSize & 2)
SC2 = SC1 + 1024;
else
SC2 = SC0;
- if (((uint8*)SC2 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC2 - Memory.VRAM) >= 0x10000)
SC2 -= 0x08000;
if (PPU.BG[bg].SCSize & 1)
@@ -2292,7 +2292,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
else
SC3 = SC2;
- if (((uint8*)SC3 - Memory.VRAM) >= 0x10000)
+ if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
@@ -2312,11 +2312,11 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
OffsetShift = 3;
}
- uint32 Y;
+ uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y += Lines)
{
- uint32 VOffset = LineData [Y].BG[bg].VOffset;
- uint32 HOffset = LineData [Y].BG[bg].HOffset;
+ uint32_t VOffset = LineData [Y].BG[bg].VOffset;
+ uint32_t HOffset = LineData [Y].BG[bg].HOffset;
int VirtAlign = (Y + VOffset) & 7;
for (Lines = 1; Lines < 8 - VirtAlign; Lines++)
@@ -2329,9 +2329,9 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
VirtAlign <<= 3;
- uint32 ScreenLine = (VOffset + Y) >> OffsetShift;
- uint32 t1;
- uint32 t2;
+ uint32_t ScreenLine = (VOffset + Y) >> OffsetShift;
+ uint32_t t1;
+ uint32_t t2;
if (((VOffset + Y) & 15) > 7)
{
t1 = 16;
@@ -2342,8 +2342,8 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
t1 = 0;
t2 = 16;
}
- uint16* b1;
- uint16* b2;
+ uint16_t* b1;
+ uint16_t* b2;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -2359,8 +2359,8 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
int clip;
for (clip = 0; clip < clipcount; clip++)
{
- uint32 Left;
- uint32 Right;
+ uint32_t Left;
+ uint32_t Right;
if (!GFX.pCurrentClip->Count [bg])
{
@@ -2376,13 +2376,13 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
continue;
}
- uint32 s = Left * GFX.PixSize + Y * GFX.PPL;
- uint32 HPos = (HOffset + Left) & OffsetMask;
+ uint32_t s = Left * GFX.PixSize + Y * GFX.PPL;
+ uint32_t HPos = (HOffset + Left) & OffsetMask;
- uint32 Quot = HPos >> 3;
- uint32 Count = 0;
+ uint32_t Quot = HPos >> 3;
+ uint32_t Count = 0;
- uint16* t;
+ uint16_t* t;
if (BG.TileSize == 8)
{
if (Quot > 31)
@@ -2402,7 +2402,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
// Left hand edge clipped tile
if (HPos & 7)
{
- uint32 Offset = (HPos & 7);
+ uint32_t Offset = (HPos & 7);
Count = 8 - Offset;
if (Count > Width)
Count = Width;
@@ -2580,10 +2580,10 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
}
#define RENDER_BACKGROUND_MODE7(TYPE,FUNC) \
- uint16 *ScreenColors = IPPU.ScreenColors; \
+ uint16_t *ScreenColors = IPPU.ScreenColors; \
CHECK_SOUND(); \
\
- uint8 *VRAM1 = Memory.VRAM + 1; \
+ uint8_t *VRAM1 = Memory.VRAM + 1; \
if (GFX.r2130 & 1) \
{ \
if (IPPU.DirectColourMapsNeedRebuild) \
@@ -2594,27 +2594,27 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
int aa, cc; \
int dir; \
int startx, endx; \
- uint32 Left = 0; \
- uint32 Right = 256; \
- uint32 ClipCount = GFX.pCurrentClip->Count [bg]; \
+ uint32_t Left = 0; \
+ uint32_t Right = 256; \
+ uint32_t ClipCount = GFX.pCurrentClip->Count [bg]; \
\
if (!ClipCount) \
ClipCount = 1; \
\
Screen += GFX.StartY * GFX.Pitch; \
- uint8 *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
+ uint8_t *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
struct SLineMatrixData *l = &LineMatrixData [GFX.StartY]; \
\
- uint32 Line; \
+ uint32_t Line; \
for (Line = GFX.StartY; Line <= GFX.EndY; Line++, Screen += GFX.Pitch, Depth += GFX.PPL, l++) \
{ \
int yy; \
\
- int32 HOffset = ((int32) LineData [Line].BG[0].HOffset << M7) >> M7; \
- int32 VOffset = ((int32) LineData [Line].BG[0].VOffset << M7) >> M7; \
+ int32_t HOffset = ((int32_t) LineData [Line].BG[0].HOffset << M7) >> M7; \
+ int32_t VOffset = ((int32_t) LineData [Line].BG[0].VOffset << M7) >> M7; \
\
- int32 CentreX = ((int32) l->CentreX << M7) >> M7; \
- int32 CentreY = ((int32) l->CentreY << M7) >> M7; \
+ int32_t CentreX = ((int32_t) l->CentreX << M7) >> M7; \
+ int32_t CentreY = ((int32_t) l->CentreY << M7) >> M7; \
\
if (PPU.Mode7VFlip) \
yy = 255 - (int) Line; \
@@ -2626,7 +2626,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
int BB = l->MatrixB * yy + (CentreX << 8); \
int DD = l->MatrixD * yy + (CentreY << 8); \
\
- uint32 clip; \
+ uint32_t clip; \
for (clip = 0; clip < ClipCount; clip++) \
{ \
if (GFX.pCurrentClip->Count [bg]) \
@@ -2637,7 +2637,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
continue; \
} \
TYPE *p = (TYPE *) Screen + Left; \
- uint8 *d = Depth + Left; \
+ uint8_t *d = Depth + Left; \
\
if (PPU.Mode7HFlip) \
{ \
@@ -2667,8 +2667,8 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
{ \
int X = ((AA + BB) >> 8) & 0x3ff; \
int Y = ((CC + DD) >> 8) & 0x3ff; \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2687,8 +2687,8 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
\
if (((X | Y) & ~0x3ff) == 0) \
{ \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2702,7 +2702,7 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
{ \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint32 b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint32_t b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2716,19 +2716,19 @@ static void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
} \
}
-static void DrawBGMode7Background(uint8* Screen, int bg)
+static void DrawBGMode7Background(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint8, (uint8)(b & GFX.Mode7Mask))
+ RENDER_BACKGROUND_MODE7(uint8_t, (uint8_t)(b & GFX.Mode7Mask))
}
-static void DrawBGMode7Background16(uint8* Screen, int bg)
+static void DrawBGMode7Background16(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint16, ScreenColors [b & GFX.Mode7Mask]);
+ RENDER_BACKGROUND_MODE7(uint16_t, ScreenColors [b & GFX.Mode7Mask]);
}
-static void DrawBGMode7Background16Add(uint8* Screen, int bg)
+static void DrawBGMode7Background16Add(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_ADD(ScreenColors [b & GFX.Mode7Mask],
p [GFX.Delta]) :
@@ -2737,9 +2737,9 @@ static void DrawBGMode7Background16Add(uint8* Screen, int bg)
ScreenColors [b & GFX.Mode7Mask]);
}
-static void DrawBGMode7Background16Add1_2(uint8* Screen, int bg)
+static void DrawBGMode7Background16Add1_2(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_ADD1_2(ScreenColors [b & GFX.Mode7Mask],
p [GFX.Delta]) :
@@ -2748,9 +2748,9 @@ static void DrawBGMode7Background16Add1_2(uint8* Screen, int bg)
ScreenColors [b & GFX.Mode7Mask]);
}
-static void DrawBGMode7Background16Sub(uint8* Screen, int bg)
+static void DrawBGMode7Background16Sub(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_SUB(ScreenColors [b & GFX.Mode7Mask],
p [GFX.Delta]) :
@@ -2759,9 +2759,9 @@ static void DrawBGMode7Background16Sub(uint8* Screen, int bg)
ScreenColors [b & GFX.Mode7Mask]);
}
-static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
+static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_SUB1_2(ScreenColors [b & GFX.Mode7Mask],
p [GFX.Delta]) :
@@ -2771,10 +2771,10 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
}
#define RENDER_BACKGROUND_MODE7_i(TYPE,FUNC,COLORFUNC) \
- uint16 *ScreenColors; \
+ uint16_t *ScreenColors; \
CHECK_SOUND(); \
\
- uint8 *VRAM1 = Memory.VRAM + 1; \
+ uint8_t *VRAM1 = Memory.VRAM + 1; \
if (GFX.r2130 & 1) \
{ \
if (IPPU.DirectColourMapsNeedRebuild) \
@@ -2787,24 +2787,24 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
int aa, cc; \
int dir; \
int startx, endx; \
- uint32 Left = 0; \
- uint32 Right = 256; \
- uint32 ClipCount = GFX.pCurrentClip->Count [bg]; \
+ uint32_t Left = 0; \
+ uint32_t Right = 256; \
+ uint32_t ClipCount = GFX.pCurrentClip->Count [bg]; \
\
if (!ClipCount) \
ClipCount = 1; \
\
Screen += GFX.StartY * GFX.Pitch; \
- uint8 *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
+ uint8_t *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
struct SLineMatrixData *l = &LineMatrixData [GFX.StartY]; \
- bool8 allowSimpleCase = FALSE; \
+ bool allowSimpleCase = false; \
if (!l->MatrixB && !l->MatrixC && (l->MatrixA == 0x0100) && (l->MatrixD == 0x0100) \
&& !LineMatrixData[GFX.EndY].MatrixB && !LineMatrixData[GFX.EndY].MatrixC \
&& (LineMatrixData[GFX.EndY].MatrixA == 0x0100) && (LineMatrixData[GFX.EndY].MatrixD == 0x0100) \
) \
- allowSimpleCase = TRUE; \
+ allowSimpleCase = true; \
\
- uint32 Line; \
+ uint32_t Line; \
for (Line = GFX.StartY; Line <= GFX.EndY; Line++, Screen += GFX.Pitch, Depth += GFX.PPL, l++) \
{ \
int yy; \
@@ -2822,7 +2822,7 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
\
\
yy += CLIP_10_BIT_SIGNED(VOffset - CentreY); \
- bool8 simpleCase = FALSE; \
+ bool simpleCase = false; \
int BB; \
int DD; \
/* Make a special case for the identity matrix, since it's a common case and */ \
@@ -2831,7 +2831,7 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
{ \
BB = CentreX << 8; \
DD = (yy + CentreY) << 8; \
- simpleCase = TRUE; \
+ simpleCase = true; \
} \
else \
{ \
@@ -2839,7 +2839,7 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
DD = l->MatrixD * yy + (CentreY << 8); \
} \
\
- uint32 clip; \
+ uint32_t clip; \
for (clip = 0; clip < ClipCount; clip++) \
{ \
if (GFX.pCurrentClip->Count [bg]) \
@@ -2850,7 +2850,7 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
continue; \
} \
TYPE *p = (TYPE *) Screen + Left; \
- uint8 *d = Depth + Left; \
+ uint8_t *d = Depth + Left; \
\
if (PPU.Mode7HFlip) \
{ \
@@ -2890,8 +2890,8 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
{ \
int X = ((AA + BB) >> 8) & 0x3ff; \
int Y = (DD >> 8) & 0x3ff; \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2912,8 +2912,8 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
\
if (((X | Y) & ~0x3ff) == 0) \
{ \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2926,8 +2926,8 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
{ \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2958,51 +2958,51 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
int x; \
for (x = startx; x != endx; x += dir, AA += aa, CC += cc, p++, d++) \
{ \
- uint32 xPos = AA + BB; \
- uint32 xPix = xPos >> 8; \
- uint32 yPos = CC + DD; \
- uint32 yPix = yPos >> 8; \
- uint32 X = xPix & 0x3ff; \
- uint32 Y = yPix & 0x3ff; \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint32_t xPos = AA + BB; \
+ uint32_t xPix = xPos >> 8; \
+ uint32_t yPos = CC + DD; \
+ uint32_t yPix = yPos >> 8; \
+ uint32_t X = xPix & 0x3ff; \
+ uint32_t Y = yPix & 0x3ff; \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
/* X10 and Y01 are the X and Y coordinates of the next source point over. */ \
- uint32 X10 = (xPix + dir) & 0x3ff; \
- uint32 Y01 = (yPix + (PPU.Mode7VFlip?-1:1)) & 0x3ff; \
- uint8 *TileData10 = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
- uint8 *TileData11 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
- uint8 *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 p1 = COLORFUNC; \
+ uint32_t X10 = (xPix + dir) & 0x3ff; \
+ uint32_t Y01 = (yPix + (PPU.Mode7VFlip?-1:1)) & 0x3ff; \
+ uint8_t *TileData10 = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
+ uint8_t *TileData11 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
+ uint8_t *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t p1 = COLORFUNC; \
p1 = (p1 & FIRST_THIRD_COLOR_MASK) | ((p1 & SECOND_COLOR_MASK) << 16); \
b = *(TileData10 + ((Y & 7) << 4) + ((X10 & 7) << 1)); \
- uint32 p2 = COLORFUNC; \
+ uint32_t p2 = COLORFUNC; \
p2 = (p2 & FIRST_THIRD_COLOR_MASK) | ((p2 & SECOND_COLOR_MASK) << 16); \
b = *(TileData11 + ((Y01 & 7) << 4) + ((X10 & 7) << 1)); \
- uint32 p4 = COLORFUNC; \
+ uint32_t p4 = COLORFUNC; \
p4 = (p4 & FIRST_THIRD_COLOR_MASK) | ((p4 & SECOND_COLOR_MASK) << 16); \
b = *(TileData01 + ((Y01 & 7) << 4) + ((X & 7) << 1)); \
- uint32 p3 = COLORFUNC; \
+ uint32_t p3 = COLORFUNC; \
p3 = (p3 & FIRST_THIRD_COLOR_MASK) | ((p3 & SECOND_COLOR_MASK) << 16); \
/* Xdel, Ydel: position (in 1/32nds) between the points */ \
- uint32 Xdel = (xPos >> 3) & 0x1F; \
- uint32 Ydel = (yPos >> 3) & 0x1F; \
- uint32 XY = (Xdel*Ydel) >> 5; \
- uint32 area1 = 0x20 + XY - Xdel - Ydel; \
- uint32 area2 = Xdel - XY; \
- uint32 area3 = Ydel - XY; \
- uint32 area4 = XY; \
+ uint32_t Xdel = (xPos >> 3) & 0x1F; \
+ uint32_t Ydel = (yPos >> 3) & 0x1F; \
+ uint32_t XY = (Xdel*Ydel) >> 5; \
+ uint32_t area1 = 0x20 + XY - Xdel - Ydel; \
+ uint32_t area2 = Xdel - XY; \
+ uint32_t area3 = Ydel - XY; \
+ uint32_t area4 = XY; \
if(PPU.Mode7HFlip){ \
- uint32 tmp=area1; area1=area2; area2=tmp; \
+ uint32_t tmp=area1; area1=area2; area2=tmp; \
tmp=area3; area3=area4; area4=tmp; \
} \
if(PPU.Mode7VFlip){ \
- uint32 tmp=area1; area1=area3; area3=tmp; \
+ uint32_t tmp=area1; area1=area3; area3=tmp; \
tmp=area2; area2=area4; area4=tmp; \
} \
- uint32 tempColor = ((area1 * p1) + \
+ uint32_t tempColor = ((area1 * p1) + \
(area2 * p2) + \
(area3 * p3) + \
(area4 * p4)) >> 5; \
@@ -3018,43 +3018,43 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
/* gives the usual huge pixels when the source image gets "close." */ \
{ \
/* Find the dimensions of the square in the source image whose corners will be examined. */ \
- uint32 aaDelX = aa >> 1; \
- uint32 ccDelX = cc >> 1; \
- uint32 bbDelY = l->MatrixB >> 1; \
- uint32 ddDelY = l->MatrixD >> 1; \
+ uint32_t aaDelX = aa >> 1; \
+ uint32_t ccDelX = cc >> 1; \
+ uint32_t bbDelY = l->MatrixB >> 1; \
+ uint32_t ddDelY = l->MatrixD >> 1; \
/* Offset the location within the source image so that the four sampled points */ \
/* center around where the single point would otherwise have been drawn. */ \
BB -= (bbDelY >> 1); \
DD -= (ddDelY >> 1); \
AA -= (aaDelX >> 1); \
CC -= (ccDelX >> 1); \
- uint32 BB10 = BB + aaDelX; \
- uint32 BB01 = BB + bbDelY; \
- uint32 BB11 = BB + aaDelX + bbDelY; \
- uint32 DD10 = DD + ccDelX; \
- uint32 DD01 = DD + ddDelY; \
- uint32 DD11 = DD + ccDelX + ddDelY; \
+ uint32_t BB10 = BB + aaDelX; \
+ uint32_t BB01 = BB + bbDelY; \
+ uint32_t BB11 = BB + aaDelX + bbDelY; \
+ uint32_t DD10 = DD + ccDelX; \
+ uint32_t DD01 = DD + ddDelY; \
+ uint32_t DD11 = DD + ccDelX + ddDelY; \
int x; \
for (x = startx; x != endx; x += dir, AA += aa, CC += cc, p++, d++) \
{ \
- uint32 X = ((AA + BB) >> 8) & 0x3ff; \
- uint32 Y = ((CC + DD) >> 8) & 0x3ff; \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint32_t X = ((AA + BB) >> 8) & 0x3ff; \
+ uint32_t Y = ((CC + DD) >> 8) & 0x3ff; \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
/* X, Y, X10, Y10, etc. are the coordinates of the four pixels within the */ \
/* source image that we're going to examine. */ \
- uint32 X10 = ((AA + BB10) >> 8) & 0x3ff; \
- uint32 Y10 = ((CC + DD10) >> 8) & 0x3ff; \
- uint32 X01 = ((AA + BB01) >> 8) & 0x3ff; \
- uint32 Y01 = ((CC + DD01) >> 8) & 0x3ff; \
- uint32 X11 = ((AA + BB11) >> 8) & 0x3ff; \
- uint32 Y11 = ((CC + DD11) >> 8) & 0x3ff; \
- uint8 *TileData10 = VRAM1 + (Memory.VRAM[((Y10 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
- uint8 *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X01 >> 2) & ~1)] << 7); \
- uint8 *TileData11 = VRAM1 + (Memory.VRAM[((Y11 & ~7) << 5) + ((X11 >> 2) & ~1)] << 7); \
+ uint32_t X10 = ((AA + BB10) >> 8) & 0x3ff; \
+ uint32_t Y10 = ((CC + DD10) >> 8) & 0x3ff; \
+ uint32_t X01 = ((AA + BB01) >> 8) & 0x3ff; \
+ uint32_t Y01 = ((CC + DD01) >> 8) & 0x3ff; \
+ uint32_t X11 = ((AA + BB11) >> 8) & 0x3ff; \
+ uint32_t Y11 = ((CC + DD11) >> 8) & 0x3ff; \
+ uint8_t *TileData10 = VRAM1 + (Memory.VRAM[((Y10 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
+ uint8_t *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X01 >> 2) & ~1)] << 7); \
+ uint8_t *TileData11 = VRAM1 + (Memory.VRAM[((Y11 & ~7) << 5) + ((X11 >> 2) & ~1)] << 7); \
TYPE p1 = COLORFUNC; \
b = *(TileData10 + ((Y10 & 7) << 4) + ((X10 & 7) << 1)); \
TYPE p2 = COLORFUNC; \
@@ -3074,47 +3074,47 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
int x; \
for (x = startx; x != endx; x += dir, AA += aa, CC += cc, p++, d++) \
{ \
- uint32 xPos = AA + BB; \
- uint32 xPix = xPos >> 8; \
- uint32 yPos = CC + DD; \
- uint32 yPix = yPos >> 8; \
- uint32 X = xPix; \
- uint32 Y = yPix; \
+ uint32_t xPos = AA + BB; \
+ uint32_t xPix = xPos >> 8; \
+ uint32_t yPos = CC + DD; \
+ uint32_t yPix = yPos >> 8; \
+ uint32_t X = xPix; \
+ uint32_t Y = yPix; \
\
\
if (((X | Y) & ~0x3ff) == 0) \
{ \
- uint8 *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
/* X10 and Y01 are the X and Y coordinates of the next source point over. */ \
- uint32 X10 = (xPix + dir) & 0x3ff; \
- uint32 Y01 = (yPix + dir) & 0x3ff; \
- uint8 *TileData10 = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
- uint8 *TileData11 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
- uint8 *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32 p1 = COLORFUNC; \
+ uint32_t X10 = (xPix + dir) & 0x3ff; \
+ uint32_t Y01 = (yPix + dir) & 0x3ff; \
+ uint8_t *TileData10 = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
+ uint8_t *TileData11 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X10 >> 2) & ~1)] << 7); \
+ uint8_t *TileData01 = VRAM1 + (Memory.VRAM[((Y01 & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ uint32_t p1 = COLORFUNC; \
p1 = (p1 & FIRST_THIRD_COLOR_MASK) | ((p1 & SECOND_COLOR_MASK) << 16); \
b = *(TileData10 + ((Y & 7) << 4) + ((X10 & 7) << 1)); \
- uint32 p2 = COLORFUNC; \
+ uint32_t p2 = COLORFUNC; \
p2 = (p2 & FIRST_THIRD_COLOR_MASK) | ((p2 & SECOND_COLOR_MASK) << 16); \
b = *(TileData11 + ((Y01 & 7) << 4) + ((X10 & 7) << 1)); \
- uint32 p4 = COLORFUNC; \
+ uint32_t p4 = COLORFUNC; \
p4 = (p4 & FIRST_THIRD_COLOR_MASK) | ((p4 & SECOND_COLOR_MASK) << 16); \
b = *(TileData01 + ((Y01 & 7) << 4) + ((X & 7) << 1)); \
- uint32 p3 = COLORFUNC; \
+ uint32_t p3 = COLORFUNC; \
p3 = (p3 & FIRST_THIRD_COLOR_MASK) | ((p3 & SECOND_COLOR_MASK) << 16); \
/* Xdel, Ydel: position (in 1/32nds) between the points */ \
- uint32 Xdel = (xPos >> 3) & 0x1F; \
- uint32 Ydel = (yPos >> 3) & 0x1F; \
- uint32 XY = (Xdel*Ydel) >> 5; \
- uint32 area1 = 0x20 + XY - Xdel - Ydel; \
- uint32 area2 = Xdel - XY; \
- uint32 area3 = Ydel - XY; \
- uint32 area4 = XY; \
- uint32 tempColor = ((area1 * p1) + \
+ uint32_t Xdel = (xPos >> 3) & 0x1F; \
+ uint32_t Ydel = (yPos >> 3) & 0x1F; \
+ uint32_t XY = (Xdel*Ydel) >> 5; \
+ uint32_t area1 = 0x20 + XY - Xdel - Ydel; \
+ uint32_t area2 = Xdel - XY; \
+ uint32_t area3 = Ydel - XY; \
+ uint32_t area4 = XY; \
+ uint32_t tempColor = ((area1 * p1) + \
(area2 * p2) + \
(area3 * p3) + \
(area4 * p4)) >> 5; \
@@ -3129,7 +3129,7 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
{ \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint32 b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ uint32_t b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -3144,13 +3144,13 @@ static void DrawBGMode7Background16Sub1_2(uint8* Screen, int bg)
} \
}
-STATIC uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
+STATIC uint32_t Q_INTERPOLATE(uint32_t A, uint32_t B, uint32_t C, uint32_t D)
{
- register uint32 x = ((A >> 2) & HIGH_BITS_SHIFTED_TWO_MASK) +
+ register uint32_t x = ((A >> 2) & HIGH_BITS_SHIFTED_TWO_MASK) +
((B >> 2) & HIGH_BITS_SHIFTED_TWO_MASK) +
((C >> 2) & HIGH_BITS_SHIFTED_TWO_MASK) +
((D >> 2) & HIGH_BITS_SHIFTED_TWO_MASK);
- register uint32 y = (A & TWO_LOW_BITS_MASK) +
+ register uint32_t y = (A & TWO_LOW_BITS_MASK) +
(B & TWO_LOW_BITS_MASK) +
(C & TWO_LOW_BITS_MASK) +
(D & TWO_LOW_BITS_MASK);
@@ -3158,14 +3158,14 @@ STATIC uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
return x + y;
}
-static void DrawBGMode7Background16_i(uint8* Screen, int bg)
+static void DrawBGMode7Background16_i(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7_i(uint16, theColor, (ScreenColors[b & GFX.Mode7Mask]));
+ RENDER_BACKGROUND_MODE7_i(uint16_t, theColor, (ScreenColors[b & GFX.Mode7Mask]));
}
-static void DrawBGMode7Background16Add_i(uint8* Screen, int bg)
+static void DrawBGMode7Background16Add_i(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7_i(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7_i(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
(COLOR_ADD(theColor,
p [GFX.Delta])) :
@@ -3174,9 +3174,9 @@ static void DrawBGMode7Background16Add_i(uint8* Screen, int bg)
theColor, (ScreenColors[b & GFX.Mode7Mask]));
}
-static void DrawBGMode7Background16Add1_2_i(uint8* Screen, int bg)
+static void DrawBGMode7Background16Add1_2_i(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7_i(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7_i(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_ADD1_2(theColor,
p [GFX.Delta]) :
@@ -3185,9 +3185,9 @@ static void DrawBGMode7Background16Add1_2_i(uint8* Screen, int bg)
theColor, (ScreenColors[b & GFX.Mode7Mask]));
}
-static void DrawBGMode7Background16Sub_i(uint8* Screen, int bg)
+static void DrawBGMode7Background16Sub_i(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7_i(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7_i(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_SUB(theColor,
p [GFX.Delta]) :
@@ -3196,9 +3196,9 @@ static void DrawBGMode7Background16Sub_i(uint8* Screen, int bg)
theColor, (ScreenColors[b & GFX.Mode7Mask]));
}
-static void DrawBGMode7Background16Sub1_2_i(uint8* Screen, int bg)
+static void DrawBGMode7Background16Sub1_2_i(uint8_t* Screen, int bg)
{
- RENDER_BACKGROUND_MODE7_i(uint16, *(d + GFX.DepthDelta) ?
+ RENDER_BACKGROUND_MODE7_i(uint16_t, *(d + GFX.DepthDelta) ?
(*(d + GFX.DepthDelta) != 1 ?
COLOR_SUB1_2(theColor,
p [GFX.Delta]) :
@@ -3241,13 +3241,13 @@ TWO_LOW_BITS_MASK = RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 1); \
HIGH_BITS_SHIFTED_TWO_MASK = (( (FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK) & \
~TWO_LOW_BITS_MASK ) >> 2);
-static void RenderScreen(uint8* Screen, bool8 sub, bool8 force_no_add, uint8 D)
+static void RenderScreen(uint8_t* Screen, bool sub, bool force_no_add, uint8_t D)
{
- bool8 BG0;
- bool8 BG1;
- bool8 BG2;
- bool8 BG3;
- bool8 OB;
+ bool BG0;
+ bool BG1;
+ bool BG2;
+ bool BG3;
+ bool OB;
GFX.S = Screen;
@@ -3403,18 +3403,18 @@ static void RenderScreen(uint8* Screen, bool8 sub, bool8 force_no_add, uint8 D)
#include "font.h"
-void DisplayChar(uint8* Screen, uint8 c)
+void DisplayChar(uint8_t* Screen, uint8_t c)
{
int line = (((c & 0x7f) - 32) >> 4) * font_height;
int offset = (((c & 0x7f) - 32) & 15) * font_width;
int h, w;
- uint16* s = (uint16*) Screen;
+ uint16_t* s = (uint16_t*) Screen;
for (h = 0; h < font_height; h++, line++,
s += GFX.PPL - font_width)
{
for (w = 0; w < font_width; w++, s++)
{
- uint8 p = font [line][offset + w];
+ uint8_t p = font [line][offset + w];
if (p == '#')
{
@@ -3439,7 +3439,7 @@ void DisplayChar(uint8* Screen, uint8 c)
static void S9xDisplayFrameRate()
{
- uint8* Screen = GFX.Screen + 2 +
+ uint8_t* Screen = GFX.Screen + 2 +
(IPPU.RenderedScreenHeight - font_height - 1) * GFX.Pitch2;
char string [10];
int len = 5;
@@ -3451,13 +3451,13 @@ static void S9xDisplayFrameRate()
for (i = 0; i < len; i++)
{
DisplayChar(Screen, string [i]);
- Screen += (font_width - 1) * sizeof(uint16);
+ Screen += (font_width - 1) * sizeof(uint16_t);
}
}
static void S9xDisplayString(const char* string)
{
- uint8* Screen = GFX.Screen + 2 +
+ uint8_t* Screen = GFX.Screen + 2 +
(IPPU.RenderedScreenHeight - font_height * 5) * GFX.Pitch2;
int len = strlen(string);
int max_chars = IPPU.RenderedScreenWidth / (font_width - 1);
@@ -3468,7 +3468,7 @@ static void S9xDisplayString(const char* string)
{
if (char_count >= max_chars || string [i] < 32)
{
- Screen -= (font_width - 1) * max_chars * sizeof(uint16);
+ Screen -= (font_width - 1) * max_chars * sizeof(uint16_t);
Screen += font_height * GFX.Pitch;
if (Screen >= GFX.Screen + GFX.Pitch * IPPU.RenderedScreenHeight)
break;
@@ -3477,13 +3477,13 @@ static void S9xDisplayString(const char* string)
if (string [i] < 32)
continue;
DisplayChar(Screen, string [i]);
- Screen += (font_width - 1) * sizeof(uint16);
+ Screen += (font_width - 1) * sizeof(uint16_t);
}
}
void S9xUpdateScreen()
{
- int32 x2 = 1;
+ int32_t x2 = 1;
GFX.S = GFX.Screen;
GFX.r2131 = Memory.FillRAM [0x2131];
@@ -3511,7 +3511,7 @@ void S9xUpdateScreen()
if (PPU.RecomputeClipWindows)
{
ComputeClipWindows();
- PPU.RecomputeClipWindows = FALSE;
+ PPU.RecomputeClipWindows = false;
}
GFX.StartY = IPPU.PreviousLine;
@@ -3521,8 +3521,8 @@ void S9xUpdateScreen()
// XXX: Check ForceBlank? Or anything else?
PPU.RangeTimeOver |= GFX.OBJLines[GFX.EndY].RTOFlags;
- uint32 starty = GFX.StartY;
- uint32 endy = GFX.EndY;
+ uint32_t starty = GFX.StartY;
+ uint32_t endy = GFX.EndY;
if (Settings.SupportHiRes &&
(PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.Interlace
@@ -3544,18 +3544,18 @@ void S9xUpdateScreen()
{
// The game has switched from lo-res to hi-res mode part way down
// the screen. Scale any existing lo-res pixels on screen
- register uint32 y;
+ register uint32_t y;
for (y = 0; y < starty; y++)
{
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + 255;
- register uint16* q = (uint16*)(GFX.Screen + y * GFX.Pitch2) + 510;
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + 255;
+ register uint16_t* q = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + 510;
register int x;
for (x = 255; x >= 0; x--, p--, q -= 2)
* q = *(q + 1) = *p;
}
- IPPU.DoubleWidthPixels = TRUE;
- IPPU.HalfWidthPixels = FALSE;
+ IPPU.DoubleWidthPixels = true;
+ IPPU.HalfWidthPixels = false;
}
// BJ: And we have to change the height if Interlace gets set,
// too.
@@ -3564,7 +3564,7 @@ void S9xUpdateScreen()
starty = GFX.StartY * 2;
endy = GFX.EndY * 2 + 1;
IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1;
- IPPU.DoubleHeightPixels = TRUE;
+ IPPU.DoubleHeightPixels = true;
GFX.Pitch2 = GFX.RealPitch;
GFX.Pitch = GFX.RealPitch * 2;
GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
@@ -3572,8 +3572,8 @@ void S9xUpdateScreen()
// The game has switched from non-interlaced to interlaced mode
// part way down the screen. Scale everything.
- register int32 y;
- for (y = (int32) GFX.StartY - 1; y >= 0; y--)
+ register 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]
@@ -3595,7 +3595,7 @@ void S9xUpdateScreen()
{
// The game has switched from lo-res to hi-res mode part way down
// the screen. Hi-res pixels must now be drawn at half width.
- IPPU.HalfWidthPixels = TRUE;
+ IPPU.HalfWidthPixels = true;
}
}
else
@@ -3604,12 +3604,12 @@ void S9xUpdateScreen()
{
// The game has switched from hi-res to lo-res mode part way down
// the screen. Lo-res pixels must now be drawn at FULL width.
- IPPU.HalfWidthPixels = FALSE;
+ IPPU.HalfWidthPixels = false;
}
}
}
- uint32 black = BLACK | (BLACK << 16);
+ uint32_t black = BLACK | (BLACK << 16);
if (Settings.Transparency)
{
@@ -3639,7 +3639,7 @@ void S9xUpdateScreen()
if (pClip->Count [5])
{
// Colour window enabled.
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
memset(GFX.SubZBuffer + y * GFX.ZPitch, 0, IPPU.RenderedScreenWidth);
@@ -3647,13 +3647,13 @@ void S9xUpdateScreen()
if (IPPU.Clip [0].Count [5])
{
- uint32* p = (uint32*)(GFX.SubScreen + y * GFX.Pitch2);
- uint32* q = (uint32*)((uint16*) p + IPPU.RenderedScreenWidth);
+ uint32_t* p = (uint32_t*)(GFX.SubScreen + y * GFX.Pitch2);
+ uint32_t* q = (uint32_t*)((uint16_t*) p + IPPU.RenderedScreenWidth);
while (p < q)
*p++ = black;
}
- uint32 c;
+ uint32_t c;
for (c = 0; c < pClip->Count [5]; c++)
{
if (pClip->Right [c][5] > pClip->Left [c][5])
@@ -3668,12 +3668,12 @@ void S9xUpdateScreen()
// the main screen that will allow the sub-screen
// 'underneath' to show through.
- uint16* p = (uint16*)(GFX.SubScreen + y * GFX.Pitch2);
- uint16* q = p + pClip->Right [c][5] * x2;
+ uint16_t* p = (uint16_t*)(GFX.SubScreen + y * GFX.Pitch2);
+ uint16_t* q = p + pClip->Right [c][5] * x2;
p += pClip->Left [c][5] * x2;
while (p < q)
- *p++ = (uint16) GFX.FixedColour;
+ *p++ = (uint16_t) GFX.FixedColour;
}
}
}
@@ -3681,7 +3681,7 @@ void S9xUpdateScreen()
}
else
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
memset(GFX.ZBuffer + y * GFX.ZPitch, 0, IPPU.RenderedScreenWidth);
@@ -3694,9 +3694,9 @@ void S9xUpdateScreen()
// the main screen that will allow the sub-screen
// 'underneath' to show through.
- uint32 b = GFX.FixedColour | (GFX.FixedColour << 16);
- uint32* p = (uint32*)(GFX.SubScreen + y * GFX.Pitch2);
- uint32* q = (uint32*)((uint16*) p + IPPU.RenderedScreenWidth);
+ 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);
while (p < q)
*p++ = b;
@@ -3707,17 +3707,17 @@ void S9xUpdateScreen()
if (ANYTHING_ON_SUB)
{
GFX.DB = GFX.SubZBuffer;
- RenderScreen(GFX.SubScreen, TRUE, TRUE, SUB_SCREEN_DEPTH);
+ RenderScreen(GFX.SubScreen, true, true, SUB_SCREEN_DEPTH);
}
if (IPPU.Clip [0].Count [5])
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2);
- register uint8* d = GFX.SubZBuffer + y * GFX.ZPitch;
- register uint8* e = d + IPPU.RenderedScreenWidth;
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2);
+ register uint8_t* d = GFX.SubZBuffer + y * GFX.ZPitch;
+ register uint8_t* e = d + IPPU.RenderedScreenWidth;
while (d < e)
{
@@ -3732,17 +3732,17 @@ void S9xUpdateScreen()
}
GFX.DB = GFX.ZBuffer;
- RenderScreen(GFX.Screen, FALSE, FALSE, MAIN_SCREEN_DEPTH);
+ RenderScreen(GFX.Screen, false, false, MAIN_SCREEN_DEPTH);
if (SUB_OR_ADD(5))
{
- uint32 back = IPPU.ScreenColors [0];
- uint32 Left = 0;
- uint32 Right = 256;
- uint32 Count;
+ uint32_t back = IPPU.ScreenColors [0];
+ uint32_t Left = 0;
+ uint32_t Right = 256;
+ uint32_t Count;
pClip = &IPPU.Clip [0];
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
if (!(Count = pClip->Count [5]))
@@ -3752,7 +3752,7 @@ void S9xUpdateScreen()
Count = 1;
}
- uint32 b;
+ uint32_t b;
for (b = 0; b < Count; b++)
{
if (pClip->Count [5])
@@ -3768,11 +3768,11 @@ void S9xUpdateScreen()
if (GFX.r2131 & 0x40)
{
// Subtract, halving the result.
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- register uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- register uint8* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
- register uint8* e = d + Right;
- uint16 back_fixed = COLOR_SUB(back, GFX.FixedColour);
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ register uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ register uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
+ register uint8_t* e = d + Right;
+ uint16_t back_fixed = COLOR_SUB(back, GFX.FixedColour);
d += Left;
while (d < e)
@@ -3787,7 +3787,7 @@ void S9xUpdateScreen()
*p = back_fixed;
}
else
- *p = (uint16) back;
+ *p = (uint16_t) back;
}
d++;
p++;
@@ -3797,11 +3797,11 @@ void S9xUpdateScreen()
else
{
// Subtract
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- register uint8* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
- register uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- register uint8* e = d + Right;
- uint16 back_fixed = COLOR_SUB(back, GFX.FixedColour);
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ register uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
+ register uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ register uint8_t* e = d + Right;
+ uint16_t back_fixed = COLOR_SUB(back, GFX.FixedColour);
d += Left;
while (d < e)
@@ -3816,7 +3816,7 @@ void S9xUpdateScreen()
*p = back_fixed;
}
else
- *p = (uint16) back;
+ *p = (uint16_t) back;
}
d++;
p++;
@@ -3826,11 +3826,11 @@ void S9xUpdateScreen()
}
else if (GFX.r2131 & 0x40)
{
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- register uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- register uint8* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
- register uint8* e = d + Right;
- uint16 back_fixed = COLOR_ADD(back, GFX.FixedColour);
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ register uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ register uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
+ register uint8_t* e = d + Right;
+ uint16_t back_fixed = COLOR_ADD(back, GFX.FixedColour);
d += Left;
while (d < e)
{
@@ -3844,7 +3844,7 @@ void S9xUpdateScreen()
*p = back_fixed;
}
else
- *p = (uint16) back;
+ *p = (uint16_t) back;
}
d++;
p++;
@@ -3853,11 +3853,11 @@ void S9xUpdateScreen()
}
else if (back != 0)
{
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- register uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- register uint8* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
- register uint8* e = d + Right;
- uint16 back_fixed = COLOR_ADD(back, GFX.FixedColour);
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ register uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ register uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
+ register uint8_t* e = d + Right;
+ uint16_t back_fixed = COLOR_ADD(back, GFX.FixedColour);
d += Left;
while (d < e)
{
@@ -3871,7 +3871,7 @@ void S9xUpdateScreen()
*p = back_fixed;
}
else
- *p = (uint16) back;
+ *p = (uint16_t) back;
}
d++;
p++;
@@ -3886,10 +3886,10 @@ void S9xUpdateScreen()
// copy the sub-screen to the main screen
// or fill it with the back-drop colour if the
// sub-screen is clear.
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- register uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- register uint8* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
- register uint8* e = d + Right;
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ register uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ register uint8_t* s = GFX.SubZBuffer + y * GFX.ZPitch + Left;
+ register uint8_t* e = d + Right;
d += Left;
while (d < e)
{
@@ -3903,7 +3903,7 @@ void S9xUpdateScreen()
*p = GFX.FixedColour;
}
else
- *p = (uint16) back;
+ *p = (uint16_t) back;
}
d++;
p++;
@@ -3917,28 +3917,28 @@ void S9xUpdateScreen()
else
{
// Subscreen not being added to back
- uint32 back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
+ uint32_t back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
pClip = &IPPU.Clip [0];
if (pClip->Count [5])
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
- uint32 b;
+ uint32_t b;
for (b = 0; b < pClip->Count [5]; b++)
{
- uint32 Left = pClip->Left [b][5] * x2;
- uint32 Right = pClip->Right [b][5] * x2;
- uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + Left;
- uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- uint8* e = d + Right;
+ uint32_t Left = pClip->Left [b][5] * x2;
+ uint32_t Right = pClip->Right [b][5] * x2;
+ uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + Left;
+ uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ uint8_t* e = d + Right;
d += Left;
while (d < e)
{
if (*d == 0)
- *p = (int16) back;
+ *p = (int16_t) back;
d++;
p++;
}
@@ -3947,17 +3947,17 @@ void S9xUpdateScreen()
}
else
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
- uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2);
- uint8* d = GFX.ZBuffer + y * GFX.ZPitch;
- uint8* e = d + 256 * x2;
+ uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2);
+ uint8_t* d = GFX.ZBuffer + y * GFX.ZPitch;
+ uint8_t* e = d + 256 * x2;
while (d < e)
{
if (*d == 0)
- *p = (int16) back;
+ *p = (int16_t) back;
d++;
p++;
}
@@ -3970,44 +3970,44 @@ void S9xUpdateScreen()
// 16bit and transparency but currently no transparency effects in
// operation.
- uint32 back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
+ uint32_t back = IPPU.ScreenColors [0] | (IPPU.ScreenColors [0] << 16);
if (PPU.ForcedBlanking)
back = black;
if (IPPU.Clip [0].Count[5])
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
- uint32* p = (uint32*)(GFX.Screen + y * GFX.Pitch2);
- uint32* q = (uint32*)((uint16*) p + IPPU.RenderedScreenWidth);
+ uint32_t* p = (uint32_t*)(GFX.Screen + y * GFX.Pitch2);
+ uint32_t* q = (uint32_t*)((uint16_t*) p + IPPU.RenderedScreenWidth);
while (p < q)
*p++ = black;
- uint32 c;
+ uint32_t c;
for (c = 0; c < IPPU.Clip [0].Count [5]; c++)
{
if (IPPU.Clip [0].Right [c][5] > IPPU.Clip [0].Left [c][5])
{
- uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2);
- uint16* q = p + IPPU.Clip [0].Right [c][5] * x2;
+ uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2);
+ uint16_t* q = p + IPPU.Clip [0].Right [c][5] * x2;
p += IPPU.Clip [0].Left [c][5] * x2;
while (p < q)
- *p++ = (uint16) back;
+ *p++ = (uint16_t) back;
}
}
}
}
else
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
{
- uint32* p = (uint32*)(GFX.Screen + y * GFX.Pitch2);
- uint32* q = (uint32*)((uint16*) p + IPPU.RenderedScreenWidth);
+ uint32_t* p = (uint32_t*)(GFX.Screen + y * GFX.Pitch2);
+ uint32_t* q = (uint32_t*)((uint16_t*) p + IPPU.RenderedScreenWidth);
while (p < q)
*p++ = back;
}
@@ -4015,11 +4015,11 @@ void S9xUpdateScreen()
if (!PPU.ForcedBlanking)
{
- uint32 y;
+ uint32_t y;
for (y = starty; y <= endy; y++)
memset(GFX.ZBuffer + y * GFX.ZPitch, 0, IPPU.RenderedScreenWidth);
GFX.DB = GFX.ZBuffer;
- RenderScreen(GFX.Screen, FALSE, TRUE, SUB_SCREEN_DEPTH);
+ RenderScreen(GFX.Screen, false, true, SUB_SCREEN_DEPTH);
}
}
}
@@ -4033,11 +4033,11 @@ void S9xUpdateScreen()
{
// Mixture of background modes used on screen - scale width
// of all non-mode 5 and 6 pixels.
- register uint32 y;
+ register uint32_t y;
for (y = starty; y <= endy; y++)
{
- register uint16* p = (uint16*)(GFX.Screen + y * GFX.Pitch2) + 255;
- register uint16* q = (uint16*)(GFX.Screen + y * GFX.Pitch2) + 510;
+ register uint16_t* p = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + 255;
+ register uint16_t* q = (uint16_t*)(GFX.Screen + y * GFX.Pitch2) + 510;
register int x;
for (x = 255; x >= 0; x--, p--, q -= 2)
* q = *(q + 1) = *p;
@@ -4045,7 +4045,7 @@ void S9xUpdateScreen()
}
// Double the height of the pixels just drawn
- FIX_INTERLACE(GFX.Screen, FALSE, GFX.ZBuffer);
+ FIX_INTERLACE(GFX.Screen, false, GFX.ZBuffer);
}
IPPU.PreviousLine = IPPU.CurrentLine;
diff --git a/source/gfx.h b/source/gfx.h
index 5c55f64..2d0ab3c 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -94,20 +94,20 @@
#include "snes9x.h"
void S9xStartScreenRefresh();
-void S9xDrawScanLine(uint8 Line);
+void S9xDrawScanLine(uint8_t Line);
void S9xEndScreenRefresh();
void S9xSetupOBJ();
void S9xUpdateScreen();
-void RenderLine(uint8 line);
+void RenderLine(uint8_t line);
void S9xBuildDirectColourMaps();
// External port interface which must be implemented or initialised for each
// port.
extern struct SGFX GFX;
-bool8 S9xInitGFX();
+bool S9xInitGFX();
void S9xDeinitGFX();
-bool8 S9xInitUpdate(void);
+bool S9xInitUpdate(void);
#if 0
void S9xSyncSpeed();
#else
@@ -118,62 +118,62 @@ void S9xSyncSpeed();
struct SGFX
{
// Initialize these variables
- uint8* Screen_buffer;
- uint8* SubScreen_buffer;
- uint8* ZBuffer_buffer;
- uint8* SubZBuffer_buffer;
+ uint8_t* Screen_buffer;
+ uint8_t* SubScreen_buffer;
+ uint8_t* ZBuffer_buffer;
+ uint8_t* SubZBuffer_buffer;
- uint8* Screen;
- uint8* SubScreen;
- uint8* ZBuffer;
- uint8* SubZBuffer;
- uint32 Pitch;
+ uint8_t* Screen;
+ uint8_t* SubScreen;
+ uint8_t* ZBuffer;
+ uint8_t* SubZBuffer;
+ uint32_t Pitch;
// Setup in call to S9xInitGFX()
int Delta;
- uint16* X2;
- uint16* ZERO_OR_X2;
- uint16* ZERO;
- uint32 RealPitch; // True pitch of Screen buffer.
- uint32 Pitch2; // Same as RealPitch except while using speed up hack for Glide.
- uint32 ZPitch; // Pitch of ZBuffer
- uint32 PPL; // Number of pixels on each of Screen buffer
- uint32 PPLx2;
- uint32 PixSize;
- uint8 S_safety_margin[8];
- uint8* S;
- uint8 DB_safety_margin[8];
- uint8* DB;
- uint32 DepthDelta;
- uint8 Z1; // Depth for comparison
- uint8 Z2; // Depth to save
- uint8 ZSprite; // Used to ensure only 1st sprite is drawn per pixel
- uint32 FixedColour;
+ 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 PPLx2;
+ uint32_t PixSize;
+ uint8_t S_safety_margin[8];
+ uint8_t* S;
+ uint8_t DB_safety_margin[8];
+ uint8_t* DB;
+ uint32_t DepthDelta;
+ uint8_t Z1; // Depth for comparison
+ uint8_t Z2; // Depth to save
+ uint8_t ZSprite; // Used to ensure only 1st sprite is drawn per pixel
+ uint32_t FixedColour;
const char* InfoString;
- uint32 InfoStringTimeout;
- uint32 StartY;
- uint32 EndY;
+ uint32_t InfoStringTimeout;
+ uint32_t StartY;
+ uint32_t EndY;
struct ClipData* pCurrentClip;
- uint32 Mode7Mask;
- uint32 Mode7PriorityMask;
- uint8 OBJWidths[128];
- uint8 OBJVisibleTiles[128];
+ uint32_t Mode7Mask;
+ uint32_t Mode7PriorityMask;
+ uint8_t OBJWidths[128];
+ uint8_t OBJVisibleTiles[128];
struct
{
- uint8 RTOFlags;
- int16 Tiles;
+ uint8_t RTOFlags;
+ int16_t Tiles;
struct
{
- int8 Sprite;
- uint8 Line;
+ int8_t Sprite;
+ uint8_t Line;
} OBJ[32];
} OBJLines [SNES_HEIGHT_EXTENDED];
- uint8 r212c;
- uint8 r212d;
- uint8 r2130;
- uint8 r2131;
- bool8 Pseudo;
+ uint8_t r212c;
+ uint8_t r212d;
+ uint8_t r2130;
+ uint8_t r2131;
+ bool Pseudo;
};
@@ -181,8 +181,8 @@ struct SLineData
{
struct
{
- uint16 VOffset;
- uint16 HOffset;
+ uint16_t VOffset;
+ uint16_t HOffset;
} BG [4];
};
@@ -192,20 +192,20 @@ struct SLineData
typedef struct
{
- uint32 TileSize;
- uint32 BitShift;
- uint32 TileShift;
- uint32 TileAddress;
- uint32 NameSelect;
- uint32 SCBase;
-
- uint32 StartPalette;
- uint32 PaletteShift;
- uint32 PaletteMask;
-
- uint8* Buffer;
- uint8* Buffered;
- bool8 DirectColourMode;
+ uint32_t TileSize;
+ uint32_t BitShift;
+ uint32_t TileShift;
+ uint32_t TileAddress;
+ uint32_t NameSelect;
+ uint32_t SCBase;
+
+ uint32_t StartPalette;
+ uint32_t PaletteShift;
+ uint32_t PaletteMask;
+
+ uint8_t* Buffer;
+ uint8_t* Buffered;
+ bool DirectColourMode;
} SBG;
struct SLineMatrixData
@@ -218,35 +218,35 @@ struct SLineMatrixData
short CentreY;
};
-extern uint32 odd_high [4][16];
-extern uint32 odd_low [4][16];
-extern uint32 even_high [4][16];
-extern uint32 even_low [4][16];
+extern uint32_t odd_high [4][16];
+extern uint32_t odd_low [4][16];
+extern uint32_t even_high [4][16];
+extern uint32_t even_low [4][16];
extern SBG BG;
-extern uint16 DirectColourMaps [8][256];
+extern uint16_t DirectColourMaps [8][256];
-extern uint8 add32_32 [32][32];
-extern uint8 add32_32_half [32][32];
-extern uint8 sub32_32 [32][32];
-extern uint8 sub32_32_half [32][32];
-extern uint8 mul_brightness [16][32];
+extern uint8_t add32_32 [32][32];
+extern uint8_t add32_32_half [32][32];
+extern uint8_t sub32_32 [32][32];
+extern uint8_t sub32_32_half [32][32];
+extern uint8_t mul_brightness [16][32];
// Could use BSWAP instruction on Intel port...
#define SWAP_DWORD(dw) dw = ((dw & 0xff) << 24) | ((dw & 0xff00) << 8) | \
((dw & 0xff0000) >> 8) | ((dw & 0xff000000) >> 24)
#ifdef FAST_LSB_WORD_ACCESS
-#define READ_2BYTES(s) (*(uint16 *) (s))
-#define WRITE_2BYTES(s, d) *(uint16 *) (s) = (d)
+#define READ_2BYTES(s) (*(uint16_t *) (s))
+#define WRITE_2BYTES(s, d) *(uint16_t *) (s) = (d)
#else
#ifdef LSB_FIRST
-#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8))
-#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \
- *((uint8 *) (s) + 1) = (d) >> 8
+#define READ_2BYTES(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8))
+#define WRITE_2BYTES(s, d) *(uint8_t *) (s) = (d), \
+ *((uint8_t *) (s) + 1) = (d) >> 8
#else // else MSB_FISRT
-#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8))
-#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \
- *((uint8 *) (s) + 1) = (d) >> 8
+#define READ_2BYTES(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8))
+#define WRITE_2BYTES(s, d) *(uint8_t *) (s) = (d), \
+ *((uint8_t *) (s) + 1) = (d) >> 8
#endif // LSB_FIRST
#endif // i386
@@ -259,9 +259,9 @@ GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
((C1) & (C2) & RGB_LOW_BITS_MASK)]
#else
-static inline uint16 COLOR_ADD(uint16, uint16);
+static inline uint16_t COLOR_ADD(uint16_t, uint16_t);
-static inline uint16 COLOR_ADD(uint16 C1, uint16 C2)
+static inline uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
{
if (C1 == 0)
return C2;
@@ -289,11 +289,11 @@ GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1] + \
((C1) & RGB_LOW_BITS_MASK) - ((C2) & RGB_LOW_BITS_MASK))
#else
-inline uint16 COLOR_SUB(uint16, uint16);
+inline uint16_t COLOR_SUB(uint16_t, uint16_t);
-inline uint16 COLOR_SUB(uint16 C1, uint16 C2)
+inline uint16_t COLOR_SUB(uint16_t C1, uint16_t C2)
{
- uint16 mC1, mC2, v = 0;
+ uint16_t mC1, mC2, v = 0;
mC1 = C1 & FIRST_COLOR_MASK;
mC2 = C2 & FIRST_COLOR_MASK;
@@ -315,14 +315,14 @@ inline uint16 COLOR_SUB(uint16 C1, uint16 C2)
GFX.ZERO [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1]
-typedef void (*NormalTileRenderer)(uint32 Tile, int32 Offset,
- uint32 StartLine, uint32 LineCount);
-typedef void (*ClippedTileRenderer)(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-typedef void (*LargePixelRenderer)(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
+typedef void (*NormalTileRenderer)(uint32_t Tile, int32_t Offset,
+ uint32_t StartLine, uint32_t LineCount);
+typedef void (*ClippedTileRenderer)(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount);
+typedef void (*LargePixelRenderer)(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount);
#endif
diff --git a/source/globals.c b/source/globals.c
index 3303dca..0625df8 100644
--- a/source/globals.c
+++ b/source/globals.c
@@ -129,7 +129,7 @@ SnesModel M2SNES = {2, 4, 3};
SnesModel* Model = &M1SNES;
-uint8* C4RAM = NULL;
+uint8_t* C4RAM = NULL;
long OpAddress = 0;
@@ -137,7 +137,7 @@ CMemory Memory;
SSNESGameFixes SNESGameFixes;
-uint8 OpenBus = 0;
+uint8_t OpenBus = 0;
struct FxInit_s SuperFX;
@@ -146,8 +146,8 @@ InternalPPU IPPU;
SDMA DMA[8];
-uint8* HDMAMemPointers [8];
-uint8* HDMABasePointers [8];
+uint8_t* HDMAMemPointers [8];
+uint8_t* HDMABasePointers [8];
SBG BG;
@@ -155,17 +155,17 @@ struct SGFX GFX;
struct SLineData LineData[240];
struct SLineMatrixData LineMatrixData [240];
-uint8 Mode7Depths [2];
+uint8_t Mode7Depths [2];
NormalTileRenderer DrawTilePtr = NULL;
ClippedTileRenderer DrawClippedTilePtr = NULL;
NormalTileRenderer DrawHiResTilePtr = NULL;
ClippedTileRenderer DrawHiResClippedTilePtr = NULL;
LargePixelRenderer DrawLargePixelPtr = NULL;
-uint32 odd_high[4][16];
-uint32 odd_low[4][16];
-uint32 even_high[4][16];
-uint32 even_low[4][16];
+uint32_t odd_high[4][16];
+uint32_t odd_low[4][16];
+uint32_t even_high[4][16];
+uint32_t even_low[4][16];
#ifdef WANT_CHEATS
SCheatData Cheat;
@@ -182,7 +182,7 @@ int FilterTaps [8];
unsigned long Z = 0;
int Loop [16];
#endif
-uint16 SignExtend [2] =
+uint16_t SignExtend [2] =
{
0x00, 0xff00
};
@@ -193,7 +193,7 @@ int HDMA_ModeByteCounts [8] =
1, 2, 2, 4, 4, 4, 2, 4
};
-uint8 BitShifts[8][4] =
+uint8_t BitShifts[8][4] =
{
{2, 2, 2, 2}, // 0
{4, 4, 2, 0}, // 1
@@ -204,7 +204,7 @@ uint8 BitShifts[8][4] =
{4, 0, 0, 0}, // 6
{8, 0, 0, 0} // 7
};
-uint8 TileShifts[8][4] =
+uint8_t TileShifts[8][4] =
{
{4, 4, 4, 4}, // 0
{5, 5, 4, 0}, // 1
@@ -215,7 +215,7 @@ uint8 TileShifts[8][4] =
{5, 0, 0, 0}, // 6
{6, 0, 0, 0} // 7
};
-uint8 PaletteShifts[8][4] =
+uint8_t PaletteShifts[8][4] =
{
{2, 2, 2, 2}, // 0
{4, 4, 2, 0}, // 1
@@ -226,7 +226,7 @@ uint8 PaletteShifts[8][4] =
{4, 0, 0, 0}, // 6
{0, 0, 0, 0} // 7
};
-uint8 PaletteMasks[8][4] =
+uint8_t PaletteMasks[8][4] =
{
{7, 7, 7, 7}, // 0
{7, 7, 7, 0}, // 1
@@ -237,7 +237,7 @@ uint8 PaletteMasks[8][4] =
{7, 0, 0, 0}, // 6
{0, 0, 0, 0} // 7
};
-uint8 Depths[8][4] =
+uint8_t Depths[8][4] =
{
{TILE_2BIT, TILE_2BIT, TILE_2BIT, TILE_2BIT}, // 0
{TILE_4BIT, TILE_4BIT, TILE_2BIT, 0}, // 1
@@ -248,11 +248,11 @@ uint8 Depths[8][4] =
{TILE_4BIT, 0, 0, 0}, // 6
{0, 0, 0, 0} // 7
};
-uint8 BGSizes [2] =
+uint8_t BGSizes [2] =
{
8, 16
};
-uint16 DirectColourMaps [8][256];
+uint16_t DirectColourMaps [8][256];
long FilterValues[4][2] =
{
@@ -269,7 +269,7 @@ int NoiseFreq [32] =
5300, 6400, 8000, 10700, 16000, 32000
};
-uint32 HeadMask [4] =
+uint32_t HeadMask [4] =
{
#ifdef LSB_FIRST
0xffffffff, 0xffffff00, 0xffff0000, 0xff000000
@@ -278,7 +278,7 @@ uint32 HeadMask [4] =
#endif
};
-uint32 TailMask [5] =
+uint32_t TailMask [5] =
{
#ifdef LSB_FIRST
0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff
@@ -287,7 +287,7 @@ uint32 TailMask [5] =
#endif
};
-uint8 APUROM [64] =
+uint8_t APUROM [64] =
{
0xCD, 0xEF, 0xBD, 0xE8, 0x00, 0xC6, 0x1D, 0xD0, 0xFC, 0x8F, 0xAA, 0xF4, 0x8F,
0xBB, 0xF5, 0x78, 0xCC, 0xF4, 0xD0, 0xFB, 0x2F, 0x19, 0xEB, 0xF4, 0xD0, 0xFC,
@@ -298,7 +298,7 @@ uint8 APUROM [64] =
// Raw SPC700 instruction cycle lengths
-uint16 S9xAPUCycleLengths [256] =
+uint16_t S9xAPUCycleLengths [256] =
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
/* 00 */ 2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8,
@@ -321,7 +321,7 @@ uint16 S9xAPUCycleLengths [256] =
// Actual data used by CPU emulation, will be scaled by APUReset routine
// to be relative to the 65c816 instruction lengths.
-uint16 S9xAPUCycles [256] =
+uint16_t S9xAPUCycles [256] =
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
/* 00 */ 2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8,
diff --git a/source/memmap.c b/source/memmap.c
index 60e190a..2f4ff8a 100644
--- a/source/memmap.c
+++ b/source/memmap.c
@@ -139,16 +139,16 @@ extern struct FxInit_s SuperFX;
#endif
static int retry_count = 0;
-static uint8 bytes0x2000 [0x2000];
+static uint8_t bytes0x2000 [0x2000];
int is_bsx(unsigned char*);
int bs_name(unsigned char*);
int check_char(unsigned);
-void S9xDeinterleaveType2(bool8 reset);
-uint32 caCRC32(uint8* array, uint32 size, register uint32 crc32);
+void S9xDeinterleaveType2(bool reset);
+uint32_t caCRC32(uint8_t* array, uint32_t size, register uint32_t crc32);
extern char* rom_filename;
-const uint32 crc32Table[256] =
+const uint32_t crc32Table[256] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
@@ -197,7 +197,7 @@ const uint32 crc32Table[256] =
-void S9xDeinterleaveType1(int TotalFileSize, uint8* base)
+void S9xDeinterleaveType1(int TotalFileSize, uint8_t* base)
{
if (Settings.DisplayColor == 0xffff)
{
@@ -207,14 +207,14 @@ void S9xDeinterleaveType1(int TotalFileSize, uint8* base)
int i;
int nblocks = TotalFileSize >> 16;
- uint8 blocks [256];
+ uint8_t blocks [256];
for (i = 0; i < nblocks; i++)
{
blocks [i * 2] = i + nblocks;
blocks [i * 2 + 1] = i;
}
// DS2 DMA notes: base may or may not be 32-byte aligned
- uint8* tmp = (uint8*) malloc(0x8000);
+ uint8_t* tmp = (uint8_t*) malloc(0x8000);
if (tmp)
{
for (i = 0; i < nblocks * 2; i++)
@@ -232,7 +232,7 @@ void S9xDeinterleaveType1(int TotalFileSize, uint8* base)
&base [blocks [i] * 0x8000], 0x8000);
// memmove converted: Different mallocs [Neb]
memcpy(&base [blocks [i] * 0x8000], tmp, 0x8000);
- uint8 b = blocks [j];
+ uint8_t b = blocks [j];
blocks [j] = blocks [i];
blocks [i] = b;
break;
@@ -243,7 +243,7 @@ void S9xDeinterleaveType1(int TotalFileSize, uint8* base)
}
}
-void S9xDeinterleaveGD24(int TotalFileSize, uint8* base)
+void S9xDeinterleaveGD24(int TotalFileSize, uint8_t* base)
{
if (TotalFileSize != 0x300000)
@@ -256,7 +256,7 @@ void S9xDeinterleaveGD24(int TotalFileSize, uint8* base)
}
// DS2 DMA notes: base may or may not be 32-byte aligned
- uint8* tmp = (uint8*) malloc(0x80000);
+ uint8_t* tmp = (uint8_t*) malloc(0x80000);
if (tmp)
{
// memmove converted: Different mallocs [Neb]
@@ -273,18 +273,18 @@ void S9xDeinterleaveGD24(int TotalFileSize, uint8* base)
}
}
-bool8 AllASCII(uint8* b, int size)
+bool AllASCII(uint8_t* b, int size)
{
int i;
for (i = 0; i < size; i++)
{
if (b[i] < 32 || b[i] > 126)
- return (FALSE);
+ return (false);
}
- return (TRUE);
+ return (true);
}
-int ScoreHiROM(bool8 skip_header, int32 romoff)
+int ScoreHiROM(bool skip_header, int32_t romoff)
{
int score = 0;
int o = skip_header ? 0xff00 + 0x200 : 0xff00;
@@ -329,7 +329,7 @@ int ScoreHiROM(bool8 skip_header, int32 romoff)
return (score);
}
-int ScoreLoROM(bool8 skip_header, int32 romoff)
+int ScoreLoROM(bool skip_header, int32_t romoff)
{
int score = 0;
int o = skip_header ? 0x7f00 + 0x200 : 0x7f00;
@@ -409,18 +409,18 @@ char* Safe(const char* s)
/* S9xInitMemory() */
/* This function allocates and zeroes all the memory needed by the emulator */
/**********************************************************************************************/
-bool8 S9xInitMemory()
+bool S9xInitMemory()
{
// DS2 DMA notes: These would do well to be allocated with 32 extra bytes
// so they can be 32-byte aligned. [Neb]
- Memory.RAM = (uint8*) malloc(0x20000);
- Memory.SRAM = (uint8*) malloc(0x20000);
- Memory.VRAM = (uint8*) malloc(0x10000);
+ Memory.RAM = (uint8_t*) malloc(0x20000);
+ Memory.SRAM = (uint8_t*) malloc(0x20000);
+ Memory.VRAM = (uint8_t*) malloc(0x10000);
#ifdef DS2_DMA
- ROM = (uint8*) AlignedMalloc(MAX_ROM_SIZE + 0x200 + 0x8000, 32,
+ ROM = (uint8_t*) AlignedMalloc(MAX_ROM_SIZE + 0x200 + 0x8000, 32,
&PtrAdj.ROM);
#else
- Memory.ROM = (uint8*) malloc(MAX_ROM_SIZE + 0x200 + 0x8000);
+ Memory.ROM = (uint8_t*) malloc(MAX_ROM_SIZE + 0x200 + 0x8000);
#endif
memset(Memory.RAM, 0, 0x20000);
memset(Memory.SRAM, 0, 0x20000);
@@ -429,18 +429,18 @@ bool8 S9xInitMemory()
// bother memsetting. [Neb]
// memset (ROM, 0, MAX_ROM_SIZE + 0x200 + 0x8000);
- Memory.BSRAM = (uint8*) malloc(0x80000);
+ Memory.BSRAM = (uint8_t*) malloc(0x80000);
memset(Memory.BSRAM, 0, 0x80000);
Memory.FillRAM = NULL;
- IPPU.TileCache [TILE_2BIT] = (uint8*) malloc(MAX_2BIT_TILES * 128);
- IPPU.TileCache [TILE_4BIT] = (uint8*) malloc(MAX_4BIT_TILES * 128);
- IPPU.TileCache [TILE_8BIT] = (uint8*) malloc(MAX_8BIT_TILES * 128);
+ IPPU.TileCache [TILE_2BIT] = (uint8_t*) malloc(MAX_2BIT_TILES * 128);
+ IPPU.TileCache [TILE_4BIT] = (uint8_t*) malloc(MAX_4BIT_TILES * 128);
+ IPPU.TileCache [TILE_8BIT] = (uint8_t*) malloc(MAX_8BIT_TILES * 128);
- IPPU.TileCached [TILE_2BIT] = (uint8*) malloc(MAX_2BIT_TILES);
- IPPU.TileCached [TILE_4BIT] = (uint8*) malloc(MAX_4BIT_TILES);
- IPPU.TileCached [TILE_8BIT] = (uint8*) malloc(MAX_8BIT_TILES);
+ IPPU.TileCached [TILE_2BIT] = (uint8_t*) malloc(MAX_2BIT_TILES);
+ IPPU.TileCached [TILE_4BIT] = (uint8_t*) malloc(MAX_4BIT_TILES);
+ IPPU.TileCached [TILE_8BIT] = (uint8_t*) malloc(MAX_8BIT_TILES);
if (!Memory.RAM || !Memory.SRAM || !Memory.VRAM || !Memory.ROM || !Memory.BSRAM
||
@@ -449,7 +449,7 @@ bool8 S9xInitMemory()
!IPPU.TileCached [TILE_4BIT] || !IPPU.TileCached [TILE_8BIT])
{
S9xDeinitMemory();
- return (FALSE);
+ return (false);
}
// FillRAM uses first 32K of ROM image area, otherwise space just
@@ -469,7 +469,7 @@ bool8 S9xInitMemory()
SuperFX.nRamBanks = 2; // Most only use 1. 1=64KB, 2=128KB=1024Mb
SuperFX.pvRam = Memory.SRAM;
SuperFX.nRomBanks = (2 * 1024 * 1024) / (32 * 1024);
- SuperFX.pvRom = (uint8*) Memory.ROM;
+ SuperFX.pvRom = (uint8_t*) Memory.ROM;
memset(IPPU.TileCache [TILE_2BIT], 0, MAX_2BIT_TILES * 128);
memset(IPPU.TileCache [TILE_4BIT], 0, MAX_4BIT_TILES * 128);
@@ -482,7 +482,7 @@ bool8 S9xInitMemory()
Memory.SDD1Data = NULL;
Memory.SDD1Index = NULL;
- return (TRUE);
+ return (true);
}
void S9xDeinitMemory()
@@ -581,14 +581,14 @@ void FreeSDD1Data()
#ifdef LOAD_FROM_MEMORY_TEST
bool LoadROM(const struct retro_game_info* game)
#else
-bool8 LoadROM(const char* filename)
+bool LoadROM(const char* filename)
#endif
{
- int32 TotalFileSize = 0;
- bool8 Interleaved = FALSE;
- bool8 Tales = FALSE;
+ int32_t TotalFileSize = 0;
+ bool Interleaved = false;
+ bool Tales = false;
- uint8* RomHeader = Memory.ROM;
+ uint8_t* RomHeader = Memory.ROM;
Memory.ExtendedFormat = NOPE;
@@ -600,7 +600,7 @@ bool8 LoadROM(const char* filename)
SNESGameFixes.SRAMInitialValue = 0x60;
memset(bytes0x2000, 0, 0x2000);
- CPU.TriedInterleavedMode2 = FALSE;
+ CPU.TriedInterleavedMode2 = false;
Memory.CalculatedSize = 0;
retry_count = 0;
@@ -640,7 +640,7 @@ again:
TotalFileSize = FileLoader(Memory.ROM, filename, MAX_ROM_SIZE);
if (!TotalFileSize)
- return FALSE; // it ends here
+ return false; // it ends here
else if (!Settings.NoPatch)
CheckForIPSPatch(filename, Memory.HeaderCount != 0, &TotalFileSize);
#endif
@@ -673,12 +673,12 @@ again:
S9xMessage(S9X_ERROR, S9X_ROM_CONFUSING_FORMAT_INFO, "Warning! Hacked Dump!");
}
- int hi_score=ScoreHiROM(TRUE, 0);
- int lo_score=ScoreLoROM(TRUE, 0);
+ int hi_score=ScoreHiROM(true, 0);
+ int lo_score=ScoreLoROM(true, 0);
if (Memory.HeaderCount == 0 && !Settings.ForceNoHeader &&
- ((hi_score > lo_score && ScoreHiROM(TRUE, 0) > hi_score) ||
- (hi_score <= lo_score && ScoreLoROM(TRUE, 0) > lo_score)))
+ ((hi_score > lo_score && ScoreHiROM(true, 0) > hi_score) ||
+ (hi_score <= lo_score && ScoreLoROM(true, 0) > lo_score)))
{
#ifdef DS2_DMA
__dcache_writeback_all();
@@ -700,8 +700,8 @@ again:
S9xMessage(S9X_INFO, S9X_HEADER_WARNING,
"Try specifying the -nhd command line option if the game doesn't work\n");
//modifying ROM, so we need to rescore
- hi_score = ScoreHiROM(FALSE, 0);
- lo_score = ScoreLoROM(FALSE, 0);
+ hi_score = ScoreHiROM(false, 0);
+ lo_score = ScoreLoROM(false, 0);
}
Memory.CalculatedSize = TotalFileSize & ~0x1FFF; // round down to lower 0x2000
@@ -734,16 +734,16 @@ again:
}
//CalculatedSize is now set, so rescore
- hi_score = ScoreHiROM(FALSE, 0);
- lo_score = ScoreLoROM(FALSE, 0);
+ hi_score = ScoreHiROM(false, 0);
+ lo_score = ScoreLoROM(false, 0);
if (Memory.ExtendedFormat != NOPE)
{
int loromscore, hiromscore, swappedlorom, swappedhirom;
- loromscore = ScoreLoROM(FALSE, 0);
- hiromscore = ScoreHiROM(FALSE, 0);
- swappedlorom = ScoreLoROM(FALSE, 0x400000);
- swappedhirom = ScoreHiROM(FALSE, 0x400000);
+ loromscore = ScoreLoROM(false, 0);
+ hiromscore = ScoreHiROM(false, 0);
+ swappedlorom = ScoreLoROM(false, 0x400000);
+ swappedhirom = ScoreHiROM(false, 0x400000);
//set swapped here.
@@ -768,8 +768,8 @@ again:
Interleaved = Settings.ForceInterleaved || Settings.ForceInterleaved2;
if (Settings.ForceLoROM || (!Settings.ForceHiROM && lo_score >= hi_score))
{
- Memory.LoROM = TRUE;
- Memory.HiROM = FALSE;
+ Memory.LoROM = true;
+ Memory.HiROM = false;
// Ignore map type byte if not 0x2x or 0x3x
if ((RomHeader [0x7fd5] & 0xf0) == 0x20 || (RomHeader [0x7fd5] & 0xf0) == 0x30)
@@ -777,11 +777,11 @@ again:
switch (RomHeader [0x7fd5] & 0xf)
{
case 1:
- Interleaved = TRUE;
+ Interleaved = true;
break;
case 5:
- Interleaved = TRUE;
- Tales = TRUE;
+ Interleaved = true;
+ Tales = true;
break;
}
}
@@ -794,12 +794,12 @@ again:
{
case 0:
case 3:
- Interleaved = TRUE;
+ Interleaved = true;
break;
}
}
- Memory.LoROM = FALSE;
- Memory.HiROM = TRUE;
+ Memory.LoROM = false;
+ Memory.HiROM = true;
}
// More
@@ -817,7 +817,7 @@ again:
#ifdef LSB_FIRST
if (strncmp((char*) &ROM [0x7fc0], "YOSHI'S ISLAND", 14) == 0
- && (*(uint16*)&ROM[0x7FDE]) == 57611 && ROM[0x10002] == 0xA9)
+ && (*(uint16_t*)&ROM[0x7FDE]) == 57611 && ROM[0x10002] == 0xA9)
#else
if (strncmp((char*) &ROM [0x7fc0], "YOSHI'S ISLAND", 14) == 0
&& (ROM[0x7FDE] + (ROM[0x7FDF] << 8)) == 57611 && ROM[0x10002] == 0xA9)
@@ -829,15 +829,15 @@ again:
#endif
if (strncmp((char*) &Memory.ROM [0x7fc0], "YUYU NO QUIZ DE GO!GO!", 22) == 0)
{
- Memory.LoROM = TRUE;
- Memory.HiROM = FALSE;
- Interleaved = FALSE;
+ Memory.LoROM = true;
+ Memory.HiROM = false;
+ Interleaved = false;
}
}
if (!Settings.ForceNotInterleaved && Interleaved)
{
- CPU.TriedInterleavedMode2 = TRUE;
+ CPU.TriedInterleavedMode2 = true;
S9xMessage(S9X_INFO, S9X_ROM_INTERLEAVED_INFO,
"ROM image is in interleaved format - converting...");
@@ -855,16 +855,16 @@ again:
}
- Memory.LoROM = FALSE;
- Memory.HiROM = TRUE;
+ Memory.LoROM = false;
+ Memory.HiROM = true;
}
else if (Settings.ForceInterleaved2)
- S9xDeinterleaveType2(FALSE);
+ S9xDeinterleaveType2(false);
else if (Settings.ForceInterleaveGD24 && Memory.CalculatedSize == 0x300000)
{
- bool8 t = Memory.LoROM;
+ bool t = Memory.LoROM;
Memory.LoROM = Memory.HiROM;
Memory.HiROM = t;
@@ -877,7 +877,7 @@ again:
Settings.DisplayColor = BUILD_PIXEL(0, 31, 0);
SET_UI_COLOR(0, 255, 0);
}
- bool8 t = Memory.LoROM;
+ bool t = Memory.LoROM;
Memory.LoROM = Memory.HiROM;
Memory.HiROM = t;
@@ -885,8 +885,8 @@ again:
S9xDeinterleaveType1(Memory.CalculatedSize, Memory.ROM);
}
- hi_score = ScoreHiROM(FALSE, 0);
- lo_score = ScoreLoROM(FALSE, 0);
+ hi_score = ScoreHiROM(false, 0);
+ lo_score = ScoreLoROM(false, 0);
if ((Memory.HiROM &&
(lo_score >= hi_score || hi_score < 0)) ||
@@ -897,8 +897,8 @@ again:
{
S9xMessage(S9X_INFO, S9X_ROM_CONFUSING_FORMAT_INFO,
"ROM lied about its type! Trying again.");
- Settings.ForceNotInterleaved = TRUE;
- Settings.ForceInterleaved = FALSE;
+ Settings.ForceNotInterleaved = true;
+ Settings.ForceInterleaved = false;
retry_count++;
goto again;
}
@@ -918,16 +918,16 @@ again:
S9xReset();
- return (TRUE);
+ return (true);
}
#ifndef LOAD_FROM_MEMORY_TEST
-uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
+uint32_t FileLoader(uint8_t* buffer, const char* filename, int32_t maxsize)
{
FILE* ROMFile;
- int32 TotalFileSize = 0;
+ int32_t TotalFileSize = 0;
int len = 0;
char dir [_MAX_DIR + 1];
@@ -952,8 +952,8 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
strcpy(Memory.ROMFilename, fname);
Memory.HeaderCount = 0;
- uint8* ptr = buffer;
- bool8 more = FALSE;
+ uint8_t* ptr = buffer;
+ bool more = false;
do
{
@@ -994,7 +994,7 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
if ((ptr - Memory.ROM) < (maxsize + 0x200) &&
(isdigit(ext [0]) && ext [1] == 0 && ext [0] < '9'))
{
- more = TRUE;
+ more = true;
ext [0]++;
#ifdef __WIN32__
// memmove required: Overlapping addresses [Neb]
@@ -1009,7 +1009,7 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
isdigit(name [2]) && isdigit(name [3]) && isdigit(name [4]) &&
isdigit(name [5]) && isalpha(name [len - 1])))
{
- more = TRUE;
+ more = true;
name [len - 1]++;
#ifdef __WIN32__
// memmove required: Overlapping addresses [Neb]
@@ -1019,7 +1019,7 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
_makepath(fname, drive, dir, name, ext);
}
else
- more = FALSE;
+ more = false;
}
while (more && (ROMFile = fopen(fname, "rb")) != NULL);
@@ -1046,10 +1046,10 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize)
//compatibility wrapper
void S9xDeinterleaveMode2()
{
- S9xDeinterleaveType2(TRUE);
+ S9xDeinterleaveType2(true);
}
-void S9xDeinterleaveType2(bool8 reset)
+void S9xDeinterleaveType2(bool reset)
{
if (Settings.DisplayColor == 0xffff
|| Settings.DisplayColor == BUILD_PIXEL(0, 31, 0))
@@ -1068,7 +1068,7 @@ void S9xDeinterleaveType2(bool8 reset)
step >>= 1;
nblocks = step;
- uint8 blocks [256];
+ uint8_t blocks [256];
int i;
for (i = 0; i < nblocks * 2; i++)
@@ -1079,9 +1079,9 @@ void S9xDeinterleaveType2(bool8 reset)
#ifdef DS2_DMA
unsigned int TmpAdj;
- uint8* tmp = (uint8*) AlignedMalloc(0x10000, 32, &TmpAdj);
+ uint8_t* tmp = (uint8_t*) AlignedMalloc(0x10000, 32, &TmpAdj);
#else
- uint8* tmp = (uint8*) malloc(0x10000);
+ uint8_t* tmp = (uint8_t*) malloc(0x10000);
#endif
if (tmp)
@@ -1122,7 +1122,7 @@ void S9xDeinterleaveType2(bool8 reset)
// memmove converted: Different mallocs [Neb]
memcpy(&Memory.ROM [blocks [i] * 0x10000], tmp, 0x10000);
#endif
- uint8 b = blocks [j];
+ uint8_t b = blocks [j];
blocks [j] = blocks [i];
blocks [i] = b;
break;
@@ -1134,40 +1134,40 @@ void S9xDeinterleaveType2(bool8 reset)
}
if (reset)
{
- InitROM(FALSE);
+ InitROM(false);
S9xReset();
}
}
//CRC32 for char arrays
-uint32 caCRC32(uint8* array, uint32 size, register uint32 crc32)
+uint32_t caCRC32(uint8_t* array, uint32_t size, register uint32_t crc32)
{
- register uint32 i;
+ register uint32_t i;
for (i = 0; i < size; i++)
crc32 = ((crc32 >> 8) & 0x00FFFFFF) ^ crc32Table[(crc32 ^ array[i]) & 0xFF];
return ~crc32;
}
-void InitROM(bool8 Interleaved)
+void InitROM(bool Interleaved)
{
SuperFX.nRomBanks = Memory.CalculatedSize >> 15;
Settings.MultiPlayer5Master = Settings.MultiPlayer5;
Settings.MouseMaster = Settings.Mouse;
Settings.SuperScopeMaster = Settings.SuperScope;
Settings.DSP1Master = Settings.ForceDSP1;
- Settings.SuperFX = FALSE;
- Settings.SA1 = FALSE;
- Settings.C4 = FALSE;
- Settings.SDD1 = FALSE;
- Settings.SRTC = FALSE;
- Settings.SPC7110 = FALSE;
- Settings.SPC7110RTC = FALSE;
- Settings.BS = FALSE;
- Settings.OBC1 = FALSE;
- Settings.SETA = FALSE;
+ Settings.SuperFX = false;
+ Settings.SA1 = false;
+ Settings.C4 = false;
+ Settings.SDD1 = false;
+ Settings.SRTC = false;
+ Settings.SPC7110 = false;
+ Settings.SPC7110RTC = false;
+ Settings.BS = false;
+ Settings.OBC1 = false;
+ Settings.SETA = false;
s7r.DataRomSize = 0;
Memory.CalculatedChecksum = 0;
- uint8* RomHeader;
+ uint8_t* RomHeader;
RomHeader = Memory.ROM + 0x7FB0;
@@ -1183,8 +1183,8 @@ void InitROM(bool8 Interleaved)
if (Settings.BS)
{
- Memory.LoROM = TRUE;
- Memory.HiROM = FALSE;
+ Memory.LoROM = true;
+ Memory.HiROM = false;
}
else
@@ -1192,8 +1192,8 @@ void InitROM(bool8 Interleaved)
Settings.BS = (-1 != is_bsx(Memory.ROM + 0xFFC0));
if (Settings.BS)
{
- Memory.HiROM = TRUE;
- Memory.LoROM = FALSE;
+ Memory.HiROM = true;
+ Memory.LoROM = false;
}
}
}
@@ -1210,7 +1210,7 @@ void InitROM(bool8 Interleaved)
// Try to auto-detect the DSP1 chip
if (!Settings.ForceNoDSP1 &&
(Memory.ROMType & 0xf) >= 3 && (Memory.ROMType & 0xf0) == 0)
- Settings.DSP1Master = TRUE;
+ Settings.DSP1Master = true;
if (Memory.HiROM)
{
@@ -1237,11 +1237,11 @@ void InitROM(bool8 Interleaved)
Settings.SuperFX = Settings.ForceSuperFX;
if (Memory.ROMType == 0x25)
- Settings.OBC1 = TRUE;
+ Settings.OBC1 = true;
//BS-X BIOS
if (Memory.ROMType == 0xE5)
- Settings.BS = TRUE;
+ Settings.BS = true;
if ((Memory.ROMType & 0xf0) == 0x10)
Settings.SuperFX = !Settings.ForceNoSuperFX;
@@ -1290,25 +1290,25 @@ void InitROM(bool8 Interleaved)
{
//::SRAM = ROM + 1024 * 1024 * 4;
SuperFXROMMap();
- Settings.MultiPlayer5Master = FALSE;
- //Settings.MouseMaster = FALSE;
- //Settings.SuperScopeMaster = FALSE;
- Settings.DSP1Master = FALSE;
- Settings.SA1 = FALSE;
- Settings.C4 = FALSE;
- Settings.SDD1 = FALSE;
+ Settings.MultiPlayer5Master = false;
+ //Settings.MouseMaster = false;
+ //Settings.SuperScopeMaster = false;
+ Settings.DSP1Master = false;
+ Settings.SA1 = false;
+ Settings.C4 = false;
+ Settings.SDD1 = false;
}
else if (Settings.ForceSA1 ||
(!Settings.ForceNoSA1 && (Memory.ROMSpeed & ~0x10) == 0x23 &&
(Memory.ROMType & 0xf) > 3 && (Memory.ROMType & 0xf0) == 0x30))
{
- Settings.SA1 = TRUE;
- // Settings.MultiPlayer5Master = FALSE;
- //Settings.MouseMaster = FALSE;
- //Settings.SuperScopeMaster = FALSE;
- Settings.DSP1Master = FALSE;
- Settings.C4 = FALSE;
- Settings.SDD1 = FALSE;
+ Settings.SA1 = true;
+ // Settings.MultiPlayer5Master = false;
+ //Settings.MouseMaster = false;
+ //Settings.SuperScopeMaster = false;
+ Settings.DSP1Master = false;
+ Settings.C4 = false;
+ Settings.SDD1 = false;
SA1ROMMap();
}
else if ((Memory.ROMSpeed & ~0x10) == 0x25)
@@ -1319,7 +1319,7 @@ void InitROM(bool8 Interleaved)
strncmp((char*) &Memory.ROM [0x7fc0], "DERBY STALLION 96", 17) == 0)
{
LoROM24MBSMap();
- Settings.DSP1Master = FALSE;
+ Settings.DSP1Master = false;
}
else if (strncmp((char*) &Memory.ROM [0x7fc0], "THOROUGHBRED BREEDER3",
@@ -1327,14 +1327,14 @@ void InitROM(bool8 Interleaved)
strncmp((char*) &Memory.ROM [0x7fc0], "RPG-TCOOL 2", 11) == 0)
{
SRAM512KLoROMMap();
- Settings.DSP1Master = FALSE;
+ Settings.DSP1Master = false;
}
else if (strncmp((char*) &Memory.ROM [0x7fc0], "ADD-ON BASE CASSETE", 19) == 0)
{
- Settings.MultiPlayer5Master = FALSE;
- Settings.MouseMaster = FALSE;
- Settings.SuperScopeMaster = FALSE;
- Settings.DSP1Master = FALSE;
+ Settings.MultiPlayer5Master = false;
+ Settings.MouseMaster = false;
+ Settings.SuperScopeMaster = false;
+ Settings.DSP1Master = false;
SufamiTurboLoROMMap();
Memory.SRAMSize = 3;
}
@@ -1349,8 +1349,8 @@ void InitROM(bool8 Interleaved)
if (Settings.BS)
Memory.ROMRegion = 0;
- uint32 sum1 = 0;
- uint32 sum2 = 0;
+ uint32_t sum1 = 0;
+ uint32_t sum2 = 0;
if (0 == Memory.CalculatedChecksum)
{
int power2 = 0;
@@ -1360,7 +1360,7 @@ void InitROM(bool8 Interleaved)
power2++;
size = 1 << power2;
- uint32 remainder = Memory.CalculatedSize - size;
+ uint32_t remainder = Memory.CalculatedSize - size;
int i;
@@ -1399,9 +1399,9 @@ void InitROM(bool8 Interleaved)
Memory.ROMCRC32 = caCRC32(Memory.ROM, Memory.CalculatedSize, 0xFFFFFFFF);
if (Settings.ForceNTSC)
- Settings.PAL = FALSE;
+ Settings.PAL = false;
else if (Settings.ForcePAL)
- Settings.PAL = TRUE;
+ Settings.PAL = true;
else
{
//Korea refers to South Korea, which uses NTSC
@@ -1410,10 +1410,10 @@ void InitROM(bool8 Interleaved)
case 13:
case 1:
case 0:
- Settings.PAL = FALSE;
+ Settings.PAL = false;
break;
default:
- Settings.PAL = TRUE;
+ Settings.PAL = true;
break;
}
}
@@ -1444,7 +1444,7 @@ void InitROM(bool8 Interleaved)
}
if ((Memory.ROMChecksum + Memory.ROMComplementChecksum != 0xffff)
|| Memory.ROMChecksum != Memory.CalculatedChecksum
- || ((uint32)Memory.CalculatedSize > (uint32)(((1 << (Memory.ROMSize - 7)) * 128)
+ || ((uint32_t)Memory.CalculatedSize > (uint32_t)(((1 << (Memory.ROMSize - 7)) * 128)
* 1024)))
{
if (Settings.DisplayColor == 0xffff
@@ -1502,7 +1502,7 @@ void InitROM(bool8 Interleaved)
Settings.ForceInterleaved2 = false;
}
-bool8 LoadSRAM(const char* filename)
+bool LoadSRAM(const char* filename)
{
int size = Memory.SRAMSize ?
(1 << (Memory.SRAMSize + 3)) * 128 : 0;
@@ -1538,23 +1538,23 @@ bool8 LoadSRAM(const char* filename)
if (Settings.SPC7110RTC)
S9xLoadSPC7110RTC(&rtc_f9);
- return (TRUE);
+ return (true);
}
S9xHardResetSRTC();
- return (FALSE);
+ return (false);
}
if (Settings.SDD1)
S9xSDD1LoadLoggedData();
- return (TRUE);
+ return (true);
}
-bool8 SaveSRAM(const char* filename)
+bool SaveSRAM(const char* filename)
{
if (Settings.SuperFX && Memory.ROMType < 0x15)
- return TRUE;
+ return true;
if (Settings.SA1 && Memory.ROMType == 0x34)
- return TRUE;
+ return true;
int size = Memory.SRAMSize ?
(1 << (Memory.SRAMSize + 3)) * 128 : 0;
@@ -1581,10 +1581,10 @@ bool8 SaveSRAM(const char* filename)
if (Settings.SPC7110RTC)
S9xSaveSPC7110RTC(&rtc_f9);
- return (TRUE);
+ return (true);
}
}
- return (FALSE);
+ return (false);
}
void FixROMSpeed()
@@ -1598,7 +1598,7 @@ void FixROMSpeed()
for (c = 0x800; c < 0x1000; c++)
{
if (c & 0x8 || c & 0x400)
- Memory.MemorySpeed [c] = (uint8) CPU.FastROMSpeed;
+ Memory.MemorySpeed [c] = (uint8_t) CPU.FastROMSpeed;
}
}
@@ -1625,7 +1625,7 @@ void WriteProtectROM()
for (c = 0; c < 0x1000; c++)
{
if (Memory.BlockIsROM [c])
- Memory.WriteMap [c] = (uint8*) MAP_NONE;
+ Memory.WriteMap [c] = (uint8_t*) MAP_NONE;
}
}
@@ -1642,11 +1642,11 @@ void MapRAM()
for (i = 0; i < 8; i++)
{
Memory.Map [(c << 4) + 0xF00 + i] = Memory.Map [(c << 4) + 0x700 + i] =
- (uint8*) MAP_LOROM_SRAM;
+ (uint8_t*) MAP_LOROM_SRAM;
Memory.BlockIsRAM [(c << 4) + 0xF00 + i] = Memory.BlockIsRAM [(c << 4) + 0x700 +
- i] = TRUE;
+ i] = true;
Memory.BlockIsROM [(c << 4) + 0xF00 + i] = Memory.BlockIsROM [(c << 4) + 0x700 +
- i] = FALSE;
+ i] = false;
}
}
}
@@ -1658,9 +1658,9 @@ void MapRAM()
int i;
for (i = 0; i < 8; i++)
{
- Memory.Map [(c << 4) + 0x700 + i] = (uint8*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [(c << 4) + 0x700 + i] = TRUE;
- Memory.BlockIsROM [(c << 4) + 0x700 + i] = FALSE;
+ Memory.Map [(c << 4) + 0x700 + i] = (uint8_t*) MAP_LOROM_SRAM;
+ Memory.BlockIsRAM [(c << 4) + 0x700 + i] = true;
+ Memory.BlockIsROM [(c << 4) + 0x700 + i] = false;
}
}
}
@@ -1669,10 +1669,10 @@ void MapRAM()
{
Memory.Map [c + 0x7e0] = Memory.RAM;
Memory.Map [c + 0x7f0] = Memory.RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- Memory.BlockIsROM [c + 0x7e0] = FALSE;
- Memory.BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ Memory.BlockIsROM [c + 0x7e0] = false;
+ Memory.BlockIsROM [c + 0x7f0] = false;
}
WriteProtectROM();
}
@@ -1686,10 +1686,10 @@ void MapExtraRAM()
{
Memory.Map [c + 0x7e0] = Memory.RAM;
Memory.Map [c + 0x7f0] = Memory.RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- Memory.BlockIsROM [c + 0x7e0] = FALSE;
- Memory.BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ Memory.BlockIsROM [c + 0x7e0] = false;
+ Memory.BlockIsROM [c + 0x7f0] = false;
}
// Banks 70->73, S-RAM
@@ -1700,14 +1700,14 @@ void MapExtraRAM()
Memory.Map [c + 0x720] = Memory.SRAM + 0x10000;
Memory.Map [c + 0x730] = Memory.SRAM + 0x18000;
- Memory.BlockIsRAM [c + 0x700] = TRUE;
- Memory.BlockIsROM [c + 0x700] = FALSE;
- Memory.BlockIsRAM [c + 0x710] = TRUE;
- Memory.BlockIsROM [c + 0x710] = FALSE;
- Memory.BlockIsRAM [c + 0x720] = TRUE;
- Memory.BlockIsROM [c + 0x720] = FALSE;
- Memory.BlockIsRAM [c + 0x730] = TRUE;
- Memory.BlockIsROM [c + 0x730] = FALSE;
+ Memory.BlockIsRAM [c + 0x700] = true;
+ Memory.BlockIsROM [c + 0x700] = false;
+ Memory.BlockIsRAM [c + 0x710] = true;
+ Memory.BlockIsROM [c + 0x710] = false;
+ Memory.BlockIsRAM [c + 0x720] = true;
+ Memory.BlockIsROM [c + 0x720] = false;
+ Memory.BlockIsRAM [c + 0x730] = true;
+ Memory.BlockIsROM [c + 0x730] = false;
}
}
@@ -1758,34 +1758,34 @@ void LoROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
if (Settings.SETA == ST_018)
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_SETA_RISC;
- else Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_SETA_RISC;
+ else Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
if (Settings.DSP1Master)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_DSP;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_DSP;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_DSP;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_DSP;
}
else if (Settings.C4)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_C4;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_C4;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_C4;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_C4;
}
else if (Settings.OBC1)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_OBC_RAM;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_OBC_RAM;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_OBC_RAM;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_OBC_RAM;
}
else
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) bytes0x2000 - 0x6000;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) bytes0x2000 - 0x6000;
}
for (i = c + 8; i < c + 16; i++)
@@ -1798,7 +1798,7 @@ void LoROMMap()
e--;
}
Memory.Map [i] = Memory.Map [i + 0x800] = Memory.ROM + (((d) - 1) * 0x8000);
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -1809,8 +1809,8 @@ void LoROMMap()
{
for (i = c + 8; i < c + 16; i++)
{
- Memory.Map [i] = Memory.Map [i + 0x800] = (uint8*) MAP_DSP;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = FALSE;
+ Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*) MAP_DSP;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = false;
}
}
}
@@ -1837,15 +1837,15 @@ void LoROMMap()
}
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
if (Settings.DSP1Master)
{
for (c = 0; c < 0x100; c++)
{
- Memory.Map [c + 0xe00] = (uint8*) MAP_DSP;
- Memory.BlockIsROM [c + 0xe00] = FALSE;
+ Memory.Map [c + 0xe00] = (uint8_t*) MAP_DSP;
+ Memory.BlockIsROM [c + 0xe00] = false;
}
}
@@ -1860,7 +1860,7 @@ void LoROMMap()
bankcount += 0x800; //normalize
for (k = 0x800; k < (bankcount); k += 16)
{
- uint8* bank = 0x8000 + Memory.Map[k + 8];
+ uint8_t* bank = 0x8000 + Memory.Map[k + 8];
for (l = 0; l < 0x8000; l++)
sum += bank[l];
}
@@ -1917,15 +1917,15 @@ void SetaDSPMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) bytes0x2000 - 0x6000;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) bytes0x2000 - 0x6000;
for (i = c + 8; i < c + 16; i++)
{
@@ -1937,7 +1937,7 @@ void SetaDSPMap()
e--;
}
Memory.Map [i] = Memory.Map [i + 0x800] = Memory.ROM + (((d) - 1) * 0x8000);
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -1960,7 +1960,7 @@ void SetaDSPMap()
//only upper half is ROM
for (i = c + 8; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
memset(Memory.SRAM, 0, 0x1000);
@@ -1970,16 +1970,16 @@ void SetaDSPMap()
{
//where does the SETA chip access, anyway?
//please confirm this?
- Memory.Map[c + 0x80 + i] = (uint8*)MAP_SETA_DSP;
- Memory.BlockIsROM [c + 0x80 + i] = FALSE;
- Memory.BlockIsRAM [c + 0x80 + i] = TRUE;
+ Memory.Map[c + 0x80 + i] = (uint8_t*)MAP_SETA_DSP;
+ Memory.BlockIsROM [c + 0x80 + i] = false;
+ Memory.BlockIsRAM [c + 0x80 + i] = true;
}
for (i = 0; i < 0x04; i++)
{
//and this!
- Memory.Map[c + i] = (uint8*)MAP_SETA_DSP;
- Memory.BlockIsROM [c + i] = FALSE;
+ Memory.Map[c + i] = (uint8_t*)MAP_SETA_DSP;
+ Memory.BlockIsROM [c + i] = false;
}
}
@@ -1993,7 +1993,7 @@ void SetaDSPMap()
bankcount += 0x800; //normalize
for (k = 0x800; k < (bankcount); k += 16)
{
- uint8* bank = 0x8000 + Memory.Map[k + 8];
+ uint8_t* bank = 0x8000 + Memory.Map[k + 8];
for (l = 0; l < 0x8000; l++)
sum += bank[l];
}
@@ -2016,37 +2016,37 @@ void BSLoROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) Memory.SRAM;
- Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = TRUE;
-
- // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8 *)MAP_NONE;
- // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8 *)MAP_NONE;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) SRAM;
- Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = TRUE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) Memory.SRAM;
- Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
+
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
+ Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true;
+
+ // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *)MAP_NONE;
+ // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *)MAP_NONE;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
+ Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
+ Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [(c << 11) %
Memory.CalculatedSize] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
for (c = 0; c < 8; c++)
{
- Memory.Map[(c << 4) + 0x105] = (uint8*)MAP_LOROM_SRAM;
- Memory.BlockIsROM [(c << 4) + 0x105] = FALSE;
- Memory.BlockIsRAM [(c << 4) + 0x105] = TRUE;
+ Memory.Map[(c << 4) + 0x105] = (uint8_t*)MAP_LOROM_SRAM;
+ Memory.BlockIsROM [(c << 4) + 0x105] = false;
+ Memory.BlockIsRAM [(c << 4) + 0x105] = true;
}
@@ -2061,7 +2061,7 @@ void BSLoROMMap()
for (i = c; i < c + 16; i++)
{
- BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = TRUE;
+ BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = true;
}
}
*/
@@ -2069,17 +2069,17 @@ void BSLoROMMap()
{
for (i = 0; i < 16; i++)
{
- Memory.Map[0x400 + i + (c << 4)] = (uint8*)MAP_LOROM_SRAM;
- Memory.BlockIsRAM[0x400 + i + (c << 4)] = TRUE;
- Memory.BlockIsROM[0x400 + i + (c << 4)] = FALSE;
+ Memory.Map[0x400 + i + (c << 4)] = (uint8_t*)MAP_LOROM_SRAM;
+ Memory.BlockIsRAM[0x400 + i + (c << 4)] = true;
+ Memory.BlockIsROM[0x400 + i + (c << 4)] = false;
}
}
for (i = 0; i < 0x80; i++)
{
Memory.Map[0x700 + i] = &Memory.BSRAM[0x10000 * (i / 16)];
- Memory.BlockIsRAM[0x700 + i] = TRUE;
- Memory.BlockIsROM[0x700 + i] = FALSE;
+ Memory.BlockIsRAM[0x700 + i] = true;
+ Memory.BlockIsROM[0x700 + i] = false;
}
for (i = 0; i < 8; i++)
{
@@ -2087,16 +2087,16 @@ void BSLoROMMap()
+ (i << 4)] = Memory.Map[0x385 + (i << 4)] = Memory.Map[0x705 + (i << 4)];
Memory.BlockIsRAM[0x205 + (i << 4)] = Memory.BlockIsRAM[0x285 +
(i << 4)] = Memory.BlockIsRAM[0x305 + (i << 4)] = Memory.BlockIsRAM[0x385 +
- (i << 4)] = TRUE;
+ (i << 4)] = true;
Memory.BlockIsROM[0x205 + (i << 4)] = Memory.BlockIsROM[0x285 +
(i << 4)] = Memory.BlockIsROM[0x305 + (i << 4)] = Memory.BlockIsROM[0x385 +
- (i << 4)] = FALSE;
+ (i << 4)] = false;
}
for (c = 0; c < 8; c++)
{
Memory.Map[(c << 4) + 0x005] = Memory.BSRAM - 0x5000;
- Memory.BlockIsROM [(c << 4) + 0x005] = FALSE;
- Memory.BlockIsRAM [(c << 4) + 0x005] = TRUE;
+ Memory.BlockIsROM [(c << 4) + 0x005] = false;
+ Memory.BlockIsRAM [(c << 4) + 0x005] = true;
}
MapRAM();
WriteProtectROM();
@@ -2159,24 +2159,24 @@ void HiROMMap()
for (c = 0; c < 0x400; c += 16)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
if (Settings.DSP1Master)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_DSP;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_DSP;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_DSP;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_DSP;
}
else
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
}
for (i = c + 8; i < c + 16; i++)
@@ -2189,21 +2189,21 @@ void HiROMMap()
e--;
}
Memory.Map [i] = Memory.Map [i + 0x800] = Memory.ROM + (d * 0x10000);
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
// Banks 30->3f and b0->bf, address ranges 6000->7fff is S-RAM.
for (c = 0; c < 16; c++)
{
- Memory.Map [0x306 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0x307 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0xb06 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0xb07 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.BlockIsRAM [0x306 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0x307 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0xb06 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0xb07 + (c << 4)] = TRUE;
+ Memory.Map [0x306 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0x307 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0xb06 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.BlockIsRAM [0x306 + (c << 4)] = true;
+ Memory.BlockIsRAM [0x307 + (c << 4)] = true;
+ Memory.BlockIsRAM [0xb06 + (c << 4)] = true;
+ Memory.BlockIsRAM [0xb07 + (c << 4)] = true;
}
// Banks 40->7f and c0->ff
@@ -2219,7 +2219,7 @@ void HiROMMap()
e--;
}
Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = Memory.ROM + (d * 0x10000);
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
}
@@ -2230,7 +2230,7 @@ void HiROMMap()
int sum = 0;
for (i = 0x40; i < bankmax; i++)
{
- uint8* bank_low = (uint8*)Memory.Map[i << 4];
+ uint8_t* bank_low = (uint8_t*)Memory.Map[i << 4];
for (c = 0; c < 0x10000; c++)
sum += bank_low[c];
}
@@ -2240,7 +2240,7 @@ void HiROMMap()
WriteProtectROM();
}
-void TalesROMMap(bool8 Interleaved)
+void TalesROMMap(bool Interleaved)
{
int c;
int i;
@@ -2253,9 +2253,9 @@ void TalesROMMap(bool8 Interleaved)
SET_UI_COLOR(0, 255, 0);
}
}
- uint32 OFFSET0 = 0x400000;
- uint32 OFFSET1 = 0x400000;
- uint32 OFFSET2 = 0x000000;
+ uint32_t OFFSET0 = 0x400000;
+ uint32_t OFFSET1 = 0x400000;
+ uint32_t OFFSET2 = 0x000000;
if (Interleaved)
{
@@ -2270,27 +2270,27 @@ void TalesROMMap(bool8 Interleaved)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
//makes more sense to map the range here.
//ToP seems to use sram to skip intro???
if (c >= 0x300)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_HIROM_SRAM;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_HIROM_SRAM;
Memory.BlockIsRAM [6 + c] = Memory.BlockIsRAM [7 + c] =
- Memory.BlockIsRAM [0x806 + c] = Memory.BlockIsRAM [0x807 + c] = TRUE;
+ Memory.BlockIsRAM [0x806 + c] = Memory.BlockIsRAM [0x807 + c] = true;
}
else
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
}
for (i = c + 8; i < c + 16; i++)
@@ -2298,8 +2298,8 @@ void TalesROMMap(bool8 Interleaved)
Memory.Map [i] = &Memory.ROM [((c << 12) % (Memory.CalculatedSize - 0x400000)) +
OFFSET0];
Memory.Map [i + 0x800] = &Memory.ROM [((c << 12) % 0x400000) + OFFSET2];
- Memory.BlockIsROM [i] = TRUE;
- Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = true;
+ Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2314,10 +2314,10 @@ void TalesROMMap(bool8 Interleaved)
0x400000)) + OFFSET1];
Memory.Map [i + 0xc00] = &Memory.ROM [((c << 12) % 0x400000) + OFFSET2];
Memory.Map [i + 0xc08] = &Memory.ROM [((c << 12) % 0x400000) + OFFSET2];
- Memory.BlockIsROM [i + 0x400] = TRUE;
- Memory.BlockIsROM [i + 0x408] = TRUE;
- Memory.BlockIsROM [i + 0xc00] = TRUE;
- Memory.BlockIsROM [i + 0xc08] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = true;
+ Memory.BlockIsROM [i + 0x408] = true;
+ Memory.BlockIsROM [i + 0xc00] = true;
+ Memory.BlockIsROM [i + 0xc08] = true;
}
}
@@ -2338,8 +2338,8 @@ void TalesROMMap(bool8 Interleaved)
int sum = 0;
for (i = 0x40; i < 0x80; i++)
{
- uint8* bank_low = (uint8*)Memory.Map[i << 4];
- uint8* bank_high = (uint8*)Memory.Map[(i << 4) + 0x800];
+ uint8_t* bank_low = (uint8_t*)Memory.Map[i << 4];
+ uint8_t* bank_high = (uint8_t*)Memory.Map[(i << 4) + 0x800];
for (c = 0; c < 0x10000; c++)
{
sum += bank_low[c];
@@ -2363,20 +2363,20 @@ void AlphaROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = TRUE;
+ Memory.BlockIsROM [i] = true;
}
}
@@ -2388,7 +2388,7 @@ void AlphaROMMap()
{
Memory.Map [i + 0x400] = &Memory.ROM [(c << 12) % Memory.CalculatedSize];
Memory.Map [i + 0xc00] = &Memory.ROM [(c << 12) % Memory.CalculatedSize];
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
}
@@ -2420,22 +2420,22 @@ void SuperFXROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [0x006 + c] = Memory.Map [0x806 + c] = (uint8*) Memory.SRAM - 0x6000;
- Memory.Map [0x007 + c] = Memory.Map [0x807 + c] = (uint8*) Memory.SRAM - 0x6000;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
+
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [0x006 + c] = Memory.Map [0x806 + c] = (uint8_t*) Memory.SRAM - 0x6000;
+ Memory.Map [0x007 + c] = Memory.Map [0x807 + c] = (uint8_t*) Memory.SRAM - 0x6000;
Memory.BlockIsRAM [0x006 + c] = Memory.BlockIsRAM [0x007 + c] =
- Memory.BlockIsRAM [0x806 + c] = Memory.BlockIsRAM [0x807 + c] = TRUE;
+ Memory.BlockIsRAM [0x806 + c] = Memory.BlockIsRAM [0x807 + c] = true;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2446,7 +2446,7 @@ void SuperFXROMMap()
{
Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &Memory.ROM [(c << 12) %
Memory.CalculatedSize];
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
}
@@ -2455,18 +2455,18 @@ void SuperFXROMMap()
{
Memory.Map [c + 0x7e0] = Memory.RAM;
Memory.Map [c + 0x7f0] = Memory.RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- Memory.BlockIsROM [c + 0x7e0] = FALSE;
- Memory.BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ Memory.BlockIsROM [c + 0x7e0] = false;
+ Memory.BlockIsROM [c + 0x7f0] = false;
}
// Banks 70->71, S-RAM
for (c = 0; c < 32; c++)
{
Memory.Map [c + 0x700] = Memory.SRAM + (((c >> 4) & 1) << 16);
- Memory.BlockIsRAM [c + 0x700] = TRUE;
- Memory.BlockIsROM [c + 0x700] = FALSE;
+ Memory.BlockIsRAM [c + 0x700] = true;
+ Memory.BlockIsROM [c + 0x700] = false;
}
// Replicate the first 2Mb of the ROM at ROM + 2MB such that each 32K
@@ -2506,20 +2506,20 @@ void SA1ROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) &Memory.FillRAM [0x3000]
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) &Memory.FillRAM [0x3000]
- 0x3000;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_BWRAM;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_BWRAM;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_BWRAM;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_BWRAM;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2527,10 +2527,10 @@ void SA1ROMMap()
for (c = 0; c < 0x400; c += 16)
{
for (i = c; i < c + 16; i++)
- Memory.Map [i + 0x400] = (uint8*) &Memory.SRAM [(c << 12) & 0x1ffff];
+ Memory.Map [i + 0x400] = (uint8_t*) &Memory.SRAM [(c << 12) & 0x1ffff];
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = FALSE;
+ Memory.BlockIsROM [i + 0x400] = false;
}
// c0->ff
@@ -2539,7 +2539,7 @@ void SA1ROMMap()
for (i = c; i < c + 16; i++)
{
Memory.Map [i + 0xc00] = &Memory.ROM [(c << 12) % Memory.CalculatedSize];
- Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0xc00] = true;
}
}
@@ -2547,10 +2547,10 @@ void SA1ROMMap()
{
Memory.Map [c + 0x7e0] = Memory.RAM;
Memory.Map [c + 0x7f0] = Memory.RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- Memory.BlockIsROM [c + 0x7e0] = FALSE;
- Memory.BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ Memory.BlockIsROM [c + 0x7e0] = false;
+ Memory.BlockIsROM [c + 0x7f0] = false;
}
WriteProtectROM();
@@ -2564,14 +2564,14 @@ void SA1ROMMap()
for (c = 0; c < 0x400; c += 16)
{
SA1.Map [c + 0] = SA1.Map [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8*) MAP_NONE;
+ SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8_t*) MAP_NONE;
SA1.WriteMap [c + 0] = SA1.WriteMap [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8*) MAP_NONE;
+ SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8_t*) MAP_NONE;
}
// Banks 60->6f
for (c = 0; c < 0x100; c++)
- SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8*) MAP_BWRAM_BITMAP;
+ SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8_t*) MAP_BWRAM_BITMAP;
Memory.BWRAM = Memory.SRAM;
}
@@ -2586,20 +2586,20 @@ void LoROM24MBSMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2608,20 +2608,20 @@ void LoROM24MBSMap()
{
Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000 + 0x200000;
- Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2637,7 +2637,7 @@ void LoROM24MBSMap()
0x200000 - 0x8000];
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
MapExtraRAM();
@@ -2654,19 +2654,19 @@ void SufamiTurboLoROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
+
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -2682,15 +2682,15 @@ void SufamiTurboLoROMMap()
0x200000 - 0x8000];
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
if (Settings.DSP1Master)
{
for (c = 0; c < 0x100; c++)
{
- Memory.Map [c + 0xe00] = (uint8*) MAP_DSP;
- Memory.BlockIsROM [c + 0xe00] = FALSE;
+ Memory.Map [c + 0xe00] = (uint8_t*) MAP_DSP;
+ Memory.BlockIsROM [c + 0xe00] = false;
}
}
@@ -2699,18 +2699,18 @@ void SufamiTurboLoROMMap()
{
Memory.Map [c + 0x7e0] = Memory.RAM;
Memory.Map [c + 0x7f0] = Memory.RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- Memory.BlockIsROM [c + 0x7e0] = FALSE;
- Memory.BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ Memory.BlockIsROM [c + 0x7e0] = false;
+ Memory.BlockIsROM [c + 0x7f0] = false;
}
// Banks 60->67, S-RAM
for (c = 0; c < 0x80; c++)
{
- Memory.Map [c + 0x600] = (uint8*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c + 0x600] = TRUE;
- Memory.BlockIsROM [c + 0x600] = FALSE;
+ Memory.Map [c + 0x600] = (uint8_t*) MAP_LOROM_SRAM;
+ Memory.BlockIsRAM [c + 0x600] = true;
+ Memory.BlockIsROM [c + 0x600] = false;
}
WriteProtectROM();
@@ -2794,30 +2794,30 @@ void SameGameMap()
for (c = 0; c < 0x400; c += 16)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
}
// Banks 30->3f and b0->bf, address ranges 6000->7fff is S-RAM.
for (c = 0; c < 16; c++)
{
- Memory.Map [0x306 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0x307 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0xb06 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0xb07 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.BlockIsRAM [0x306 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0x307 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0xb06 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0xb07 + (c << 4)] = TRUE;
+ Memory.Map [0x306 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0x307 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0xb06 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.BlockIsRAM [0x306 + (c << 4)] = true;
+ Memory.BlockIsRAM [0x307 + (c << 4)] = true;
+ Memory.BlockIsRAM [0xb06 + (c << 4)] = true;
+ Memory.BlockIsRAM [0xb07 + (c << 4)] = true;
}
for c = 0;
@@ -2891,7 +2891,7 @@ c += 16)
int sum = 0;
for (i = 0x40; i < bankmax; i++)
{
- uint8* bank_low = (uint8*)Memory.Map[i << 4];
+ uint8_t* bank_low = (uint8_t*)Memory.Map[i << 4];
for (c = 0; c < 0x10000; c++)
sum += bank_low[c];
}
@@ -2913,20 +2913,20 @@ void GNextROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) &Memory.FillRAM [0x3000]
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) &Memory.FillRAM [0x3000]
- 0x3000;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_BWRAM;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_BWRAM;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_BWRAM;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_BWRAM;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
}
}
@@ -2935,16 +2935,16 @@ void GNextROMMap()
for (c = 0; c < 0x100; c += 16)
{
for (i = c; i < c + 16; i++)
- Memory.Map [i + 0x400] = (uint8*) &SRAM [(c << 12) & 0x1ffff];
+ Memory.Map [i + 0x400] = (uint8_t*) &SRAM [(c << 12) & 0x1ffff];
for (i = c; i < c + 16; i++)
- BlockIsROM [i + 0x400] = FALSE;
+ BlockIsROM [i + 0x400] = false;
}
for (c = 0; c < 0x100; c += 16)
{
for (i = c; i < c + 16; i++)
- Memory.Map [i + 0x700] = (uint8*) &ROMOffset1 [(c << 12) & (Slot1Size - 1)];
+ Memory.Map [i + 0x700] = (uint8_t*) &ROMOffset1 [(c << 12) & (Slot1Size - 1)];
}
// c0->ff
@@ -2953,7 +2953,7 @@ void GNextROMMap()
for (i = c; i < c + 16; i++)
{
Memory.Map [i + 0xc00] = &ROM [(c << 12) % CalculatedSize];
- BlockIsROM [i + 0xc00] = TRUE;
+ BlockIsROM [i + 0xc00] = true;
}
}
@@ -2961,10 +2961,10 @@ void GNextROMMap()
{
Memory.Map [c + 0x7e0] = RAM;
Memory.Map [c + 0x7f0] = RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- BlockIsROM [c + 0x7e0] = FALSE;
- BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ BlockIsROM [c + 0x7e0] = false;
+ BlockIsROM [c + 0x7f0] = false;
}
WriteProtectROM();
@@ -2978,14 +2978,14 @@ void GNextROMMap()
for (c = 0; c < 0x400; c += 16)
{
SA1.Map [c + 0] = SA1.Map [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8*) MAP_NONE;
+ SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8_t*) MAP_NONE;
SA1.WriteMap [c + 0] = SA1.WriteMap [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8*) MAP_NONE;
+ SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8_t*) MAP_NONE;
}
// Banks 60->6f
for (c = 0; c < 0x100; c++)
- SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8*) MAP_BWRAM_BITMAP;
+ SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8_t*) MAP_BWRAM_BITMAP;
BWRAM = SRAM;
}
@@ -2996,10 +2996,10 @@ void SufamiTurboAltROMMap()
int i;
if (Slot1Size != 0)
- Slot1SRAMSize = (1 << ((uint8)ROMOffset1[0x32])) * 1024;
+ Slot1SRAMSize = (1 << ((uint8_t)ROMOffset1[0x32])) * 1024;
else Slot1Size = 0x8000;
if (Slot2Size != 0)
- Slot2SRAMSize = (1 << ((uint8)ROMOffset2[0x32])) * 1024;
+ Slot2SRAMSize = (1 << ((uint8_t)ROMOffset2[0x32])) * 1024;
else Slot2Size = 0x8000;
// Banks 00->3f and 80->bf
@@ -3007,20 +3007,20 @@ void SufamiTurboAltROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
// for (i = c + 8; i < c + 16; i++)
// {
// Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000;
- // BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ // BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
// }
}
@@ -3033,7 +3033,7 @@ void SufamiTurboAltROMMap()
{
Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [((c >> 4) * 0x8000) %
CalculatedSize] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
}
}
@@ -3047,9 +3047,9 @@ void SufamiTurboAltROMMap()
{
Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset1 [(((
c >> 4) * 0x8000) % Slot1Size)] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
}
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8*)MAP_NONE;
+ else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
}
}
@@ -3062,9 +3062,9 @@ void SufamiTurboAltROMMap()
{
Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[(((
c >> 4) * 0x8000) % Slot2Size)];
- BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
}
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8*)MAP_NONE;
+ else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
}
for (i = c + 8; i < c + 16; i++)
@@ -3073,9 +3073,9 @@ void SufamiTurboAltROMMap()
{
Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[(((
c >> 4) * 0x8000) % Slot2Size)] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = TRUE;
+ BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
}
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8*)MAP_NONE;
+ else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
}
@@ -3086,18 +3086,18 @@ void SufamiTurboAltROMMap()
{
for (c = 0; c < 0x100; c++)
{
- Memory.Map [c + 0xE00] = Memory.Map [c + 0x600] = (uint8*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c + 0xE00] = Memory.BlockIsRAM [c + 0x600] = TRUE;
- BlockIsROM [c + 0xE00] = BlockIsROM [c + 0x600] = FALSE;
+ Memory.Map [c + 0xE00] = Memory.Map [c + 0x600] = (uint8_t*) MAP_LOROM_SRAM;
+ Memory.BlockIsRAM [c + 0xE00] = Memory.BlockIsRAM [c + 0x600] = true;
+ BlockIsROM [c + 0xE00] = BlockIsROM [c + 0x600] = false;
}
}
if (Slot2SRAMSize != 0)
{
for (c = 0; c < 0x100; c++)
{
- Memory.Map [c + 0xF00] = Memory.Map [c + 0x700] = (uint8*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c + 0xF00] = Memory.BlockIsRAM [c + 0x700] = TRUE;
- BlockIsROM [c + 0xF00] = BlockIsROM [c + 0x700] = FALSE;
+ Memory.Map [c + 0xF00] = Memory.Map [c + 0x700] = (uint8_t*) MAP_LOROM_SRAM;
+ Memory.BlockIsRAM [c + 0xF00] = Memory.BlockIsRAM [c + 0x700] = true;
+ BlockIsROM [c + 0xF00] = BlockIsROM [c + 0x700] = false;
}
}
@@ -3106,10 +3106,10 @@ void SufamiTurboAltROMMap()
{
Memory.Map [c + 0x7e0] = RAM;
Memory.Map [c + 0x7f0] = RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = TRUE;
- Memory.BlockIsRAM [c + 0x7f0] = TRUE;
- BlockIsROM [c + 0x7e0] = FALSE;
- BlockIsROM [c + 0x7f0] = FALSE;
+ Memory.BlockIsRAM [c + 0x7e0] = true;
+ Memory.BlockIsRAM [c + 0x7f0] = true;
+ BlockIsROM [c + 0x7e0] = false;
+ BlockIsROM [c + 0x7f0] = false;
}
WriteProtectROM();
@@ -3127,20 +3127,20 @@ void SRAM512KLoROMMap()
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [c << 11] - 0x8000;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -3156,7 +3156,7 @@ void SRAM512KLoROMMap()
0x200000 - 0x8000];
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
MapExtraRAM();
@@ -3174,32 +3174,32 @@ void BSHiROMMap()
for (c = 0; c < 0x400; c += 16)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
// XXX: How large is SRAM??
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) SRAM;
- Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = TRUE;
- // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8 *) MAP_NONE;
- // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8 *) MAP_NONE;
-
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) SRAM;
- Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = TRUE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8 *) Memory.SRAM;
- Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = TRUE;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
+ Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true;
+ // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *) MAP_NONE;
+ // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *) MAP_NONE;
+
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
+ Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM;
+ // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
+ Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [(c << 12) %
Memory.CalculatedSize];
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
@@ -3212,12 +3212,12 @@ void BSHiROMMap()
for (i = c; i < c + 8; i++)
{
Memory.Map [i] = &Memory.ROM [0x400000 + (c << 11)];
- Memory.BlockIsRAM [i] = TRUE;
+ Memory.BlockIsRAM [i] = true;
}
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = &Memory.ROM [0x400000 + (c << 11) - 0x8000];
- Memory.BlockIsRAM [i] = TRUE;
+ Memory.BlockIsRAM [i] = true;
}
}
@@ -3228,14 +3228,14 @@ void BSHiROMMap()
{
Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &Memory.ROM [(c << 12) %
Memory.CalculatedSize];
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
}
for (i = 0; i < 0x80; i++)
{
Memory.Map[0x700 + i] = &Memory.BSRAM[0x10000 * (i / 16)];
- Memory.BlockIsRAM[0x700 + i] = TRUE;
- Memory.BlockIsROM[0x700 + i] = FALSE;
+ Memory.BlockIsRAM[0x700 + i] = true;
+ Memory.BlockIsROM[0x700 + i] = false;
}
for (i = 0; i < 8; i++)
{
@@ -3243,24 +3243,24 @@ void BSHiROMMap()
+ (i << 4)] = Memory.Map[0x385 + (i << 4)] = Memory.Map[0x705 + (i << 4)];
Memory.BlockIsRAM[0x205 + (i << 4)] = Memory.BlockIsRAM[0x285 +
(i << 4)] = Memory.BlockIsRAM[0x305 + (i << 4)] = Memory.BlockIsRAM[0x385 +
- (i << 4)] = TRUE;
+ (i << 4)] = true;
Memory.BlockIsROM[0x205 + (i << 4)] = Memory.BlockIsROM[0x285 +
(i << 4)] = Memory.BlockIsROM[0x305 + (i << 4)] = Memory.BlockIsROM[0x385 +
- (i << 4)] = FALSE;
+ (i << 4)] = false;
}
MapRAM();
WriteProtectROM();
}
-void JumboLoROMMap(bool8 Interleaved)
+void JumboLoROMMap(bool Interleaved)
{
int c;
int i;
- uint32 OFFSET0 = 0x400000;
-// uint32 OFFSET1 = 0x400000;
- uint32 OFFSET2 = 0x000000;
+ uint32_t OFFSET0 = 0x400000;
+// uint32_t OFFSET1 = 0x400000;
+ uint32_t OFFSET2 = 0x000000;
if (Interleaved)
{
@@ -3274,27 +3274,27 @@ void JumboLoROMMap(bool8 Interleaved)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
if (Settings.DSP1Master)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_DSP;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_DSP;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_DSP;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_DSP;
}
else if (Settings.C4)
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) MAP_C4;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) MAP_C4;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_C4;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_C4;
}
else
{
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8*) bytes0x2000 - 0x6000;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) bytes0x2000 - 0x6000;
+ Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) bytes0x2000 - 0x6000;
}
for (i = c + 8; i < c + 16; i++)
@@ -3303,7 +3303,7 @@ void JumboLoROMMap(bool8 Interleaved)
OFFSET0] - 0x8000;
Memory.Map [i + 0x800] = &Memory.ROM [((c << 11) % (0x400000)) + OFFSET2] -
0x8000;
- Memory.BlockIsROM [i + 0x800] = Memory.BlockIsROM [i] = TRUE;
+ Memory.BlockIsROM [i + 0x800] = Memory.BlockIsROM [i] = true;
}
}
@@ -3314,8 +3314,8 @@ void JumboLoROMMap(bool8 Interleaved)
{
for (i = c + 8; i < c + 16; i++)
{
- Memory.Map [i + 0x800] = (uint8*) MAP_DSP;
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = FALSE;
+ Memory.Map [i + 0x800] = (uint8_t*) MAP_DSP;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = false;
}
}
}
@@ -3340,14 +3340,14 @@ void JumboLoROMMap(bool8 Interleaved)
}
for (i = c; i < c + 16; i++)
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
//ROM type has to be 64 Mbit header!
int sum = 0, k, l;
for (k = 0; k < 256; k++)
{
- uint8* bank = 0x8000 + Memory.Map[8 + (k <<
+ uint8_t* bank = 0x8000 + Memory.Map[8 + (k <<
4)]; //use upper half of the banks, and adjust for LoROM.
for (l = 0; l < 0x8000; l++)
sum += bank[l];
@@ -3367,38 +3367,38 @@ void SPC7110HiROMMap()
for (c = 0; c < 0x400; c += 16)
{
Memory.Map [c + 0] = Memory.Map [c + 0x800] = Memory.RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = TRUE;
+ Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
Memory.Map [c + 1] = Memory.Map [c + 0x801] = Memory.RAM;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = TRUE;
+ Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8*) MAP_CPU;
+ Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
+ Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
+ Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 6] /*= Memory.Map [c + 0x806]*/ = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [c + 7] /*= Memory.Map [c + 0x807]*/ = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [c + 0x806] = Memory.Map [c + 0x807] = (uint8*) MAP_NONE;
+ Memory.Map [c + 6] /*= Memory.Map [c + 0x806]*/ = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [c + 7] /*= Memory.Map [c + 0x807]*/ = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [c + 0x806] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
{
Memory.Map [i] = Memory.Map [i + 0x800] = &Memory.ROM [(c << 12) %
Memory.CalculatedSize];
- Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = TRUE;
+ Memory.BlockIsROM [i] = Memory.BlockIsROM [i + 0x800] = true;
}
}
// Banks 30->3f and b0->bf, address ranges 6000->7fff is S-RAM.
for (c = 0; c < 16; c++)
{
- Memory.Map [0x306 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0x307 + (c << 4)] = (uint8*) MAP_HIROM_SRAM;
- Memory.Map [0xb06 + (c << 4)] = (uint8*) MAP_NONE;
- Memory.Map [0xb07 + (c << 4)] = (uint8*) MAP_NONE;
- Memory.BlockIsRAM [0x306 + (c << 4)] = TRUE;
- Memory.BlockIsRAM [0x307 + (c << 4)] = TRUE;
- // Memory.BlockIsRAM [0xb06 + (c << 4)] = TRUE;
- // Memory.BlockIsRAM [0xb07 + (c << 4)] = TRUE;
+ Memory.Map [0x306 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0x307 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [0xb06 + (c << 4)] = (uint8_t*) MAP_NONE;
+ Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_NONE;
+ Memory.BlockIsRAM [0x306 + (c << 4)] = true;
+ Memory.BlockIsRAM [0x307 + (c << 4)] = true;
+ // Memory.BlockIsRAM [0xb06 + (c << 4)] = true;
+ // Memory.BlockIsRAM [0xb07 + (c << 4)] = true;
}
// Banks 40->7f and c0->ff
@@ -3408,23 +3408,23 @@ void SPC7110HiROMMap()
{
Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &Memory.ROM [(c << 12) %
Memory.CalculatedSize];
- Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = TRUE;
+ Memory.BlockIsROM [i + 0x400] = Memory.BlockIsROM [i + 0xc00] = true;
}
}
for (c = 0; c < 0x10; c++)
{
- Memory.Map [0x500 + c] = (uint8*)MAP_SPC7110_DRAM;
- Memory.BlockIsROM [0x500 + c] = TRUE;
+ Memory.Map [0x500 + c] = (uint8_t*)MAP_SPC7110_DRAM;
+ Memory.BlockIsROM [0x500 + c] = true;
}
for (c = 0; c < 0x100; c++)
{
- Memory.Map [0xD00 + c] = (uint8*) MAP_SPC7110_ROM;
- Memory.Map [0xE00 + c] = (uint8*) MAP_SPC7110_ROM;
- Memory.Map [0xF00 + c] = (uint8*) MAP_SPC7110_ROM;
+ Memory.Map [0xD00 + c] = (uint8_t*) MAP_SPC7110_ROM;
+ Memory.Map [0xE00 + c] = (uint8_t*) MAP_SPC7110_ROM;
+ Memory.Map [0xF00 + c] = (uint8_t*) MAP_SPC7110_ROM;
Memory.BlockIsROM [0xD00 + c] = Memory.BlockIsROM [0xE00 + c] =
- Memory.BlockIsROM [0xF00 + c] = TRUE;
+ Memory.BlockIsROM [0xF00 + c] = true;
}
S9xSpc7110Init();
@@ -3440,23 +3440,23 @@ void SPC7110HiROMMap()
MapRAM();
WriteProtectROM();
}
-void SPC7110Sram(uint8 newstate)
+void SPC7110Sram(uint8_t newstate)
{
if (newstate & 0x80)
{
- Memory.Map[6] = (uint8*)MAP_HIROM_SRAM;
- Memory.Map[7] = (uint8*)MAP_HIROM_SRAM;
- Memory.Map[0x306] = (uint8*)MAP_HIROM_SRAM;
- Memory.Map[0x307] = (uint8*)MAP_HIROM_SRAM;
+ Memory.Map[6] = (uint8_t*)MAP_HIROM_SRAM;
+ Memory.Map[7] = (uint8_t*)MAP_HIROM_SRAM;
+ Memory.Map[0x306] = (uint8_t*)MAP_HIROM_SRAM;
+ Memory.Map[0x307] = (uint8_t*)MAP_HIROM_SRAM;
}
else
{
- Memory.Map[6] = (uint8*)MAP_RONLY_SRAM;
- Memory.Map[7] = (uint8*)MAP_RONLY_SRAM;
- Memory.Map[0x306] = (uint8*)MAP_RONLY_SRAM;
- Memory.Map[0x307] = (uint8*)MAP_RONLY_SRAM;
+ Memory.Map[6] = (uint8_t*)MAP_RONLY_SRAM;
+ Memory.Map[7] = (uint8_t*)MAP_RONLY_SRAM;
+ Memory.Map[0x306] = (uint8_t*)MAP_RONLY_SRAM;
+ Memory.Map[0x307] = (uint8_t*)MAP_RONLY_SRAM;
}
}
const char* TVStandard()
@@ -3624,9 +3624,9 @@ void ApplyROMFixes()
int c;
for (c = 0xE00; c < 0xE10; c++)
{
- Memory.Map [c] = (uint8*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c] = TRUE;
- Memory.BlockIsROM [c] = FALSE;
+ Memory.Map [c] = (uint8_t*) MAP_LOROM_SRAM;
+ Memory.BlockIsRAM [c] = true;
+ Memory.BlockIsROM [c] = false;
}
WriteProtectROM();
}
@@ -3637,9 +3637,9 @@ void ApplyROMFixes()
int c;
for (c = 0; c < 0xE0; c++)
{
- Memory.Map[c + 0x700] = (uint8*)MAP_LOROM_SRAM;
- Memory.BlockIsROM[c + 0x700] = FALSE;
- Memory.BlockIsRAM[c + 0x700] = TRUE;
+ Memory.Map[c + 0x700] = (uint8_t*)MAP_LOROM_SRAM;
+ Memory.BlockIsROM[c + 0x700] = false;
+ Memory.BlockIsRAM[c + 0x700] = true;
}
WriteProtectROM();
}
@@ -3653,10 +3653,10 @@ void ApplyROMFixes()
{
Memory.Map [c + 6] = Memory.Map [c + 0x806] = Memory.SRAM;
Memory.Map [c + 7] = Memory.Map [c + 0x807] = Memory.SRAM;
- Memory.BlockIsROM [c + 6] = Memory.BlockIsROM [c + 0x806] = FALSE;
- Memory.BlockIsROM [c + 7] = Memory.BlockIsROM [c + 0x807] = FALSE;
- Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = TRUE;
- Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = TRUE;
+ Memory.BlockIsROM [c + 6] = Memory.BlockIsROM [c + 0x806] = false;
+ Memory.BlockIsROM [c + 7] = Memory.BlockIsROM [c + 0x807] = false;
+ Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true;
+ Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true;
}
WriteProtectROM();
}
@@ -3669,28 +3669,28 @@ void ApplyROMFixes()
for (c = 0; c < 0x80; c++)
{
Memory.Map [c + 0x700] = Memory.ROM + 0x200000 + 0x1000 * (c & 0xf0);
- Memory.BlockIsRAM [c + 0x700] = TRUE;
- Memory.BlockIsROM [c + 0x700] = FALSE;
+ Memory.BlockIsRAM [c + 0x700] = true;
+ Memory.BlockIsROM [c + 0x700] = false;
}
for (c = 0; c < 0x400; c += 16)
{
Memory.Map [c + 5] = Memory.Map [c + 0x805] = Memory.ROM + 0x300000;
- Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = TRUE;
+ Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true;
}
WriteProtectROM();
}
if (strncmp(Memory.ROMName, "WAR 2410", 8) == 0)
{
- Memory.Map [0x005] = (uint8*) Memory.RAM;
- Memory.BlockIsRAM [0x005] = TRUE;
- Memory.BlockIsROM [0x005] = FALSE;
+ Memory.Map [0x005] = (uint8_t*) Memory.RAM;
+ Memory.BlockIsRAM [0x005] = true;
+ Memory.BlockIsROM [0x005] = false;
}
if (strcmp(Memory.ROMName, "BATMAN--REVENGE JOKER") == 0)
{
- Memory.HiROM = FALSE;
- Memory.LoROM = TRUE;
+ Memory.HiROM = false;
+ Memory.LoROM = true;
LoROMMap();
}
@@ -3711,7 +3711,7 @@ void ApplyROMFixes()
strncmp(Memory.ROMName, "NHL", 3) == 0 ||
strcmp(Memory.ROMName, "WeaponLord") == 0 ||
strncmp(Memory.ROMName, "WAR 2410", 8) == 0)
- Settings.Shutdown = FALSE;
+ Settings.Shutdown = false;
//APU timing hacks
@@ -3785,7 +3785,7 @@ void ApplyROMFixes()
if ((strcmp(Memory.ROMName, "LEGEND") == 0 && !Settings.PAL) ||
strcmp(Memory.ROMName, "King Arthurs World") == 0)
- SNESGameFixes.EchoOnlyOutput = TRUE;
+ SNESGameFixes.EchoOnlyOutput = true;
Settings.DaffyDuck = (strcmp(Memory.ROMName, "DAFFY DUCK: MARV MISS") == 0) ||
@@ -3805,7 +3805,7 @@ void ApplyROMFixes()
//is this even useful now?
if (strcmp(Memory.ROMName, "ALIENS vs. PREDATOR") == 0)
- SNESGameFixes.alienVSpredetorFix = TRUE;
+ SNESGameFixes.alienVSpredetorFix = true;
if (strcmp(Memory.ROMName, "���̧߰н�") == 0
|| //Super Famista
@@ -3813,10 +3813,10 @@ void ApplyROMFixes()
|| //Super Famista 2
strcmp(Memory.ROMName, "ZENKI TENCHIMEIDOU") == 0 ||
strcmp(Memory.ROMName, "GANBA LEAGUE") == 0)
- SNESGameFixes.APU_OutPorts_ReturnValueFix = TRUE;
+ SNESGameFixes.APU_OutPorts_ReturnValueFix = true;
if (strcmp(Memory.ROMName, "FURAI NO SIREN") == 0)
- SNESGameFixes.SoundEnvelopeHeightReading2 = TRUE;
+ SNESGameFixes.SoundEnvelopeHeightReading2 = true;
//CPU timing hacks
Settings.H_Max = (SNES_CYCLES_PER_SCANLINE *
@@ -3874,7 +3874,7 @@ void ApplyROMFixes()
strcmp(Memory.ROMName, "STAR FOX 2") == 0 ||
strcmp(Memory.ROMName, "YOSSY'S ISLAND") == 0 ||
strcmp(Memory.ROMName, "YOSHI'S ISLAND") == 0)
- CPU.TriedInterleavedMode2 = TRUE;
+ CPU.TriedInterleavedMode2 = true;
#endif
// Start Trek: Deep Sleep 9
@@ -4082,8 +4082,8 @@ void ApplyROMFixes()
for (int i = c; i < c + 16; i++)
{
Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &ROM[c * 0x1000];
- Memory.BlockIsRAM [i + 0x400] = Memory.BlockIsRAM [i + 0xc00] = TRUE;
- BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = FALSE;
+ Memory.BlockIsRAM [i + 0x400] = Memory.BlockIsRAM [i + 0xc00] = true;
+ BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = false;
}
}
WriteProtectROM();
@@ -4136,8 +4136,8 @@ static long ReadInt(FILE* f, unsigned nbytes)
#define IPS_EOF 0x00454F46l
-void CheckForIPSPatch(const char* rom_filename, bool8 header,
- int32* rom_size)
+void CheckForIPSPatch(const char* rom_filename, bool header,
+ int32_t* rom_size)
{
char dir [_MAX_DIR + 1];
char drive [_MAX_DRIVE + 1];
@@ -4163,7 +4163,7 @@ void CheckForIPSPatch(const char* rom_filename, bool8 header,
return;
}
- int32 ofs;
+ int32_t ofs;
for (;;)
{
@@ -4195,7 +4195,7 @@ void CheckForIPSPatch(const char* rom_filename, bool8 header,
rchar = fgetc(patch_file);
if (rchar == EOF)
goto err_eof;
- Memory.ROM [ofs++] = (uint8) rchar;
+ Memory.ROM [ofs++] = (uint8_t) rchar;
}
if (ofs > *rom_size)
*rom_size = ofs;
@@ -4214,7 +4214,7 @@ void CheckForIPSPatch(const char* rom_filename, bool8 header,
goto err_eof;
while (rlen--)
- Memory.ROM [ofs++] = (uint8) rchar;
+ Memory.ROM [ofs++] = (uint8_t) rchar;
if (ofs > *rom_size)
*rom_size = ofs;
@@ -4324,7 +4324,7 @@ int check_char(unsigned c)
return 0;
}
-void ParseSNESHeader(uint8* RomHeader)
+void ParseSNESHeader(uint8_t* RomHeader)
{
Memory.SRAMSize = RomHeader [0x28];
strncpy(Memory.ROMName, (char*) &RomHeader[0x10], ROM_NAME_LEN - 1);
diff --git a/source/memmap.h b/source/memmap.h
index c4902f6..84eca92 100644
--- a/source/memmap.h
+++ b/source/memmap.h
@@ -93,35 +93,35 @@
#include "snes9x.h"
#ifdef FAST_LSB_WORD_ACCESS
-#define READ_WORD(s) (*(uint16 *) (s))
-#define READ_DWORD(s) (*(uint32 *) (s))
-#define WRITE_WORD(s, d) (*(uint16 *) (s)) = (d)
-#define WRITE_DWORD(s, d) (*(uint32 *) (s)) = (d)
+#define READ_WORD(s) (*(uint16_t *) (s))
+#define READ_DWORD(s) (*(uint32_t *) (s))
+#define WRITE_WORD(s, d) (*(uint16_t *) (s)) = (d)
+#define WRITE_DWORD(s, d) (*(uint32_t *) (s)) = (d)
-#define READ_3WORD(s) (0x00ffffff & *(uint32 *) (s))
-#define WRITE_3WORD(s, d) *(uint16 *) (s) = (uint16)(d),\
- *((uint8 *) (s) + 2) = (uint8) ((d) >> 16)
+#define READ_3WORD(s) (0x00ffffff & *(uint32_t *) (s))
+#define WRITE_3WORD(s, d) *(uint16_t *) (s) = (uint16_t)(d),\
+ *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16)
#else
-#define READ_WORD(s) ( *(uint8 *) (s) |\
- (*((uint8 *) (s) + 1) << 8))
-#define READ_DWORD(s) ( *(uint8 *) (s) |\
- (*((uint8 *) (s) + 1) << 8) |\
- (*((uint8 *) (s) + 2) << 16) |\
- (*((uint8 *) (s) + 3) << 24))
-#define WRITE_WORD(s, d) *(uint8 *) (s) = (d), \
- *((uint8 *) (s) + 1) = (d) >> 8
-#define WRITE_DWORD(s, d) *(uint8 *) (s) = (uint8) (d), \
- *((uint8 *) (s) + 1) = (uint8) ((d) >> 8),\
- *((uint8 *) (s) + 2) = (uint8) ((d) >> 16),\
- *((uint8 *) (s) + 3) = (uint8) ((d) >> 24)
-#define WRITE_3WORD(s, d) *(uint8 *) (s) = (uint8) (d), \
- *((uint8 *) (s) + 1) = (uint8) ((d) >> 8),\
- *((uint8 *) (s) + 2) = (uint8) ((d) >> 16)
-#define READ_3WORD(s) ( *(uint8 *) (s) |\
- (*((uint8 *) (s) + 1) << 8) |\
- (*((uint8 *) (s) + 2) << 16))
+#define READ_WORD(s) ( *(uint8_t *) (s) |\
+ (*((uint8_t *) (s) + 1) << 8))
+#define READ_DWORD(s) ( *(uint8_t *) (s) |\
+ (*((uint8_t *) (s) + 1) << 8) |\
+ (*((uint8_t *) (s) + 2) << 16) |\
+ (*((uint8_t *) (s) + 3) << 24))
+#define WRITE_WORD(s, d) *(uint8_t *) (s) = (d), \
+ *((uint8_t *) (s) + 1) = (d) >> 8
+#define WRITE_DWORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), \
+ *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8),\
+ *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16),\
+ *((uint8_t *) (s) + 3) = (uint8_t) ((d) >> 24)
+#define WRITE_3WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), \
+ *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8),\
+ *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16)
+#define READ_3WORD(s) ( *(uint8_t *) (s) |\
+ (*((uint8_t *) (s) + 1) << 8) |\
+ (*((uint8_t *) (s) + 2) << 16))
#endif
#define MEMMAP_BLOCK_SIZE (0x1000)
@@ -140,13 +140,13 @@
#ifdef LOAD_FROM_MEMORY_TEST
bool LoadROM(const struct retro_game_info* game);
#else
-bool8 LoadROM(const char*);
-uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize);
+bool LoadROM(const char*);
+uint32_t FileLoader(uint8_t* buffer, const char* filename, int32_t maxsize);
#endif
-void InitROM(bool8);
-bool8 LoadSRAM(const char*);
-bool8 SaveSRAM(const char*);
-bool8 S9xInitMemory();
+void InitROM(bool);
+bool LoadSRAM(const char*);
+bool SaveSRAM(const char*);
+bool S9xInitMemory();
void S9xDeinitMemory();
void FreeSDD1Data();
@@ -157,7 +157,7 @@ void MapExtraRAM();
char* Safe(const char*);
void BSLoROMMap();
-void JumboLoROMMap(bool8);
+void JumboLoROMMap(bool);
void LoROMMap();
void LoROM24MBSMap();
void SRAM512KLoROMMap();
@@ -165,22 +165,22 @@ void SRAM512KLoROMMap();
void SufamiTurboLoROMMap();
void HiROMMap();
void SuperFXROMMap();
-void TalesROMMap(bool8);
+void TalesROMMap(bool);
void AlphaROMMap();
void SA1ROMMap();
void BSHiROMMap();
void SPC7110HiROMMap();
-void SPC7110Sram(uint8);
+void SPC7110Sram(uint8_t);
void SetaDSPMap();
-bool8 AllASCII(uint8* b, int size);
-int ScoreHiROM(bool8 skip_header, int32 offset);
-int ScoreLoROM(bool8 skip_header, int32 offset);
+bool AllASCII(uint8_t* b, int size);
+int ScoreHiROM(bool skip_header, int32_t offset);
+int ScoreLoROM(bool skip_header, int32_t offset);
#if 0
void SufamiTurboAltROMMap();
#endif
void ApplyROMFixes();
-void CheckForIPSPatch(const char* rom_filename, bool8 header,
- int32* rom_size);
+void CheckForIPSPatch(const char* rom_filename, bool header,
+ int32_t* rom_size);
const char* TVStandard();
const char* Speed();
@@ -192,7 +192,7 @@ const char* Size();
const char* Headers();
const char* ROMID();
const char* CompanyID();
-void ParseSNESHeader(uint8*);
+void ParseSNESHeader(uint8_t*);
enum
{
MAP_PPU, MAP_CPU, MAP_DSP, MAP_LOROM_SRAM, MAP_HIROM_SRAM,
@@ -204,47 +204,47 @@ enum { MAX_ROM_SIZE = 0x800000 };
typedef struct
{
- uint8* RAM;
- uint8* ROM;
- uint8* VRAM;
- uint8* SRAM;
- uint8* BWRAM;
- uint8* FillRAM;
- uint8* C4RAM;
- bool8 HiROM;
- bool8 LoROM;
- uint32 SRAMMask;
- uint8 SRAMSize;
- uint8* Map [MEMMAP_NUM_BLOCKS];
- uint8* WriteMap [MEMMAP_NUM_BLOCKS];
- uint8 MemorySpeed [MEMMAP_NUM_BLOCKS];
- uint8 BlockIsRAM [MEMMAP_NUM_BLOCKS];
- uint8 BlockIsROM [MEMMAP_NUM_BLOCKS];
+ uint8_t* RAM;
+ uint8_t* ROM;
+ uint8_t* VRAM;
+ uint8_t* SRAM;
+ uint8_t* BWRAM;
+ uint8_t* FillRAM;
+ uint8_t* C4RAM;
+ bool HiROM;
+ bool LoROM;
+ uint32_t SRAMMask;
+ uint8_t SRAMSize;
+ uint8_t* Map [MEMMAP_NUM_BLOCKS];
+ uint8_t* WriteMap [MEMMAP_NUM_BLOCKS];
+ uint8_t MemorySpeed [MEMMAP_NUM_BLOCKS];
+ uint8_t BlockIsRAM [MEMMAP_NUM_BLOCKS];
+ uint8_t BlockIsROM [MEMMAP_NUM_BLOCKS];
char ROMName [ROM_NAME_LEN];
char ROMId [5];
char CompanyId [3];
- uint8 ROMSpeed;
- uint8 ROMType;
- uint8 ROMSize;
- int32 ROMFramesPerSecond;
- int32 HeaderCount;
- uint32 CalculatedSize;
- uint32 CalculatedChecksum;
- uint32 ROMChecksum;
- uint32 ROMComplementChecksum;
- uint8* SDD1Index;
- uint8* SDD1Data;
- uint32 SDD1Entries;
- uint32 SDD1LoggedDataCountPrev;
- uint32 SDD1LoggedDataCount;
- uint8 SDD1LoggedData [MEMMAP_MAX_SDD1_LOGGED_ENTRIES];
+ uint8_t ROMSpeed;
+ uint8_t ROMType;
+ uint8_t ROMSize;
+ int32_t ROMFramesPerSecond;
+ int32_t HeaderCount;
+ uint32_t CalculatedSize;
+ uint32_t CalculatedChecksum;
+ uint32_t ROMChecksum;
+ uint32_t ROMComplementChecksum;
+ uint8_t* SDD1Index;
+ uint8_t* SDD1Data;
+ uint32_t SDD1Entries;
+ uint32_t SDD1LoggedDataCountPrev;
+ uint32_t SDD1LoggedDataCount;
+ uint8_t SDD1LoggedData [MEMMAP_MAX_SDD1_LOGGED_ENTRIES];
char ROMFilename [_MAX_PATH];
- uint8 ROMRegion;
- uint32 ROMCRC32;
- uint8 ExtendedFormat;
- uint8* BSRAM;
+ uint8_t ROMRegion;
+ uint32_t ROMCRC32;
+ uint8_t ExtendedFormat;
+ uint8_t* BSRAM;
#if 0
- bool8 LoadMulti(const char*, const char*, const char*);
+ bool LoadMulti(const char*, const char*, const char*);
#endif
} CMemory;
@@ -252,24 +252,24 @@ void ResetSpeedMap();
extern CMemory Memory;
void S9xDeinterleaveMode2();
-bool8 LoadZip(const char* zipname,
- int32* TotalFileSize,
- int32* headers,
- uint8* buffer);
+bool LoadZip(const char* zipname,
+ int32_t* TotalFileSize,
+ int32_t* headers,
+ uint8_t* buffer);
void S9xAutoSaveSRAM();
#ifdef NO_INLINE_SET_GET
-uint8 S9xGetByte(uint32 Address);
-uint16 S9xGetWord(uint32 Address);
-void S9xSetByte(uint8 Byte, uint32 Address);
-void S9xSetWord(uint16 Byte, uint32 Address);
-void S9xSetPCBase(uint32 Address);
-uint8* S9xGetMemPointer(uint32 Address);
-uint8* GetBasePointer(uint32 Address);
-
-extern uint8 OpenBus;
+uint8_t S9xGetByte(uint32_t Address);
+uint16_t S9xGetWord(uint32_t Address);
+void S9xSetByte(uint8_t Byte, uint32_t Address);
+void S9xSetWord(uint16_t Byte, uint32_t Address);
+void S9xSetPCBase(uint32_t Address);
+uint8_t* S9xGetMemPointer(uint32_t Address);
+uint8_t* GetBasePointer(uint32_t Address);
+
+extern uint8_t OpenBus;
#else
#define INLINE static inline
diff --git a/source/missing.h b/source/missing.h
index 7762194..d4a9b8a 100644
--- a/source/missing.h
+++ b/source/missing.h
@@ -92,71 +92,71 @@
struct HDMA
{
- uint8 used;
- uint8 bbus_address;
- uint8 abus_bank;
- uint16 abus_address;
- uint8 indirect_address;
- uint8 force_table_address_write;
- uint8 force_table_address_read;
- uint8 line_count_write;
- uint8 line_count_read;
+ uint8_t used;
+ uint8_t bbus_address;
+ uint8_t abus_bank;
+ uint16_t abus_address;
+ uint8_t indirect_address;
+ uint8_t force_table_address_write;
+ uint8_t force_table_address_read;
+ uint8_t line_count_write;
+ uint8_t line_count_read;
};
struct Missing
{
- uint8 emulate6502;
- uint8 decimal_mode;
- uint8 mv_8bit_index;
- uint8 mv_8bit_acc;
- uint8 interlace;
- uint8 lines_239;
- uint8 pseudo_512;
+ uint8_t emulate6502;
+ uint8_t decimal_mode;
+ uint8_t mv_8bit_index;
+ uint8_t mv_8bit_acc;
+ uint8_t interlace;
+ uint8_t lines_239;
+ uint8_t pseudo_512;
struct HDMA hdma [8];
- uint8 modes [8];
- uint8 mode7_fx;
- uint8 mode7_flip;
- uint8 mode7_bgmode;
- uint8 direct;
- uint8 matrix_multiply;
- uint8 oam_read;
- uint8 vram_read;
- uint8 cgram_read;
- uint8 wram_read;
- uint8 dma_read;
- uint8 vram_inc;
- uint8 vram_full_graphic_inc;
- uint8 virq;
- uint8 hirq;
- uint16 virq_pos;
- uint16 hirq_pos;
- uint8 h_v_latch;
- uint8 h_counter_read;
- uint8 v_counter_read;
- uint8 fast_rom;
- uint8 window1 [6];
- uint8 window2 [6];
- uint8 sprite_priority_rotation;
- uint8 subscreen;
- uint8 subscreen_add;
- uint8 subscreen_sub;
- uint8 fixed_colour_add;
- uint8 fixed_colour_sub;
- uint8 mosaic;
- uint8 sprite_double_height;
- uint8 dma_channels;
- uint8 dma_this_frame;
- uint8 oam_address_read;
- uint8 bg_offset_read;
- uint8 matrix_read;
- uint8 hdma_channels;
- uint8 hdma_this_frame;
- uint16 unknownppu_read;
- uint16 unknownppu_write;
- uint16 unknowncpu_read;
- uint16 unknowncpu_write;
- uint16 unknowndsp_read;
- uint16 unknowndsp_write;
+ uint8_t modes [8];
+ uint8_t mode7_fx;
+ uint8_t mode7_flip;
+ uint8_t mode7_bgmode;
+ uint8_t direct;
+ uint8_t matrix_multiply;
+ uint8_t oam_read;
+ uint8_t vram_read;
+ uint8_t cgram_read;
+ uint8_t wram_read;
+ uint8_t dma_read;
+ uint8_t vram_inc;
+ uint8_t vram_full_graphic_inc;
+ uint8_t virq;
+ uint8_t hirq;
+ uint16_t virq_pos;
+ uint16_t hirq_pos;
+ uint8_t h_v_latch;
+ uint8_t h_counter_read;
+ uint8_t v_counter_read;
+ uint8_t fast_rom;
+ uint8_t window1 [6];
+ uint8_t window2 [6];
+ uint8_t sprite_priority_rotation;
+ uint8_t subscreen;
+ uint8_t subscreen_add;
+ uint8_t subscreen_sub;
+ uint8_t fixed_colour_add;
+ uint8_t fixed_colour_sub;
+ uint8_t mosaic;
+ uint8_t sprite_double_height;
+ uint8_t dma_channels;
+ uint8_t dma_this_frame;
+ uint8_t oam_address_read;
+ uint8_t bg_offset_read;
+ uint8_t matrix_read;
+ uint8_t hdma_channels;
+ uint8_t hdma_this_frame;
+ uint16_t unknownppu_read;
+ uint16_t unknownppu_write;
+ uint16_t unknowncpu_read;
+ uint16_t unknowncpu_write;
+ uint16_t unknowndsp_read;
+ uint16_t unknowndsp_write;
};
struct Missing missing;
diff --git a/source/obc1.c b/source/obc1.c
index 1bc8db8..0a4993a 100644
--- a/source/obc1.c
+++ b/source/obc1.c
@@ -90,13 +90,13 @@
#include "memmap.h"
#include "obc1.h"
-static uint8* OBC1_RAM = NULL;
+static uint8_t* OBC1_RAM = NULL;
int OBC1_Address;
int OBC1_BasePtr;
int OBC1_Shift;
-uint8 GetOBC1(uint16 Address)
+uint8_t GetOBC1(uint16_t Address)
{
switch (Address)
{
@@ -119,7 +119,7 @@ uint8 GetOBC1(uint16 Address)
return OBC1_RAM[Address & 0x1fff];
}
-void SetOBC1(uint8 Byte, uint16 Address)
+void SetOBC1(uint8_t Byte, uint16_t Address)
{
switch (Address)
{
@@ -181,12 +181,12 @@ void SetOBC1(uint8 Byte, uint16 Address)
}
}
-uint8* GetBasePointerOBC1(uint32 Address)
+uint8_t* GetBasePointerOBC1(uint32_t Address)
{
return Memory.FillRAM;
}
-uint8* GetMemPointerOBC1(uint32 Address)
+uint8_t* GetMemPointerOBC1(uint32_t Address)
{
return (Memory.FillRAM + (Address & 0xffff));
}
diff --git a/source/obc1.h b/source/obc1.h
index b2ef338..e0c475c 100644
--- a/source/obc1.h
+++ b/source/obc1.h
@@ -90,11 +90,11 @@
#ifndef _OBC1_H_
#define _OBC1_H_
-uint8 GetOBC1(uint16 Address);
-void SetOBC1(uint8 Byte, uint16 Address);
-uint8* GetBasePointerOBC1(uint32 Address);
-uint8* GetMemPointerOBC1(uint32 Address);
-void ResetOBC1();//bool8 full);
+uint8_t GetOBC1(uint16_t Address);
+void SetOBC1(uint8_t Byte, uint16_t Address);
+uint8_t* GetBasePointerOBC1(uint32_t Address);
+uint8_t* GetMemPointerOBC1(uint32_t Address);
+void ResetOBC1();//bool full);
#endif
diff --git a/source/port.h b/source/port.h
index 952aebf..264425f 100644
--- a/source/port.h
+++ b/source/port.h
@@ -144,62 +144,10 @@ int strcasecmp(const char* s1, const char* s2);
#define USE_X86_ASM
#endif
-#ifndef snes9x_types_defined
-#define snes9x_types_defined
-
-typedef unsigned char bool8;
-
-/* FIXME: Refactor this by moving out the BORLAND part and unifying typedefs */
-#ifndef __WIN32__
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef signed char int8;
-typedef short int16;
-typedef int int32;
-typedef unsigned int uint32;
-# ifdef __GNUC__ /* long long is not part of ISO C++ */
-__extension__
-# endif
-typedef long long int64;
-#else /* __WIN32__ */
-
-# ifdef __BORLANDC__
-# include <systypes.h>
-# else
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef signed char int8;
-typedef short int16;
-
-# ifndef WSAAPI
-/* winsock2.h typedefs int32 as well. */
-typedef long int32;
-
-# define PLAT_SOUND_BUFFER SoundBuffer
-# define RIGHTSHIFT_IS_SAR
-# endif
-
-typedef unsigned int uint32;
-
-# endif /* __BORLANDC__ */
-
-typedef __int64 int64;
-
-#endif /* __WIN32__ */
-#endif /* snes9x_types_defined */
#include "pixform.h"
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
#ifndef __WIN32__
#ifndef PATH_MAX
@@ -286,15 +234,7 @@ void MixSound(void);
#define STATIC static
#endif
-#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
-/* Hack applied for MSVC when compiling in C89 mode
- * as it isn't C99-compliant. */
-#define bool unsigned char
-#define true 1
-#define false 0
-#else
-#include <stdbool.h>
-#endif
+#include <libretro.h>
#endif
diff --git a/source/ppu.c b/source/ppu.c
index 1b43cba..d3fdb20 100644
--- a/source/ppu.c
+++ b/source/ppu.c
@@ -105,10 +105,10 @@
#include "fxinst.h"
extern struct FxInit_s SuperFX;
-uint32 justifiers = 0xFFFF00AA;
-uint8 in_bit = 0;
+uint32_t justifiers = 0xFFFF00AA;
+uint8_t in_bit = 0;
-extern uint8* HDMAMemPointers [8];
+extern uint8_t* HDMAMemPointers [8];
void S9xLatchCounters(bool force)
{
@@ -120,8 +120,8 @@ void S9xLatchCounters(bool force)
# endif
#endif
PPU.HVBeamCounterLatched = 1;
- PPU.VBeamPosLatched = (uint16) CPU.V_Counter;
- PPU.HBeamPosLatched = (uint16)((CPU.Cycles * SNES_HCOUNTER_MAX) /
+ PPU.VBeamPosLatched = (uint16_t) CPU.V_Counter;
+ PPU.HBeamPosLatched = (uint16_t)((CPU.Cycles * SNES_HCOUNTER_MAX) /
Settings.H_Max);
// Causes screen flicker for Yoshi's Island if uncommented
@@ -200,9 +200,9 @@ void S9xFixColourBrightness()
}
}
-static void S9xSetSuperFX(uint8 Byte, uint16 Address)
+static void S9xSetSuperFX(uint8_t Byte, uint16_t Address)
{
- uint8 old_fill_ram;
+ uint8_t old_fill_ram;
if (!Settings.SuperFX)
return;
@@ -258,7 +258,7 @@ static void S9xSetSuperFX(uint8 Byte, uint16 Address)
/* S9xSetPPU() */
/* This function sets a PPU Register to a specific byte */
/******************************************************************************/
-void S9xSetPPU(uint8 Byte, uint16 Address)
+void S9xSetPPU(uint8_t Byte, uint16_t Address)
{
// fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, Byte, Address);
if (Address <= 0x2183)
@@ -272,8 +272,8 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
FLUSH_REDRAW();
if (PPU.Brightness != (Byte & 0xF))
{
- IPPU.ColorsChanged = TRUE;
- IPPU.DirectColourMapsNeedRebuild = TRUE;
+ IPPU.ColorsChanged = true;
+ IPPU.DirectColourMapsNeedRebuild = true;
PPU.Brightness = Byte & 0xF;
S9xFixColourBrightness();
if (PPU.Brightness > IPPU.MaxBrightness)
@@ -281,7 +281,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
}
if ((Memory.FillRAM[0x2100] & 0x80) != (Byte & 0x80))
{
- IPPU.ColorsChanged = TRUE;
+ IPPU.ColorsChanged = true;
PPU.ForcedBlanking = (Byte >> 7) & 1;
}
}
@@ -295,7 +295,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
PPU.OBJNameBase = (Byte & 3) << 14;
PPU.OBJNameSelect = ((Byte >> 3) & 3) << 13;
PPU.OBJSizeSelect = (Byte >> 5) & 7;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
break;
@@ -308,7 +308,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
break;
@@ -323,7 +323,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
else
@@ -331,7 +331,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (PPU.FirstSprite != 0)
{
PPU.FirstSprite = 0;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
PPU.OAMFlip = 0;
@@ -461,7 +461,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
case 0x2115:
// VRAM byte/word access flag and increment
- PPU.VMA.High = (Byte & 0x80) == 0 ? FALSE : TRUE;
+ PPU.VMA.High = (Byte & 0x80) == 0 ? false : true;
switch (Byte & 3)
{
case 0:
@@ -477,10 +477,10 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
}
if (Byte & 0x0c)
{
- static uint16 IncCount [4] = { 0, 32, 64, 128 };
- static uint16 Shift [4] = { 0, 5, 6, 7 };
+ static uint16_t IncCount [4] = { 0, 32, 64, 128 };
+ static uint16_t Shift [4] = { 0, 5, 6, 7 };
// PPU.VMA.Increment = 1;
- uint8 i = (Byte & 0x0c) >> 2;
+ uint8_t i = (Byte & 0x0c) >> 2;
PPU.VMA.FullGraphicCount = IncCount [i];
PPU.VMA.Mask1 = IncCount [i] * 8 - 1;
PPU.VMA.Shift = Shift [i];
@@ -496,9 +496,9 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
#ifdef CORRECT_VRAM_READS
if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xFFFF));
@@ -507,7 +507,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) &
0xffff));
#else
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
break;
@@ -518,9 +518,9 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
#ifdef CORRECT_VRAM_READS
if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xFFFF));
@@ -529,14 +529,14 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) &
0xffff));
#else
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
break;
case 0x2118:
// VRAM write data (low)
#ifndef CORRECT_VRAM_READS
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
REGISTER_2118(Byte);
break;
@@ -544,7 +544,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
case 0x2119:
// VRAM write data (high)
#ifndef CORRECT_VRAM_READS
- IPPU.FirstVRAMRead = TRUE;
+ IPPU.FirstVRAMRead = true;
#endif
REGISTER_2119(Byte);
break;
@@ -564,12 +564,12 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
case 0x211b:
// Mode 7 matrix A (low & high)
PPU.MatrixA = ((PPU.MatrixA >> 8) & 0xff) | (Byte << 8);
- PPU.Need16x8Mulitply = TRUE;
+ PPU.Need16x8Mulitply = true;
break;
case 0x211c:
// Mode 7 matrix B (low & high)
PPU.MatrixB = ((PPU.MatrixB >> 8) & 0xff) | (Byte << 8);
- PPU.Need16x8Mulitply = TRUE;
+ PPU.Need16x8Mulitply = true;
break;
case 0x211d:
// Mode 7 matrix C (low & high)
@@ -612,7 +612,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
PPU.ClipWindow1Inside [1] = !(Byte & 0x10);
PPU.ClipWindow2Inside [0] = !(Byte & 0x04);
PPU.ClipWindow2Inside [1] = !(Byte & 0x40);
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2124:
@@ -628,7 +628,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
PPU.ClipWindow1Inside [3] = !(Byte & 0x10);
PPU.ClipWindow2Inside [2] = !(Byte & 0x04);
PPU.ClipWindow2Inside [3] = !(Byte & 0x40);
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2125:
@@ -644,7 +644,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
PPU.ClipWindow1Inside [5] = !(Byte & 0x10);
PPU.ClipWindow2Inside [4] = !(Byte & 0x04);
PPU.ClipWindow2Inside [5] = !(Byte & 0x40);
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2126:
@@ -653,7 +653,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
{
FLUSH_REDRAW();
PPU.Window1Left = Byte;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2127:
@@ -662,7 +662,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
{
FLUSH_REDRAW();
PPU.Window1Right = Byte;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2128:
@@ -671,7 +671,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
{
FLUSH_REDRAW();
PPU.Window2Left = Byte;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2129:
@@ -680,7 +680,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
{
FLUSH_REDRAW();
PPU.Window2Right = Byte;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x212a:
@@ -692,7 +692,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
PPU.ClipWindowOverlapLogic [1] = (Byte & 0x0c) >> 2;
PPU.ClipWindowOverlapLogic [2] = (Byte & 0x30) >> 4;
PPU.ClipWindowOverlapLogic [3] = (Byte & 0xc0) >> 6;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x212b:
@@ -702,7 +702,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
FLUSH_REDRAW();
PPU.ClipWindowOverlapLogic [4] = Byte & 0x03;
PPU.ClipWindowOverlapLogic [5] = (Byte & 0x0c) >> 2;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x212c:
@@ -710,7 +710,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (Byte != Memory.FillRAM [0x212c])
{
FLUSH_REDRAW();
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
Memory.FillRAM [Address] = Byte;
return;
}
@@ -720,7 +720,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (Byte != Memory.FillRAM [0x212d])
{
FLUSH_REDRAW();
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
Memory.FillRAM [Address] = Byte;
return;
}
@@ -732,7 +732,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (Byte != Memory.FillRAM [Address])
{
FLUSH_REDRAW();
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2130:
@@ -740,7 +740,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
if (Byte != Memory.FillRAM [0x2130])
{
FLUSH_REDRAW();
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
}
break;
case 0x2131:
@@ -785,7 +785,7 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
{
FLUSH_REDRAW();
if ((Memory.FillRAM [0x2133] ^ Byte) & 2)
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
if (PPU.BGMode == 5 || PPU.BGMode == 6)
IPPU.Interlace = Byte & 1;
IPPU.InterlaceSprites = 0;
@@ -950,9 +950,9 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
/* S9xGetPPU() */
/* This function retrieves a PPU Register */
/******************************************************************************/
-uint8 S9xGetPPU(uint16 Address)
+uint8_t S9xGetPPU(uint16_t Address)
{
- uint8 byte = OpenBus;
+ uint8_t byte = OpenBus;
if (Address < 0x2100) //not a real PPU reg
return OpenBus; //treat as unmapped memory returning last byte on the bus
if (Address <= 0x2190)
@@ -1028,12 +1028,12 @@ uint8 S9xGetPPU(uint16 Address)
// 16bit x 8bit multiply read result.
if (PPU.Need16x8Mulitply)
{
- int32 r = (int32) PPU.MatrixA * (int32)(PPU.MatrixB >> 8);
+ int32_t r = (int32_t) PPU.MatrixA * (int32_t)(PPU.MatrixB >> 8);
- Memory.FillRAM[0x2134] = (uint8) r;
- Memory.FillRAM[0x2135] = (uint8)(r >> 8);
- Memory.FillRAM[0x2136] = (uint8)(r >> 16);
- PPU.Need16x8Mulitply = FALSE;
+ Memory.FillRAM[0x2134] = (uint8_t) r;
+ Memory.FillRAM[0x2135] = (uint8_t)(r >> 8);
+ Memory.FillRAM[0x2136] = (uint8_t)(r >> 16);
+ PPU.Need16x8Mulitply = false;
}
return (PPU.OpenBus1 = Memory.FillRAM[Address]);
case 0x2137:
@@ -1053,7 +1053,7 @@ uint8 S9xGetPPU(uint16 Address)
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
}
@@ -1068,7 +1068,7 @@ uint8 S9xGetPPU(uint16 Address)
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
}
@@ -1083,9 +1083,9 @@ uint8 S9xGetPPU(uint16 Address)
{
if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xFFFF));
@@ -1100,9 +1100,9 @@ uint8 S9xGetPPU(uint16 Address)
byte = Memory.VRAM[(PPU.VMA.Address << 1) & 0xFFFF];
else if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address - 1;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address - 1;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
byte = Memory.VRAM [((address << 1) - 2) & 0xFFFF];
@@ -1113,7 +1113,7 @@ uint8 S9xGetPPU(uint16 Address)
if (!PPU.VMA.High)
{
PPU.VMA.Address += PPU.VMA.Increment;
- IPPU.FirstVRAMRead = FALSE;
+ IPPU.FirstVRAMRead = false;
}
#endif
PPU.OpenBus1 = byte;
@@ -1126,9 +1126,9 @@ uint8 S9xGetPPU(uint16 Address)
{
if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xFFFF));
@@ -1143,9 +1143,9 @@ uint8 S9xGetPPU(uint16 Address)
byte = Memory.VRAM[((PPU.VMA.Address << 1) + 1) & 0xffff];
else if (PPU.VMA.FullGraphicCount)
{
- uint32 addr = PPU.VMA.Address - 1;
- uint32 rem = addr & PPU.VMA.Mask1;
- uint32 address = (addr & ~PPU.VMA.Mask1) +
+ uint32_t addr = PPU.VMA.Address - 1;
+ uint32_t rem = addr & PPU.VMA.Mask1;
+ uint32_t address = (addr & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
byte = Memory.VRAM [((address << 1) - 1) & 0xFFFF];
@@ -1155,7 +1155,7 @@ uint8 S9xGetPPU(uint16 Address)
if (PPU.VMA.High)
{
PPU.VMA.Address += PPU.VMA.Increment;
- IPPU.FirstVRAMRead = FALSE;
+ IPPU.FirstVRAMRead = false;
}
#endif
PPU.OpenBus1 = byte;
@@ -1178,7 +1178,7 @@ uint8 S9xGetPPU(uint16 Address)
| ((PPU.HBeamPosLatched >> 8) & 0x01);
else
- byte = (uint8)PPU.HBeamPosLatched;
+ byte = (uint8_t)PPU.HBeamPosLatched;
PPU.OpenBus2 = byte;
PPU.HBeamFlip ^= 1;
break;
@@ -1189,7 +1189,7 @@ uint8 S9xGetPPU(uint16 Address)
byte = (PPU.OpenBus2 & 0xfe)
| ((PPU.VBeamPosLatched >> 8) & 0x01);
else
- byte = (uint8)PPU.VBeamPosLatched;
+ byte = (uint8_t)PPU.VBeamPosLatched;
PPU.OpenBus2 = byte;
PPU.VBeamFlip ^= 1;
break;
@@ -1275,7 +1275,7 @@ uint8 S9xGetPPU(uint16 Address)
case 0x217f:
#ifndef USE_BLARGG_APU
#ifdef SPCTOOL
- return ((uint8) _SPCOutP [Address & 3]);
+ return ((uint8_t) _SPCOutP [Address & 3]);
#else
// CPU.Flags |= DEBUG_MODE_FLAG;
#ifdef SPC700_SHUTDOWN
@@ -1290,7 +1290,7 @@ uint8 S9xGetPPU(uint16 Address)
if (SNESGameFixes.APU_OutPorts_ReturnValueFix &&
Address >= 0x2140 && Address <= 0x2143 && !CPU.V_Counter)
{
- return (uint8)((Address & 1) ? ((rand() & 0xff00) >> 8) :
+ return (uint8_t)((Address & 1) ? ((rand() & 0xff00) >> 8) :
(rand() & 0xff));
}
@@ -1302,7 +1302,7 @@ uint8 S9xGetPPU(uint16 Address)
case 0:
case 1:
case 3:
- CPU.BranchSkip = TRUE;
+ CPU.BranchSkip = true;
break;
case 2:
break;
@@ -1400,7 +1400,7 @@ uint8 S9xGetPPU(uint16 Address)
/* S9xSetCPU() */
/* This function sets a CPU/DMA Register to a specific byte */
/******************************************************************************/
-void S9xSetCPU(uint8 byte, uint16 Address)
+void S9xSetCPU(uint8_t byte, uint16_t Address)
{
int d;
// fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, byte, Address);
@@ -1435,7 +1435,7 @@ void S9xSetCPU(uint8 byte, uint16 Address)
//if(!SNESGameFixes.umiharakawaseFix && PPU.IRQVBeamPos==262) fprintf(stderr, "PPU.IRQVBeamPos = %d, CPU.V_Counter = %d\n", PPU.IRQVBeamPos, CPU.V_Counter);
if (!PPU.VTimerEnabled)
{
- PPU.VTimerEnabled = TRUE;
+ PPU.VTimerEnabled = true;
if (PPU.HTimerEnabled)
S9xUpdateHTimer();
else if (PPU.IRQVBeamPos == CPU.V_Counter)
@@ -1444,7 +1444,7 @@ void S9xSetCPU(uint8 byte, uint16 Address)
}
else
{
- PPU.VTimerEnabled = FALSE;
+ PPU.VTimerEnabled = false;
// if (SNESGameFixes.umiharakawaseFix)
// byte &= ~0x20;
}
@@ -1453,7 +1453,7 @@ void S9xSetCPU(uint8 byte, uint16 Address)
{
if (!PPU.HTimerEnabled)
{
- PPU.HTimerEnabled = TRUE;
+ PPU.HTimerEnabled = true;
S9xUpdateHTimer();
}
}
@@ -1461,7 +1461,7 @@ void S9xSetCPU(uint8 byte, uint16 Address)
{
// No need to check for HTimer being disabled as the scanline
// event trigger code won't trigger an H-IRQ unless its enabled.
- PPU.HTimerEnabled = FALSE;
+ PPU.HTimerEnabled = false;
PPU.HTimerPosition = Settings.H_Max + 1;
}
if (!Settings.DaffyDuck)
@@ -1480,7 +1480,7 @@ void S9xSetCPU(uint8 byte, uint16 Address)
!CPU.NMIActive)
{
CPU.Flags |= NMI_FLAG;
- CPU.NMIActive = TRUE;
+ CPU.NMIActive = true;
CPU.NMICycleCount = CPU.NMITriggerPoint;
}
break;
@@ -1495,14 +1495,14 @@ void S9xSetCPU(uint8 byte, uint16 Address)
case 0x4203:
{
// Multiplicand
- uint32 res = Memory.FillRAM[0x4202] * byte;
+ uint32_t res = Memory.FillRAM[0x4202] * byte;
#if defined FAST_LSB_WORD_ACCESS || defined FAST_ALIGNED_LSB_WORD_ACCESS
// assume malloc'd memory is 2-byte aligned
- * ((uint16*) &Memory.FillRAM[0x4216]) = res;
+ * ((uint16_t*) &Memory.FillRAM[0x4216]) = res;
#else
- Memory.FillRAM[0x4216] = (uint8) res;
- Memory.FillRAM[0x4217] = (uint8)(res >> 8);
+ Memory.FillRAM[0x4216] = (uint8_t) res;
+ Memory.FillRAM[0x4217] = (uint8_t)(res >> 8);
#endif
break;
}
@@ -1514,21 +1514,21 @@ void S9xSetCPU(uint8 byte, uint16 Address)
{
#if defined FAST_LSB_WORD_ACCESS || defined FAST_ALIGNED_LSB_WORD_ACCESS
// assume malloc'd memory is 2-byte aligned
- uint16 a = *((uint16*) &Memory.FillRAM[0x4204]);
+ uint16_t a = *((uint16_t*) &Memory.FillRAM[0x4204]);
#else
- uint16 a = Memory.FillRAM[0x4204] + (Memory.FillRAM[0x4205] << 8);
+ uint16_t a = Memory.FillRAM[0x4204] + (Memory.FillRAM[0x4205] << 8);
#endif
- uint16 div = byte ? a / byte : 0xffff;
- uint16 rem = byte ? a % byte : a;
+ uint16_t div = byte ? a / byte : 0xffff;
+ uint16_t rem = byte ? a % byte : a;
#if defined FAST_LSB_WORD_ACCESS || defined FAST_ALIGNED_LSB_WORD_ACCESS
// assume malloc'd memory is 2-byte aligned
- * ((uint16*) &Memory.FillRAM[0x4214]) = div;
- * ((uint16*) &Memory.FillRAM[0x4216]) = rem;
+ * ((uint16_t*) &Memory.FillRAM[0x4214]) = div;
+ * ((uint16_t*) &Memory.FillRAM[0x4216]) = rem;
#else
- Memory.FillRAM[0x4214] = (uint8)div;
+ Memory.FillRAM[0x4214] = (uint8_t)div;
Memory.FillRAM[0x4215] = div >> 8;
- Memory.FillRAM[0x4216] = (uint8)rem;
+ Memory.FillRAM[0x4216] = (uint8_t)rem;
Memory.FillRAM[0x4217] = rem >> 8;
#endif
break;
@@ -1906,9 +1906,9 @@ void S9xSetCPU(uint8 byte, uint16 Address)
/* S9xGetCPU() */
/* This function retrieves a CPU/DMA Register */
/******************************************************************************/
-uint8 S9xGetCPU(uint16 Address)
+uint8_t S9xGetCPU(uint16_t Address)
{
- uint8 byte;
+ uint8_t byte;
// fprintf(stderr, "read from %04x\n", Address);
if (Address < 0x4200)
@@ -1980,7 +1980,7 @@ uint8 S9xGetCPU(uint16 Address)
else if (IPPU.Controller == SNES_JUSTIFIER
|| IPPU.Controller == SNES_JUSTIFIER_2)
{
- uint8 rv;
+ uint8_t rv;
rv = (1 & (justifiers >> in_bit));
in_bit++;
in_bit %= 32;
@@ -2221,7 +2221,7 @@ static void CommonPPUReset()
PPU.VMA.FullGraphicCount = 0;
PPU.VMA.Shift = 0;
- uint8 B;
+ uint8_t B;
for (B = 0; B != 4; B++)
{
PPU.BG[B].SCBase = 0;
@@ -2233,19 +2233,19 @@ static void CommonPPUReset()
PPU.ClipCounts[B] = 0;
PPU.ClipWindowOverlapLogic [B] = CLIP_OR;
- PPU.ClipWindow1Enable[B] = FALSE;
- PPU.ClipWindow2Enable[B] = FALSE;
- PPU.ClipWindow1Inside[B] = TRUE;
- PPU.ClipWindow2Inside[B] = TRUE;
+ PPU.ClipWindow1Enable[B] = false;
+ PPU.ClipWindow2Enable[B] = false;
+ PPU.ClipWindow1Inside[B] = true;
+ PPU.ClipWindow2Inside[B] = true;
}
PPU.ClipCounts[4] = 0;
PPU.ClipCounts[5] = 0;
PPU.ClipWindowOverlapLogic[4] = PPU.ClipWindowOverlapLogic[5] = CLIP_OR;
- PPU.ClipWindow1Enable[4] = PPU.ClipWindow1Enable[5] = FALSE;
- PPU.ClipWindow2Enable[4] = PPU.ClipWindow2Enable[5] = FALSE;
- PPU.ClipWindow1Inside[4] = PPU.ClipWindow1Inside[5] = TRUE;
- PPU.ClipWindow2Inside[4] = PPU.ClipWindow2Inside[5] = TRUE;
+ PPU.ClipWindow1Enable[4] = PPU.ClipWindow1Enable[5] = false;
+ PPU.ClipWindow2Enable[4] = PPU.ClipWindow2Enable[5] = false;
+ PPU.ClipWindow1Inside[4] = PPU.ClipWindow1Inside[5] = true;
+ PPU.ClipWindow2Inside[4] = PPU.ClipWindow2Inside[5] = true;
PPU.CGFLIP = 0;
int c;
@@ -2298,43 +2298,43 @@ static void CommonPPUReset()
PPU.ScreenHeight = SNES_HEIGHT;
PPU.WRAM = 0;
PPU.BG_Forced = 0;
- PPU.ForcedBlanking = TRUE;
- PPU.OBJThroughMain = FALSE;
- PPU.OBJThroughSub = FALSE;
+ PPU.ForcedBlanking = true;
+ PPU.OBJThroughMain = false;
+ PPU.OBJThroughSub = false;
PPU.OBJSizeSelect = 0;
PPU.OBJNameSelect = 0;
PPU.OBJNameBase = 0;
- PPU.OBJAddition = FALSE;
+ PPU.OBJAddition = false;
PPU.OAMReadFlip = 0;
PPU.BGnxOFSbyte = 0;
memset(PPU.OAMData, 0, 512 + 32);
- PPU.VTimerEnabled = FALSE;
- PPU.HTimerEnabled = FALSE;
+ PPU.VTimerEnabled = false;
+ PPU.HTimerEnabled = false;
PPU.HTimerPosition = Settings.H_Max + 1;
PPU.Mosaic = 0;
- PPU.BGMosaic [0] = PPU.BGMosaic [1] = FALSE;
- PPU.BGMosaic [2] = PPU.BGMosaic [3] = FALSE;
- PPU.Mode7HFlip = FALSE;
- PPU.Mode7VFlip = FALSE;
+ PPU.BGMosaic [0] = PPU.BGMosaic [1] = false;
+ PPU.BGMosaic [2] = PPU.BGMosaic [3] = false;
+ PPU.Mode7HFlip = false;
+ PPU.Mode7VFlip = false;
PPU.Mode7Repeat = 0;
PPU.Window1Left = 1;
PPU.Window1Right = 0;
PPU.Window2Left = 1;
PPU.Window2Right = 0;
- PPU.RecomputeClipWindows = TRUE;
+ PPU.RecomputeClipWindows = true;
PPU.CGFLIPRead = 0;
- PPU.Need16x8Mulitply = FALSE;
+ PPU.Need16x8Mulitply = false;
PPU.MouseSpeed[0] = PPU.MouseSpeed[1] = 0;
- IPPU.ColorsChanged = TRUE;
+ IPPU.ColorsChanged = true;
IPPU.HDMA = 0;
- IPPU.HDMAStarted = FALSE;
+ IPPU.HDMAStarted = false;
IPPU.MaxBrightness = 0;
IPPU.LatchedBlanking = 0;
- IPPU.OBJChanged = TRUE;
- IPPU.RenderThisFrame = TRUE;
- IPPU.DirectColourMapsNeedRebuild = TRUE;
+ IPPU.OBJChanged = true;
+ IPPU.RenderThisFrame = true;
+ IPPU.DirectColourMapsNeedRebuild = true;
IPPU.FrameCount = 0;
IPPU.RenderedFramesCount = 0;
IPPU.DisplayedRenderedFrameCount = 0;
@@ -2346,13 +2346,13 @@ static void CommonPPUReset()
#ifdef CORRECT_VRAM_READS
IPPU.VRAMReadBuffer = 0; // XXX: FIXME: anything better?
#else
- IPPU.FirstVRAMRead = FALSE;
+ IPPU.FirstVRAMRead = false;
#endif
- IPPU.Interlace = FALSE;
- IPPU.InterlaceSprites = FALSE;
- IPPU.DoubleWidthPixels = FALSE;
- IPPU.HalfWidthPixels = FALSE;
- IPPU.DoubleHeightPixels = FALSE;
+ IPPU.Interlace = false;
+ IPPU.InterlaceSprites = false;
+ IPPU.DoubleWidthPixels = false;
+ IPPU.HalfWidthPixels = false;
+ IPPU.DoubleHeightPixels = false;
IPPU.RenderedScreenWidth = SNES_WIDTH;
IPPU.RenderedScreenHeight = SNES_HEIGHT;
IPPU.XB = NULL;
@@ -2444,7 +2444,7 @@ void S9xSoftResetPPU()
void S9xProcessMouse(int which1)
{
int x, y;
- uint32 buttons;
+ uint32_t buttons;
if ((IPPU.Controller == SNES_MOUSE || IPPU.Controller == SNES_MOUSE_SWAPPED)
&& S9xReadMousePosition(which1, &x, &y, &buttons))
@@ -2510,13 +2510,13 @@ void S9xProcessMouse(int which1)
void ProcessSuperScope()
{
int x, y;
- uint32 buttons;
+ uint32_t buttons;
if (IPPU.Controller == SNES_SUPERSCOPE &&
S9xReadSuperScopePosition(&x, &y, &buttons))
{
#define SUPERSCOPE_SIGNATURE 0x00ff
- uint32 scope;
+ uint32_t scope;
scope = SUPERSCOPE_SIGNATURE | ((buttons & 1) << (7 + 8)) |
((buttons & 2) << (5 + 8)) | ((buttons & 4) << (3 + 8)) |
@@ -2533,9 +2533,9 @@ void ProcessSuperScope()
if (y < 0)
y = 0;
- PPU.VBeamPosLatched = (uint16)(y + 1);
- PPU.HBeamPosLatched = (uint16) x;
- PPU.HVBeamCounterLatched = TRUE;
+ PPU.VBeamPosLatched = (uint16_t)(y + 1);
+ PPU.HBeamPosLatched = (uint16_t) x;
+ PPU.HVBeamCounterLatched = true;
Memory.FillRAM [0x213F] |= 0x40 | Model->_5C78;
}
IPPU.Joypads [1] = scope;
@@ -2612,7 +2612,7 @@ void S9xUpdateJustifiers()
justifiers |= 0x1000;
int x, y;
- uint32 buttons;
+ uint32_t buttons;
if (Memory.FillRAM[0x4201] & 0x80)
{
@@ -2632,7 +2632,7 @@ void S9xUpdateJustifiers()
if (last_p1)
{
- PPU.HVBeamCounterLatched = FALSE;
+ PPU.HVBeamCounterLatched = false;
Memory.FillRAM [0x213F] = Model->_5C78;
//process latch as Justifier 2
@@ -2643,9 +2643,9 @@ void S9xUpdateJustifiers()
if (!offscreen)
{
- PPU.VBeamPosLatched = (uint16)(y + 1);
- PPU.HBeamPosLatched = (uint16) x;
- PPU.HVBeamCounterLatched = TRUE;
+ PPU.VBeamPosLatched = (uint16_t)(y + 1);
+ PPU.HBeamPosLatched = (uint16_t) x;
+ PPU.HVBeamCounterLatched = true;
Memory.FillRAM [0x213F] |= 0x40 | Model->_5C78;
}
}
@@ -2654,7 +2654,7 @@ void S9xUpdateJustifiers()
else
{
- PPU.HVBeamCounterLatched = FALSE;
+ PPU.HVBeamCounterLatched = false;
Memory.FillRAM [0x213F] = Model->_5C78;
//emulate player 1.
@@ -2662,9 +2662,9 @@ void S9xUpdateJustifiers()
{
if (!offscreen)
{
- PPU.VBeamPosLatched = (uint16)(y + 1);
- PPU.HBeamPosLatched = (uint16) x;
- PPU.HVBeamCounterLatched = TRUE;
+ PPU.VBeamPosLatched = (uint16_t)(y + 1);
+ PPU.HBeamPosLatched = (uint16_t) x;
+ PPU.HVBeamCounterLatched = true;
Memory.FillRAM [0x213F] |= 0x40 | Model->_5C78;
}
}
@@ -2677,21 +2677,21 @@ void S9xUpdateJustifiers()
if ((!last_p1 && IPPU.Controller == SNES_JUSTIFIER) || (last_p1
&& IPPU.Controller == SNES_JUSTIFIER_2))
{
- PPU.VBeamPosLatched = (uint16)(y + 1);
- PPU.HBeamPosLatched = (uint16) x;
- PPU.HVBeamCounterLatched = TRUE;
+ PPU.VBeamPosLatched = (uint16_t)(y + 1);
+ PPU.HBeamPosLatched = (uint16_t) x;
+ PPU.HVBeamCounterLatched = true;
Memory.FillRAM [0x213F] |= 0x40 | Model->_5C78;
}
else
{
- PPU.HVBeamCounterLatched = FALSE;
+ PPU.HVBeamCounterLatched = false;
Memory.FillRAM [0x213F] = Model->_5C78;
}
}
else
{
- PPU.HVBeamCounterLatched = FALSE;
+ PPU.HVBeamCounterLatched = false;
Memory.FillRAM [0x213F] = Model->_5C78;
}
}
@@ -2699,7 +2699,7 @@ void S9xUpdateJustifiers()
void S9xUpdateJoypads()
{
- uint32 i;
+ uint32_t i;
for (i = 0; i < 5; i++)
IPPU.Joypads [i] = S9xReadJoypad(i);
@@ -2752,23 +2752,23 @@ void S9xUpdateJoypads()
}
int ind = Settings.SwapJoypads ? 1 : 0;
- Memory.FillRAM [0x4218] = (uint8) IPPU.Joypads [ind];
- Memory.FillRAM [0x4219] = (uint8)(IPPU.Joypads [ind] >> 8);
- Memory.FillRAM [0x421a] = (uint8) IPPU.Joypads [ind ^ 1];
- Memory.FillRAM [0x421b] = (uint8)(IPPU.Joypads [ind ^ 1] >> 8);
+ Memory.FillRAM [0x4218] = (uint8_t) IPPU.Joypads [ind];
+ Memory.FillRAM [0x4219] = (uint8_t)(IPPU.Joypads [ind] >> 8);
+ Memory.FillRAM [0x421a] = (uint8_t) IPPU.Joypads [ind ^ 1];
+ Memory.FillRAM [0x421b] = (uint8_t)(IPPU.Joypads [ind ^ 1] >> 8);
if (Memory.FillRAM [0x4201] & 0x80)
{
- Memory.FillRAM [0x421c] = (uint8) IPPU.Joypads [ind];
- Memory.FillRAM [0x421d] = (uint8)(IPPU.Joypads [ind] >> 8);
- Memory.FillRAM [0x421e] = (uint8) IPPU.Joypads [2];
- Memory.FillRAM [0x421f] = (uint8)(IPPU.Joypads [2] >> 8);
+ Memory.FillRAM [0x421c] = (uint8_t) IPPU.Joypads [ind];
+ Memory.FillRAM [0x421d] = (uint8_t)(IPPU.Joypads [ind] >> 8);
+ Memory.FillRAM [0x421e] = (uint8_t) IPPU.Joypads [2];
+ Memory.FillRAM [0x421f] = (uint8_t)(IPPU.Joypads [2] >> 8);
}
else
{
- Memory.FillRAM [0x421c] = (uint8) IPPU.Joypads [3];
- Memory.FillRAM [0x421d] = (uint8)(IPPU.Joypads [3] >> 8);
- Memory.FillRAM [0x421e] = (uint8) IPPU.Joypads [4];
- Memory.FillRAM [0x421f] = (uint8)(IPPU.Joypads [4] >> 8);
+ Memory.FillRAM [0x421c] = (uint8_t) IPPU.Joypads [3];
+ Memory.FillRAM [0x421d] = (uint8_t)(IPPU.Joypads [3] >> 8);
+ Memory.FillRAM [0x421e] = (uint8_t) IPPU.Joypads [4];
+ Memory.FillRAM [0x421f] = (uint8_t)(IPPU.Joypads [4] >> 8);
}
}
if (Settings.Justifier || Settings.SecondJustifier)
@@ -2805,9 +2805,9 @@ void S9xSuperFXExec()
// Register reads and writes...
-uint8 REGISTER_4212()
+uint8_t REGISTER_4212()
{
- uint8 GetBank = 0;
+ uint8_t GetBank = 0;
if (CPU.V_Counter >= PPU.ScreenHeight + FIRST_VISIBLE_LINE &&
CPU.V_Counter < PPU.ScreenHeight + FIRST_VISIBLE_LINE + 3)
GetBank = 1;
@@ -2825,7 +2825,7 @@ void FLUSH_REDRAW()
S9xUpdateScreen();
}
-void REGISTER_2104(uint8 byte)
+void REGISTER_2104(uint8_t byte)
{
if (PPU.OAMAddr & 0x100)
{
@@ -2834,7 +2834,7 @@ void REGISTER_2104(uint8 byte)
{
FLUSH_REDRAW();
PPU.OAMData [addr] = byte;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
// X position high bit, and sprite size (x4)
struct SOBJ* pObj = &PPU.OBJ [(addr & 0x1f) * 4];
@@ -2856,12 +2856,12 @@ void REGISTER_2104(uint8 byte)
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
else
{
- if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1)) IPPU.OBJChanged = TRUE;
+ if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1)) IPPU.OBJChanged = true;
}
}
else if (!(PPU.OAMFlip & 1))
@@ -2869,13 +2869,13 @@ void REGISTER_2104(uint8 byte)
PPU.OAMWriteRegister &= 0xff00;
PPU.OAMWriteRegister |= byte;
PPU.OAMFlip |= 1;
- if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1)) IPPU.OBJChanged = TRUE;
+ if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1)) IPPU.OBJChanged = true;
}
else
{
PPU.OAMWriteRegister &= 0x00ff;
- uint8 lowbyte = (uint8)(PPU.OAMWriteRegister);
- uint8 highbyte = byte;
+ uint8_t lowbyte = (uint8_t)(PPU.OAMWriteRegister);
+ uint8_t highbyte = byte;
PPU.OAMWriteRegister |= byte << 8;
int addr = (PPU.OAMAddr << 1);
@@ -2886,7 +2886,7 @@ void REGISTER_2104(uint8 byte)
FLUSH_REDRAW();
PPU.OAMData [addr] = lowbyte;
PPU.OAMData [addr + 1] = highbyte;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
if (addr & 2)
{
// Tile
@@ -2913,19 +2913,19 @@ void REGISTER_2104(uint8 byte)
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
{
PPU.FirstSprite = (PPU.OAMAddr & 0xFE) >> 1;
- IPPU.OBJChanged = TRUE;
+ IPPU.OBJChanged = true;
}
}
Memory.FillRAM [0x2104] = byte;
}
-void REGISTER_2118(uint8 Byte)
+void REGISTER_2118(uint8_t Byte)
{
- uint32 address;
+ uint32_t address;
if (PPU.VMA.FullGraphicCount)
{
- uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
+ uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
address = (((PPU.VMA.Address & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3)) << 1) & 0xffff;
@@ -2933,48 +2933,48 @@ void REGISTER_2118(uint8 Byte)
}
else
Memory.VRAM[address = (PPU.VMA.Address << 1) & 0xFFFF] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2118] = Byte;
}
-void REGISTER_2118_tile(uint8 Byte)
+void REGISTER_2118_tile(uint8_t Byte)
{
- uint32 address;
- uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
+ uint32_t address;
+ uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
address = (((PPU.VMA.Address & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3)) << 1) & 0xffff;
Memory.VRAM [address] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2118] = Byte;
}
-void REGISTER_2118_linear(uint8 Byte)
+void REGISTER_2118_linear(uint8_t Byte)
{
- uint32 address;
+ uint32_t address;
Memory.VRAM[address = (PPU.VMA.Address << 1) & 0xFFFF] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2118] = Byte;
}
-void REGISTER_2119(uint8 Byte)
+void REGISTER_2119(uint8_t Byte)
{
- uint32 address;
+ uint32_t address;
if (PPU.VMA.FullGraphicCount)
{
- uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
+ uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
address = ((((PPU.VMA.Address & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3)) << 1) + 1) & 0xFFFF;
@@ -2982,42 +2982,42 @@ void REGISTER_2119(uint8 Byte)
}
else
Memory.VRAM[address = ((PPU.VMA.Address << 1) + 1) & 0xFFFF] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2119] = Byte;
}
-void REGISTER_2119_tile(uint8 Byte)
+void REGISTER_2119_tile(uint8_t Byte)
{
- uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
- uint32 address = ((((PPU.VMA.Address & ~PPU.VMA.Mask1) +
+ uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
+ uint32_t address = ((((PPU.VMA.Address & ~PPU.VMA.Mask1) +
(rem >> PPU.VMA.Shift) +
((rem & (PPU.VMA.FullGraphicCount - 1)) << 3)) << 1) + 1) & 0xFFFF;
Memory.VRAM [address] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2119] = Byte;
}
-void REGISTER_2119_linear(uint8 Byte)
+void REGISTER_2119_linear(uint8_t Byte)
{
- uint32 address;
+ uint32_t address;
Memory.VRAM[address = ((PPU.VMA.Address << 1) + 1) & 0xFFFF] = Byte;
- IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
- IPPU.TileCached [TILE_4BIT][address >> 5] = FALSE;
- IPPU.TileCached [TILE_8BIT][address >> 6] = FALSE;
+ IPPU.TileCached [TILE_2BIT][address >> 4] = false;
+ IPPU.TileCached [TILE_4BIT][address >> 5] = false;
+ IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
// Memory.FillRAM [0x2119] = Byte;
}
-void REGISTER_2122(uint8 Byte)
+void REGISTER_2122(uint8_t Byte)
{
// CG-RAM (palette) write
@@ -3028,10 +3028,10 @@ void REGISTER_2122(uint8 Byte)
FLUSH_REDRAW();
PPU.CGDATA[PPU.CGADD] &= 0x00FF;
PPU.CGDATA[PPU.CGADD] |= (Byte & 0x7f) << 8;
- IPPU.ColorsChanged = TRUE;
+ IPPU.ColorsChanged = true;
IPPU.Blue [PPU.CGADD] = IPPU.XB [(Byte >> 2) & 0x1f];
IPPU.Green [PPU.CGADD] = IPPU.XB [(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
- IPPU.ScreenColors [PPU.CGADD] = (uint16) BUILD_PIXEL(IPPU.Red [PPU.CGADD],
+ IPPU.ScreenColors [PPU.CGADD] = (uint16_t) BUILD_PIXEL(IPPU.Red [PPU.CGADD],
IPPU.Green [PPU.CGADD],
IPPU.Blue [PPU.CGADD]);
}
@@ -3039,15 +3039,15 @@ void REGISTER_2122(uint8 Byte)
}
else
{
- if (Byte != (uint8)(PPU.CGDATA[PPU.CGADD] & 0xff))
+ if (Byte != (uint8_t)(PPU.CGDATA[PPU.CGADD] & 0xff))
{
FLUSH_REDRAW();
PPU.CGDATA[PPU.CGADD] &= 0x7F00;
PPU.CGDATA[PPU.CGADD] |= Byte;
- IPPU.ColorsChanged = TRUE;
+ IPPU.ColorsChanged = true;
IPPU.Red [PPU.CGADD] = IPPU.XB [Byte & 0x1f];
IPPU.Green [PPU.CGADD] = IPPU.XB [(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
- IPPU.ScreenColors [PPU.CGADD] = (uint16) BUILD_PIXEL(IPPU.Red [PPU.CGADD],
+ IPPU.ScreenColors [PPU.CGADD] = (uint16_t) BUILD_PIXEL(IPPU.Red [PPU.CGADD],
IPPU.Green [PPU.CGADD],
IPPU.Blue [PPU.CGADD]);
}
@@ -3056,7 +3056,7 @@ void REGISTER_2122(uint8 Byte)
// Memory.FillRAM [0x2122] = Byte;
}
-void REGISTER_2180(uint8 Byte)
+void REGISTER_2180(uint8_t Byte)
{
Memory.RAM[PPU.WRAM++] = Byte;
PPU.WRAM &= 0x1FFFF;
diff --git a/source/ppu.h b/source/ppu.h
index c01135f..c85c29a 100644
--- a/source/ppu.h
+++ b/source/ppu.h
@@ -92,8 +92,8 @@
#define FIRST_VISIBLE_LINE 1
-extern uint8 GetBank;
-extern uint16 SignExtend [2];
+extern uint8_t GetBank;
+extern uint16_t SignExtend [2];
#define TILE_2BIT 0
#define TILE_4BIT 1
@@ -111,51 +111,51 @@ extern uint16 SignExtend [2];
struct ClipData
{
- uint32 Count [6];
- uint32 Left [6][6];
- uint32 Right [6][6];
+ uint32_t Count [6];
+ uint32_t Left [6][6];
+ uint32_t Right [6][6];
};
typedef struct
{
- bool8 ColorsChanged;
- uint8 HDMA;
- bool8 HDMAStarted;
- uint8 MaxBrightness;
- bool8 LatchedBlanking;
- bool8 OBJChanged;
- bool8 RenderThisFrame;
- bool8 DirectColourMapsNeedRebuild;
- uint32 FrameCount;
- uint32 RenderedFramesCount;
- uint32 DisplayedRenderedFrameCount;
- uint32 SkippedFrames;
- uint32 FrameSkip;
- uint8* TileCache [3];
- uint8* TileCached [3];
+ bool ColorsChanged;
+ uint8_t HDMA;
+ bool HDMAStarted;
+ uint8_t MaxBrightness;
+ bool LatchedBlanking;
+ bool OBJChanged;
+ bool RenderThisFrame;
+ bool DirectColourMapsNeedRebuild;
+ uint32_t FrameCount;
+ uint32_t RenderedFramesCount;
+ uint32_t DisplayedRenderedFrameCount;
+ uint32_t SkippedFrames;
+ uint32_t FrameSkip;
+ uint8_t* TileCache [3];
+ uint8_t* TileCached [3];
#ifdef CORRECT_VRAM_READS
- uint16 VRAMReadBuffer;
+ uint16_t VRAMReadBuffer;
#else
- bool8 FirstVRAMRead;
+ bool FirstVRAMRead;
#endif
- bool8 DoubleHeightPixels;
- bool8 Interlace;
- bool8 InterlaceSprites;
- bool8 DoubleWidthPixels;
- bool8 HalfWidthPixels;
+ bool DoubleHeightPixels;
+ bool Interlace;
+ bool InterlaceSprites;
+ bool DoubleWidthPixels;
+ bool HalfWidthPixels;
int RenderedScreenHeight;
int RenderedScreenWidth;
- uint32 Red [256];
- uint32 Green [256];
- uint32 Blue [256];
- uint8* XB;
- uint16 ScreenColors [256];
+ uint32_t Red [256];
+ uint32_t Green [256];
+ uint32_t Blue [256];
+ uint8_t* XB;
+ uint16_t ScreenColors [256];
int PreviousLine;
int CurrentLine;
int Controller;
- uint32 Joypads[5];
- uint32 SuperScope;
- uint32 Mouse[2];
+ uint32_t Joypads[5];
+ uint32_t SuperScope;
+ uint32_t Mouse[2];
int PrevMouseX[2];
int PrevMouseY[2];
struct ClipData Clip [2];
@@ -164,60 +164,60 @@ typedef struct
struct SOBJ
{
short HPos;
- uint16 VPos;
- uint16 Name;
- uint8 VFlip;
- uint8 HFlip;
- uint8 Priority;
- uint8 Palette;
- uint8 Size;
+ uint16_t VPos;
+ uint16_t Name;
+ uint8_t VFlip;
+ uint8_t HFlip;
+ uint8_t Priority;
+ uint8_t Palette;
+ uint8_t Size;
};
typedef struct
{
- uint8 BGMode;
- uint8 BG3Priority;
- uint8 Brightness;
+ uint8_t BGMode;
+ uint8_t BG3Priority;
+ uint8_t Brightness;
struct
{
- bool8 High;
- uint8 Increment;
- uint16 Address;
- uint16 Mask1;
- uint16 FullGraphicCount;
- uint16 Shift;
+ bool High;
+ uint8_t Increment;
+ uint16_t Address;
+ uint16_t Mask1;
+ uint16_t FullGraphicCount;
+ uint16_t Shift;
} VMA;
struct
{
- uint16 SCBase;
- uint16 VOffset;
- uint16 HOffset;
- uint8 BGSize;
- uint16 NameBase;
- uint16 SCSize;
+ uint16_t SCBase;
+ uint16_t VOffset;
+ uint16_t HOffset;
+ uint8_t BGSize;
+ uint16_t NameBase;
+ uint16_t SCSize;
} BG [4];
- bool8 CGFLIP;
- uint16 CGDATA [256];
- uint8 FirstSprite;
- uint8 LastSprite;
+ bool CGFLIP;
+ uint16_t CGDATA [256];
+ uint8_t FirstSprite;
+ uint8_t LastSprite;
struct SOBJ OBJ [128];
- uint8 OAMPriorityRotation;
- uint16 OAMAddr;
- uint8 RangeTimeOver;
+ uint8_t OAMPriorityRotation;
+ uint16_t OAMAddr;
+ uint8_t RangeTimeOver;
- uint8 OAMFlip;
- uint16 OAMTileAddress;
- uint16 IRQVBeamPos;
- uint16 IRQHBeamPos;
- uint16 VBeamPosLatched;
- uint16 HBeamPosLatched;
+ uint8_t OAMFlip;
+ uint16_t OAMTileAddress;
+ uint16_t IRQVBeamPos;
+ uint16_t IRQHBeamPos;
+ uint16_t VBeamPosLatched;
+ uint16_t HBeamPosLatched;
- uint8 HBeamFlip;
- uint8 VBeamFlip;
- uint8 HVBeamCounterLatched;
+ uint8_t HBeamFlip;
+ uint8_t VBeamFlip;
+ uint8_t HVBeamCounterLatched;
short MatrixA;
short MatrixB;
@@ -225,55 +225,55 @@ typedef struct
short MatrixD;
short CentreX;
short CentreY;
- uint8 Joypad1ButtonReadPos;
- uint8 Joypad2ButtonReadPos;
-
- uint8 CGADD;
- uint8 FixedColourRed;
- uint8 FixedColourGreen;
- uint8 FixedColourBlue;
- uint16 SavedOAMAddr;
- uint16 ScreenHeight;
- uint32 WRAM;
- uint8 BG_Forced;
- bool8 ForcedBlanking;
- bool8 OBJThroughMain;
- bool8 OBJThroughSub;
- uint8 OBJSizeSelect;
- uint16 OBJNameBase;
- bool8 OBJAddition;
- uint8 OAMReadFlip;
- uint8 OAMData [512 + 32];
- bool8 VTimerEnabled;
- bool8 HTimerEnabled;
+ uint8_t Joypad1ButtonReadPos;
+ uint8_t Joypad2ButtonReadPos;
+
+ uint8_t CGADD;
+ uint8_t FixedColourRed;
+ uint8_t FixedColourGreen;
+ uint8_t FixedColourBlue;
+ uint16_t SavedOAMAddr;
+ uint16_t ScreenHeight;
+ uint32_t WRAM;
+ uint8_t BG_Forced;
+ bool ForcedBlanking;
+ bool OBJThroughMain;
+ bool OBJThroughSub;
+ uint8_t OBJSizeSelect;
+ uint16_t OBJNameBase;
+ bool OBJAddition;
+ uint8_t OAMReadFlip;
+ uint8_t OAMData [512 + 32];
+ bool VTimerEnabled;
+ bool HTimerEnabled;
short HTimerPosition;
- uint8 Mosaic;
- bool8 BGMosaic [4];
- bool8 Mode7HFlip;
- bool8 Mode7VFlip;
- uint8 Mode7Repeat;
- uint8 Window1Left;
- uint8 Window1Right;
- uint8 Window2Left;
- uint8 Window2Right;
- uint8 ClipCounts [6];
- uint8 ClipWindowOverlapLogic [6];
- uint8 ClipWindow1Enable [6];
- uint8 ClipWindow2Enable [6];
- bool8 ClipWindow1Inside [6];
- bool8 ClipWindow2Inside [6];
- bool8 RecomputeClipWindows;
- uint8 CGFLIPRead;
- uint16 OBJNameSelect;
- bool8 Need16x8Mulitply;
- uint8 Joypad3ButtonReadPos;
- uint8 MouseSpeed[2];
+ uint8_t Mosaic;
+ bool BGMosaic [4];
+ bool Mode7HFlip;
+ bool Mode7VFlip;
+ uint8_t Mode7Repeat;
+ uint8_t Window1Left;
+ uint8_t Window1Right;
+ uint8_t Window2Left;
+ uint8_t Window2Right;
+ uint8_t ClipCounts [6];
+ uint8_t ClipWindowOverlapLogic [6];
+ uint8_t ClipWindow1Enable [6];
+ uint8_t ClipWindow2Enable [6];
+ bool ClipWindow1Inside [6];
+ bool ClipWindow2Inside [6];
+ bool RecomputeClipWindows;
+ uint8_t CGFLIPRead;
+ uint16_t OBJNameSelect;
+ bool Need16x8Mulitply;
+ uint8_t Joypad3ButtonReadPos;
+ uint8_t MouseSpeed[2];
// XXX Do these need to be added to snapshot.cpp?
- uint16 OAMWriteRegister;
- uint8 BGnxOFSbyte;
- uint8 OpenBus1;
- uint8 OpenBus2;
+ uint16_t OAMWriteRegister;
+ uint8_t BGnxOFSbyte;
+ uint8_t OpenBus1;
+ uint8_t OpenBus2;
} SPPU;
#define CLIP_OR 0
@@ -283,26 +283,26 @@ typedef struct
typedef struct
{
- bool8 TransferDirection;
- bool8 AAddressFixed;
- bool8 AAddressDecrement;
- uint8 TransferMode;
+ bool TransferDirection;
+ bool AAddressFixed;
+ bool AAddressDecrement;
+ uint8_t TransferMode;
- uint8 ABank;
- uint16 AAddress;
- uint16 Address;
- uint8 BAddress;
+ uint8_t ABank;
+ uint16_t AAddress;
+ uint16_t Address;
+ uint8_t BAddress;
// General DMA only:
- uint16 TransferBytes;
+ uint16_t TransferBytes;
// H-DMA only:
- bool8 HDMAIndirectAddressing;
- uint16 IndirectAddress;
- uint8 IndirectBank;
- uint8 Repeat;
- uint8 LineCount;
- uint8 FirstLine;
+ bool HDMAIndirectAddressing;
+ uint16_t IndirectAddress;
+ uint8_t IndirectBank;
+ uint8_t Repeat;
+ uint8_t LineCount;
+ uint8_t FirstLine;
} SDMA;
void S9xUpdateScreen();
@@ -313,16 +313,16 @@ void S9xUpdateJoypads();
void S9xProcessMouse(int which1);
void S9xSuperFXExec();
-void S9xSetPPU(uint8 Byte, uint16 Address);
-uint8 S9xGetPPU(uint16 Address);
-void S9xSetCPU(uint8 Byte, uint16 Address);
-uint8 S9xGetCPU(uint16 Address);
+void S9xSetPPU(uint8_t Byte, uint16_t Address);
+uint8_t S9xGetPPU(uint16_t Address);
+void S9xSetCPU(uint8_t Byte, uint16_t Address);
+uint8_t S9xGetCPU(uint16_t Address);
void S9xInitC4();
-void S9xSetC4(uint8 Byte, uint16 Address);
-uint8 S9xGetC4(uint16 Address);
-void S9xSetC4RAM(uint8 Byte, uint16 Address);
-uint8 S9xGetC4RAM(uint16 Address);
+void S9xSetC4(uint8_t Byte, uint16_t Address);
+uint8_t S9xGetC4(uint16_t Address);
+void S9xSetC4RAM(uint8_t Byte, uint16_t Address);
+uint8_t S9xGetC4RAM(uint16_t Address);
extern SPPU PPU;
extern SDMA DMA [8];
@@ -333,9 +333,9 @@ extern InternalPPU IPPU;
typedef struct
{
- uint8 _5C77;
- uint8 _5C78;
- uint8 _5A22;
+ uint8_t _5C77;
+ uint8_t _5C78;
+ uint8_t _5A22;
} SnesModel;
extern SnesModel* Model;
@@ -346,20 +346,20 @@ extern SnesModel M2SNES;
#define MAX_5C78_VERSION 0x03
#define MAX_5A22_VERSION 0x02
-extern uint8 REGISTER_4212();
+extern uint8_t REGISTER_4212();
extern void FLUSH_REDRAW();
-extern void REGISTER_2104(uint8 byte);
-extern void REGISTER_2118(uint8 Byte);
-extern void REGISTER_2118_tile(uint8 Byte);
-extern void REGISTER_2118_linear(uint8 Byte);
-extern void REGISTER_2119(uint8 Byte);
-extern void REGISTER_2119_tile(uint8 Byte);
-extern void REGISTER_2119_linear(uint8 Byte);
-extern void REGISTER_2122(uint8 Byte);
-extern void REGISTER_2180(uint8 Byte);
+extern void REGISTER_2104(uint8_t byte);
+extern void REGISTER_2118(uint8_t Byte);
+extern void REGISTER_2118_tile(uint8_t Byte);
+extern void REGISTER_2118_linear(uint8_t Byte);
+extern void REGISTER_2119(uint8_t Byte);
+extern void REGISTER_2119_tile(uint8_t Byte);
+extern void REGISTER_2119_linear(uint8_t Byte);
+extern void REGISTER_2122(uint8_t Byte);
+extern void REGISTER_2180(uint8_t Byte);
//Platform specific input functions used by PPU.CPP
-void JustifierButtons(uint32*);
+void JustifierButtons(uint32_t*);
bool JustifierOffscreen();
#endif
diff --git a/source/sa1.c b/source/sa1.c
index 4171903..6ac3041 100644
--- a/source/sa1.c
+++ b/source/sa1.c
@@ -95,16 +95,16 @@
static void S9xSA1CharConv2();
static void S9xSA1DMA();
-static void S9xSA1ReadVariableLengthData(bool8 inc, bool8 no_shift);
+static void S9xSA1ReadVariableLengthData(bool inc, bool no_shift);
void S9xSA1Init()
{
- SA1.NMIActive = FALSE;
- SA1.IRQActive = FALSE;
- SA1.WaitingForInterrupt = FALSE;
- SA1.Waiting = FALSE;
+ SA1.NMIActive = false;
+ SA1.IRQActive = false;
+ SA1.WaitingForInterrupt = false;
+ SA1.Waiting = false;
SA1.Flags = 0;
- SA1.Executing = FALSE;
+ SA1.Executing = false;
memset(&Memory.FillRAM [0x2200], 0, 0x200);
Memory.FillRAM [0x2200] = 0x20;
Memory.FillRAM [0x2220] = 0x00;
@@ -116,7 +116,7 @@ void S9xSA1Init()
SA1.op2 = 0;
SA1.arithmetic_op = 0;
SA1.sum = 0;
- SA1.overflow = FALSE;
+ SA1.overflow = false;
SA1.S9xOpcodes = NULL;
}
@@ -138,7 +138,7 @@ void S9xSA1Reset()
SA1SetFlags(MemoryFlag | IndexFlag | IRQ | Emulation);
SA1ClearFlags(Decimal);
- SA1.WaitingForInterrupt = FALSE;
+ SA1.WaitingForInterrupt = false;
SA1.PC = NULL;
SA1.PCBase = NULL;
S9xSA1SetPCBase(SA1.Registers.PC);
@@ -146,12 +146,12 @@ void S9xSA1Reset()
S9xSA1UnpackStatus();
S9xSA1FixCycles();
- SA1.Executing = TRUE;
+ SA1.Executing = true;
SA1.BWRAM = Memory.SRAM;
Memory.FillRAM [0x2225] = 0;
}
-void S9xSA1SetBWRAMMemMap(uint8 val)
+void S9xSA1SetBWRAMMemMap(uint8_t val)
{
int c;
@@ -159,10 +159,10 @@ void S9xSA1SetBWRAMMemMap(uint8 val)
{
for (c = 0; c < 0x400; c += 16)
{
- SA1.Map [c + 6] = SA1.Map [c + 0x806] = (uint8*) MAP_BWRAM_BITMAP2;
- SA1.Map [c + 7] = SA1.Map [c + 0x807] = (uint8*) MAP_BWRAM_BITMAP2;
- SA1.WriteMap [c + 6] = SA1.WriteMap [c + 0x806] = (uint8*) MAP_BWRAM_BITMAP2;
- SA1.WriteMap [c + 7] = SA1.WriteMap [c + 0x807] = (uint8*) MAP_BWRAM_BITMAP2;
+ SA1.Map [c + 6] = SA1.Map [c + 0x806] = (uint8_t*) MAP_BWRAM_BITMAP2;
+ SA1.Map [c + 7] = SA1.Map [c + 0x807] = (uint8_t*) MAP_BWRAM_BITMAP2;
+ SA1.WriteMap [c + 6] = SA1.WriteMap [c + 0x806] = (uint8_t*) MAP_BWRAM_BITMAP2;
+ SA1.WriteMap [c + 7] = SA1.WriteMap [c + 0x807] = (uint8_t*) MAP_BWRAM_BITMAP2;
}
SA1.BWRAM = Memory.SRAM + (val & 0x7f) * 0x2000 / 4;
}
@@ -170,10 +170,10 @@ void S9xSA1SetBWRAMMemMap(uint8 val)
{
for (c = 0; c < 0x400; c += 16)
{
- SA1.Map [c + 6] = SA1.Map [c + 0x806] = (uint8*) MAP_BWRAM;
- SA1.Map [c + 7] = SA1.Map [c + 0x807] = (uint8*) MAP_BWRAM;
- SA1.WriteMap [c + 6] = SA1.WriteMap [c + 0x806] = (uint8*) MAP_BWRAM;
- SA1.WriteMap [c + 7] = SA1.WriteMap [c + 0x807] = (uint8*) MAP_BWRAM;
+ SA1.Map [c + 6] = SA1.Map [c + 0x806] = (uint8_t*) MAP_BWRAM;
+ SA1.Map [c + 7] = SA1.Map [c + 0x807] = (uint8_t*) MAP_BWRAM;
+ SA1.WriteMap [c + 6] = SA1.WriteMap [c + 0x806] = (uint8_t*) MAP_BWRAM;
+ SA1.WriteMap [c + 7] = SA1.WriteMap [c + 0x807] = (uint8_t*) MAP_BWRAM;
}
SA1.BWRAM = Memory.SRAM + (val & 7) * 0x2000;
}
@@ -181,8 +181,8 @@ void S9xSA1SetBWRAMMemMap(uint8 val)
void S9xFixSA1AfterSnapshotLoad()
{
- SA1.ShiftedPB = (uint32) SA1.Registers.PB << 16;
- SA1.ShiftedDB = (uint32) SA1.Registers.DB << 16;
+ SA1.ShiftedPB = (uint32_t) SA1.Registers.PB << 16;
+ SA1.ShiftedDB = (uint32_t) SA1.Registers.DB << 16;
S9xSA1SetPCBase(SA1.ShiftedPB + SA1.Registers.PC);
S9xSA1UnpackStatus();
@@ -195,10 +195,10 @@ void S9xFixSA1AfterSnapshotLoad()
SA1.Executing = !SA1.Waiting;
}
-uint8 S9xSA1GetByte(uint32 address)
+uint8_t S9xSA1GetByte(uint32_t address)
{
- uint8* GetAddress = SA1.Map [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (GetAddress >= (uint8*) MAP_LAST)
+ uint8_t* GetAddress = SA1.Map [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
+ if (GetAddress >= (uint8_t*) MAP_LAST)
return (*(GetAddress + (address & 0xffff)));
switch ((intptr_t) GetAddress)
@@ -229,17 +229,17 @@ uint8 S9xSA1GetByte(uint32 address)
}
}
-uint16 S9xSA1GetWord(uint32 address)
+uint16_t S9xSA1GetWord(uint32_t address)
{
OpenBus = S9xSA1GetByte(address);
return (OpenBus | (S9xSA1GetByte(address + 1) << 8));
}
-void S9xSA1SetByte(uint8 byte, uint32 address)
+void S9xSA1SetByte(uint8_t byte, uint32_t address)
{
- uint8* Setaddress = SA1.WriteMap [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
+ uint8_t* Setaddress = SA1.WriteMap [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (Setaddress >= (uint8*) MAP_LAST)
+ if (Setaddress >= (uint8_t*) MAP_LAST)
{
*(Setaddress + (address & 0xffff)) = byte;
return;
@@ -261,13 +261,13 @@ void S9xSA1SetByte(uint8 byte, uint32 address)
address -= 0x600000;
if (SA1.VirtualBitmapFormat == 2)
{
- uint8* ptr = &Memory.SRAM [(address >> 2) & 0xffff];
+ uint8_t* ptr = &Memory.SRAM [(address >> 2) & 0xffff];
*ptr &= ~(3 << ((address & 3) << 1));
*ptr |= (byte & 3) << ((address & 3) << 1);
}
else
{
- uint8* ptr = &Memory.SRAM [(address >> 1) & 0xffff];
+ uint8_t* ptr = &Memory.SRAM [(address >> 1) & 0xffff];
*ptr &= ~(15 << ((address & 1) << 2));
*ptr |= (byte & 15) << ((address & 1) << 2);
}
@@ -276,13 +276,13 @@ void S9xSA1SetByte(uint8 byte, uint32 address)
address = (address & 0xffff) - 0x6000;
if (SA1.VirtualBitmapFormat == 2)
{
- uint8* ptr = &SA1.BWRAM [(address >> 2) & 0xffff];
+ uint8_t* ptr = &SA1.BWRAM [(address >> 2) & 0xffff];
*ptr &= ~(3 << ((address & 3) << 1));
*ptr |= (byte & 3) << ((address & 3) << 1);
}
else
{
- uint8* ptr = &SA1.BWRAM [(address >> 1) & 0xffff];
+ uint8_t* ptr = &SA1.BWRAM [(address >> 1) & 0xffff];
*ptr &= ~(15 << ((address & 1) << 2));
*ptr |= (byte & 15) << ((address & 1) << 2);
}
@@ -291,16 +291,16 @@ void S9xSA1SetByte(uint8 byte, uint32 address)
}
}
-void S9xSA1SetWord(uint16 Word, uint32 address)
+void S9xSA1SetWord(uint16_t Word, uint32_t address)
{
- S9xSA1SetByte((uint8) Word, address);
- S9xSA1SetByte((uint8)(Word >> 8), address + 1);
+ S9xSA1SetByte((uint8_t) Word, address);
+ S9xSA1SetByte((uint8_t)(Word >> 8), address + 1);
}
-void S9xSA1SetPCBase(uint32 address)
+void S9xSA1SetPCBase(uint32_t address)
{
- uint8* GetAddress = SA1.Map [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (GetAddress >= (uint8*) MAP_LAST)
+ uint8_t* GetAddress = SA1.Map [(address >> MEMMAP_SHIFT) & MEMMAP_MASK];
+ if (GetAddress >= (uint8_t*) MAP_LAST)
{
SA1.PCBase = GetAddress;
SA1.PC = GetAddress + (address & 0xffff);
@@ -363,7 +363,7 @@ void S9xSA1ExecuteDuringSleep()
#endif
}
-void S9xSetSA1MemMap(uint32 which1, uint8 map)
+void S9xSetSA1MemMap(uint32_t which1, uint8_t map)
{
int c;
int start = which1 * 0x100 + 0xc00;
@@ -374,7 +374,7 @@ void S9xSetSA1MemMap(uint32 which1, uint8 map)
for (c = 0; c < 0x100; c += 16)
{
- uint8* block = &Memory.ROM [(map & 7) * 0x100000 + (c << 12)];
+ uint8_t* block = &Memory.ROM [(map & 7) * 0x100000 + (c << 12)];
int i;
for (i = c; i < c + 16; i++)
@@ -383,7 +383,7 @@ void S9xSetSA1MemMap(uint32 which1, uint8 map)
for (c = 0; c < 0x200; c += 16)
{
- uint8* block = &Memory.ROM [(map & 7) * 0x100000 + (c << 11) - 0x8000];
+ uint8_t* block = &Memory.ROM [(map & 7) * 0x100000 + (c << 11) - 0x8000];
int i;
for (i = c + 8; i < c + 16; i++)
@@ -391,35 +391,35 @@ void S9xSetSA1MemMap(uint32 which1, uint8 map)
}
}
-uint8 S9xGetSA1(uint32 address)
+uint8_t S9xGetSA1(uint32_t address)
{
// printf ("R: %04x\n", address);
switch (address)
{
case 0x2300:
- return ((uint8)((Memory.FillRAM [0x2209] & 0x5f) |
+ return ((uint8_t)((Memory.FillRAM [0x2209] & 0x5f) |
(CPU.IRQActive & (SA1_IRQ_SOURCE | SA1_DMA_IRQ_SOURCE))));
case 0x2301:
return ((Memory.FillRAM [0x2200] & 0xf) |
(Memory.FillRAM [0x2301] & 0xf0));
case 0x2306:
- return ((uint8) SA1.sum);
+ return ((uint8_t) SA1.sum);
case 0x2307:
- return ((uint8)(SA1.sum >> 8));
+ return ((uint8_t)(SA1.sum >> 8));
case 0x2308:
- return ((uint8)(SA1.sum >> 16));
+ return ((uint8_t)(SA1.sum >> 16));
case 0x2309:
- return ((uint8)(SA1.sum >> 24));
+ return ((uint8_t)(SA1.sum >> 24));
case 0x230a:
- return ((uint8)(SA1.sum >> 32));
+ return ((uint8_t)(SA1.sum >> 32));
case 0x230c:
return (Memory.FillRAM [0x230c]);
case 0x230d:
{
- uint8 byte = Memory.FillRAM [0x230d];
+ uint8_t byte = Memory.FillRAM [0x230d];
if (Memory.FillRAM [0x2258] & 0x80)
- S9xSA1ReadVariableLengthData(TRUE, FALSE);
+ S9xSA1ReadVariableLengthData(true, false);
return (byte);
}
default:
@@ -429,7 +429,7 @@ uint8 S9xGetSA1(uint32 address)
return (Memory.FillRAM [address]);
}
-void S9xSetSA1(uint8 byte, uint32 address)
+void S9xSetSA1(uint8_t byte, uint32_t address)
{
//printf ("W: %02x -> %04x\n", byte, address);
switch (address)
@@ -642,7 +642,7 @@ void S9xSetSA1(uint8 byte, uint32 address)
break;
case 0x2231:
if (byte & 0x80)
- SA1.in_char_dma = FALSE;
+ SA1.in_char_dma = false;
#if 0
printf("CHDEND %s\n", (byte & 0x80) ? "complete" : "incomplete");
printf("DMA colour mode %d\n", byte & 3);
@@ -674,7 +674,7 @@ void S9xSetSA1(uint8 byte, uint32 address)
Memory.FillRAM [0x2300] |= 0x20;
if (Memory.FillRAM [0x2201] & 0x20)
S9xSetIRQ(SA1_DMA_IRQ_SOURCE);
- SA1.in_char_dma = TRUE;
+ SA1.in_char_dma = true;
}
break;
case 0x2237:
@@ -768,21 +768,21 @@ void S9xSetSA1(uint8 byte, uint32 address)
SA1.sum = SA1.op1 << 16;
else
{
- SA1.sum = (SA1.op1 / (int)((uint16) SA1.op2)) |
- ((SA1.op1 % (int)((uint16) SA1.op2)) << 16);
+ SA1.sum = (SA1.op1 / (int)((uint16_t) SA1.op2)) |
+ ((SA1.op1 % (int)((uint16_t) SA1.op2)) << 16);
}
break;
case 2:
default: // cumulative sum
SA1.sum += SA1.op1 * SA1.op2;
- if (SA1.sum & ((int64) 0xffffff << 32))
- SA1.overflow = TRUE;
+ if (SA1.sum & ((int64_t) 0xffffff << 32))
+ SA1.overflow = true;
break;
}
break;
case 0x2258: // Variable bit-field length/auto inc/start.
Memory.FillRAM [0x2258] = byte;
- S9xSA1ReadVariableLengthData(TRUE, FALSE);
+ S9xSA1ReadVariableLengthData(true, false);
return;
case 0x2259:
case 0x225a:
@@ -790,7 +790,7 @@ void S9xSetSA1(uint8 byte, uint32 address)
Memory.FillRAM [address] = byte;
// XXX: ???
SA1.variable_bit_pos = 0;
- S9xSA1ReadVariableLengthData(FALSE, TRUE);
+ S9xSA1ReadVariableLengthData(false, true);
return;
default:
// printf ("W: %02x->%04x\n", byte, address);
@@ -803,13 +803,13 @@ void S9xSetSA1(uint8 byte, uint32 address)
static void S9xSA1CharConv2()
{
int l, b;
- uint32 dest = Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8);
- uint32 offset = (SA1.in_char_dma & 7) ? 0 : 1;
+ uint32_t dest = Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8);
+ uint32_t offset = (SA1.in_char_dma & 7) ? 0 : 1;
int depth = (Memory.FillRAM [0x2231] & 3) == 0 ? 8 :
(Memory.FillRAM [0x2231] & 3) == 1 ? 4 : 2;
int bytes_per_char = 8 * depth;
- uint8* p = &Memory.FillRAM [0x3000] + dest + offset * bytes_per_char;
- uint8* q = &Memory.ROM [MAX_ROM_SIZE - 0x10000] + offset * 64;
+ uint8_t* p = &Memory.FillRAM [0x3000] + dest + offset * bytes_per_char;
+ uint8_t* q = &Memory.ROM [MAX_ROM_SIZE - 0x10000] + offset * 64;
switch (depth)
{
@@ -822,7 +822,7 @@ static void S9xSA1CharConv2()
{
for (b = 0; b < 8; b++)
{
- uint8 r = *(q + b);
+ uint8_t r = *(q + b);
*(p + 0) = (*(p + 0) << 1) | ((r >> 0) & 1);
*(p + 1) = (*(p + 1) << 1) | ((r >> 1) & 1);
*(p + 16) = (*(p + 16) << 1) | ((r >> 2) & 1);
@@ -840,23 +840,23 @@ static void S9xSA1CharConv2()
static void S9xSA1DMA()
{
- uint32 src = Memory.FillRAM [0x2232] |
+ uint32_t src = Memory.FillRAM [0x2232] |
(Memory.FillRAM [0x2233] << 8) |
(Memory.FillRAM [0x2234] << 16);
- uint32 dst = Memory.FillRAM [0x2235] |
+ uint32_t dst = Memory.FillRAM [0x2235] |
(Memory.FillRAM [0x2236] << 8) |
(Memory.FillRAM [0x2237] << 16);
- uint32 len = Memory.FillRAM [0x2238] |
+ uint32_t len = Memory.FillRAM [0x2238] |
(Memory.FillRAM [0x2239] << 8);
- uint8* s;
- uint8* d;
+ uint8_t* s;
+ uint8_t* d;
switch (Memory.FillRAM [0x2230] & 3)
{
case 0: // ROM
s = SA1.Map [(src >> MEMMAP_SHIFT) & MEMMAP_MASK];
- if (s >= (uint8*) MAP_LAST)
+ if (s >= (uint8_t*) MAP_LAST)
s += (src & 0xffff);
else
s = Memory.ROM + (src & 0xffff);
@@ -898,37 +898,37 @@ static void S9xSA1DMA()
}
}
-void S9xSA1ReadVariableLengthData(bool8 inc, bool8 no_shift)
+void S9xSA1ReadVariableLengthData(bool inc, bool no_shift)
{
- uint32 addr = Memory.FillRAM [0x2259] |
+ uint32_t addr = Memory.FillRAM [0x2259] |
(Memory.FillRAM [0x225a] << 8) |
(Memory.FillRAM [0x225b] << 16);
- uint8 shift = Memory.FillRAM [0x2258] & 15;
+ uint8_t shift = Memory.FillRAM [0x2258] & 15;
if (no_shift)
shift = 0;
else if (shift == 0)
shift = 16;
- uint8 s = shift + SA1.variable_bit_pos;
+ uint8_t s = shift + SA1.variable_bit_pos;
if (s >= 16)
{
addr += (s >> 4) << 1;
s &= 15;
}
- uint32 data = S9xSA1GetWord(addr) |
+ uint32_t data = S9xSA1GetWord(addr) |
(S9xSA1GetWord(addr + 2) << 16);
data >>= s;
- Memory.FillRAM [0x230c] = (uint8) data;
- Memory.FillRAM [0x230d] = (uint8)(data >> 8);
+ Memory.FillRAM [0x230c] = (uint8_t) data;
+ Memory.FillRAM [0x230d] = (uint8_t)(data >> 8);
if (inc)
{
SA1.variable_bit_pos = (SA1.variable_bit_pos + shift) & 15;
- Memory.FillRAM [0x2259] = (uint8) addr;
- Memory.FillRAM [0x225a] = (uint8)(addr >> 8);
- Memory.FillRAM [0x225b] = (uint8)(addr >> 16);
+ Memory.FillRAM [0x2259] = (uint8_t) addr;
+ Memory.FillRAM [0x225a] = (uint8_t)(addr >> 8);
+ Memory.FillRAM [0x225b] = (uint8_t)(addr >> 16);
}
}
diff --git a/source/sa1.h b/source/sa1.h
index 740d615..92345df 100644
--- a/source/sa1.h
+++ b/source/sa1.h
@@ -95,55 +95,55 @@
typedef struct
{
- uint8 PB;
- uint8 DB;
+ uint8_t PB;
+ uint8_t DB;
pair P;
pair A;
pair D;
pair S;
pair X;
pair Y;
- uint16 PC;
+ uint16_t PC;
} SSA1Registers;
typedef struct
{
SOpcodes* S9xOpcodes;
- uint8 _Carry;
- uint8 _Zero;
- uint8 _Negative;
- uint8 _Overflow;
- bool8 CPUExecuting;
- uint32 ShiftedPB;
- uint32 ShiftedDB;
- uint32 Flags;
- bool8 Executing;
- bool8 NMIActive;
- bool8 IRQActive;
- bool8 WaitingForInterrupt;
- bool8 Waiting;
- // uint8 WhichEvent;
- uint8* PC;
- uint8* PCBase;
- uint8* BWRAM;
- uint8* PCAtOpcodeStart;
- uint8* WaitAddress;
- uint32 WaitCounter;
- uint8* WaitByteAddress1;
- uint8* WaitByteAddress2;
+ uint8_t _Carry;
+ uint8_t _Zero;
+ uint8_t _Negative;
+ uint8_t _Overflow;
+ bool CPUExecuting;
+ uint32_t ShiftedPB;
+ uint32_t ShiftedDB;
+ uint32_t Flags;
+ bool Executing;
+ bool NMIActive;
+ bool IRQActive;
+ bool WaitingForInterrupt;
+ bool Waiting;
+ // uint8_t WhichEvent;
+ uint8_t* PC;
+ uint8_t* PCBase;
+ uint8_t* BWRAM;
+ uint8_t* PCAtOpcodeStart;
+ uint8_t* WaitAddress;
+ uint32_t WaitCounter;
+ uint8_t* WaitByteAddress1;
+ uint8_t* WaitByteAddress2;
// long Cycles;
// long NextEvent;
// long V_Counter;
- uint8* Map [MEMMAP_NUM_BLOCKS];
- uint8* WriteMap [MEMMAP_NUM_BLOCKS];
- int16 op1;
- int16 op2;
+ uint8_t* Map [MEMMAP_NUM_BLOCKS];
+ uint8_t* WriteMap [MEMMAP_NUM_BLOCKS];
+ int16_t op1;
+ int16_t op2;
int arithmetic_op;
- int64 sum;
- bool8 overflow;
- uint8 VirtualBitmapFormat;
- bool8 in_char_dma;
- uint8 variable_bit_pos;
+ int64_t sum;
+ bool overflow;
+ uint8_t VirtualBitmapFormat;
+ bool in_char_dma;
+ uint8_t variable_bit_pos;
SSA1Registers Registers;
} SSA1;
@@ -162,13 +162,13 @@ typedef struct
#define SA1CheckFlag(f) (SA1.Registers.PL & (f))
-uint8 S9xSA1GetByte(uint32);
-uint16 S9xSA1GetWord(uint32);
-void S9xSA1SetByte(uint8, uint32);
-void S9xSA1SetWord(uint16, uint32);
-void S9xSA1SetPCBase(uint32);
-uint8 S9xGetSA1(uint32);
-void S9xSetSA1(uint8, uint32);
+uint8_t S9xSA1GetByte(uint32_t);
+uint16_t S9xSA1GetWord(uint32_t);
+void S9xSA1SetByte(uint8_t, uint32_t);
+void S9xSA1SetWord(uint16_t, uint32_t);
+void S9xSA1SetPCBase(uint32_t);
+uint8_t S9xGetSA1(uint32_t);
+void S9xSetSA1(uint8_t, uint32_t);
extern SOpcodes S9xSA1OpcodesM1X1 [256];
extern SOpcodes S9xSA1OpcodesM1X0 [256];
diff --git a/source/sa1cpu.c b/source/sa1cpu.c
index ddabd09..b2b33b7 100644
--- a/source/sa1cpu.c
+++ b/source/sa1cpu.c
@@ -212,7 +212,7 @@ void S9xSA1MainLoop()
SA1.Flags &= ~NMI_FLAG;
if (SA1.WaitingForInterrupt)
{
- SA1.WaitingForInterrupt = FALSE;
+ SA1.WaitingForInterrupt = false;
SA1.PC++;
}
S9xSA1Opcode_NMI();
@@ -224,7 +224,7 @@ void S9xSA1MainLoop()
{
if (SA1.WaitingForInterrupt)
{
- SA1.WaitingForInterrupt = FALSE;
+ SA1.WaitingForInterrupt = false;
SA1.PC++;
}
if (!SA1CheckFlag(IRQ))
diff --git a/source/sar.h b/source/sar.h
index 14d89d9..0441b71 100644
--- a/source/sar.h
+++ b/source/sar.h
@@ -96,10 +96,6 @@
#include "port.h"
-#ifndef snes9x_types_defined
-#include "9xtypes.h"
-#endif
-
#ifdef RIGHTSHIFT_IS_SAR
#define SAR8(b, n) ((b)>>(n))
#define SAR16(b, n) ((b)>>(n))
@@ -107,7 +103,7 @@
#define SAR64(b, n) ((b)>>(n))
#else
-static inline int8 SAR8(const int8 b, const int n)
+static inline int8_t SAR8(const int8_t b, const int n)
{
#ifndef RIGHTSHIFT_INT8_IS_SAR
if (b < 0) return (b >> n) | (-1 << (8 - n));
@@ -115,7 +111,7 @@ static inline int8 SAR8(const int8 b, const int n)
return b >> n;
}
-static inline int16 SAR16(const int16 b, const int n)
+static inline int16_t SAR16(const int16_t b, const int n)
{
#ifndef RIGHTSHIFT_INT16_IS_SAR
if (b < 0) return (b >> n) | (-1 << (16 - n));
@@ -123,7 +119,7 @@ static inline int16 SAR16(const int16 b, const int n)
return b >> n;
}
-static inline int32 SAR32(const int32 b, const int n)
+static inline int32_t SAR32(const int32_t b, const int n)
{
#ifndef RIGHTSHIFT_INT32_IS_SAR
if (b < 0) return (b >> n) | (-1 << (32 - n));
@@ -131,7 +127,7 @@ static inline int32 SAR32(const int32 b, const int n)
return b >> n;
}
-static inline int64 SAR64(const int64 b, const int n)
+static inline int64_t SAR64(const int64_t b, const int n)
{
#ifndef RIGHTSHIFT_INT64_IS_SAR
if (b < 0) return (b >> n) | (-1 << (64 - n));
diff --git a/source/sdd1.c b/source/sdd1.c
index bf14496..79b06f6 100644
--- a/source/sdd1.c
+++ b/source/sdd1.c
@@ -97,7 +97,7 @@
#include <unistd.h>
#endif
-void S9xSetSDD1MemoryMap(uint32 bank, uint32 value)
+void S9xSetSDD1MemoryMap(uint32_t bank, uint32_t value)
{
bank = 0xc00 + bank * 0x100;
value = value * 1024 * 1024;
@@ -106,7 +106,7 @@ void S9xSetSDD1MemoryMap(uint32 bank, uint32 value)
for (c = 0; c < 0x100; c += 16)
{
- uint8* block = &Memory.ROM [value + (c << 12)];
+ uint8_t* block = &Memory.ROM [value + (c << 12)];
int i;
for (i = c; i < c + 16; i++)
@@ -134,10 +134,10 @@ void S9xSDD1PostLoadState()
static int S9xCompareSDD1LoggedDataEntries(const void* p1, const void* p2)
{
- uint8* b1 = (uint8*) p1;
- uint8* b2 = (uint8*) p2;
- uint32 a1 = (*b1 << 16) + (*(b1 + 1) << 8) + *(b1 + 2);
- uint32 a2 = (*b2 << 16) + (*(b2 + 1) << 8) + *(b2 + 2);
+ uint8_t* b1 = (uint8_t*) p1;
+ uint8_t* b2 = (uint8_t*) p2;
+ uint32_t a1 = (*b1 << 16) + (*(b1 + 1) << 8) + *(b1 + 2);
+ uint32_t a2 = (*b2 << 16) + (*(b2 + 1) << 8) + *(b2 + 2);
return (a1 - a2);
}
diff --git a/source/sdd1.h b/source/sdd1.h
index 48c6362..52e93b6 100644
--- a/source/sdd1.h
+++ b/source/sdd1.h
@@ -89,7 +89,7 @@
#ifndef _SDD1_H_
#define _SDD1_H_
-void S9xSetSDD1MemoryMap(uint32 bank, uint32 value);
+void S9xSetSDD1MemoryMap(uint32_t bank, uint32_t value);
void S9xResetSDD1();
void S9xSDD1PostLoadState();
void S9xSDD1SaveLoggedData();
diff --git a/source/sdd1emu.c b/source/sdd1emu.c
index c7005ec..cccbf27 100644
--- a/source/sdd1emu.c
+++ b/source/sdd1emu.c
@@ -105,10 +105,10 @@
#include "sdd1emu.h"
static int valid_bits;
-static uint16 in_stream;
-static uint8* in_buf;
-static uint8 bit_ctr[8];
-static uint8 context_states[32];
+static uint16_t in_stream;
+static uint8_t* in_buf;
+static uint8_t bit_ctr[8];
+static uint8_t context_states[32];
static int context_MPS[32];
static int bitplane_type;
static int high_context_bits;
@@ -117,9 +117,9 @@ static int prev_bits[8];
static struct
{
- uint8 code_size;
- uint8 MPS_next;
- uint8 LPS_next;
+ uint8_t code_size;
+ uint8_t MPS_next;
+ uint8_t LPS_next;
} evolution_table[] =
{
/* 0 */ { 0, 25, 25},
@@ -157,7 +157,7 @@ static struct
/* 32 */ { 7, 24, 22}
};
-static uint8 run_table[128] =
+static uint8_t run_table[128] =
{
128, 64, 96, 32, 112, 48, 80, 16, 120, 56, 88, 24, 104, 40, 72,
8, 124, 60, 92, 28, 108, 44, 76, 12, 116, 52, 84, 20, 100, 36,
@@ -170,9 +170,9 @@ static uint8 run_table[128] =
113, 49, 81, 17, 97, 33, 65, 1
};
-static inline uint8 GetCodeword(int bits)
+static inline uint8_t GetCodeword(int bits)
{
- uint8 tmp;
+ uint8_t tmp;
if (!valid_bits)
{
@@ -194,7 +194,7 @@ static inline uint8 GetCodeword(int bits)
return run_table[tmp];
}
-static inline uint8 GolombGetBit(int code_size)
+static inline uint8_t GolombGetBit(int code_size)
{
if (!bit_ctr[code_size]) bit_ctr[code_size] = GetCodeword(code_size);
bit_ctr[code_size]--;
@@ -206,10 +206,10 @@ static inline uint8 GolombGetBit(int code_size)
return (bit_ctr[code_size] == 0) ? 1 : 0;
}
-static inline uint8 ProbGetBit(uint8 context)
+static inline uint8_t ProbGetBit(uint8_t context)
{
- uint8 state = context_states[context];
- uint8 bit = GolombGetBit(evolution_table[state].code_size);
+ uint8_t state = context_states[context];
+ uint8_t bit = GolombGetBit(evolution_table[state].code_size);
if (bit & 1)
{
@@ -232,9 +232,9 @@ static inline uint8 ProbGetBit(uint8 context)
return context_MPS[context]; /* we know bit is 0, so don't bother xoring */
}
-static inline uint8 GetBit(uint8 cur_bitplane)
+static inline uint8_t GetBit(uint8_t cur_bitplane)
{
- uint8 bit;
+ uint8_t bit;
bit = ProbGetBit(((cur_bitplane & 1) << 4)
| ((prev_bits[cur_bitplane] & high_context_bits) >> 5)
@@ -245,10 +245,10 @@ static inline uint8 GetBit(uint8 cur_bitplane)
return bit;
}
-void SDD1_decompress(uint8* out, uint8* in, int len)
+void SDD1_decompress(uint8_t* out, uint8_t* in, int len)
{
- uint8 bit, i, plane;
- uint8 byte1, byte2;
+ uint8_t bit, i, plane;
+ uint8_t byte1, byte2;
if (len == 0) len = 0x10000;
@@ -344,11 +344,11 @@ void SDD1_decompress(uint8* out, uint8* in, int len)
}
}
-static uint8 cur_plane;
-static uint8 num_bits;
-static uint8 next_byte;
+static uint8_t cur_plane;
+static uint8_t num_bits;
+static uint8_t next_byte;
-void SDD1_init(uint8* in)
+void SDD1_init(uint8_t* in)
{
bitplane_type = in[0] >> 6;
@@ -384,10 +384,10 @@ void SDD1_init(uint8* in)
num_bits = 0;
}
-uint8 SDD1_get_byte(void)
+uint8_t SDD1_get_byte(void)
{
- uint8 bit;
- uint8 byte = 0;
+ uint8_t bit;
+ uint8_t byte = 0;
switch (bitplane_type)
{
diff --git a/source/sdd1emu.h b/source/sdd1emu.h
index 642454f..5b06e02 100644
--- a/source/sdd1emu.h
+++ b/source/sdd1emu.h
@@ -91,9 +91,9 @@
//#include "port.h"
-void SDD1_decompress(uint8* out, uint8* in, int output_length);
+void SDD1_decompress(uint8_t* out, uint8_t* in, int output_length);
-void SDD1_init(uint8* in);
-uint8 SDD1_get_byte(void);
+void SDD1_init(uint8_t* in);
+uint8_t SDD1_get_byte(void);
#endif
diff --git a/source/seta.c b/source/seta.c
index cce8330..895fa32 100644
--- a/source/seta.c
+++ b/source/seta.c
@@ -88,15 +88,15 @@
*******************************************************************************/
#include "seta.h"
-void (*SetSETA)(uint32, uint8) = &S9xSetST010;
-uint8(*GetSETA)(uint32) = &S9xGetST010;
+void (*SetSETA)(uint32_t, uint8_t) = &S9xSetST010;
+uint8_t(*GetSETA)(uint32_t) = &S9xGetST010;
-uint8 S9xGetSetaDSP(uint32 Address)
+uint8_t S9xGetSetaDSP(uint32_t Address)
{
return GetSETA(Address);
}
-void S9xSetSetaDSP(uint8 Byte, uint32 Address)
+void S9xSetSetaDSP(uint8_t Byte, uint32_t Address)
{
SetSETA(Address, Byte);
}
diff --git a/source/seta.h b/source/seta.h
index d50e588..fc8f5ce 100644
--- a/source/seta.h
+++ b/source/seta.h
@@ -97,54 +97,54 @@
#define ST_011 0x02
#define ST_018 0x03
-uint8 S9xGetSetaDSP(uint32 Address);
-void S9xSetSetaDSP(uint8 byte, uint32 Address);
-uint8 S9xGetST018(uint32 Address);
-void S9xSetST018(uint8 Byte, uint32 Address);
+uint8_t S9xGetSetaDSP(uint32_t Address);
+void S9xSetSetaDSP(uint8_t byte, uint32_t Address);
+uint8_t S9xGetST018(uint32_t Address);
+void S9xSetST018(uint8_t Byte, uint32_t Address);
-uint8 S9xGetST010(uint32 Address);
-void S9xSetST010(uint32 Address, uint8 Byte);
-uint8 S9xGetST011(uint32 Address);
-void S9xSetST011(uint32 Address, uint8 Byte);
+uint8_t S9xGetST010(uint32_t Address);
+void S9xSetST010(uint32_t Address, uint8_t Byte);
+uint8_t S9xGetST011(uint32_t Address);
+void S9xSetST011(uint32_t Address, uint8_t Byte);
-extern void (*SetSETA)(uint32, uint8);
-extern uint8(*GetSETA)(uint32);
+extern void (*SetSETA)(uint32_t, uint8_t);
+extern uint8_t(*GetSETA)(uint32_t);
typedef struct SETA_ST010_STRUCT
{
- uint8 input_params[16];
- uint8 output_params[16];
- uint8 op_reg;
- uint8 execute;
- bool8 control_enable;
+ uint8_t input_params[16];
+ uint8_t output_params[16];
+ uint8_t op_reg;
+ uint8_t execute;
+ bool control_enable;
} ST010_Regs;
typedef struct SETA_ST011_STRUCT
{
- bool8 waiting4command;
- uint8 status;
- uint8 command;
- uint32 in_count;
- uint32 in_index;
- uint32 out_count;
- uint32 out_index;
- uint8 parameters [512];
- uint8 output [512];
+ bool waiting4command;
+ uint8_t status;
+ uint8_t command;
+ uint32_t in_count;
+ uint32_t in_index;
+ uint32_t out_count;
+ uint32_t out_index;
+ uint8_t parameters [512];
+ uint8_t output [512];
} ST011_Regs;
typedef struct SETA_ST018_STRUCT
{
- bool8 waiting4command;
- uint8 status;
- uint8 part_command;
- uint8 pass;
- uint32 command;
- uint32 in_count;
- uint32 in_index;
- uint32 out_count;
- uint32 out_index;
- uint8 parameters [512];
- uint8 output [512];
+ bool waiting4command;
+ uint8_t status;
+ uint8_t part_command;
+ uint8_t pass;
+ uint32_t command;
+ uint32_t in_count;
+ uint32_t in_index;
+ uint32_t out_count;
+ uint32_t out_index;
+ uint8_t parameters [512];
+ uint8_t output [512];
} ST018_Regs;
#endif
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;
}
diff --git a/source/seta011.c b/source/seta011.c
index df6d696..c58a451 100644
--- a/source/seta011.c
+++ b/source/seta011.c
@@ -93,15 +93,15 @@
ST011_Regs ST011;
// shougi playboard
-uint8 board[9][9];
+uint8_t board[9][9];
// debug
static int line = 0;
-uint8 S9xGetST011(uint32 Address)
+uint8_t S9xGetST011(uint32_t Address)
{
- uint8 t;
- uint16 address = (uint16) Address & 0xFFFF;
+ uint8_t t;
+ uint16_t address = (uint16_t) Address & 0xFFFF;
// line counter
line++;
@@ -120,9 +120,9 @@ uint8 S9xGetST011(uint32 Address)
return t;
}
-void S9xSetST011(uint32 Address, uint8 Byte)
+void S9xSetST011(uint32_t Address, uint8_t Byte)
{
- uint16 address = (uint16) Address & 0xFFFF;
+ uint16_t address = (uint16_t) Address & 0xFFFF;
static bool reset = false;
// debug
diff --git a/source/seta018.c b/source/seta018.c
index 33a1bb1..d3a7092 100644
--- a/source/seta018.c
+++ b/source/seta018.c
@@ -93,10 +93,10 @@ ST018_Regs ST018;
static int line; // line counter
-uint8 S9xGetST018(uint32 Address)
+uint8_t S9xGetST018(uint32_t Address)
{
- uint8 t = 0; // Initialise to some value for the compiler
- uint16 address = (uint16) Address & 0xFFFF;
+ uint8_t t = 0; // Initialise to some value for the compiler
+ uint16_t address = (uint16_t) Address & 0xFFFF;
line++;
@@ -106,7 +106,7 @@ uint8 S9xGetST018(uint32 Address)
{
if (ST018.out_count)
{
- t = (uint8) ST018.output [ST018.out_index];
+ t = (uint8_t) ST018.output [ST018.out_index];
ST018.out_index++;
if (ST018.out_count == ST018.out_index)
ST018.out_count = 0;
@@ -123,9 +123,9 @@ uint8 S9xGetST018(uint32 Address)
return t;
}
-void S9xSetST018(uint8 Byte, uint32 Address)
+void S9xSetST018(uint8_t Byte, uint32_t Address)
{
- uint16 address = (uint16) Address & 0xFFFF;
+ uint16_t address = (uint16_t) Address & 0xFFFF;
static bool reset = false;
printf("ST018 W: %06X %02X\n", Address, Byte);
diff --git a/source/snes9x.h b/source/snes9x.h
index e9c04a5..4bf7409 100644
--- a/source/snes9x.h
+++ b/source/snes9x.h
@@ -164,7 +164,7 @@ extern int cprintf(const char* fmt, ...);
#define SNES_CLOCK_LEN (1.0 / SNES_CLOCK_SPEED)
-#define SNES_CYCLES_PER_SCANLINE ((uint32) ((SNES_SCANLINE_TIME / SNES_CLOCK_LEN) * 6 + 0.5))
+#define SNES_CYCLES_PER_SCANLINE ((uint32_t) ((SNES_SCANLINE_TIME / SNES_CLOCK_LEN) * 6 + 0.5))
#define ONE_CYCLE 6
#define SLOW_ONE_CYCLE 8
@@ -211,31 +211,31 @@ enum
typedef struct
{
- uint32 Flags;
- bool8 BranchSkip;
- bool8 NMIActive;
- bool8 IRQActive;
- bool8 WaitingForInterrupt;
- bool8 InDMA;
- uint8 WhichEvent;
- uint8* PC;
- uint8* PCBase;
- uint8* PCAtOpcodeStart;
- uint8* WaitAddress;
- uint32 WaitCounter;
+ uint32_t Flags;
+ bool BranchSkip;
+ bool NMIActive;
+ bool IRQActive;
+ bool WaitingForInterrupt;
+ bool InDMA;
+ uint8_t WhichEvent;
+ uint8_t* PC;
+ uint8_t* PCBase;
+ uint8_t* PCAtOpcodeStart;
+ uint8_t* WaitAddress;
+ uint32_t WaitCounter;
long Cycles;
long NextEvent;
long V_Counter;
long MemSpeed;
long MemSpeedx2;
long FastROMSpeed;
- uint32 AutoSaveTimer;
- bool8 SRAMModified;
- uint32 NMITriggerPoint;
- bool8 BRKTriggered;
- bool8 TriedInterleavedMode2;
- uint32 NMICycleCount;
- uint32 IRQCycleCount;
+ uint32_t AutoSaveTimer;
+ bool SRAMModified;
+ uint32_t NMITriggerPoint;
+ bool BRKTriggered;
+ bool TriedInterleavedMode2;
+ uint32_t NMICycleCount;
+ uint32_t IRQCycleCount;
#ifdef DEBUG_MAXCOUNT
unsigned long GlobalLoopCount;
#endif
@@ -250,130 +250,130 @@ typedef struct
typedef struct
{
/* CPU options */
- bool8 APUEnabled;
- bool8 Shutdown;
- uint8 SoundSkipMethod;
+ bool APUEnabled;
+ bool Shutdown;
+ uint8_t SoundSkipMethod;
long H_Max;
long HBlankStart;
long CyclesPercentage;
- bool8 DisableIRQ;
- bool8 Paused;
- bool8 ForcedPause;
- bool8 StopEmulation;
- bool8 FrameAdvance;
+ bool DisableIRQ;
+ bool Paused;
+ bool ForcedPause;
+ bool StopEmulation;
+ bool FrameAdvance;
/* Tracing options */
- bool8 TraceDMA;
- bool8 TraceHDMA;
- bool8 TraceVRAM;
- bool8 TraceUnknownRegisters;
- bool8 TraceDSP;
+ bool TraceDMA;
+ bool TraceHDMA;
+ bool TraceVRAM;
+ bool TraceUnknownRegisters;
+ bool TraceDSP;
/* Joystick options */
- bool8 SwapJoypads;
- bool8 JoystickEnabled;
+ bool SwapJoypads;
+ bool JoystickEnabled;
/* ROM timing options (see also H_Max above) */
- bool8 ForcePAL;
- bool8 ForceNTSC;
- bool8 PAL;
- uint32 FrameTimePAL;
- uint32 FrameTimeNTSC;
- uint32 FrameTime;
- uint32 SkipFrames;
+ bool ForcePAL;
+ bool ForceNTSC;
+ bool PAL;
+ uint32_t FrameTimePAL;
+ uint32_t FrameTimeNTSC;
+ uint32_t FrameTime;
+ uint32_t SkipFrames;
/* ROM image options */
- bool8 ForceLoROM;
- bool8 ForceHiROM;
- bool8 ForceHeader;
- bool8 ForceNoHeader;
- bool8 ForceInterleaved;
- bool8 ForceInterleaved2;
- bool8 ForceNotInterleaved;
+ bool ForceLoROM;
+ bool ForceHiROM;
+ bool ForceHeader;
+ bool ForceNoHeader;
+ bool ForceInterleaved;
+ bool ForceInterleaved2;
+ bool ForceNotInterleaved;
/* Peripherial options */
- bool8 ForceSuperFX;
- bool8 ForceNoSuperFX;
- bool8 ForceDSP1;
- bool8 ForceNoDSP1;
- bool8 ForceSA1;
- bool8 ForceNoSA1;
- bool8 ForceC4;
- bool8 ForceNoC4;
- bool8 ForceSDD1;
- bool8 ForceNoSDD1;
- bool8 MultiPlayer5;
- bool8 Mouse;
- bool8 SuperScope;
- bool8 SRTC;
- uint32 ControllerOption;
-
- bool8 ShutdownMaster;
- bool8 MultiPlayer5Master;
- bool8 SuperScopeMaster;
- bool8 MouseMaster;
- bool8 SuperFX;
- bool8 DSP1Master;
- bool8 SA1;
- bool8 C4;
- bool8 SDD1;
- bool8 SPC7110;
- bool8 SPC7110RTC;
- bool8 OBC1;
+ bool ForceSuperFX;
+ bool ForceNoSuperFX;
+ bool ForceDSP1;
+ bool ForceNoDSP1;
+ bool ForceSA1;
+ bool ForceNoSA1;
+ bool ForceC4;
+ bool ForceNoC4;
+ bool ForceSDD1;
+ bool ForceNoSDD1;
+ bool MultiPlayer5;
+ bool Mouse;
+ bool SuperScope;
+ bool SRTC;
+ uint32_t ControllerOption;
+
+ bool ShutdownMaster;
+ bool MultiPlayer5Master;
+ bool SuperScopeMaster;
+ bool MouseMaster;
+ bool SuperFX;
+ bool DSP1Master;
+ bool SA1;
+ bool C4;
+ bool SDD1;
+ bool SPC7110;
+ bool SPC7110RTC;
+ bool OBC1;
/* Sound options */
- uint32 SoundPlaybackRate;
+ uint32_t SoundPlaybackRate;
#ifdef USE_BLARGG_APU
- uint32 SoundInputRate;
+ uint32_t SoundInputRate;
#endif
- bool8 TraceSoundDSP;
- bool8 EightBitConsoleSound; // due to caching, this needs S9xSetEightBitConsoleSound()
+ bool TraceSoundDSP;
+ bool EightBitConsoleSound; // due to caching, this needs S9xSetEightBitConsoleSound()
int SoundBufferSize;
int SoundMixInterval;
- bool8 SoundEnvelopeHeightReading;
- bool8 DisableSoundEcho;
- bool8 DisableMasterVolume;
- bool8 SoundSync;
- bool8 InterpolatedSound;
- bool8 ThreadSound;
- bool8 Mute;
- bool8 NextAPUEnabled;
+ bool SoundEnvelopeHeightReading;
+ bool DisableSoundEcho;
+ bool DisableMasterVolume;
+ bool SoundSync;
+ bool InterpolatedSound;
+ bool ThreadSound;
+ bool Mute;
+ bool NextAPUEnabled;
/* Graphics options */
- bool8 Transparency;
- bool8 SupportHiRes;
- bool8 Mode7Interpolate;
+ bool Transparency;
+ bool SupportHiRes;
+ bool Mode7Interpolate;
/* SNES graphics options */
- bool8 BGLayering;
- bool8 DisableGraphicWindows;
- bool8 ForceTransparency;
- bool8 ForceNoTransparency;
- bool8 DisableHDMA;
- bool8 DisplayFrameRate;
- bool8 DisableRangeTimeOver; /* XXX: unused */
+ bool BGLayering;
+ bool DisableGraphicWindows;
+ bool ForceTransparency;
+ bool ForceNoTransparency;
+ bool DisableHDMA;
+ bool DisplayFrameRate;
+ bool DisableRangeTimeOver; /* XXX: unused */
/* Others */
- bool8 ApplyCheats;
+ bool ApplyCheats;
/* Fixes for individual games */
- bool8 StarfoxHack;
- bool8 WinterGold;
- bool8 BS; /* Japanese Satellite System games. */
- bool8 DaffyDuck;
- uint8 APURAMInitialValue;
- bool8 SampleCatchup;
- bool8 JustifierMaster;
- bool8 Justifier;
- bool8 SecondJustifier;
- int8 SETA;
- bool8 TakeScreenshot;
- int8 StretchScreenshots;
- uint16 DisplayColor;
+ bool StarfoxHack;
+ bool WinterGold;
+ bool BS; /* Japanese Satellite System games. */
+ bool DaffyDuck;
+ uint8_t APURAMInitialValue;
+ bool SampleCatchup;
+ bool JustifierMaster;
+ bool Justifier;
+ bool SecondJustifier;
+ int8_t SETA;
+ bool TakeScreenshot;
+ int8_t StretchScreenshots;
+ uint16_t DisplayColor;
int SoundDriver;
int AIDOShmId;
- bool8 SDD1Pack;
- bool8 NoPatch;
- bool8 ForceInterleaveGD24;
+ bool SDD1Pack;
+ bool NoPatch;
+ bool ForceInterleaveGD24;
#ifdef DEBUG_MAXCOUNT
unsigned int MaxCount;
#endif
@@ -381,12 +381,12 @@ typedef struct
typedef struct
{
- uint8 alienVSpredetorFix;
- uint8 APU_OutPorts_ReturnValueFix;
- uint8 SoundEnvelopeHeightReading2;
- uint8 SRAMInitialValue;
- uint8 Uniracers;
- bool8 EchoOnlyOutput;
+ uint8_t alienVSpredetorFix;
+ uint8_t APU_OutPorts_ReturnValueFix;
+ uint8_t SoundEnvelopeHeightReading2;
+ uint8_t SRAMInitialValue;
+ uint8_t Uniracers;
+ bool EchoOnlyOutput;
} SSNESGameFixes;
extern SSettings Settings;
@@ -397,8 +397,8 @@ extern char String [513];
void S9xMessage(int type, int number, const char* message);
void S9xLoadSDD1Data();
-void S9xSetPause(uint32 mask);
-void S9xClearPause(uint32 mask);
+void S9xSetPause(uint32_t mask);
+void S9xClearPause(uint32_t mask);
#endif
diff --git a/source/soundux.c b/source/soundux.c
index 8f9b124..9f85e7a 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -90,7 +90,7 @@
#ifdef __DJGPP__
#include <allegro.h>
-#undef TRUE
+#undef true
#endif
#include <stdlib.h>
@@ -133,20 +133,20 @@
#include "memmap.h"
#include "cpuexec.h"
-extern int32 Echo [24000];
-extern int32 DummyEchoBuffer [SOUND_BUFFER_SIZE];
-extern int32 MixBuffer [SOUND_BUFFER_SIZE];
-extern int32 EchoBuffer [SOUND_BUFFER_SIZE];
-extern int32 FilterTaps [8];
-static uint8 FilterTapDefinitionBitfield;
+extern int32_t Echo [24000];
+extern int32_t DummyEchoBuffer [SOUND_BUFFER_SIZE];
+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.
extern unsigned long Z;
-extern int32 Loop [16];
+extern int32_t Loop [16];
extern long FilterValues[4][2];
-extern int32 NoiseFreq [32];
+extern int32_t NoiseFreq [32];
-static int32 noise_gen;
+static int32_t noise_gen;
#undef ABS
#define ABS(a) ((a) < 0 ? -(a) : (a))
@@ -159,8 +159,8 @@ static int32 noise_gen;
#define VOL_DIV16 0x0080
#define ENVX_SHIFT 24
-void DecodeBlockAsm(int8*, int16*, int32*, int32*);
-void DecodeBlockAsm2(int8*, int16*, int32*, int32*);
+void DecodeBlockAsm(int8_t*, int16_t*, int32_t*, int32_t*);
+void DecodeBlockAsm2(int8_t*, int16_t*, int32_t*, int32_t*);
// 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.
@@ -170,20 +170,20 @@ void DecodeBlockAsm2(int8*, int16*, int32*, int32*);
#define LAST_SAMPLE 0xffffff
#define JUST_PLAYED_LAST_SAMPLE(c) ((c)->sample_pointer >= LAST_SAMPLE)
-void S9xSetEightBitConsoleSound(bool8 Enabled)
+void S9xSetEightBitConsoleSound(bool Enabled)
{
if (Settings.EightBitConsoleSound != Enabled)
{
Settings.EightBitConsoleSound = Enabled;
int i;
for (i = 0; i < 8; i++)
- SoundData.channels[i].needs_decode = TRUE;
+ SoundData.channels[i].needs_decode = true;
}
}
-STATIC inline uint8* S9xGetSampleAddress(int sample_number)
+STATIC inline uint8_t* S9xGetSampleAddress(int sample_number)
{
- uint32 addr = (((APU.DSP[APU_DIR] << 8) + (sample_number << 2)) & 0xffff);
+ uint32_t addr = (((APU.DSP[APU_DIR] << 8) + (sample_number << 2)) & 0xffff);
return (IAPU.RAM + addr);
}
@@ -220,19 +220,19 @@ void S9xSetEnvRate(Channel* ch, unsigned long rate, int direction, int target)
else
ch->direction = direction;
- static int64 steps [] =
+ static int64_t steps [] =
{
// 0, 64, 1238, 1238, 256, 1, 64, 109, 64, 1238
0,
- (int64) FIXED_POINT * 1000 * 64,
- (int64) FIXED_POINT * 1000 * 619,
- (int64) FIXED_POINT * 1000 * 619,
- (int64) FIXED_POINT * 1000 * 128,
- (int64) FIXED_POINT * 1000 * 1,
- (int64) FIXED_POINT * 1000 * 64,
- (int64) FIXED_POINT * 1000 * 55,
- (int64) FIXED_POINT * 1000 * 64,
- (int64) FIXED_POINT * 1000 * 619
+ (int64_t) FIXED_POINT * 1000 * 64,
+ (int64_t) FIXED_POINT * 1000 * 619,
+ (int64_t) FIXED_POINT * 1000 * 619,
+ (int64_t) FIXED_POINT * 1000 * 128,
+ (int64_t) FIXED_POINT * 1000 * 1,
+ (int64_t) FIXED_POINT * 1000 * 64,
+ (int64_t) FIXED_POINT * 1000 * 55,
+ (int64_t) FIXED_POINT * 1000 * 64,
+ (int64_t) FIXED_POINT * 1000 * 619
};
if (rate == 0 || so.playback_rate == 0)
@@ -284,7 +284,7 @@ void S9xSetEchoVolume(short volume_left, short volume_right)
SoundData.echo_volume [1] = volume_right;
}
-void S9xSetEchoEnable(uint8 byte)
+void S9xSetEchoEnable(uint8_t byte)
{
SoundData.echo_channel_enable = byte;
if (!SoundData.echo_write_enabled || Settings.DisableSoundEcho)
@@ -323,13 +323,13 @@ void S9xSetEchoDelay(int delay)
S9xSetEchoEnable(APU.DSP [APU_EON]);
}
-void S9xSetEchoWriteEnable(uint8 byte)
+void S9xSetEchoWriteEnable(uint8_t byte)
{
SoundData.echo_write_enabled = byte;
S9xSetEchoDelay(APU.DSP [APU_EDL] & 15);
}
-void S9xSetFrequencyModulationEnable(uint8 byte)
+void S9xSetFrequencyModulationEnable(uint8_t byte)
{
SoundData.pitch_mod = byte & ~1;
}
@@ -364,14 +364,14 @@ void S9xFixSoundAfterSnapshotLoad()
int i;
for (i = 0; i < 8; i++)
{
- SoundData.channels[i].needs_decode = TRUE;
+ SoundData.channels[i].needs_decode = true;
S9xSetSoundFrequency(i, SoundData.channels[i].hertz);
SoundData.channels [i].envxx = SoundData.channels [i].envx << ENVX_SHIFT;
SoundData.channels [i].next_sample = 0;
SoundData.channels [i].interpolate = 0;
- SoundData.channels [i].previous [0] = (int32)
+ SoundData.channels [i].previous [0] = (int32_t)
SoundData.channels [i].previous16 [0];
- SoundData.channels [i].previous [1] = (int32)
+ SoundData.channels [i].previous [1] = (int32_t)
SoundData.channels [i].previous16 [1];
}
IAPU.Scanline = 0;
@@ -443,11 +443,11 @@ int S9xGetEnvelopeHeight(int channel)
}
#if 1
-void S9xSetSoundSample(int channel, uint16 sample_number)
+void S9xSetSoundSample(int channel, uint16_t sample_number)
{
}
#else
-void S9xSetSoundSample(int channel, uint16 sample_number)
+void S9xSetSoundSample(int channel, uint16_t sample_number)
{
register Channel* ch = &SoundData.channels[channel];
@@ -457,11 +457,11 @@ void S9xSetSoundSample(int channel, uint16 sample_number)
int keep = ch->state;
ch->state = SOUND_SILENT;
ch->sample_number = sample_number;
- ch->loop = FALSE;
- ch->needs_decode = TRUE;
- ch->last_block = FALSE;
+ ch->loop = false;
+ ch->needs_decode = true;
+ ch->last_block = false;
ch->previous [0] = ch->previous[1] = 0;
- uint8* dir = S9xGetSampleAddress(sample_number);
+ uint8_t* dir = S9xGetSampleAddress(sample_number);
ch->block_pointer = READ_WORD(dir);
ch->sample_pointer = 0;
ch->state = keep;
@@ -476,7 +476,7 @@ void S9xSetSoundFrequency(int channel, int hertz)
if (SoundData.channels[channel].type == SOUND_NOISE)
hertz = NoiseFreq [APU.DSP [APU_FLG] & 0x1f];
SoundData.channels[channel].frequency = (int)
- (((int64) hertz * FIXED_POINT) / so.playback_rate);
+ (((int64_t) hertz * FIXED_POINT) / so.playback_rate);
}
}
@@ -493,7 +493,7 @@ void S9xSetSoundType(int channel, int type_of_sound)
void DecodeBlock(Channel* ch)
{
- int32 out;
+ int32_t out;
unsigned char filter;
unsigned char shift;
signed char sample1, sample2;
@@ -502,8 +502,8 @@ void DecodeBlock(Channel* ch)
if (ch->block_pointer > 0x10000 - 9)
{
- ch->last_block = TRUE;
- ch->loop = FALSE;
+ ch->last_block = true;
+ ch->loop = false;
ch->block = ch->decoded;
return;
}
@@ -516,8 +516,8 @@ void DecodeBlock(Channel* ch)
if ((ch->last_block = filter & 1))
ch->loop = (filter & 2) != 0;
- int16 interim[16];
- uint8 interim_byte = 0;
+ int16_t interim[16];
+ uint8_t interim_byte = 0;
compressed++;
signed short* raw = ch->block = ch->decoded;
@@ -532,10 +532,10 @@ void DecodeBlock(Channel* ch)
filter = filter & 0x0c;
- int32 prev0 = ch->previous [0];
- int32 prev1 = ch->previous [1];
+ int32_t prev0 = ch->previous [0];
+ int32_t prev1 = ch->previous [1];
- int16 amplitude = 0;
+ int16_t amplitude = 0;
for (i = 8; i != 0; i--)
{
@@ -581,7 +581,7 @@ void DecodeBlock(Channel* ch)
}
CLIP16(out);
- int16 result = (signed short)(out << 1);
+ int16_t result = (signed short)(out << 1);
if (abs(result) > amplitude)
amplitude = abs(result);
interim[interim_byte++] = out;
@@ -592,10 +592,10 @@ void DecodeBlock(Channel* ch)
ch->previous [0] = prev0;
ch->previous [1] = prev1;
- int32 total_deviation_from_previous = 0;
+ int32_t total_deviation_from_previous = 0;
for (i = 1; i < 16; i++)
total_deviation_from_previous += abs(interim[i] - interim[i - 1]);
- if (total_deviation_from_previous >= (int32) amplitude * 4)
+ if (total_deviation_from_previous >= (int32_t) amplitude * 4)
{
/* Looks like noise. Generate noise. */
for (i = 0; i < 16; i++)
@@ -722,8 +722,8 @@ void DecodeBlock(Channel* ch)
filter = filter & 0x0c;
- int32 prev0 = ch->previous [0];
- int32 prev1 = ch->previous [1];
+ int32_t prev0 = ch->previous [0];
+ int32_t prev1 = ch->previous [1];
for (i = 8; i != 0; i--)
{
@@ -782,11 +782,11 @@ void DecodeBlock(Channel* ch)
static inline void MixStereo(int sample_count)
{
- static int32 wave[SOUND_BUFFER_SIZE];
+ static int32_t wave[SOUND_BUFFER_SIZE];
int pitch_mod = SoundData.pitch_mod & ~APU.DSP[APU_NON];
- uint32 J;
+ uint32_t J;
for (J = 0; J < NUM_CHANNELS; J++)
{
Channel* ch = &SoundData.channels[J];
@@ -794,15 +794,15 @@ static inline void MixStereo(int sample_count)
if (ch->state == SOUND_SILENT || !(so.sound_switch & (1 << J)))
continue;
- int32 VL, VR;
+ int32_t VL, VR;
unsigned long freq0 = ch->frequency;
- bool8 mod = pitch_mod & (1 << J);
+ bool mod = pitch_mod & (1 << J);
if (ch->needs_decode)
{
DecodeBlock(ch);
- ch->needs_decode = FALSE;
+ ch->needs_decode = false;
ch->sample = ch->block[0];
ch->sample_pointer = freq0 >> FIXED_POINT_SHIFT;
if (ch->sample_pointer == 0)
@@ -820,8 +820,8 @@ static inline void MixStereo(int sample_count)
VL = (ch->sample * ch-> left_vol_level) / 128;
VR = (ch->sample * ch->right_vol_level) / 128;
- uint32 I;
- for (I = 0; I < (uint32) sample_count; I += 2)
+ uint32_t I;
+ for (I = 0; I < (uint32_t) sample_count; I += 2)
{
unsigned long freq = freq0;
@@ -831,7 +831,7 @@ static inline void MixStereo(int sample_count)
ch->env_error += ch->erate;
if (ch->env_error >= FIXED_POINT)
{
- uint32 step = ch->env_error >> FIXED_POINT_SHIFT;
+ uint32_t step = ch->env_error >> FIXED_POINT_SHIFT;
switch (ch->state)
{
@@ -1010,8 +1010,8 @@ static inline void MixStereo(int sample_count)
else
{
S9xAPUSetEndX(J);
- ch->last_block = FALSE;
- uint8* dir = S9xGetSampleAddress(ch->sample_number);
+ ch->last_block = false;
+ uint8_t* dir = S9xGetSampleAddress(ch->sample_number);
ch->block_pointer = READ_WORD(dir + 2);
}
}
@@ -1030,7 +1030,7 @@ static inline void MixStereo(int sample_count)
{
ch->interpolate = ((ch->next_sample - ch->sample) *
(long) freq) / (long) FIXED_POINT;
- ch->sample = (int16)(ch->sample + (((ch->next_sample - ch->sample) *
+ ch->sample = (int16_t)(ch->sample + (((ch->next_sample - ch->sample) *
(long)(ch->count)) / (long) FIXED_POINT));
}
else
@@ -1052,10 +1052,10 @@ static inline void MixStereo(int sample_count)
{
if (ch->interpolate)
{
- int32 s = (int32) ch->sample + ch->interpolate;
+ int32_t s = (int32_t) ch->sample + ch->interpolate;
CLIP16(s);
- ch->sample = (int16) s;
+ ch->sample = (int16_t) s;
VL = (ch->sample * ch-> left_vol_level) / 128;
VR = (ch->sample * ch->right_vol_level) / 128;
}
@@ -1079,11 +1079,11 @@ END_OF_FUNCTION(MixStereo);
#endif
#ifdef __sun
-extern uint8 int2ulaw(int);
+extern uint8_t int2ulaw(int);
#endif
// For backwards compatibility with older port specific code
-void S9xMixSamplesO(uint8* buffer, int sample_count, int byte_offset)
+void S9xMixSamplesO(uint8_t* buffer, int sample_count, int byte_offset)
{
S9xMixSamples(buffer + byte_offset, sample_count);
}
@@ -1091,7 +1091,7 @@ void S9xMixSamplesO(uint8* buffer, int sample_count, int byte_offset)
END_OF_FUNCTION(S9xMixSamplesO);
#endif
-void S9xMixSamples(uint8* buffer, int sample_count)
+void S9xMixSamples(uint8_t* buffer, int sample_count)
{
int J;
int I;
@@ -1188,7 +1188,7 @@ void S9xMixSamples(uint8* buffer, int sample_count)
END_OF_FUNCTION(S9xMixSamples);
#endif
-void S9xResetSound(bool8 full)
+void S9xResetSound(bool full)
{
int i;
for (i = 0; i < 8; i++)
@@ -1200,7 +1200,7 @@ void S9xResetSound(bool8 full)
SoundData.channels[i].volume_right = 0;
SoundData.channels[i].hertz = 0;
SoundData.channels[i].count = 0;
- SoundData.channels[i].loop = FALSE;
+ SoundData.channels[i].loop = false;
SoundData.channels[i].envx_target = 0;
SoundData.channels[i].env_error = 0;
SoundData.channels[i].erate = 0;
@@ -1251,16 +1251,16 @@ void S9xResetSound(bool8 full)
SoundData.master_volume [0] = SoundData.master_volume [1] = 127;
if (so.playback_rate)
- so.err_rate = (uint32)(FIXED_POINT * SNES_SCANLINE_TIME /
+ so.err_rate = (uint32_t)(FIXED_POINT * SNES_SCANLINE_TIME /
(1.0 / so.playback_rate));
else
so.err_rate = 0;
}
-void S9xSetPlaybackRate(uint32 playback_rate)
+void S9xSetPlaybackRate(uint32_t playback_rate)
{
so.playback_rate = playback_rate;
- so.err_rate = (uint32)(SNES_SCANLINE_TIME * FIXED_POINT / (1.0 /
+ so.err_rate = (uint32_t)(SNES_SCANLINE_TIME * FIXED_POINT / (1.0 /
(double) so.playback_rate));
S9xSetEchoDelay(APU.DSP [APU_EDL] & 0xf);
int i;
@@ -1268,14 +1268,14 @@ void S9xSetPlaybackRate(uint32 playback_rate)
S9xSetSoundFrequency(i, SoundData.channels [i].hertz);
}
-bool8 S9xInitSound(int mode, bool8 stereo, int buffer_size)
+bool S9xInitSound(int mode, bool stereo, int buffer_size)
{
so.sound_fd = -1;
so.sound_switch = 255;
so.playback_rate = 0;
so.buffer_size = 0;
- so.encoded = FALSE;
+ so.encoded = false;
if (!(mode & 7))
return (1);
@@ -1283,7 +1283,7 @@ bool8 S9xInitSound(int mode, bool8 stereo, int buffer_size)
return (1);
}
-bool8 S9xSetSoundMode(int channel, int mode)
+bool S9xSetSoundMode(int channel, int mode)
{
Channel* ch = &SoundData.channels[channel];
@@ -1293,7 +1293,7 @@ bool8 S9xSetSoundMode(int channel, int mode)
if (ch->mode != MODE_NONE)
{
ch->mode = MODE_RELEASE;
- return (TRUE);
+ return (true);
}
break;
@@ -1306,7 +1306,7 @@ bool8 S9xSetSoundMode(int channel, int mode)
if (ch->state != SOUND_SILENT)
ch->state = mode;
- return (TRUE);
+ return (true);
}
break;
@@ -1318,7 +1318,7 @@ bool8 S9xSetSoundMode(int channel, int mode)
if (ch->state != SOUND_SILENT)
ch->state = mode;
- return (TRUE);
+ return (true);
}
break;
@@ -1326,11 +1326,11 @@ bool8 S9xSetSoundMode(int channel, int mode)
if (ch->mode == MODE_NONE || ch->mode == MODE_ADSR)
{
ch->mode = mode;
- return (TRUE);
+ return (true);
}
}
- return (FALSE);
+ return (false);
}
void S9xSetSoundControl(int sound_switch)
@@ -1359,11 +1359,11 @@ void S9xPlaySample(int channel)
ch->type = SOUND_SAMPLE;
S9xSetSoundFrequency(channel, ch->hertz);
- ch->loop = FALSE;
- ch->needs_decode = TRUE;
- ch->last_block = FALSE;
+ ch->loop = false;
+ ch->needs_decode = true;
+ ch->last_block = false;
ch->previous [0] = ch->previous[1] = 0;
- uint8* dir = S9xGetSampleAddress(ch->sample_number);
+ uint8_t* dir = S9xGetSampleAddress(ch->sample_number);
ch->block_pointer = READ_WORD(dir);
ch->sample_pointer = 0;
ch->env_error = 0;
diff --git a/source/soundux.h b/source/soundux.h
index e901c2b..b5ffe4a 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -128,17 +128,17 @@ typedef struct
int sound_switch;
int playback_rate;
int buffer_size;
- bool8 encoded;
+ bool encoded;
#ifdef __sun
int last_eof;
#endif
#ifdef __sgi
ALport al_port;
#endif /* __sgi */
- int32 samples_mixed_so_far;
- int32 play_position;
- uint32 err_counter;
- uint32 err_rate;
+ int32_t samples_mixed_so_far;
+ int32_t play_position;
+ uint32_t err_counter;
+ uint32_t err_rate;
} SoundStatus;
SoundStatus so;
@@ -150,10 +150,10 @@ typedef struct
int type;
short volume_left;
short volume_right;
- uint32 hertz;
- uint32 frequency;
- uint32 count;
- bool8 loop;
+ uint32_t hertz;
+ uint32_t frequency;
+ uint32_t count;
+ bool loop;
int envx;
short left_vol_level;
short right_vol_level;
@@ -170,19 +170,19 @@ typedef struct
signed short decoded [16];
signed short previous16 [2];
signed short* block;
- uint16 sample_number;
- bool8 last_block;
- bool8 needs_decode;
- uint32 block_pointer;
- uint32 sample_pointer;
+ uint16_t sample_number;
+ bool last_block;
+ bool needs_decode;
+ uint32_t block_pointer;
+ uint32_t sample_pointer;
int* echo_buf_ptr;
int mode;
- int32 envxx;
+ int32_t envxx;
signed short next_sample;
- int32 interpolate;
- int32 previous [2];
+ int32_t interpolate;
+ int32_t previous [2];
// Just incase they are needed in the future, for snapshot compatibility.
- uint32 dummy [8];
+ uint32_t dummy [8];
// unsigned short last_valid_header;
} Channel;
@@ -196,9 +196,9 @@ typedef struct
int echo_channel_enable;
int pitch_mod;
// Just incase they are needed in the future, for snapshot compatibility.
- uint32 dummy [3];
+ uint32_t dummy [3];
Channel channels [NUM_CHANNELS];
- // bool8 no_filter;
+ // bool no_filter;
short master_volume [2]; /* range is -128 .. 127 */
short echo_volume [2]; /* range is -128 .. 127 */
int noise_hertz;
@@ -206,7 +206,7 @@ typedef struct
SSoundData SoundData;
-void S9xSetEightBitConsoleSound(bool8 Enabled);
+void S9xSetEightBitConsoleSound(bool Enabled);
void S9xSetSoundVolume(int channel, short volume_left, short volume_right);
void S9xSetSoundFrequency(int channel, int hertz);
@@ -222,28 +222,28 @@ void S9xSetSoundKeyOff(int channel);
void S9xSetSoundDecayMode(int channel);
void S9xSetSoundAttachMode(int channel);
void S9xSoundStartEnvelope(Channel*);
-void S9xSetSoundSample(int channel, uint16 sample_number);
+void S9xSetSoundSample(int channel, uint16_t sample_number);
void S9xSetEchoFeedback(int echo_feedback);
-void S9xSetEchoEnable(uint8 byte);
+void S9xSetEchoEnable(uint8_t byte);
void S9xSetEchoDelay(int byte);
-void S9xSetEchoWriteEnable(uint8 byte);
+void S9xSetEchoWriteEnable(uint8_t byte);
void S9xSetFilterCoefficient(int tap, int value);
-void S9xSetFrequencyModulationEnable(uint8 byte);
+void S9xSetFrequencyModulationEnable(uint8_t byte);
void S9xSetEnvelopeRate(int channel, unsigned long rate, int direction,
int target);
-bool8 S9xSetSoundMode(int channel, int mode);
+bool S9xSetSoundMode(int channel, int mode);
int S9xGetEnvelopeHeight(int channel);
-void S9xResetSound(bool8 full);
+void S9xResetSound(bool full);
void S9xFixSoundAfterSnapshotLoad();
void S9xPlaybackSoundSetting(int channel);
void S9xPlaySample(int channel);
-void S9xFixEnvelope(int channel, uint8 gain, uint8 adsr1, uint8 adsr2);
+void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2);
void S9xStartSample(int channel);
-void S9xMixSamples(uint8* buffer, int sample_count);
-void S9xMixSamplesO(uint8* buffer, int sample_count, int byte_offset);
-bool8 S9xOpenSoundDevice(int, bool8, int);
-void S9xSetPlaybackRate(uint32 rate);
+void S9xMixSamples(uint8_t* buffer, int sample_count);
+void S9xMixSamplesO(uint8_t* buffer, int sample_count, int byte_offset);
+bool S9xOpenSoundDevice(int, bool, int);
+void S9xSetPlaybackRate(uint32_t rate);
#endif
#endif
diff --git a/source/spc700.c b/source/spc700.c
index 4483267..4e68ebe 100644
--- a/source/spc700.c
+++ b/source/spc700.c
@@ -99,10 +99,10 @@
// SPC700/Sound DSP chips have a 24.57MHz crystal on their PCB.
#ifdef NO_INLINE_SET_GET
-uint8 S9xAPUGetByteZ(uint8 address);
-uint8 S9xAPUGetByte(uint32 address);
-void S9xAPUSetByteZ(uint8, uint8 address);
-void S9xAPUSetByte(uint8, uint32 address);
+uint8_t S9xAPUGetByteZ(uint8_t address);
+uint8_t S9xAPUGetByte(uint32_t address);
+void S9xAPUSetByteZ(uint8_t, uint8_t address);
+void S9xAPUSetByte(uint8_t, uint32_t address);
#else
#undef INLINE
@@ -122,7 +122,7 @@ void S9xAPUSetByte(uint8, uint32 address);
if (!ICPU.CPUExecuting) \
APU.Cycles = CPU.Cycles = CPU.NextEvent; \
else \
- IAPU.APUExecuting = FALSE; \
+ IAPU.APUExecuting = false; \
} \
else \
if (IAPU.WaitCounter >= 2) \
@@ -149,37 +149,37 @@ void S9xAPUSetByte(uint8, uint32 address);
// XXX: HalfCarry - BJ fixed?
#define SBC(a,b)\
-int16 Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\
+int16_t Int16 = (short) (a) - (short) (b) + (short) (APUCheckCarry ()) - 1;\
IAPU._Carry = Int16 >= 0;\
-if ((((a) ^ (b)) & 0x80) && (((a) ^ (uint8) Int16) & 0x80))\
+if ((((a) ^ (b)) & 0x80) && (((a) ^ (uint8_t) Int16) & 0x80))\
APUSetOverflow ();\
else \
APUClearOverflow (); \
APUSetHalfCarry ();\
-if(((a) ^ (b) ^ (uint8) Int16) & 0x10)\
+if(((a) ^ (b) ^ (uint8_t) Int16) & 0x10)\
APUClearHalfCarry ();\
-(a) = (uint8) Int16;\
-APUSetZN8 ((uint8) Int16);
+(a) = (uint8_t) Int16;\
+APUSetZN8 ((uint8_t) Int16);
// XXX: HalfCarry - BJ fixed?
// XXX: HalfCarry used Int16 before; trying to fix it with Work16 [Neb]
#define ADC(a,b)\
-uint16 Work16 = (a) + (b) + APUCheckCarry();\
+uint16_t Work16 = (a) + (b) + APUCheckCarry();\
IAPU._Carry = Work16 >= 0x100; \
-if (~((a) ^ (b)) & ((b) ^ (uint8) Work16) & 0x80)\
+if (~((a) ^ (b)) & ((b) ^ (uint8_t) Work16) & 0x80)\
APUSetOverflow ();\
else \
APUClearOverflow (); \
APUClearHalfCarry ();\
-if(((a) ^ (b) ^ (uint8) Work16) & 0x10)\
+if(((a) ^ (b) ^ (uint8_t) Work16) & 0x10)\
APUSetHalfCarry ();\
-(a) = (uint8) Work16;\
-APUSetZN8 ((uint8) Work16);
+(a) = (uint8_t) Work16;\
+APUSetZN8 ((uint8_t) Work16);
#define CMP(a,b)\
-int16 Int16 = (short) (a) - (short) (b);\
+int16_t Int16 = (short) (a) - (short) (b);\
IAPU._Carry = Int16 >= 0;\
-APUSetZN8 ((uint8) Int16);
+APUSetZN8 ((uint8_t) Int16);
#define ASL(b)\
IAPU._Carry = ((b) & 0x80) != 0; \
@@ -190,15 +190,15 @@ APUSetZN8 ((uint8) Int16);
(b) >>= 1;\
APUSetZN8 (b);
#define ROL(b)\
- uint16 Work16 = ((b) << 1) | APUCheckCarry (); \
+ uint16_t Work16 = ((b) << 1) | APUCheckCarry (); \
IAPU._Carry = Work16 >= 0x100; \
- (b) = (uint8) Work16; \
+ (b) = (uint8_t) Work16; \
APUSetZN8 (b);
#define ROR(b)\
- uint16 Work16 = (b) | ((uint16) APUCheckCarry () << 8); \
- IAPU._Carry = (uint8) Work16 & 1; \
+ uint16_t Work16 = (b) | ((uint16_t) APUCheckCarry () << 8); \
+ IAPU._Carry = (uint8_t) Work16 & 1; \
Work16 >>= 1; \
- (b) = (uint8) Work16; \
+ (b) = (uint8_t) Work16; \
APUSetZN8 (b);
#define Push(b)\
@@ -211,11 +211,11 @@ APUSetZN8 ((uint8) Int16);
#ifdef FAST_LSB_WORD_ACCESS
#define SPC700_PushW(w)\
- *(uint16 *) (IAPU.RAM + 0xff + IAPU.Registers.S) = w;\
+ *(uint16_t *) (IAPU.RAM + 0xff + IAPU.Registers.S) = w;\
IAPU.Registers.S -= 2;
#define PopW(w)\
IAPU.Registers.S += 2;\
- w = *(uint16 *) (IAPU.RAM + 0xff + IAPU.Registers.S);
+ w = *(uint16_t *) (IAPU.RAM + 0xff + IAPU.Registers.S);
#else
#define SPC700_PushW(w)\
*(IAPU.RAM + 0xff + IAPU.Registers.S) = w;\
@@ -227,33 +227,33 @@ APUSetZN8 ((uint8) Int16);
#endif
#define Relative()\
- int8 Int8 = OP1;\
- int16 Int16 = (intptr_t) (IAPU.PC + 2 - IAPU.RAM) + Int8;
+ int8_t Int8 = OP1;\
+ int16_t Int16 = (intptr_t) (IAPU.PC + 2 - IAPU.RAM) + Int8;
#define Relative2()\
- int8 Int8 = OP2;\
- int16 Int16 = (intptr_t) (IAPU.PC + 3 - IAPU.RAM) + Int8;
+ int8_t Int8 = OP2;\
+ int16_t Int16 = (intptr_t) (IAPU.PC + 3 - IAPU.RAM) + Int8;
#ifdef FAST_LSB_WORD_ACCESS
#define IndexedXIndirect()\
- IAPU.Address = *(uint16 *) (IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff));
+ IAPU.Address = *(uint16_t *) (IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff));
#define Absolute()\
- IAPU.Address = *(uint16 *) (IAPU.PC + 1);
+ IAPU.Address = *(uint16_t *) (IAPU.PC + 1);
#define AbsoluteX()\
- IAPU.Address = *(uint16 *) (IAPU.PC + 1) + IAPU.Registers.X;
+ IAPU.Address = *(uint16_t *) (IAPU.PC + 1) + IAPU.Registers.X;
#define AbsoluteY()\
- IAPU.Address = *(uint16 *) (IAPU.PC + 1) + IAPU.Registers.YA.B.Y;
+ IAPU.Address = *(uint16_t *) (IAPU.PC + 1) + IAPU.Registers.YA.B.Y;
#define MemBit()\
- IAPU.Address = *(uint16 *) (IAPU.PC + 1);\
- IAPU.Bit = (uint8)(IAPU.Address >> 13);\
+ IAPU.Address = *(uint16_t *) (IAPU.PC + 1);\
+ IAPU.Bit = (uint8_t)(IAPU.Address >> 13);\
IAPU.Address &= 0x1fff;
#define IndirectIndexedY()\
- IAPU.Address = *(uint16 *) (IAPU.DirectPage + OP1) + IAPU.Registers.YA.B.Y;
+ IAPU.Address = *(uint16_t *) (IAPU.DirectPage + OP1) + IAPU.Registers.YA.B.Y;
#else
#define IndexedXIndirect()\
IAPU.Address = *(IAPU.DirectPage + ((OP1 + IAPU.Registers.X) & 0xff)) + \
@@ -269,7 +269,7 @@ APUSetZN8 ((uint8) Int16);
#define MemBit()\
IAPU.Address = OP1 + (OP2 << 8);\
- IAPU.Bit = (int8) (IAPU.Address >> 13);\
+ IAPU.Bit = (int8_t) (IAPU.Address >> 13);\
IAPU.Address &= 0x1fff;
#define IndirectIndexedY()\
@@ -374,13 +374,13 @@ void Apu3F() // CALL absolute
void Apu4F() // PCALL $XX
{
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
SPC700_PushW(IAPU.PC + 2 - IAPU.RAM);
IAPU.PC = IAPU.RAM + 0xff00 + Work8;
}
#define SET(b) \
-S9xAPUSetByteZ ((uint8) (S9xAPUGetByteZ (OP1 ) | (1 << (b))), OP1); \
+S9xAPUSetByteZ ((uint8_t) (S9xAPUGetByteZ (OP1 ) | (1 << (b))), OP1); \
IAPU.PC += 2
void Apu02()
@@ -424,7 +424,7 @@ void ApuE2()
}
#define CLR(b) \
-S9xAPUSetByteZ ((uint8) (S9xAPUGetByteZ (OP1) & ~(1 << (b))), OP1); \
+S9xAPUSetByteZ ((uint8_t) (S9xAPUGetByteZ (OP1) & ~(1 << (b))), OP1); \
IAPU.PC += 2;
void Apu12()
@@ -468,11 +468,11 @@ void ApuF2()
}
#define BBS(b) \
-uint8 Work8 = OP1; \
+uint8_t Work8 = OP1; \
Relative2 (); \
if (S9xAPUGetByteZ (Work8) & (1 << (b))) \
{ \
- IAPU.PC = IAPU.RAM + (uint16) Int16; \
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16; \
APU.Cycles += IAPU.TwoCycles; \
} \
else \
@@ -519,11 +519,11 @@ void ApuE3()
}
#define BBC(b) \
-uint8 Work8 = OP1; \
+uint8_t Work8 = OP1; \
Relative2 (); \
if (!(S9xAPUGetByteZ (Work8) & (1 << (b)))) \
{ \
- IAPU.PC = IAPU.RAM + (uint16) Int16; \
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16; \
APU.Cycles += IAPU.TwoCycles; \
} \
else \
@@ -614,7 +614,7 @@ void Apu08()
void Apu09()
{
// OR dp(dest),dp(src)
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
Work8 |= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -659,7 +659,7 @@ void Apu17()
void Apu18()
{
// OR dp,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
Work8 |= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -669,7 +669,7 @@ void Apu18()
void Apu19()
{
// OR (X),(Y)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) | S9xAPUGetByteZ(
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) | S9xAPUGetByteZ(
IAPU.Registers.YA.B.Y);
APUSetZN8(Work8);
S9xAPUSetByteZ(Work8, IAPU.Registers.X);
@@ -774,7 +774,7 @@ void ApuEA()
void Apu0B()
{
// ASL dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
ASL(Work8);
S9xAPUSetByteZ(Work8, OP1);
IAPU.PC += 2;
@@ -784,7 +784,7 @@ void Apu0C()
{
// ASL abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ASL(Work8);
S9xAPUSetByte(Work8, IAPU.Address);
IAPU.PC += 3;
@@ -793,7 +793,7 @@ void Apu0C()
void Apu1B()
{
// ASL dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
ASL(Work8);
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
IAPU.PC += 2;
@@ -872,7 +872,7 @@ void Apu0E()
{
// TSET1 abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
S9xAPUSetByte(Work8 | IAPU.Registers.YA.B.A, IAPU.Address);
Work8 &= IAPU.Registers.YA.B.A;
APUSetZN8(Work8);
@@ -883,7 +883,7 @@ void Apu4E()
{
// TCLR1 abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
S9xAPUSetByte(Work8 & ~IAPU.Registers.YA.B.A, IAPU.Address);
Work8 &= IAPU.Registers.YA.B.A;
APUSetZN8(Work8);
@@ -907,14 +907,14 @@ void ApuEF()
{
// SLEEP
// XXX: sleep
- IAPU.APUExecuting = FALSE;
+ IAPU.APUExecuting = false;
IAPU.PC++;
}
void ApuFF()
{
// STOP
- IAPU.APUExecuting = FALSE;
+ IAPU.APUExecuting = false;
IAPU.PC++;
}
@@ -924,7 +924,7 @@ void Apu10()
Relative();
if (!APUCheckNegative())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -938,7 +938,7 @@ void Apu30()
Relative();
if (APUCheckNegative())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -952,7 +952,7 @@ void Apu90()
Relative();
if (!APUCheckCarry())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -966,7 +966,7 @@ void ApuB0()
Relative();
if (APUCheckCarry())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -980,7 +980,7 @@ void ApuD0()
Relative();
if (!APUCheckZero())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -994,7 +994,7 @@ void ApuF0()
Relative();
if (APUCheckZero())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -1008,7 +1008,7 @@ void Apu50()
Relative();
if (!APUCheckOverflow())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
}
else
@@ -1021,7 +1021,7 @@ void Apu70()
Relative();
if (APUCheckOverflow())
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
}
else
@@ -1032,7 +1032,7 @@ void Apu2F()
{
// BRA
Relative();
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
}
void Apu80()
@@ -1060,9 +1060,9 @@ void Apu40()
void Apu1A()
{
// DECW dp
- uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
+ uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
Work16--;
- S9xAPUSetByteZ((uint8) Work16, OP1);
+ S9xAPUSetByteZ((uint8_t) Work16, OP1);
S9xAPUSetByteZ(Work16 >> 8, OP1 + 1);
APUSetZN16(Work16);
IAPU.PC += 2;
@@ -1071,19 +1071,19 @@ void Apu1A()
void Apu5A()
{
// CMPW YA,dp
- uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
- int32 Int32 = (long) IAPU.Registers.YA.W - (long) Work16;
+ uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
+ int32_t Int32 = (long) IAPU.Registers.YA.W - (long) Work16;
IAPU._Carry = Int32 >= 0;
- APUSetZN16((uint16) Int32);
+ APUSetZN16((uint16_t) Int32);
IAPU.PC += 2;
}
void Apu3A()
{
// INCW dp
- uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
+ uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
Work16++;
- S9xAPUSetByteZ((uint8) Work16, OP1);
+ S9xAPUSetByteZ((uint8_t) Work16, OP1);
S9xAPUSetByteZ(Work16 >> 8, OP1 + 1);
APUSetZN16(Work16);
IAPU.PC += 2;
@@ -1093,17 +1093,17 @@ void Apu3A()
void Apu7A()
{
// ADDW YA,dp
- uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
- uint32 Work32 = (uint32) IAPU.Registers.YA.W + Work16;
+ uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
+ uint32_t Work32 = (uint32_t) IAPU.Registers.YA.W + Work16;
IAPU._Carry = Work32 >= 0x10000;
- if (~(IAPU.Registers.YA.W ^ Work16) & (Work16 ^ (uint16) Work32) & 0x8000)
+ if (~(IAPU.Registers.YA.W ^ Work16) & (Work16 ^ (uint16_t) Work32) & 0x8000)
APUSetOverflow();
else
APUClearOverflow();
APUClearHalfCarry();
- if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16) Work32) & 0x10)
+ if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Work32) & 0x10)
APUSetHalfCarry();
- IAPU.Registers.YA.W = (uint16) Work32;
+ IAPU.Registers.YA.W = (uint16_t) Work32;
APUSetZN16(IAPU.Registers.YA.W);
IAPU.PC += 2;
}
@@ -1114,22 +1114,22 @@ void Apu7A()
void Apu9A()
{
// SUBW YA,dp
- uint16 Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
- int32 Int32 = (long) IAPU.Registers.YA.W - (long) Work16;
+ uint16_t Work16 = S9xAPUGetByteZ(OP1) + (S9xAPUGetByteZ(OP1 + 1) << 8);
+ int32_t Int32 = (long) IAPU.Registers.YA.W - (long) Work16;
APUClearHalfCarry();
IAPU._Carry = Int32 >= 0;
if (((IAPU.Registers.YA.W ^ Work16) & 0x8000) &&
- ((IAPU.Registers.YA.W ^ (uint16) Int32) & 0x8000))
+ ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x8000))
APUSetOverflow();
else
APUClearOverflow();
if (((IAPU.Registers.YA.W ^ Work16) & 0x0080) &&
- ((IAPU.Registers.YA.W ^ (uint16) Int32) & 0x0080))
+ ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x0080))
APUSetHalfCarry();
APUSetHalfCarry();
- if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16) Int32) & 0x10)
+ if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Int32) & 0x10)
APUClearHalfCarry();
- IAPU.Registers.YA.W = (uint16) Int32;
+ IAPU.Registers.YA.W = (uint16_t) Int32;
APUSetZN16(IAPU.Registers.YA.W);
IAPU.PC += 2;
}
@@ -1154,7 +1154,7 @@ void ApuDA()
void Apu64()
{
// CMP A,dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1163,7 +1163,7 @@ void Apu65()
{
// CMP A,abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -1171,7 +1171,7 @@ void Apu65()
void Apu66()
{
// CMP A,(X)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC++;
}
@@ -1180,7 +1180,7 @@ void Apu67()
{
// CMP A,(dp+X)
IndexedXIndirect();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1188,7 +1188,7 @@ void Apu67()
void Apu68()
{
// CMP A,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1196,8 +1196,8 @@ void Apu68()
void Apu69()
{
// CMP dp(dest), dp(src)
- uint8 W1 = S9xAPUGetByteZ(OP1);
- uint8 Work8 = S9xAPUGetByteZ(OP2);
+ uint8_t W1 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP2);
CMP(Work8, W1);
IAPU.PC += 3;
}
@@ -1205,7 +1205,7 @@ void Apu69()
void Apu74()
{
// CMP A, dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1214,7 +1214,7 @@ void Apu75()
{
// CMP A,abs+X
AbsoluteX();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -1223,7 +1223,7 @@ void Apu76()
{
// CMP A, abs+Y
AbsoluteY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -1232,7 +1232,7 @@ void Apu77()
{
// CMP A,(dp)+Y
IndirectIndexedY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1240,8 +1240,8 @@ void Apu77()
void Apu78()
{
// CMP dp,#00
- uint8 Work8 = OP1;
- uint8 W1 = S9xAPUGetByteZ(OP2);
+ uint8_t Work8 = OP1;
+ uint8_t W1 = S9xAPUGetByteZ(OP2);
CMP(W1, Work8);
IAPU.PC += 3;
}
@@ -1249,8 +1249,8 @@ void Apu78()
void Apu79()
{
// CMP (X),(Y)
- uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X);
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
+ uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
CMP(W1, Work8);
IAPU.PC++;
}
@@ -1259,7 +1259,7 @@ void Apu1E()
{
// CMP X,abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.X, Work8);
IAPU.PC += 3;
}
@@ -1267,7 +1267,7 @@ void Apu1E()
void Apu3E()
{
// CMP X,dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
CMP(IAPU.Registers.X, Work8);
IAPU.PC += 2;
}
@@ -1283,7 +1283,7 @@ void Apu5E()
{
// CMP Y,abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
CMP(IAPU.Registers.YA.B.Y, Work8);
IAPU.PC += 3;
}
@@ -1291,7 +1291,7 @@ void Apu5E()
void Apu7E()
{
// CMP Y,dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
CMP(IAPU.Registers.YA.B.Y, Work8);
IAPU.PC += 2;
}
@@ -1299,7 +1299,7 @@ void Apu7E()
void ApuAD()
{
// CMP Y,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
CMP(IAPU.Registers.YA.B.Y, Work8);
IAPU.PC += 2;
}
@@ -1389,7 +1389,7 @@ void Apu28()
void Apu29()
{
// AND dp(dest),dp(src)
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
Work8 &= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -1434,7 +1434,7 @@ void Apu37()
void Apu38()
{
// AND dp,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
Work8 &= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -1444,7 +1444,7 @@ void Apu38()
void Apu39()
{
// AND (X),(Y)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) & S9xAPUGetByteZ(
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) & S9xAPUGetByteZ(
IAPU.Registers.YA.B.Y);
APUSetZN8(Work8);
S9xAPUSetByteZ(Work8, IAPU.Registers.X);
@@ -1454,7 +1454,7 @@ void Apu39()
void Apu2B()
{
// ROL dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
ROL(Work8);
S9xAPUSetByteZ(Work8, OP1);
IAPU.PC += 2;
@@ -1464,7 +1464,7 @@ void Apu2C()
{
// ROL abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ROL(Work8);
S9xAPUSetByte(Work8, IAPU.Address);
IAPU.PC += 3;
@@ -1473,7 +1473,7 @@ void Apu2C()
void Apu3B()
{
// ROL dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
ROL(Work8);
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
IAPU.PC += 2;
@@ -1489,12 +1489,12 @@ void Apu3C()
void Apu2E()
{
// CBNE dp,rel
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
Relative2();
if (S9xAPUGetByteZ(Work8) != IAPU.Registers.YA.B.A)
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -1505,12 +1505,12 @@ void Apu2E()
void ApuDE()
{
// CBNE dp+X,rel
- uint8 Work8 = OP1 + IAPU.Registers.X;
+ uint8_t Work8 = OP1 + IAPU.Registers.X;
Relative2();
if (S9xAPUGetByteZ(Work8) != IAPU.Registers.YA.B.A)
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
APUShutdown();
}
@@ -1573,7 +1573,7 @@ void ApuDC()
void ApuAB()
{
// INC dp
- uint8 Work8 = S9xAPUGetByteZ(OP1) + 1;
+ uint8_t Work8 = S9xAPUGetByteZ(OP1) + 1;
S9xAPUSetByteZ(Work8, OP1);
APUSetZN8(Work8);
@@ -1588,7 +1588,7 @@ void ApuAC()
{
// INC abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address) + 1;
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address) + 1;
S9xAPUSetByte(Work8, IAPU.Address);
APUSetZN8(Work8);
@@ -1602,7 +1602,7 @@ void ApuAC()
void ApuBB()
{
// INC dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) + 1;
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) + 1;
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
APUSetZN8(Work8);
@@ -1629,7 +1629,7 @@ void ApuBC()
void Apu8B()
{
// DEC dp
- uint8 Work8 = S9xAPUGetByteZ(OP1) - 1;
+ uint8_t Work8 = S9xAPUGetByteZ(OP1) - 1;
S9xAPUSetByteZ(Work8, OP1);
APUSetZN8(Work8);
@@ -1644,7 +1644,7 @@ void Apu8C()
{
// DEC abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address) - 1;
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address) - 1;
S9xAPUSetByte(Work8, IAPU.Address);
APUSetZN8(Work8);
@@ -1658,7 +1658,7 @@ void Apu8C()
void Apu9B()
{
// DEC dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) - 1;
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X) - 1;
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
APUSetZN8(Work8);
@@ -1727,7 +1727,7 @@ void Apu48()
void Apu49()
{
// EOR dp(dest),dp(src)
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
Work8 ^= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -1772,7 +1772,7 @@ void Apu57()
void Apu58()
{
// EOR dp,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
Work8 ^= S9xAPUGetByteZ(OP2);
S9xAPUSetByteZ(Work8, OP2);
APUSetZN8(Work8);
@@ -1782,7 +1782,7 @@ void Apu58()
void Apu59()
{
// EOR (X),(Y)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X) ^ S9xAPUGetByteZ(
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X) ^ S9xAPUGetByteZ(
IAPU.Registers.YA.B.Y);
APUSetZN8(Work8);
S9xAPUSetByteZ(Work8, IAPU.Registers.X);
@@ -1792,7 +1792,7 @@ void Apu59()
void Apu4B()
{
// LSR dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
LSR(Work8);
S9xAPUSetByteZ(Work8, OP1);
IAPU.PC += 2;
@@ -1802,7 +1802,7 @@ void Apu4C()
{
// LSR abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
LSR(Work8);
S9xAPUSetByte(Work8, IAPU.Address);
IAPU.PC += 3;
@@ -1811,7 +1811,7 @@ void Apu4C()
void Apu5B()
{
// LSR dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
LSR(Work8);
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
IAPU.PC += 2;
@@ -1874,7 +1874,7 @@ void ApuBD()
void Apu6B()
{
// ROR dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
ROR(Work8);
S9xAPUSetByteZ(Work8, OP1);
IAPU.PC += 2;
@@ -1884,7 +1884,7 @@ void Apu6C()
{
// ROR abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ROR(Work8);
S9xAPUSetByte(Work8, IAPU.Address);
IAPU.PC += 3;
@@ -1893,7 +1893,7 @@ void Apu6C()
void Apu7B()
{
// ROR dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
ROR(Work8);
S9xAPUSetByteZ(Work8, OP1 + IAPU.Registers.X);
IAPU.PC += 2;
@@ -1909,13 +1909,13 @@ void Apu7C()
void Apu6E()
{
// DBNZ dp,rel
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
Relative2();
- uint8 W1 = S9xAPUGetByteZ(Work8) - 1;
+ uint8_t W1 = S9xAPUGetByteZ(Work8) - 1;
S9xAPUSetByteZ(W1, Work8);
if (W1 != 0)
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
}
else
@@ -1929,7 +1929,7 @@ void ApuFE()
IAPU.Registers.YA.B.Y--;
if (IAPU.Registers.YA.B.Y != 0)
{
- IAPU.PC = IAPU.RAM + (uint16) Int16;
+ IAPU.PC = IAPU.RAM + (uint16_t) Int16;
APU.Cycles += IAPU.TwoCycles;
}
else
@@ -1955,7 +1955,7 @@ void Apu7F()
void Apu84()
{
// ADC A,dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1964,7 +1964,7 @@ void Apu85()
{
// ADC A, abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -1972,7 +1972,7 @@ void Apu85()
void Apu86()
{
// ADC A,(X)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC++;
}
@@ -1981,7 +1981,7 @@ void Apu87()
{
// ADC A,(dp+X)
IndexedXIndirect();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1989,7 +1989,7 @@ void Apu87()
void Apu88()
{
// ADC A,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -1997,8 +1997,8 @@ void Apu88()
void Apu89()
{
// ADC dp(dest),dp(src)
- uint8 Work8 = S9xAPUGetByteZ(OP1);
- uint8 W1 = S9xAPUGetByteZ(OP2);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t W1 = S9xAPUGetByteZ(OP2);
ADC(W1, Work8);
S9xAPUSetByteZ(W1, OP2);
IAPU.PC += 3;
@@ -2007,7 +2007,7 @@ void Apu89()
void Apu94()
{
// ADC A,dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2016,7 +2016,7 @@ void Apu95()
{
// ADC A, abs+X
AbsoluteX();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -2025,7 +2025,7 @@ void Apu96()
{
// ADC A, abs+Y
AbsoluteY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -2034,7 +2034,7 @@ void Apu97()
{
// ADC A, (dp)+Y
IndirectIndexedY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
ADC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2042,8 +2042,8 @@ void Apu97()
void Apu98()
{
// ADC dp,#00
- uint8 Work8 = OP1;
- uint8 W1 = S9xAPUGetByteZ(OP2);
+ uint8_t Work8 = OP1;
+ uint8_t W1 = S9xAPUGetByteZ(OP2);
ADC(W1, Work8);
S9xAPUSetByteZ(W1, OP2);
IAPU.PC += 3;
@@ -2052,8 +2052,8 @@ void Apu98()
void Apu99()
{
// ADC (X),(Y)
- uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X);
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
+ uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
ADC(W1, Work8);
S9xAPUSetByteZ(W1, IAPU.Registers.X);
IAPU.PC++;
@@ -2070,7 +2070,7 @@ void Apu8D()
void Apu8F()
{
// MOV dp,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
S9xAPUSetByteZ(Work8, OP2);
IAPU.PC += 3;
}
@@ -2087,7 +2087,7 @@ void Apu9E()
else
{
APUClearOverflow();
- uint8 Work8 = IAPU.Registers.YA.W / IAPU.Registers.X;
+ uint8_t Work8 = IAPU.Registers.YA.W / IAPU.Registers.X;
IAPU.Registers.YA.B.Y = IAPU.Registers.YA.W % IAPU.Registers.X;
IAPU.Registers.YA.B.A = Work8;
}
@@ -2109,7 +2109,7 @@ void Apu9F()
void ApuA4()
{
// SBC A, dp
- uint8 Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2118,7 +2118,7 @@ void ApuA5()
{
// SBC A, abs
Absolute();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -2126,7 +2126,7 @@ void ApuA5()
void ApuA6()
{
// SBC A, (X)
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.X);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC++;
}
@@ -2135,7 +2135,7 @@ void ApuA7()
{
// SBC A,(dp+X)
IndexedXIndirect();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2143,7 +2143,7 @@ void ApuA7()
void ApuA8()
{
// SBC A,#00
- uint8 Work8 = OP1;
+ uint8_t Work8 = OP1;
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2151,8 +2151,8 @@ void ApuA8()
void ApuA9()
{
// SBC dp(dest), dp(src)
- uint8 Work8 = S9xAPUGetByteZ(OP1);
- uint8 W1 = S9xAPUGetByteZ(OP2);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1);
+ uint8_t W1 = S9xAPUGetByteZ(OP2);
SBC(W1, Work8);
S9xAPUSetByteZ(W1, OP2);
IAPU.PC += 3;
@@ -2161,7 +2161,7 @@ void ApuA9()
void ApuB4()
{
// SBC A, dp+X
- uint8 Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(OP1 + IAPU.Registers.X);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2170,7 +2170,7 @@ void ApuB5()
{
// SBC A,abs+X
AbsoluteX();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -2179,7 +2179,7 @@ void ApuB6()
{
// SBC A,abs+Y
AbsoluteY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 3;
}
@@ -2188,7 +2188,7 @@ void ApuB7()
{
// SBC A,(dp)+Y
IndirectIndexedY();
- uint8 Work8 = S9xAPUGetByte(IAPU.Address);
+ uint8_t Work8 = S9xAPUGetByte(IAPU.Address);
SBC(IAPU.Registers.YA.B.A, Work8);
IAPU.PC += 2;
}
@@ -2196,8 +2196,8 @@ void ApuB7()
void ApuB8()
{
// SBC dp,#00
- uint8 Work8 = OP1;
- uint8 W1 = S9xAPUGetByteZ(OP2);
+ uint8_t Work8 = OP1;
+ uint8_t W1 = S9xAPUGetByteZ(OP2);
SBC(W1, Work8);
S9xAPUSetByteZ(W1, OP2);
IAPU.PC += 3;
@@ -2206,8 +2206,8 @@ void ApuB8()
void ApuB9()
{
// SBC (X),(Y)
- uint8 W1 = S9xAPUGetByteZ(IAPU.Registers.X);
- uint8 Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
+ uint8_t W1 = S9xAPUGetByteZ(IAPU.Registers.X);
+ uint8_t Work8 = S9xAPUGetByteZ(IAPU.Registers.YA.B.Y);
SBC(W1, Work8);
S9xAPUSetByteZ(W1, IAPU.Registers.X);
IAPU.PC++;
@@ -2322,7 +2322,7 @@ void ApuCD()
void ApuCF()
{
// MUL YA
- IAPU.Registers.YA.W = (uint16) IAPU.Registers.YA.B.A * IAPU.Registers.YA.B.Y;
+ IAPU.Registers.YA.W = (uint16_t) IAPU.Registers.YA.B.A * IAPU.Registers.YA.B.Y;
APUSetZN16(IAPU.Registers.YA.W);
IAPU.PC++;
}
diff --git a/source/spc700.h b/source/spc700.h
index d7da8cd..9ddb72f 100644
--- a/source/spc700.h
+++ b/source/spc700.h
@@ -138,24 +138,24 @@ typedef union
#ifdef LSB_FIRST
struct
{
- uint8 A, Y;
+ uint8_t A, Y;
} B;
#else
struct
{
- uint8 Y, A;
+ uint8_t Y, A;
} B;
#endif
- uint16 W;
+ uint16_t W;
} YAndA;
typedef struct
{
- uint8 P;
+ uint8_t P;
YAndA YA;
- uint8 X;
- uint8 S;
- uint16 PC;
+ uint8_t X;
+ uint8_t S;
+ uint16_t PC;
} SAPURegisters;
// Needed by ILLUSION OF GAIA
@@ -169,11 +169,11 @@ typedef struct
// 1.953us := 1.024065.54MHz
#ifdef SPCTOOL
-int32 ESPC(int32);
+int32_t ESPC(int32_t);
#define APU_EXECUTE() \
{ \
- int32 l = (CPU.Cycles - APU.Cycles) / 14; \
+ int32_t l = (CPU.Cycles - APU.Cycles) / 14; \
if (l > 0) \
{ \
l -= _EmuSPC(l); \
diff --git a/source/spc7110.c b/source/spc7110.c
index 4285cb3..89cab00 100644
--- a/source/spc7110.c
+++ b/source/spc7110.c
@@ -117,7 +117,7 @@ char* osd_GetPackDir();
#define MAX_TABLES 48
//default to using 5 megs of RAM for method 3 caching.
-uint16 cacheMegs = 5;
+uint16_t cacheMegs = 5;
//using function pointers to initialize cache management
void (*CleanUp7110)(void) = NULL;
@@ -128,10 +128,10 @@ void (*Copy7110)(void) = NULL;
//offset and size of reads from pack
typedef struct SPC7110DecompressionLocationStruct
{
- uint32 offset;
- uint32 size;
- uint16 used_offset;
- uint16 used_len;
+ uint32_t offset;
+ uint32_t size;
+ uint16_t used_offset;
+ uint16_t used_len;
} Data7110;
//this maps an index.bin table to the decompression pack
@@ -145,12 +145,12 @@ typedef struct SPC7110DecompressionIndexStruct
//this contains all the data for the decompression pack.
typedef struct SPC7110DecompressionPackStructure
{
- uint8* binfiles[MAX_TABLES];
+ uint8_t* binfiles[MAX_TABLES];
Index7110 tableEnts[MAX_TABLES];
int last_table;
int idx;
- uint8 last_idx;
- uint16 last_offset;
+ uint8_t last_idx;
+ uint16_t last_offset;
} Pack7110;
@@ -407,7 +407,7 @@ void ReadPackData()
sprintf(bfname, "%06X.bin", table);
strcat(name, "/");
strcat(name, bfname);
- decompack->binfiles[i] = (uint8*)fopen(name, "rb");
+ decompack->binfiles[i] = (uint8_t*)fopen(name, "rb");
}
else
{
@@ -527,7 +527,7 @@ void GetPackData()
}
//reads SPC7110 and RTC registers.
-uint8 S9xGetSPC7110(uint16 Address)
+uint8_t S9xGetSPC7110(uint16_t Address)
{
switch (Address)
{
@@ -540,7 +540,7 @@ uint8 S9xGetSPC7110(uint16 Address)
case 0x4800:
{
unsigned short count = s7r.reg4809 | (s7r.reg480A << 8);
- uint32 i, j;
+ uint32_t i, j;
j = (s7r.reg4805 | (s7r.reg4806 << 8));
j *= s7r.AlignBy;
i = j;
@@ -609,7 +609,7 @@ uint8 S9xGetSPC7110(uint16 Address)
return 0;
if ((s7r.written & 0x07) == 0x07)
{
- uint32 i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
+ uint32_t i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
i %= s7r.DataRomSize;
if (s7r.reg4818 & 0x02)
{
@@ -619,8 +619,8 @@ uint8 S9xGetSPC7110(uint16 Address)
r4814 = (s7r.reg4815 << 8) | s7r.reg4814;
i += r4814;
r4814++;
- s7r.reg4815 = (uint8)(r4814 >> 8);
- s7r.reg4814 = (uint8)(r4814 & 0x00FF);
+ s7r.reg4815 = (uint8_t)(r4814 >> 8);
+ s7r.reg4814 = (uint8_t)(r4814 & 0x00FF);
}
else
{
@@ -630,13 +630,13 @@ uint8 S9xGetSPC7110(uint16 Address)
if (r4814 != 0xFFFF)
r4814++;
else r4814 = 0;
- s7r.reg4815 = (uint8)(r4814 >> 8);
- s7r.reg4814 = (uint8)(r4814 & 0x00FF);
+ s7r.reg4815 = (uint8_t)(r4814 >> 8);
+ s7r.reg4814 = (uint8_t)(r4814 & 0x00FF);
}
}
i += s7r.DataRomOffset;
- uint8 tmp = Memory.ROM[i];
+ uint8_t tmp = Memory.ROM[i];
i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
if (s7r.reg4818 & 0x02)
@@ -675,7 +675,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
else
{
- uint16 inc;
+ uint16_t inc;
inc = (s7r.reg4817 << 8) | s7r.reg4816;
if (!(s7r.reg4818 & 0x10))
i += inc;
@@ -766,7 +766,7 @@ uint8 S9xGetSPC7110(uint16 Address)
case 0x481A:
if (s7r.written == 0x1F)
{
- uint32 i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811);
+ uint32_t i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811);
if (s7r.reg4818 & 0x08)
{
short adj;
@@ -775,14 +775,14 @@ uint8 S9xGetSPC7110(uint16 Address)
}
else
{
- uint16 adj;
+ uint16_t adj;
adj = (s7r.reg4815 << 8) | s7r.reg4814;
i += adj;
}
i %= s7r.DataRomSize;
i += s7r.DataRomOffset;
- uint8 tmp = Memory.ROM[i];
+ uint8_t tmp = Memory.ROM[i];
i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811);
if (0x60 == (s7r.reg4818 & 0x60))
{
@@ -798,7 +798,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
else
{
- uint16 adj;
+ uint16_t adj;
adj = (s7r.reg4815 << 8) | s7r.reg4814;
i += adj;
}
@@ -819,7 +819,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
else
{
- uint16 adj;
+ uint16_t adj;
adj = (s7r.reg4815 << 8) | s7r.reg4814;
adj += adj;
s7r.reg4815 = (adj & 0xFF00) >> 8;
@@ -914,7 +914,7 @@ uint8 S9xGetSPC7110(uint16 Address)
if (rtc_f9.init)
{
S9xUpdateRTC();
- uint8 tmp = rtc_f9.reg[rtc_f9.index];
+ uint8_t tmp = rtc_f9.reg[rtc_f9.index];
rtc_f9.index++;
rtc_f9.index %= 0x10;
return tmp;
@@ -931,7 +931,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
}
-void S9xSetSPC7110(uint8 data, uint16 Address)
+void S9xSetSPC7110(uint8_t data, uint16_t Address)
{
switch (Address)
{
@@ -1055,7 +1055,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint32 i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
+ uint32_t i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
if (s7r.reg4818 & 0x08)
i += (signed char)s7r.reg4814;
else
@@ -1077,7 +1077,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint32 i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
+ uint32_t i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
if (s7r.reg4818 & 0x08)
{
short adj;
@@ -1086,7 +1086,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint16 adj;
+ uint16_t adj;
adj = (s7r.reg4815 << 8) | s7r.reg4814;
i += adj;
}
@@ -1118,7 +1118,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint32 i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
+ uint32_t i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
if (s7r.reg4818 & 0x08)
i += (signed char)s7r.reg4814;
@@ -1141,7 +1141,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint32 i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
+ uint32_t i = (s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811;
if (s7r.reg4818 & 0x08)
{
short adj;
@@ -1150,7 +1150,7 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
else
{
- uint16 adj;
+ uint16_t adj;
adj = (s7r.reg4815 << 8) | s7r.reg4814;
i += adj;
}
@@ -1212,22 +1212,22 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
short m2 = (short)((s7r.reg4820) | (s7r.reg4821 << 8));
mul = m1 * m2;
- s7r.reg4828 = (uint8)(mul & 0x000000FF);
- s7r.reg4829 = (uint8)((mul & 0x0000FF00) >> 8);
- s7r.reg482A = (uint8)((mul & 0x00FF0000) >> 16);
- s7r.reg482B = (uint8)((mul & 0xFF000000) >> 24);
+ s7r.reg4828 = (uint8_t)(mul & 0x000000FF);
+ s7r.reg4829 = (uint8_t)((mul & 0x0000FF00) >> 8);
+ s7r.reg482A = (uint8_t)((mul & 0x00FF0000) >> 16);
+ s7r.reg482B = (uint8_t)((mul & 0xFF000000) >> 24);
}
else
{
- uint32 mul;
- uint16 m1 = (uint16)((s7r.reg4824) | (s7r.reg4825 << 8));
- uint16 m2 = (uint16)((s7r.reg4820) | (s7r.reg4821 << 8));
+ uint32_t mul;
+ uint16_t m1 = (uint16_t)((s7r.reg4824) | (s7r.reg4825 << 8));
+ uint16_t m2 = (uint16_t)((s7r.reg4820) | (s7r.reg4821 << 8));
mul = m1 * m2;
- s7r.reg4828 = (uint8)(mul & 0x000000FF);
- s7r.reg4829 = (uint8)((mul & 0x0000FF00) >> 8);
- s7r.reg482A = (uint8)((mul & 0x00FF0000) >> 16);
- s7r.reg482B = (uint8)((mul & 0xFF000000) >> 24);
+ s7r.reg4828 = (uint8_t)(mul & 0x000000FF);
+ s7r.reg4829 = (uint8_t)((mul & 0x0000FF00) >> 8);
+ s7r.reg482A = (uint8_t)((mul & 0x00FF0000) >> 16);
+ s7r.reg482B = (uint8_t)((mul & 0xFF000000) >> 24);
}
s7r.reg482F = 0x80;
break;
@@ -1255,36 +1255,36 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
quotient = 0;
remainder = dividend & 0x0000FFFF;
}
- s7r.reg4828 = (uint8)(quotient & 0x000000FF);
- s7r.reg4829 = (uint8)((quotient & 0x0000FF00) >> 8);
- s7r.reg482A = (uint8)((quotient & 0x00FF0000) >> 16);
- s7r.reg482B = (uint8)((quotient & 0xFF000000) >> 24);
- s7r.reg482C = (uint8)remainder & 0x00FF;
- s7r.reg482D = (uint8)((remainder & 0xFF00) >> 8);
+ s7r.reg4828 = (uint8_t)(quotient & 0x000000FF);
+ s7r.reg4829 = (uint8_t)((quotient & 0x0000FF00) >> 8);
+ s7r.reg482A = (uint8_t)((quotient & 0x00FF0000) >> 16);
+ s7r.reg482B = (uint8_t)((quotient & 0xFF000000) >> 24);
+ s7r.reg482C = (uint8_t)remainder & 0x00FF;
+ s7r.reg482D = (uint8_t)((remainder & 0xFF00) >> 8);
}
else
{
- uint32 quotient;
- uint16 remainder;
- uint32 dividend = (uint32)(s7r.reg4820 | (s7r.reg4821 << 8) |
+ uint32_t quotient;
+ uint16_t remainder;
+ uint32_t dividend = (uint32_t)(s7r.reg4820 | (s7r.reg4821 << 8) |
(s7r.reg4822 << 16) | (s7r.reg4823 << 24));
- uint16 divisor = (uint16)(s7r.reg4826 | (s7r.reg4827 << 8));
+ uint16_t divisor = (uint16_t)(s7r.reg4826 | (s7r.reg4827 << 8));
if (divisor != 0)
{
- quotient = (uint32)(dividend / divisor);
- remainder = (uint16)(dividend % divisor);
+ quotient = (uint32_t)(dividend / divisor);
+ remainder = (uint16_t)(dividend % divisor);
}
else
{
quotient = 0;
remainder = dividend & 0x0000FFFF;
}
- s7r.reg4828 = (uint8)(quotient & 0x000000FF);
- s7r.reg4829 = (uint8)((quotient & 0x0000FF00) >> 8);
- s7r.reg482A = (uint8)((quotient & 0x00FF0000) >> 16);
- s7r.reg482B = (uint8)((quotient & 0xFF000000) >> 24);
- s7r.reg482C = (uint8)remainder & 0x00FF;
- s7r.reg482D = (uint8)((remainder & 0xFF00) >> 8);
+ s7r.reg4828 = (uint8_t)(quotient & 0x000000FF);
+ s7r.reg4829 = (uint8_t)((quotient & 0x0000FF00) >> 8);
+ s7r.reg482A = (uint8_t)((quotient & 0x00FF0000) >> 16);
+ s7r.reg482B = (uint8_t)((quotient & 0xFF000000) >> 24);
+ s7r.reg482C = (uint8_t)remainder & 0x00FF;
+ s7r.reg482D = (uint8_t)((remainder & 0xFF00) >> 8);
}
s7r.reg482F = 0x80;
break;
@@ -1429,9 +1429,9 @@ void S9xSetSPC7110(uint8 data, uint16 Address)
}
//emulate the SPC7110's ability to remap banks Dx, Ex, and Fx.
-uint8 S9xGetSPC7110Byte(uint32 Address)
+uint8_t S9xGetSPC7110Byte(uint32_t Address)
{
- uint32 i;
+ uint32_t i;
switch ((Address & 0x00F00000) >> 16)
{
case 0xD0:
@@ -1623,9 +1623,9 @@ void S9xUpdateRTC()
}
//allows DMA from the ROM (is this even possible on the SPC7110?
-uint8* Get7110BasePtr(uint32 Address)
+uint8_t* Get7110BasePtr(uint32_t Address)
{
- uint32 i;
+ uint32_t i;
switch ((Address & 0x00F00000) >> 16)
{
case 0xD0:
@@ -1650,11 +1650,11 @@ uint8* Get7110BasePtr(uint32 Address)
bool Load7110Index(char* filename)
{
FILE* fp;
- uint8 buffer[12];
+ uint8_t buffer[12];
int table = 0;
- uint8 index = 0;
- uint32 offset = 0;
- uint32 size = 0;
+ uint8_t index = 0;
+ uint32_t offset = 0;
+ uint32_t size = 0;
int i = 0;
fp = fopen(filename, "rb");
if (NULL == fp)
@@ -1730,7 +1730,7 @@ void SPC7110Load(char* dirname)
#endif
struct stat buf;
if (-1 != stat(binname, &buf))
- decompack->binfiles[i] = (uint8*)malloc(buf.st_size);
+ decompack->binfiles[i] = (uint8_t*)malloc(buf.st_size);
FILE* fp = fopen(binname, "rb");
if (fp)
{
@@ -1810,7 +1810,7 @@ void SPC7110Grab(char* dirname)
getcwd(temp_path, PATH_MAX);
#endif
- int32 buffer_size = 1024 * 1024 * cacheMegs; //*some setting
+ int32_t buffer_size = 1024 * 1024 * cacheMegs; //*some setting
memset(decompack, 0, sizeof(Pack7110));
#ifndef _XBOX
@@ -1841,7 +1841,7 @@ void SPC7110Grab(char* dirname)
if (-1 != stat(binname, &buf))
{
if (buf.st_size < buffer_size)
- decompack->binfiles[i] = (uint8*)malloc(buf.st_size);
+ decompack->binfiles[i] = (uint8_t*)malloc(buf.st_size);
FILE* fp = fopen(binname, "rb");
//use them here
if (fp)
@@ -1855,7 +1855,7 @@ void SPC7110Grab(char* dirname)
}
else
{
- decompack->binfiles[i] = (uint8*)fp;
+ decompack->binfiles[i] = (uint8_t*)fp;
decompack->tableEnts[i].is_file = true;
}
}
@@ -2038,7 +2038,7 @@ void S9xSpc7110Reset()
//note the logs are explicitly little-endian, not host byte order.
void Do7110Logging()
{
- uint8 ent_temp;
+ uint8_t ent_temp;
FILE* flog;
int entries = 0;
@@ -2090,10 +2090,10 @@ void Do7110Logging()
if (flog)
{
- uint8 buffer[8];
+ uint8_t buffer[8];
int table = 0;
- uint16 offset = 0;
- uint16 length = 0;
+ uint16_t offset = 0;
+ uint16_t length = 0;
fseek(flog, 35, 0);
int f_len;
@@ -2236,23 +2236,23 @@ void Do7110Logging()
}
}
}
-bool8 S9xSaveSPC7110RTC(S7RTC* rtc_f9)
+bool S9xSaveSPC7110RTC(S7RTC* rtc_f9)
{
FILE* fp;
if ((fp = fopen(S9xGetFilename("rtc"), "wb")) == NULL)
- return (FALSE);
+ return (false);
int i = 0;
- uint8 temp = 0;
+ uint8_t temp = 0;
for (i = 0; i < 16; i++)
fwrite(&rtc_f9->reg[i], 1, 1, fp);
temp = rtc_f9->index & 0x00FF;
fwrite(&temp, 1, 1, fp);
temp = (rtc_f9->index) >> 8;
fwrite(&temp, 1, 1, fp);
- temp = (uint8)rtc_f9->control;
+ temp = (uint8_t)rtc_f9->control;
fwrite(&temp, 1, 1, fp);
- temp = (uint8)rtc_f9->init;
+ temp = (uint8_t)rtc_f9->init;
fwrite(&temp, 1, 1, fp);
temp = rtc_f9->last_used & 0x00FF;
fwrite(&temp, 1, 1, fp);
@@ -2263,19 +2263,19 @@ bool8 S9xSaveSPC7110RTC(S7RTC* rtc_f9)
temp = (rtc_f9->last_used >> 24) & 0x00FF;;
fwrite(&temp, 1, 1, fp);
fclose(fp);
- return (TRUE);
+ return (true);
}
-bool8 S9xLoadSPC7110RTC(S7RTC* rtc_f9)
+bool S9xLoadSPC7110RTC(S7RTC* rtc_f9)
{
FILE* fp;
if ((fp = fopen(S9xGetFilename("rtc"), "rb")) == NULL)
- return (FALSE);
+ return (false);
int i;
for (i = 0; i < 16; i++)
fread(&(rtc_f9->reg[i]), 1, 1, fp);
- uint8 temp = 0;
+ uint8_t temp = 0;
fread(&temp, 1, 1, fp);
rtc_f9->index = temp;
fread(&temp, 1, 1, fp);
@@ -2292,6 +2292,6 @@ bool8 S9xLoadSPC7110RTC(S7RTC* rtc_f9)
fread(&temp, 1, 1, fp);
rtc_f9->last_used |= (temp << 24);
fclose(fp);
- return (TRUE);
+ return (true);
}
diff --git a/source/spc7110.h b/source/spc7110.h
index 12078d3..c597096 100644
--- a/source/spc7110.h
+++ b/source/spc7110.h
@@ -96,17 +96,17 @@ extern void (*LoadUp7110)(char*);
extern void (*CleanUp7110)(void);
extern void (*Copy7110)(void);
-extern uint16 cacheMegs;
+extern uint16_t cacheMegs;
void Del7110Gfx(void);
void Close7110Gfx(void);
void Drop7110Gfx(void);
-uint8 S9xGetSPC7110(uint16 Address);
-uint8 S9xGetSPC7110Byte(uint32 Address);
-uint8* Get7110BasePtr(uint32);
-void S9xSetSPC7110(uint8 data, uint16 Address);
+uint8_t S9xGetSPC7110(uint16_t Address);
+uint8_t S9xGetSPC7110Byte(uint32_t Address);
+uint8_t* Get7110BasePtr(uint32_t);
+void S9xSetSPC7110(uint8_t data, uint16_t Address);
void S9xSpc7110Init();
-uint8* Get7110BasePtr(uint32);
+uint8_t* Get7110BasePtr(uint32_t);
void S9xSpc7110Reset();
void S9xUpdateRTC();
void Do7110Logging();
@@ -122,7 +122,7 @@ typedef struct SPC7110RTC
{
unsigned char reg[16];
short index;
- uint8 control;
+ uint8_t control;
bool init;
time_t last_used;
} S7RTC;
@@ -174,20 +174,20 @@ typedef struct SPC7110EmuVars
unsigned char reg4840;
unsigned char reg4841;
unsigned char reg4842;
- uint8 AlignBy;
- uint8 written;
- uint8 offset_add;
- uint32 DataRomOffset;
- uint32 DataRomSize;
- uint32 bank50Internal;
- uint8 bank50[DECOMP_BUFFER_SIZE];
+ uint8_t AlignBy;
+ uint8_t written;
+ uint8_t offset_add;
+ uint32_t DataRomOffset;
+ uint32_t DataRomSize;
+ uint32_t bank50Internal;
+ uint8_t bank50[DECOMP_BUFFER_SIZE];
} SPC7110Regs;
extern SPC7110Regs s7r;
extern S7RTC rtc_f9;
// These are defined in spc7110.cpp
-bool8 S9xSaveSPC7110RTC(S7RTC* rtc_f9);
-bool8 S9xLoadSPC7110RTC(S7RTC* rtc_f9);
+bool S9xSaveSPC7110RTC(S7RTC* rtc_f9);
+bool S9xLoadSPC7110RTC(S7RTC* rtc_f9);
#endif
diff --git a/source/srtc.c b/source/srtc.c
index fb2165a..5073d35 100644
--- a/source/srtc.c
+++ b/source/srtc.c
@@ -152,8 +152,8 @@ void S9xHardResetSRTC()
memset(&rtc, 0, sizeof(rtc));
rtc.index = -1;
rtc.mode = MODE_READ;
- rtc.count_enable = FALSE;
- rtc.needs_init = TRUE;
+ rtc.count_enable = false;
+ rtc.needs_init = true;
// Get system timestamp
rtc.system_timestamp = time(NULL);
@@ -370,7 +370,7 @@ void S9xUpdateSrtcTime()
/* S9xSetSRTC() */
/* This function sends data to the S-RTC used in Dai Kaijyu Monogatari II */
/**********************************************************************************************/
-void S9xSetSRTC(uint8 data, uint16 Address)
+void S9xSetSRTC(uint8_t data, uint16_t Address)
{
data &= 0x0F; // Data is only 4-bits, mask out unused bits.
@@ -416,8 +416,8 @@ void S9xSetSRTC(uint8 data, uint16 Address)
rtc.data[rtc.index++] = S9xSRTCComputeDayOfWeek();
// Start RTC counting again
- rtc.count_enable = TRUE;
- rtc.needs_init = FALSE;
+ rtc.count_enable = true;
+ rtc.needs_init = false;
}
return;
@@ -434,7 +434,7 @@ void S9xSetSRTC(uint8 data, uint16 Address)
{
case COMMAND_CLEAR_RTC:
// Disable RTC counter
- rtc.count_enable = FALSE;
+ rtc.count_enable = false;
memset(rtc.data, 0, MAX_RTC_INDEX + 1);
rtc.index = -1;
@@ -443,7 +443,7 @@ void S9xSetSRTC(uint8 data, uint16 Address)
case COMMAND_LOAD_RTC:
// Disable RTC counter
- rtc.count_enable = FALSE;
+ rtc.count_enable = false;
rtc.index = 0; // Setup for writing
rtc.mode = MODE_LOAD_RTC;
@@ -475,7 +475,7 @@ void S9xSetSRTC(uint8 data, uint16 Address)
/* S9xGetSRTC() */
/* This function retrieves data from the S-RTC */
/**********************************************************************************************/
-uint8 S9xGetSRTC(uint16 Address)
+uint8_t S9xGetSRTC(uint16_t Address)
{
if (rtc.mode == MODE_READ)
{
@@ -522,14 +522,14 @@ void S9xSRTCPreSaveState()
// memmove converted: Different mallocs [Neb]
memcpy(&Memory.SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
#else
- SRAM [s + 5 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 0);
- SRAM [s + 6 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 8);
- SRAM [s + 7 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 16);
- SRAM [s + 8 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 24);
- SRAM [s + 9 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 32);
- SRAM [s + 10 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 40);
- SRAM [s + 11 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 48);
- SRAM [s + 12 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 56);
+ SRAM [s + 5 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 0);
+ SRAM [s + 6 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 8);
+ SRAM [s + 7 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 16);
+ SRAM [s + 8 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 24);
+ SRAM [s + 9 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 32);
+ SRAM [s + 10 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 40);
+ SRAM [s + 11 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 48);
+ SRAM [s + 12 + MAX_RTC_INDEX] = (uint8_t)(rtc.system_timestamp >> 56);
#endif
}
}
diff --git a/source/srtc.h b/source/srtc.h
index 2158207..789f059 100644
--- a/source/srtc.h
+++ b/source/srtc.h
@@ -131,21 +131,21 @@ Index Description Range (nibble)
typedef struct
{
- bool8 needs_init;
- bool8 count_enable; // Does RTC mark time or is it frozen
- uint8 data [MAX_RTC_INDEX + 1];
- int8 index;
- uint8 mode;
+ bool needs_init;
+ 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
- uint32 pad;
+ uint32_t pad;
} SRTC_DATA;
extern SRTC_DATA rtc;
void S9xUpdateSrtcTime();
-void S9xSetSRTC(uint8 data, uint16 Address);
-uint8 S9xGetSRTC(uint16 Address);
+void S9xSetSRTC(uint8_t data, uint16_t Address);
+uint8_t S9xGetSRTC(uint16_t Address);
void S9xSRTCPreSaveState();
void S9xSRTCPostLoadState();
void S9xResetSRTC();
diff --git a/source/tile.c b/source/tile.c
index d10acca..a9619fa 100644
--- a/source/tile.c
+++ b/source/tile.c
@@ -94,24 +94,24 @@
#include "gfx.h"
#include "tile.h"
-extern uint32 HeadMask [4];
-extern uint32 TailMask [5];
+extern uint32_t HeadMask [4];
+extern uint32_t TailMask [5];
-static uint8 ConvertTile(uint8* pCache, uint32 TileAddr)
+static uint8_t ConvertTile(uint8_t* pCache, uint32_t TileAddr)
{
- register uint8* tp = &Memory.VRAM[TileAddr];
- uint32* p = (uint32*) pCache;
- uint32 non_zero = 0;
- uint8 line;
+ register uint8_t* tp = &Memory.VRAM[TileAddr];
+ uint32_t* p = (uint32_t*) pCache;
+ uint32_t non_zero = 0;
+ uint8_t line;
switch (BG.BitShift)
{
case 8:
for (line = 8; line != 0; line--, tp += 2)
{
- uint32 p1 = 0;
- uint32 p2 = 0;
- register uint8 pix;
+ uint32_t p1 = 0;
+ uint32_t p2 = 0;
+ register uint8_t pix;
if ((pix = *(tp + 0)))
{
@@ -162,9 +162,9 @@ static uint8 ConvertTile(uint8* pCache, uint32 TileAddr)
case 4:
for (line = 8; line != 0; line--, tp += 2)
{
- uint32 p1 = 0;
- uint32 p2 = 0;
- register uint8 pix;
+ uint32_t p1 = 0;
+ uint32_t p2 = 0;
+ register uint8_t pix;
if ((pix = *(tp + 0)))
{
p1 |= odd_high[0][pix >> 4];
@@ -194,9 +194,9 @@ static uint8 ConvertTile(uint8* pCache, uint32 TileAddr)
case 2:
for (line = 8; line != 0; line--, tp += 2)
{
- uint32 p1 = 0;
- uint32 p2 = 0;
- register uint8 pix;
+ uint32_t p1 = 0;
+ uint32_t p2 = 0;
+ register uint8_t pix;
if ((pix = *(tp + 0)))
{
p1 |= odd_high[0][pix >> 4];
@@ -213,16 +213,16 @@ static uint8 ConvertTile(uint8* pCache, uint32 TileAddr)
}
break;
}
- return (non_zero ? TRUE : BLANK_TILE);
+ return (non_zero ? true : BLANK_TILE);
}
#define PLOT_PIXEL(screen, pixel) (pixel)
-static void WRITE_4PIXELS16(int32 Offset, uint8* Pixels, uint16* ScreenColors)
+static void WRITE_4PIXELS16(int32_t Offset, uint8_t* Pixels, uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -234,12 +234,12 @@ static void WRITE_4PIXELS16(int32 Offset, uint8* Pixels, uint16* ScreenColors)
}
}
-static void WRITE_4PIXELS16_FLIPPED(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -251,12 +251,12 @@ static void WRITE_4PIXELS16_FLIPPED(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_HALFWIDTH(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_HALFWIDTH(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N += 2)
{
@@ -268,12 +268,12 @@ static void WRITE_4PIXELS16_HALFWIDTH(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPED_HALFWIDTH(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_HALFWIDTH(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N += 2)
{
@@ -285,11 +285,11 @@ static void WRITE_4PIXELS16_FLIPPED_HALFWIDTH(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16x2(int32 Offset, uint8* Pixels, uint16* ScreenColors)
+static void WRITE_4PIXELS16x2(int32_t Offset, uint8_t* Pixels, uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -301,12 +301,12 @@ static void WRITE_4PIXELS16x2(int32 Offset, uint8* Pixels, uint16* ScreenColors)
}
}
-static void WRITE_4PIXELS16_FLIPPEDx2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPEDx2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -318,12 +318,12 @@ static void WRITE_4PIXELS16_FLIPPEDx2(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16x2x2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16x2x2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -337,12 +337,12 @@ static void WRITE_4PIXELS16x2x2(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPEDx2x2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPEDx2x2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
for (N = 0; N < 4; N++)
{
@@ -356,121 +356,121 @@ static void WRITE_4PIXELS16_FLIPPEDx2x2(int32 Offset, uint8* Pixels,
}
}
-void DrawTile16(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16, WRITE_4PIXELS16_FLIPPED, 4)
}
-void DrawClippedTile16(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16, WRITE_4PIXELS16_FLIPPED, 4)
}
-void DrawTile16HalfWidth(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16HalfWidth(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_HALFWIDTH, WRITE_4PIXELS16_FLIPPED_HALFWIDTH, 2)
}
-void DrawClippedTile16HalfWidth(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16HalfWidth(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_HALFWIDTH,
WRITE_4PIXELS16_FLIPPED_HALFWIDTH, 2)
}
-void DrawTile16x2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16x2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16x2, WRITE_4PIXELS16_FLIPPEDx2, 8)
}
-void DrawClippedTile16x2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16x2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16x2, WRITE_4PIXELS16_FLIPPEDx2, 8)
}
-void DrawTile16x2x2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16x2x2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16x2x2, WRITE_4PIXELS16_FLIPPEDx2x2, 8)
}
-void DrawClippedTile16x2x2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16x2x2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16x2x2, WRITE_4PIXELS16_FLIPPEDx2x2, 8)
}
-void DrawLargePixel16(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
+ uint16_t pixel;
RENDER_TILE_LARGE(ScreenColors [pixel], PLOT_PIXEL)
}
-void DrawLargePixel16HalfWidth(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16HalfWidth(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.DB + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.DB + Offset;
+ uint16_t pixel;
RENDER_TILE_LARGE_HALFWIDTH(ScreenColors [pixel], PLOT_PIXEL)
}
-static void WRITE_4PIXELS16_ADD(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_ADD(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
+ uint8_t Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -493,14 +493,14 @@ static void WRITE_4PIXELS16_ADD(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPED_ADD(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_ADD(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
+ uint8_t Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -523,13 +523,13 @@ static void WRITE_4PIXELS16_FLIPPED_ADD(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_ADD1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_ADD1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -544,7 +544,7 @@ static void WRITE_4PIXELS16_ADD1_2(int32 Offset, uint8* Pixels,
Screen [N] = COLOR_ADD(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16)(COLOR_ADD1_2(ScreenColors [Pixel],
+ Screen [N] = (uint16_t)(COLOR_ADD1_2(ScreenColors [Pixel],
Screen [GFX.Delta + N]));
break;
}
@@ -553,13 +553,13 @@ static void WRITE_4PIXELS16_ADD1_2(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPED_ADD1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_ADD1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -574,7 +574,7 @@ static void WRITE_4PIXELS16_FLIPPED_ADD1_2(int32 Offset, uint8* Pixels,
Screen [N] = COLOR_ADD(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16)(COLOR_ADD1_2(ScreenColors [Pixel],
+ Screen [N] = (uint16_t)(COLOR_ADD1_2(ScreenColors [Pixel],
Screen [GFX.Delta + N]));
break;
}
@@ -583,13 +583,13 @@ static void WRITE_4PIXELS16_FLIPPED_ADD1_2(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_SUB(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_SUB(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -601,10 +601,10 @@ static void WRITE_4PIXELS16_SUB(int32 Offset, uint8* Pixels,
Screen [N] = ScreenColors [Pixel];
break;
case 1:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], Screen [GFX.Delta + N]);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], Screen [GFX.Delta + N]);
break;
}
Depth [N] = GFX.Z2;
@@ -612,13 +612,13 @@ static void WRITE_4PIXELS16_SUB(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPED_SUB(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_SUB(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -630,10 +630,10 @@ static void WRITE_4PIXELS16_FLIPPED_SUB(int32 Offset, uint8* Pixels,
Screen [N] = ScreenColors [Pixel];
break;
case 1:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], Screen [GFX.Delta + N]);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], Screen [GFX.Delta + N]);
break;
}
Depth [N] = GFX.Z2;
@@ -641,13 +641,13 @@ static void WRITE_4PIXELS16_FLIPPED_SUB(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_SUB1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_SUB1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -659,10 +659,10 @@ static void WRITE_4PIXELS16_SUB1_2(int32 Offset, uint8* Pixels,
Screen [N] = ScreenColors [Pixel];
break;
case 1:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16) COLOR_SUB1_2(ScreenColors [Pixel],
+ Screen [N] = (uint16_t) COLOR_SUB1_2(ScreenColors [Pixel],
Screen [GFX.Delta + N]);
break;
}
@@ -671,13 +671,13 @@ static void WRITE_4PIXELS16_SUB1_2(int32 Offset, uint8* Pixels,
}
}
-static void WRITE_4PIXELS16_FLIPPED_SUB1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_SUB1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -689,10 +689,10 @@ static void WRITE_4PIXELS16_FLIPPED_SUB1_2(int32 Offset, uint8* Pixels,
Screen [N] = ScreenColors [Pixel];
break;
case 1:
- Screen [N] = (uint16) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB(ScreenColors [Pixel], GFX.FixedColour);
break;
default:
- Screen [N] = (uint16) COLOR_SUB1_2(ScreenColors [Pixel],
+ Screen [N] = (uint16_t) COLOR_SUB1_2(ScreenColors [Pixel],
Screen [GFX.Delta + N]);
break;
}
@@ -702,15 +702,15 @@ static void WRITE_4PIXELS16_FLIPPED_SUB1_2(int32 Offset, uint8* Pixels,
}
-void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16Add(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
- uint8 Pixel;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ register uint8_t* bp;
+ uint8_t Pixel;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
switch (Tile & (V_FLIP | H_FLIP))
{
@@ -719,7 +719,7 @@ void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
for (l = LineCount; l != 0;
l--, bp += 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- uint8 N;
+ uint8_t N;
for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[N]))
@@ -746,7 +746,7 @@ void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
for (l = LineCount; l != 0;
l--, bp += 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- uint8 N;
+ uint8_t N;
for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[7 - N]))
@@ -773,7 +773,7 @@ void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
for (l = LineCount; l != 0;
l--, bp -= 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- uint8 N;
+ uint8_t N;
for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[7 - N]))
@@ -800,7 +800,7 @@ void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
for (l = LineCount; l != 0;
l--, bp -= 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- uint8 N;
+ uint8_t N;
for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[N]))
@@ -827,84 +827,84 @@ void DrawTile16Add(uint32 Tile, int32 Offset, uint32 StartLine,
}
}
-void DrawClippedTile16Add(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16Add(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_ADD, WRITE_4PIXELS16_FLIPPED_ADD, 4)
}
-void DrawTile16Add1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16Add1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_ADD1_2, WRITE_4PIXELS16_FLIPPED_ADD1_2, 4)
}
-void DrawClippedTile16Add1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16Add1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_ADD1_2, WRITE_4PIXELS16_FLIPPED_ADD1_2, 4)
}
-void DrawTile16Sub(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16Sub(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_SUB, WRITE_4PIXELS16_FLIPPED_SUB, 4)
}
-void DrawClippedTile16Sub(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16Sub(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_SUB, WRITE_4PIXELS16_FLIPPED_SUB, 4)
}
-void DrawTile16Sub1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16Sub1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_SUB1_2, WRITE_4PIXELS16_FLIPPED_SUB1_2, 4)
}
-void DrawClippedTile16Sub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16Sub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_SUB1_2, WRITE_4PIXELS16_FLIPPED_SUB1_2, 4)
}
-static void WRITE_4PIXELS16_ADDF1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_ADDF1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -912,19 +912,19 @@ static void WRITE_4PIXELS16_ADDF1_2(int32 Offset, uint8* Pixels,
{
Screen [N] = ScreenColors [Pixel];
if (SubDepth [N] == 1)
- Screen [N] = (uint16)(COLOR_ADD1_2(ScreenColors [Pixel], GFX.FixedColour));
+ Screen [N] = (uint16_t)(COLOR_ADD1_2(ScreenColors [Pixel], GFX.FixedColour));
Depth [N] = GFX.Z2;
}
}
}
-static void WRITE_4PIXELS16_FLIPPED_ADDF1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_ADDF1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -932,19 +932,19 @@ static void WRITE_4PIXELS16_FLIPPED_ADDF1_2(int32 Offset, uint8* Pixels,
{
Screen [N] = ScreenColors [Pixel];
if (SubDepth [N] == 1)
- Screen [N] = (uint16)(COLOR_ADD1_2(ScreenColors [Pixel], GFX.FixedColour));
+ Screen [N] = (uint16_t)(COLOR_ADD1_2(ScreenColors [Pixel], GFX.FixedColour));
Depth [N] = GFX.Z2;
}
}
}
-static void WRITE_4PIXELS16_SUBF1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_SUBF1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -952,19 +952,19 @@ static void WRITE_4PIXELS16_SUBF1_2(int32 Offset, uint8* Pixels,
{
Screen [N] = ScreenColors [Pixel];
if (SubDepth [N] == 1)
- Screen [N] = (uint16) COLOR_SUB1_2(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB1_2(ScreenColors [Pixel], GFX.FixedColour);
Depth [N] = GFX.Z2;
}
}
}
-static void WRITE_4PIXELS16_FLIPPED_SUBF1_2(int32 Offset, uint8* Pixels,
- uint16* ScreenColors)
+static void WRITE_4PIXELS16_FLIPPED_SUBF1_2(int32_t Offset, uint8_t* Pixels,
+ uint16_t* ScreenColors)
{
- uint8 Pixel, N;
- uint16* Screen = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint8* SubDepth = GFX.SubZBuffer + Offset;
+ uint8_t Pixel, N;
+ uint16_t* Screen = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint8_t* SubDepth = GFX.SubZBuffer + Offset;
for (N = 0; N < 4; N++)
{
@@ -972,63 +972,63 @@ static void WRITE_4PIXELS16_FLIPPED_SUBF1_2(int32 Offset, uint8* Pixels,
{
Screen [N] = ScreenColors [Pixel];
if (SubDepth [N] == 1)
- Screen [N] = (uint16) COLOR_SUB1_2(ScreenColors [Pixel], GFX.FixedColour);
+ Screen [N] = (uint16_t) COLOR_SUB1_2(ScreenColors [Pixel], GFX.FixedColour);
Depth [N] = GFX.Z2;
}
}
}
-void DrawTile16FixedAdd1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16FixedAdd1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_ADDF1_2, WRITE_4PIXELS16_FLIPPED_ADDF1_2, 4)
}
-void DrawClippedTile16FixedAdd1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16FixedAdd1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_ADDF1_2,
WRITE_4PIXELS16_FLIPPED_ADDF1_2, 4)
}
-void DrawTile16FixedSub1_2(uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
+void DrawTile16FixedSub1_2(uint32_t Tile, int32_t Offset, uint32_t StartLine,
+ uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
RENDER_TILE(WRITE_4PIXELS16_SUBF1_2, WRITE_4PIXELS16_FLIPPED_SUBF1_2, 4)
}
-void DrawClippedTile16FixedSub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
+void DrawClippedTile16FixedSub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Width,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint8* bp;
+ register uint8_t* bp;
TILE_CLIP_PREAMBLE
RENDER_CLIPPED_TILE(WRITE_4PIXELS16_SUBF1_2,
WRITE_4PIXELS16_FLIPPED_SUBF1_2, 4)
}
-void DrawLargePixel16Add(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16Add(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint16_t pixel;
#define LARGE_ADD_PIXEL(s, p) \
(Depth [z + GFX.DepthDelta] ? (Depth [z + GFX.DepthDelta] != 1 ? \
@@ -1039,18 +1039,18 @@ void DrawLargePixel16Add(uint32 Tile, int32 Offset,
RENDER_TILE_LARGE(ScreenColors [pixel], LARGE_ADD_PIXEL)
}
-void DrawLargePixel16Add1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16Add1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint16_t pixel;
#define LARGE_ADD_PIXEL1_2(s, p) \
-((uint16) (Depth [z + GFX.DepthDelta] ? (Depth [z + GFX.DepthDelta] != 1 ? \
+((uint16_t) (Depth [z + GFX.DepthDelta] ? (Depth [z + GFX.DepthDelta] != 1 ? \
COLOR_ADD1_2 (p, *(s + GFX.Delta)) : \
COLOR_ADD (p, GFX.FixedColour)) \
: p))
@@ -1058,15 +1058,15 @@ void DrawLargePixel16Add1_2(uint32 Tile, int32 Offset,
RENDER_TILE_LARGE(ScreenColors [pixel], LARGE_ADD_PIXEL1_2)
}
-void DrawLargePixel16Sub(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16Sub(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint16_t pixel;
#define LARGE_SUB_PIXEL(s, p) \
(Depth [z + GFX.DepthDelta] ? (Depth [z + GFX.DepthDelta] != 1 ? \
@@ -1077,15 +1077,15 @@ void DrawLargePixel16Sub(uint32 Tile, int32 Offset,
RENDER_TILE_LARGE(ScreenColors [pixel], LARGE_SUB_PIXEL)
}
-void DrawLargePixel16Sub1_2(uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
+void DrawLargePixel16Sub1_2(uint32_t Tile, int32_t Offset,
+ uint32_t StartPixel, uint32_t Pixels,
+ uint32_t StartLine, uint32_t LineCount)
{
TILE_PREAMBLE
- register uint16* sp = (uint16*) GFX.S + Offset;
- uint8* Depth = GFX.ZBuffer + Offset;
- uint16 pixel;
+ register uint16_t* sp = (uint16_t*) GFX.S + Offset;
+ uint8_t* Depth = GFX.ZBuffer + Offset;
+ uint16_t pixel;
#define LARGE_SUB_PIXEL1_2(s, p) \
(Depth [z + GFX.DepthDelta] ? (Depth [z + GFX.DepthDelta] != 1 ? \
diff --git a/source/tile.h b/source/tile.h
index 7e70ddc..5200270 100644
--- a/source/tile.h
+++ b/source/tile.h
@@ -90,15 +90,15 @@
#define _TILE_H_
#define TILE_PREAMBLE \
- uint8 *pCache; \
+ uint8_t *pCache; \
\
- uint32 TileAddr = BG.TileAddress + ((Tile & 0x3ff) << BG.TileShift); \
+ uint32_t TileAddr = BG.TileAddress + ((Tile & 0x3ff) << BG.TileShift); \
if ((Tile & 0x1ff) >= 256) \
TileAddr += BG.NameSelect; \
\
TileAddr &= 0xffff; \
\
- uint32 TileNumber; \
+ uint32_t TileNumber; \
pCache = &BG.Buffer[(TileNumber = (TileAddr >> BG.TileShift)) << 6]; \
\
if (!BG.Buffered [TileNumber]) \
@@ -107,8 +107,8 @@
if (BG.Buffered [TileNumber] == BLANK_TILE) \
return; \
\
- register uint32 l; \
- uint16 *ScreenColors; \
+ register uint32_t l; \
+ uint16_t *ScreenColors; \
if (BG.DirectColourMode) \
{ \
if (IPPU.DirectColourMapsNeedRebuild) \
@@ -125,9 +125,9 @@
bp = pCache + StartLine; \
for (l = LineCount; l != 0; l--, bp += 8, Offset += GFX.PPL) \
{ \
- if (*(uint32 *) bp) \
+ if (*(uint32_t *) bp) \
NORMAL (Offset, bp, ScreenColors); \
- if (*(uint32 *) (bp + 4)) \
+ if (*(uint32_t *) (bp + 4)) \
NORMAL (Offset + N, bp + 4, ScreenColors); \
} \
break; \
@@ -135,9 +135,9 @@
bp = pCache + StartLine; \
for (l = LineCount; l != 0; l--, bp += 8, Offset += GFX.PPL) \
{ \
- if (*(uint32 *) (bp + 4)) \
+ if (*(uint32_t *) (bp + 4)) \
FLIPPED (Offset, bp + 4, ScreenColors); \
- if (*(uint32 *) bp) \
+ if (*(uint32_t *) bp) \
FLIPPED (Offset + N, bp, ScreenColors); \
} \
break; \
@@ -145,9 +145,9 @@
bp = pCache + 56 - StartLine; \
for (l = LineCount; l != 0; l--, bp -= 8, Offset += GFX.PPL) \
{ \
- if (*(uint32 *) (bp + 4)) \
+ if (*(uint32_t *) (bp + 4)) \
FLIPPED (Offset, bp + 4, ScreenColors); \
- if (*(uint32 *) bp) \
+ if (*(uint32_t *) bp) \
FLIPPED (Offset + N, bp, ScreenColors); \
} \
break; \
@@ -155,9 +155,9 @@
bp = pCache + 56 - StartLine; \
for (l = LineCount; l != 0; l--, bp -= 8, Offset += GFX.PPL) \
{ \
- if (*(uint32 *) bp) \
+ if (*(uint32_t *) bp) \
NORMAL (Offset, bp, ScreenColors); \
- if (*(uint32 *) (bp + 4)) \
+ if (*(uint32_t *) (bp + 4)) \
NORMAL (Offset + N, bp + 4, ScreenColors); \
} \
break; \
@@ -166,8 +166,8 @@
}
#define TILE_CLIP_PREAMBLE \
- uint32 d1; \
- uint32 d2; \
+ uint32_t d1; \
+ uint32_t d2; \
\
if (StartPixel < 4) \
{ \
@@ -191,7 +191,7 @@
d2 = 0;
#define RENDER_CLIPPED_TILE(NORMAL, FLIPPED, N) \
- uint32 dd; \
+ uint32_t dd; \
switch (Tile & (V_FLIP | H_FLIP)) \
{ \
case 0: \
@@ -202,10 +202,10 @@
* cached in leftmost-endian order (when not horiz flipped) by \
* the ConvertTile function. \
*/ \
- if ((dd = (*(uint32 *) bp) & d1)) \
- NORMAL (Offset, (uint8 *) &dd, ScreenColors); \
- if ((dd = (*(uint32 *) (bp + 4)) & d2)) \
- NORMAL (Offset + N, (uint8 *) &dd, ScreenColors); \
+ if ((dd = (*(uint32_t *) bp) & d1)) \
+ NORMAL (Offset, (uint8_t *) &dd, ScreenColors); \
+ if ((dd = (*(uint32_t *) (bp + 4)) & d2)) \
+ NORMAL (Offset + N, (uint8_t *) &dd, ScreenColors); \
} \
break; \
case H_FLIP: \
@@ -214,10 +214,10 @@
SWAP_DWORD (d2); \
for (l = LineCount; l != 0; l--, bp += 8, Offset += GFX.PPL) \
{ \
- if ((dd = *(uint32 *) (bp + 4) & d1)) \
- FLIPPED (Offset, (uint8 *) &dd, ScreenColors); \
- if ((dd = *(uint32 *) bp & d2)) \
- FLIPPED (Offset + N, (uint8 *) &dd, ScreenColors); \
+ if ((dd = *(uint32_t *) (bp + 4) & d1)) \
+ FLIPPED (Offset, (uint8_t *) &dd, ScreenColors); \
+ if ((dd = *(uint32_t *) bp & d2)) \
+ FLIPPED (Offset + N, (uint8_t *) &dd, ScreenColors); \
} \
break; \
case H_FLIP | V_FLIP: \
@@ -226,20 +226,20 @@
SWAP_DWORD (d2); \
for (l = LineCount; l != 0; l--, bp -= 8, Offset += GFX.PPL) \
{ \
- if ((dd = *(uint32 *) (bp + 4) & d1)) \
- FLIPPED (Offset, (uint8 *) &dd, ScreenColors); \
- if ((dd = *(uint32 *) bp & d2)) \
- FLIPPED (Offset + N, (uint8 *) &dd, ScreenColors); \
+ if ((dd = *(uint32_t *) (bp + 4) & d1)) \
+ FLIPPED (Offset, (uint8_t *) &dd, ScreenColors); \
+ if ((dd = *(uint32_t *) bp & d2)) \
+ FLIPPED (Offset + N, (uint8_t *) &dd, ScreenColors); \
} \
break; \
case V_FLIP: \
bp = pCache + 56 - StartLine; \
for (l = LineCount; l != 0; l--, bp -= 8, Offset += GFX.PPL) \
{ \
- if ((dd = (*(uint32 *) bp) & d1)) \
- NORMAL (Offset, (uint8 *) &dd, ScreenColors); \
- if ((dd = (*(uint32 *) (bp + 4)) & d2)) \
- NORMAL (Offset + N, (uint8 *) &dd, ScreenColors); \
+ if ((dd = (*(uint32_t *) bp) & d1)) \
+ NORMAL (Offset, (uint8_t *) &dd, ScreenColors); \
+ if ((dd = (*(uint32_t *) (bp + 4)) & d2)) \
+ NORMAL (Offset + N, (uint8_t *) &dd, ScreenColors); \
} \
break; \
default: \