summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortwinaphex2016-08-08 04:17:09 +0200
committertwinaphex2016-08-08 04:17:09 +0200
commit4dd0294a7a11d6dd8cb2890df9e66fcc17bc7937 (patch)
treee9892ec1f77697ec1902f7930c7e434d9836aff7 /src
parentc34fcd8d6193fedfa16c3d452c89cbb9a22b158a (diff)
downloadsnes9x2002-4dd0294a7a11d6dd8cb2890df9e66fcc17bc7937.tar.gz
snes9x2002-4dd0294a7a11d6dd8cb2890df9e66fcc17bc7937.tar.bz2
snes9x2002-4dd0294a7a11d6dd8cb2890df9e66fcc17bc7937.zip
Remove ZeroMemory
Diffstat (limited to 'src')
-rw-r--r--src/apu.c6
-rw-r--r--src/cpu.c2
-rw-r--r--src/gfx.c10
-rw-r--r--src/gfx16.c4
-rw-r--r--src/memmap.c14
-rw-r--r--src/port.h1
-rw-r--r--src/ppu.c18
-rw-r--r--src/ppu_.c16
-rw-r--r--src/srtc.c4
9 files changed, 37 insertions, 38 deletions
diff --git a/src/apu.c b/src/apu.c
index aa895e7..fb7f6ed 100644
--- a/src/apu.c
+++ b/src/apu.c
@@ -413,7 +413,7 @@ void S9xResetAPU()
int i, j;
// Settings.APUEnabled = Settings.NextAPUEnabled;
- ZeroMemory(IAPU.RAM, 0x100);
+ memset(IAPU.RAM, 0, 0x100);
memset(IAPU.RAM + 0x20, 0xFF, 0x20);
memset(IAPU.RAM + 0x60, 0xFF, 0x20);
memset(IAPU.RAM + 0xA0, 0xFF, 0x20);
@@ -422,8 +422,8 @@ void S9xResetAPU()
for (i = 1; i < 256; i++)
memcpy(IAPU.RAM + (i << 8), IAPU.RAM, 0x100);
- //ZeroMemory (IAPU.CachedSamples, 0x40000);
- ZeroMemory(APU.OutPorts, 4);
+ //memset (IAPU.CachedSamples, 0, 0x40000);
+ memset(APU.OutPorts, 0, 4);
IAPU.DirectPage = IAPU.RAM;
memmove(&IAPU.RAM [0xffc0], APUROM, sizeof(APUROM));
memmove(APU.ExtraRAM, APUROM, sizeof(APUROM));
diff --git a/src/cpu.c b/src/cpu.c
index c27fd2c..438d9b8 100644
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -131,7 +131,7 @@ void S9xReset(void)
S9xResetSuperFX();
#endif
- ZeroMemory(Memory.FillRAM, 0x8000);
+ memset(Memory.FillRAM, 0, 0x8000);
memset(Memory.VRAM, 0x00, 0x10000);
memset(Memory.RAM, 0x55, 0x20000);
diff --git a/src/gfx.c b/src/gfx.c
index f9d8df5..3df10ca 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -400,8 +400,8 @@ bool8_32 S9xGraphicsInit()
}
}
}
- ZeroMemory(GFX.ZERO, 0x10000 * sizeof(uint16));
- ZeroMemory(GFX.ZERO_OR_X2, 0x10000 * sizeof(uint16));
+ memset(GFX.ZERO, 0, 0x10000 * sizeof(uint16));
+ memset(GFX.ZERO_OR_X2, 0, 0x10000 * sizeof(uint16));
// 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.
@@ -2956,9 +2956,9 @@ void S9xUpdateScreen() // ~30-50ms! (called from FLUSH_REDRAW())
for (uint32 y = starty; y <= endy; y++)
{
- ZeroMemory(GFX.SubZBuffer + y * GFX_ZPITCH,
+ memset(GFX.SubZBuffer + y * GFX_ZPITCH, 0,
IPPU.RenderedScreenWidth);
- ZeroMemory(GFX.ZBuffer + y * GFX_ZPITCH,
+ memset(GFX.ZBuffer + y * GFX_ZPITCH, 0,
IPPU.RenderedScreenWidth);
if (IPPU.Clip [0].Count [5])
@@ -3042,7 +3042,7 @@ void S9xUpdateScreen() // ~30-50ms! (called from FLUSH_REDRAW())
{
for (uint32 y = starty; y <= endy; y++)
{
- ZeroMemory(GFX.ZBuffer + y * GFX_ZPITCH,
+ memset(GFX.ZBuffer + y * GFX_ZPITCH, 0,
IPPU.RenderedScreenWidth);
memset(GFX.SubZBuffer + y * GFX_ZPITCH, 1,
IPPU.RenderedScreenWidth);
diff --git a/src/gfx16.c b/src/gfx16.c
index ee317e8..38da4d7 100644
--- a/src/gfx16.c
+++ b/src/gfx16.c
@@ -405,8 +405,8 @@ bool8_32 S9xGraphicsInit()
}
}
}
- ZeroMemory(GFX.ZERO, 0x10000 * sizeof(uint16));
- ZeroMemory(GFX.ZERO_OR_X2, 0x10000 * sizeof(uint16));
+ memset(GFX.ZERO, 0, 0x10000 * sizeof(uint16));
+ memset(GFX.ZERO_OR_X2, 0, 0x10000 * sizeof(uint16));
// 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.
diff --git a/src/memmap.c b/src/memmap.c
index e65f6fe..47bba48 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -202,9 +202,9 @@ bool8_32 MemoryInit ()
SuperFX.nRomBanks = (2 * 1024 * 1024) / (32 * 1024);
SuperFX.pvRom = (uint8 *) Memory.ROM;
- ZeroMemory (IPPU.TileCached [TILE_2BIT], MAX_2BIT_TILES);
- ZeroMemory (IPPU.TileCached [TILE_4BIT], MAX_4BIT_TILES);
- ZeroMemory (IPPU.TileCached [TILE_8BIT], MAX_8BIT_TILES);
+ memset (IPPU.TileCached [TILE_2BIT], 0, MAX_2BIT_TILES);
+ memset (IPPU.TileCached [TILE_4BIT], 0, MAX_4BIT_TILES);
+ memset (IPPU.TileCached [TILE_8BIT], 0, MAX_8BIT_TILES);
Memory.SDD1Data = NULL;
Memory.SDD1Index = NULL;
@@ -404,7 +404,7 @@ again:
}
Memory.CalculatedSize = (TotalFileSize / 0x2000) * 0x2000;
- ZeroMemory (Memory.ROM + Memory.CalculatedSize, MAX_ROM_SIZE - Memory.CalculatedSize);
+ memset (Memory.ROM + Memory.CalculatedSize, 0, MAX_ROM_SIZE - Memory.CalculatedSize);
// Check for cherryroms.com DAIKAIJYUMONOGATARI2
@@ -501,7 +501,7 @@ again:
}
Memory.LoROM = TRUE;
Memory.HiROM = FALSE;
- ZeroMemory (Memory.ROM + Memory.CalculatedSize, MAX_ROM_SIZE - Memory.CalculatedSize);
+ memset (Memory.ROM + Memory.CalculatedSize, 0, MAX_ROM_SIZE - Memory.CalculatedSize);
}
}
@@ -677,8 +677,8 @@ void InitROM (bool8_32 Interleaved)
Settings.SDD1 = FALSE;
Settings.SRTC = FALSE;
- ZeroMemory (Memory.BlockIsRAM, MEMMAP_NUM_BLOCKS);
- ZeroMemory (Memory.BlockIsROM, MEMMAP_NUM_BLOCKS);
+ memset (Memory.BlockIsRAM, 0, MEMMAP_NUM_BLOCKS);
+ memset (Memory.BlockIsROM, 0, MEMMAP_NUM_BLOCKS);
SRAM = Memory.SRAM;
memset (Memory.ROMId, 0, 5);
diff --git a/src/port.h b/src/port.h
index 24cc7a0..43dd864 100644
--- a/src/port.h
+++ b/src/port.h
@@ -114,7 +114,6 @@ typedef short int16_32;
#define FASTCALL
#define PIXEL_FORMAT RGB565
#define CPU_SHUTDOWN
-#define ZeroMemory(a,b) memset((a),0,(b))
#define PACKING __attribute__ ((packed))
#define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))
#undef FAST_LSB_WORD_ACCESS
diff --git a/src/ppu.c b/src/ppu.c
index daa8a5b..79d891c 100644
--- a/src/ppu.c
+++ b/src/ppu.c
@@ -1059,7 +1059,7 @@ void S9xResetPPU()
PPU.OBJAddition = FALSE;
PPU.OAMReadFlip = 0;
PPU.BGnxOFSbyte = 0;
- ZeroMemory(PPU.OAMData, 512 + 32);
+ memset(PPU.OAMData, 0, 512 + 32);
PPU.VTimerEnabled = FALSE;
PPU.HTimerEnabled = FALSE;
@@ -1092,9 +1092,9 @@ void S9xResetPPU()
IPPU.DisplayedRenderedFrameCount = 0;
IPPU.SkippedFrames = 0;
IPPU.FrameSkip = 0;
- ZeroMemory(IPPU.TileCached[TILE_2BIT], MAX_2BIT_TILES);
- ZeroMemory(IPPU.TileCached[TILE_4BIT], MAX_4BIT_TILES);
- ZeroMemory(IPPU.TileCached[TILE_8BIT], MAX_8BIT_TILES);
+ memset(IPPU.TileCached[TILE_2BIT], 0, MAX_2BIT_TILES);
+ memset(IPPU.TileCached[TILE_4BIT], 0, MAX_4BIT_TILES);
+ memset(IPPU.TileCached[TILE_8BIT], 0, MAX_8BIT_TILES);
IPPU.FirstVRAMRead = FALSE;
IPPU.LatchedInterlace = FALSE;
IPPU.DoubleWidthPixels = FALSE;
@@ -1129,11 +1129,11 @@ void S9xResetPPU()
for (c = 0; c < 0x8000; c += 0x100)
memset(& Memory.FillRAM[c], c >> 8, 0x100);
- ZeroMemory(& Memory.FillRAM[0x2100], 0x100);
- ZeroMemory(& Memory.FillRAM[0x4200], 0x100);
- ZeroMemory(& Memory.FillRAM[0x4000], 0x100);
+ memset(& Memory.FillRAM[0x2100], 0, 0x100);
+ memset(& Memory.FillRAM[0x4200], 0, 0x100);
+ memset(& Memory.FillRAM[0x4000], 0, 0x100);
// For BS Suttehakkun 2...
- ZeroMemory(& Memory.FillRAM[0x1000], 0x1000);
+ memset(& Memory.FillRAM[0x1000], 0, 0x1000);
Memory.FillRAM[0x4201] = Memory.FillRAM[0x4213] = 0xFF;
PPU.BG[0].OffsetsChanged = 0;
@@ -1141,7 +1141,7 @@ void S9xResetPPU()
PPU.BG[2].OffsetsChanged = 0;
PPU.BG[3].OffsetsChanged = 0;
ROpCount = 0;
- ZeroMemory(&rops, MAX_ROPS);
+ memset(&rops, 0, MAX_ROPS);
GFX.r212c_s = 0;
GFX.r212d_s = 0;
GFX.r212e_s = 0;
diff --git a/src/ppu_.c b/src/ppu_.c
index 8fcfc4c..fea833a 100644
--- a/src/ppu_.c
+++ b/src/ppu_.c
@@ -2237,7 +2237,7 @@ void S9xResetPPU()
PPU.OBJNameBase = 0;
PPU.OBJAddition = FALSE;
PPU.OAMReadFlip = 0;
- ZeroMemory(PPU.OAMData, 512 + 32);
+ memset(PPU.OAMData, 0, 512 + 32);
PPU.VTimerEnabled = FALSE;
PPU.HTimerEnabled = FALSE;
@@ -2270,9 +2270,9 @@ void S9xResetPPU()
IPPU.DisplayedRenderedFrameCount = 0;
IPPU.SkippedFrames = 0;
IPPU.FrameSkip = 0;
- ZeroMemory(IPPU.TileCached [TILE_2BIT], MAX_2BIT_TILES);
- ZeroMemory(IPPU.TileCached [TILE_4BIT], MAX_4BIT_TILES);
- ZeroMemory(IPPU.TileCached [TILE_8BIT], MAX_8BIT_TILES);
+ memset(IPPU.TileCached [TILE_2BIT], 0, MAX_2BIT_TILES);
+ memset(IPPU.TileCached [TILE_4BIT], 0, MAX_4BIT_TILES);
+ memset(IPPU.TileCached [TILE_8BIT], 0, MAX_8BIT_TILES);
IPPU.FirstVRAMRead = FALSE;
IPPU.LatchedInterlace = FALSE;
IPPU.DoubleWidthPixels = FALSE;
@@ -2307,11 +2307,11 @@ void S9xResetPPU()
for (c = 0; c < 0x8000; c += 0x100)
memset(&Memory.FillRAM [c], c >> 8, 0x100);
- ZeroMemory(&Memory.FillRAM [0x2100], 0x100);
- ZeroMemory(&Memory.FillRAM [0x4200], 0x100);
- ZeroMemory(&Memory.FillRAM [0x4000], 0x100);
+ memset(&Memory.FillRAM [0x2100], 0, 0x100);
+ memset(&Memory.FillRAM [0x4200], 0, 0x100);
+ memset(&Memory.FillRAM [0x4000], 0, 0x100);
// For BS Suttehakkun 2...
- ZeroMemory(&Memory.FillRAM [0x1000], 0x1000);
+ memset(&Memory.FillRAM [0x1000], 0, 0x1000);
}
void S9xProcessMouse(int which1)
diff --git a/src/srtc.c b/src/srtc.c
index 136599b..05aa6c9 100644
--- a/src/srtc.c
+++ b/src/srtc.c
@@ -101,7 +101,7 @@ void S9xResetSRTC()
void S9xHardResetSRTC()
{
- ZeroMemory(&rtc, sizeof(rtc));
+ memset(&rtc, 0, sizeof(rtc));
rtc.index = -1;
rtc.mode = MODE_READ;
rtc.count_enable = FALSE;
@@ -388,7 +388,7 @@ void S9xSetSRTC(uint8 data, uint16 Address)
// Disable RTC counter
rtc.count_enable = FALSE;
- ZeroMemory(rtc.data, MAX_RTC_INDEX + 1);
+ memset(rtc.data, 0, MAX_RTC_INDEX + 1);
rtc.index = -1;
rtc.mode = MODE_COMMAND_DONE;
break;