aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile61
-rw-r--r--Makefile.common30
-rw-r--r--libretro-common/include/retro_inline.h39
-rw-r--r--source/apu.h6
-rw-r--r--source/c4.c22
-rw-r--r--source/c4emu.c85
-rw-r--r--source/cheats.c19
-rw-r--r--source/cheats2.c28
-rw-r--r--source/cpuaddr.h46
-rw-r--r--source/cpuexec.c6
-rw-r--r--source/cpuexec.h15
-rw-r--r--source/cpumacro.h206
-rw-r--r--source/cpuops.c19
-rw-r--r--source/dma.c50
-rw-r--r--source/dsp1.c11
-rw-r--r--source/dsp1emu.c8
-rw-r--r--source/dsp4emu.c61
-rw-r--r--source/fxemu.c3
-rw-r--r--source/fxinst.c1198
-rw-r--r--source/gfx.c502
-rw-r--r--source/gfx.h4
-rw-r--r--source/port.h17
-rw-r--r--source/ppu.h56
-rw-r--r--source/sa1.h13
-rw-r--r--source/sar.h9
25 files changed, 1384 insertions, 1130 deletions
diff --git a/Makefile b/Makefile
index d53269e..0d7bd9a 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,27 @@ else ifeq ($(platform), gcw0)
LIBM :=
LOAD_FROM_MEMORY_TEST = 0
CFLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
+
+# Windows MSVC 2010 x86
+else ifeq ($(platform), windows_msvc2010_x86)
+ CC = cl.exe
+ CXX = cl.exe
+
+PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
+PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
+INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
+LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/lib")
+BIN := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin")
+
+WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
+WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
+
+export INCLUDE := $(INCLUDE)
+export LIB := $(LIB);$(WindowsSdkDir)
+TARGET := $(TARGET_NAME)_libretro.dll
+PSS_STYLE :=2
+LDFLAGS += -DLL
+OLD_GCC = 1
else
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
@@ -220,6 +241,32 @@ LIBRETRO_DIR := .
include Makefile.common
+ifeq ($(OLD_GCC), 1)
+ WARNINGS := -Wall
+else ifeq ($(NO_GCC), 1)
+ WARNINGS :=
+else
+ WARNINGS := \
+ -Wall \
+ -Wno-sign-compare \
+ -Wno-unused-variable \
+ -Wno-unused-function \
+ -Wno-uninitialized \
+ -Wno-strict-aliasing \
+ -Wno-overflow \
+ -fno-strict-overflow
+endif
+
+ifeq ($(DEBUG),1)
+ FLAGS += -O0 -g
+else
+ FLAGS += -O2 -DNDEBUG
+endif
+
+ifeq ($(PERF_TEST),1)
+ FLAGS += -DPERF_TEST
+endif
+
ifeq ($(platform), psp1)
INCFLAGS += -I$(shell psp-config --pspsdk-path)/include
endif
@@ -233,6 +280,16 @@ FLAGS += $(fpic)
CXXFLAGS += $(FLAGS)
CFLAGS += $(FLAGS)
+ifneq (,$(findstring msvc,$(platform)))
+ OBJOUT = -Fo
+ LINKOUT = -out:
+ LD = link.exe
+else
+ OBJOUT = -o
+ LINKOUT = -o
+ LD = $(CC)
+endif
+
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(COMMON_FLAGS) $(CFLAGS)
@@ -248,10 +305,10 @@ else
endif
%.o: %.cpp
- $(CXX) -c -o $@ $< $(CXXFLAGS)
+ $(CXX) -c $(OBJOUT)$@ $< $(CXXFLAGS)
%.o: %.c
- $(CC) -c -o $@ $< $(CFLAGS)
+ $(CC) -c $(OBJOUT)$@ $< $(CFLAGS)
clean:
rm -f $(TARGET) $(OBJECTS)
diff --git a/Makefile.common b/Makefile.common
index 83a0fdc..e62fabb 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,4 +1,6 @@
-INCFLAGS := -I$(CORE_DIR) -I$(LIBRETRO_DIR)
+LIBRETRO_COMM_DIR := $(LIBRETRO_DIR)/libretro-common
+
+INCFLAGS := -I$(CORE_DIR) -I$(LIBRETRO_DIR) -I$(LIBRETRO_COMM_DIR)/include
ifeq ($(HAVE_GRIFFIN), 1)
SOURCES_C := $(CORE_DIR)/catsfc_griffin.c
@@ -44,16 +46,6 @@ SOURCES_C := \
$(LIBRETRO_DIR)/libretro.c
endif
-ifeq ($(DEBUG),1)
- FLAGS += -O0 -g
-else
- FLAGS += -O3 -DNDEBUG
-endif
-
-ifeq ($(PERF_TEST),1)
- FLAGS += -DPERF_TEST
-endif
-
ifeq ($(USE_BLARGG_APU),1)
FLAGS += -DUSE_BLARGG_APU
endif
@@ -62,20 +54,4 @@ ifeq ($(LOAD_FROM_MEMORY_TEST),1)
FLAGS += -DLOAD_FROM_MEMORY_TEST
endif
-ifeq ($(OLD_GCC), 1)
- WARNINGS := -Wall
-else ifeq ($(NO_GCC), 1)
- WARNINGS :=
-else
- WARNINGS := \
- -Wall \
- -Wno-sign-compare \
- -Wno-unused-variable \
- -Wno-unused-function \
- -Wno-uninitialized \
- -Wno-strict-aliasing \
- -Wno-overflow \
- -fno-strict-overflow
-endif
-
FLAGS += $(DEFS) $(WARNINGS) $(INCFLAGS)
diff --git a/libretro-common/include/retro_inline.h b/libretro-common/include/retro_inline.h
new file mode 100644
index 0000000..ffdaa4a
--- /dev/null
+++ b/libretro-common/include/retro_inline.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2010-2017 The RetroArch team
+ *
+ * ---------------------------------------------------------------------------------------
+ * The following license statement only applies to this file (retro_inline.h).
+ * ---------------------------------------------------------------------------------------
+ *
+ * Permission is hereby granted, free of charge,
+ * to any person obtaining a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __LIBRETRO_SDK_INLINE_H
+#define __LIBRETRO_SDK_INLINE_H
+
+#ifndef INLINE
+
+#if defined(_WIN32) || defined(__INTEL_COMPILER)
+#define INLINE __inline
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
+#define INLINE inline
+#elif defined(__GNUC__)
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+
+#endif
+#endif
diff --git a/source/apu.h b/source/apu.h
index 3e034c1..8944377 100644
--- a/source/apu.h
+++ b/source/apu.h
@@ -8,6 +8,8 @@
#include "port.h"
#include "spc700.h"
+#include <retro_inline.h>
+
typedef struct
{
uint8_t* PC;
@@ -47,14 +49,14 @@ typedef struct
SAPU APU;
SIAPU IAPU;
-static inline void S9xAPUUnpackStatus(void)
+static INLINE void S9xAPUUnpackStatus(void)
{
IAPU._Zero = ((IAPU.Registers.P & Zero) == 0) | (IAPU.Registers.P & Negative);
IAPU._Carry = (IAPU.Registers.P & Carry);
IAPU._Overflow = IAPU.Registers.P & Overflow;
}
-static inline void S9xAPUPackStatus(void)
+static INLINE void S9xAPUPackStatus(void)
{
IAPU.Registers.P &= ~(Zero | Negative | Carry | Overflow);
if (IAPU._Carry)
diff --git a/source/c4.c b/source/c4.c
index 251493c..04e4d21 100644
--- a/source/c4.c
+++ b/source/c4.c
@@ -55,14 +55,19 @@ const int16_t C4MulTable[256] =
int16_t C4_Sin(int16_t Angle)
{
+ int32_t S;
+ int16_t AngleS7;
+
if (Angle < 0)
{
if (Angle == -32768)
return 0;
return -C4_Sin(-Angle);
}
- int16_t AngleS7 = Angle >> 7;
- int32_t S = C4SinTable[AngleS7] + (C4MulTable[Angle & 0xff] * C4SinTable[0x80 + AngleS7] >> 15);
+
+ AngleS7 = Angle >> 7;
+ S = C4SinTable[AngleS7] + (C4MulTable[Angle & 0xff] * C4SinTable[0x80 + AngleS7] >> 15);
+
if (S > 32767)
S = 32767;
return (int16_t) S;
@@ -70,14 +75,17 @@ int16_t C4_Sin(int16_t Angle)
int16_t C4_Cos(int16_t Angle)
{
+ int32_t S;
+ int16_t AngleS7;
+
if (Angle < 0)
{
if (Angle == -32768)
return -32768;
Angle = -Angle;
}
- int16_t AngleS7 = Angle >> 7;
- int32_t S = C4SinTable[0x80 + AngleS7] - (C4MulTable[Angle & 0xff] * C4SinTable[AngleS7] >> 15);
+ AngleS7 = Angle >> 7;
+ S = C4SinTable[0x80 + AngleS7] - (C4MulTable[Angle & 0xff] * C4SinTable[AngleS7] >> 15);
if (S < -32768)
S = -32767;
return (int16_t) S;
@@ -104,11 +112,13 @@ const int16_t atantbl[256] = {
int16_t _atan2(int16_t x, int16_t y)
{
+ int32_t absAtan;
+ int32_t x1, y1;
if (x == 0)
return 0;
- int32_t x1 = ABS(x), y1 = ABS(y);
- int32_t absAtan;
+ x1 = ABS(x);
+ y1 = ABS(y);
if (x1 > y1)
absAtan = atantbl[(uint8_t)((y1 << 8) / x1)];
diff --git a/source/c4emu.c b/source/c4emu.c
index 9736e3b..7805dc5 100644
--- a/source/c4emu.c
+++ b/source/c4emu.c
@@ -36,16 +36,15 @@ static uint8_t C4TestPattern [12 * 4] =
static void C4ConvOAM()
{
- uint8_t* i;
- uint8_t* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
- for (i = Memory.C4RAM + 0x1fd; i > OAMptr; i -= 4)
- *i = 0xe0; // Clear OAM-to-be
-
uint16_t globalX, globalY;
uint8_t* OAMptr2;
int16_t SprX, SprY;
uint8_t SprName, SprAttr;
uint8_t SprCount;
+ uint8_t* i;
+ uint8_t* OAMptr = Memory.C4RAM + (Memory.C4RAM[0x626] << 2);
+ for (i = Memory.C4RAM + 0x1fd; i > OAMptr; i -= 4)
+ *i = 0xe0; // Clear OAM-to-be
globalX = READ_WORD(Memory.C4RAM + 0x0621);
globalY = READ_WORD(Memory.C4RAM + 0x0623);
@@ -53,14 +52,16 @@ static void C4ConvOAM()
if (Memory.C4RAM[0x0620] != 0)
{
+ uint8_t offset;
int32_t prio, i;
SprCount = 128 - Memory.C4RAM[0x626];
- uint8_t offset = (Memory.C4RAM[0x626] & 3) * 2;
+ offset = (Memory.C4RAM[0x626] & 3) * 2;
for (prio = 0x30; prio >= 0; prio -= 0x10)
{
uint8_t* srcptr = Memory.C4RAM + 0x220;
for (i = Memory.C4RAM[0x0620]; i > 0 && SprCount > 0; i--, srcptr += 16)
{
+ uint8_t *sprptr;
if ((srcptr[4] & 0x30) != prio)
continue;
SprX = READ_WORD(srcptr) - globalX;
@@ -68,7 +69,7 @@ static void C4ConvOAM()
SprName = srcptr[5];
SprAttr = srcptr[4] | srcptr[0x06]; // XXX: mask bits?
- uint8_t* sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
+ sprptr = S9xGetMemPointer(READ_3WORD(srcptr + 7));
if (*sprptr != 0)
{
int32_t SprCnt;
@@ -130,12 +131,21 @@ static void C4ConvOAM()
static void C4DoScaleRotate(int32_t row_padding)
{
int16_t A, B, C, D;
+ int32_t YScale;
+ uint8_t w, h;
+ int32_t Cx, Cy;
+ int32_t LineX, LineY;
+ uint32_t X, Y;
+ uint8_t byte;
+ int32_t outidx = 0;
+ int32_t x, y;
+ uint8_t bit = 0x80;
// Calculate matrix
int32_t XScale = READ_WORD(Memory.C4RAM + 0x1f8f);
if (XScale & 0x8000)
XScale = 0x7fff;
- int32_t YScale = READ_WORD(Memory.C4RAM + 0x1f92);
+ YScale = READ_WORD(Memory.C4RAM + 0x1f92);
if (YScale & 0x8000)
YScale = 0x7fff;
@@ -182,28 +192,23 @@ static void C4DoScaleRotate(int32_t row_padding)
}
// Calculate Pixel Resolution
- uint8_t w = Memory.C4RAM[0x1f89] & ~7;
- uint8_t h = Memory.C4RAM[0x1f8c] & ~7;
+ w = Memory.C4RAM[0x1f89] & ~7;
+ h = Memory.C4RAM[0x1f8c] & ~7;
// Clear the output RAM
memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2);
- int32_t Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
- int32_t Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
+ Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
+ Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
// Calculate start position (i.e. (Ox, Oy) = (0, 0))
// The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in
// the function. We do Cx*A etc normally because the matrix parameters
// already have the fractional parts.
- int32_t LineX = (Cx << 12) - Cx * A - Cx * B;
- int32_t LineY = (Cy << 12) - Cy * C - Cy * D;
+ LineX = (Cx << 12) - Cx * A - Cx * B;
+ LineY = (Cy << 12) - Cy * C - Cy * D;
// Start loop
- uint32_t X, Y;
- uint8_t byte;
- int32_t outidx = 0;
- int32_t x, y;
- uint8_t bit = 0x80;
for (y = 0; y < h; y++)
{
X = LineX;
@@ -252,6 +257,8 @@ static void C4DoScaleRotate(int32_t row_padding)
static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, int32_t X2, int32_t Y2, int16_t Z2, uint8_t Color)
{
+ int32_t i;
+
// Transform coordinates
C4WFXVal = (int16_t)X1;
C4WFYVal = (int16_t)Y1;
@@ -281,7 +288,6 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, int32_t X2, int32_t Y
Y2 = (int16_t)C4WFYVal;
// render line
- int32_t i;
for (i = C4WFDist ? C4WFDist : 1; i > 0; i--)
{
//.loop
@@ -336,15 +342,17 @@ static void C4DrawWireFrame()
static void C4TransformLines()
{
+ int32_t i;
+ uint8_t *ptr;
+ uint8_t* ptr2;
+
C4WFX2Val = Memory.C4RAM[0x1f83];
C4WFY2Val = Memory.C4RAM[0x1f86];
C4WFDist = Memory.C4RAM[0x1f89];
C4WFScale = Memory.C4RAM[0x1f8c];
- int32_t i;
-
// transform vertices
- uint8_t* ptr = Memory.C4RAM;
+ ptr = Memory.C4RAM;
{
for (i = READ_WORD(Memory.C4RAM + 0x1f80); i > 0; i--, ptr += 0x10)
{
@@ -365,8 +373,8 @@ static void C4TransformLines()
WRITE_WORD(Memory.C4RAM + 0x602 + 8, 0x60);
WRITE_WORD(Memory.C4RAM + 0x605 + 8, 0x40);
- ptr = Memory.C4RAM + 0xb02;
- uint8_t* ptr2 = Memory.C4RAM;
+ ptr = Memory.C4RAM + 0xb02;
+ ptr2 = Memory.C4RAM;
for (i = READ_WORD(Memory.C4RAM + 0xb00); i > 0; i--, ptr += 2, ptr2 += 8)
{
@@ -450,25 +458,18 @@ static void C4BitPlaneWave()
static void C4SprDisintegrate()
{
- 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_t)READ_WORD(Memory.C4RAM + 0x1f80);
- Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
-
- 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;
+ uint32_t x, y, i, j;
+ uint8_t width = Memory.C4RAM[0x1f89];
+ uint8_t height = Memory.C4RAM[0x1f8c];
+ int32_t Cx = (int16_t)READ_WORD(Memory.C4RAM + 0x1f80);
+ int32_t Cy = (int16_t)READ_WORD(Memory.C4RAM + 0x1f83);
+ int32_t scaleX = (int16_t)READ_WORD(Memory.C4RAM + 0x1f86);
+ int32_t scaleY = (int16_t)READ_WORD(Memory.C4RAM + 0x1f8f);
+ uint32_t StartX = -Cx * scaleX + (Cx << 8);
+ uint32_t StartY = -Cy * scaleY + (Cy << 8);
+ uint8_t *src = Memory.C4RAM + 0x600;
memset(Memory.C4RAM, 0, width * height / 2);
- 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)
diff --git a/source/cheats.c b/source/cheats.c
index 2b03078..1a5e833 100644
--- a/source/cheats.c
+++ b/source/cheats.c
@@ -33,6 +33,7 @@ const char* S9xProActionReplayToRaw(const char* code, uint32_t* address, uint8_t
const char* S9xGoldFingerToRaw(const char* code, uint32_t* address, bool* sram, uint8_t* num_bytes, uint8_t bytes[3])
{
+ int32_t i;
char tmp [15];
if (strlen(code) != 14)
return "Invalid Gold Finger code should be 14 hex digits in length.";
@@ -42,12 +43,11 @@ const char* S9xGoldFingerToRaw(const char* code, uint32_t* address, bool* sram,
if (sscanf(tmp, "%x", address) != 1)
return "Invalid Gold Finger code.";
- int32_t i;
for (i = 0; i < 3; i++)
{
+ int32_t byte;
strncpy(tmp, code + 5 + i * 2, 2);
tmp [2] = 0;
- int32_t byte;
if (sscanf(tmp, "%x", &byte) != 1)
break;
bytes [i] = (uint8_t) byte;
@@ -60,6 +60,10 @@ const char* S9xGoldFingerToRaw(const char* code, uint32_t* address, bool* sram,
const char* S9xGameGenieToRaw(const char* code, uint32_t* address, uint8_t* byte)
{
char new_code [12];
+ static char* real_hex = "0123456789ABCDEF";
+ static char* genie_hex = "DF4709156BC8A23E";
+ uint32_t data = 0;
+ int32_t i;
if (strlen(code) != 9 || *(code + 4) != '-' || !S9xAllHex(code, 4) || !S9xAllHex(code + 5, 4))
return "Invalid Game Genie(tm) code - should be 'xxxx-xxxx'.";
@@ -68,15 +72,11 @@ const char* S9xGameGenieToRaw(const char* code, uint32_t* address, uint8_t* byte
strncpy(new_code + 2, code, 4);
strcpy(new_code + 6, code + 5);
- static char* real_hex = "0123456789ABCDEF";
- static char* genie_hex = "DF4709156BC8A23E";
-
- int32_t i;
for (i = 2; i < 10; i++)
{
+ int32_t j;
if (islower(new_code [i]))
new_code [i] = toupper(new_code [i]);
- int32_t j;
for (j = 0; j < 16; j++)
{
if (new_code [i] == genie_hex [j])
@@ -88,7 +88,6 @@ const char* S9xGameGenieToRaw(const char* code, uint32_t* address, uint8_t* byte
if (j == 16)
return "Invalid hex-character in Game Genie(tm) code";
}
- uint32_t data = 0;
sscanf(new_code, "%x", &data);
*byte = (uint8_t)(data >> 24);
*address = ((data & 0x003c00) << 10) +
@@ -148,6 +147,7 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp,
S9xCheatDataSize size, bool is_signed, bool update)
{
int32_t l;
+ int32_t i;
switch (size)
{
@@ -166,7 +166,6 @@ void S9xSearchForChange(SCheatData* d, S9xCheatComparisonType cmp,
break;
}
- int32_t i;
if (is_signed)
{
for (i = 0; i < 0x20000 - l; i++)
@@ -250,6 +249,7 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
bool is_signed, bool update)
{
int32_t l;
+ int32_t i;
switch (size)
{
@@ -268,7 +268,6 @@ void S9xSearchForValue(SCheatData* d, S9xCheatComparisonType cmp,
break;
}
- int32_t i;
if (is_signed)
{
diff --git a/source/cheats2.c b/source/cheats2.c
index 977daf6..3d6519e 100644
--- a/source/cheats2.c
+++ b/source/cheats2.c
@@ -9,7 +9,7 @@
extern SCheatData Cheat;
-void S9xInitCheatData()
+void S9xInitCheatData(void)
{
Cheat.RAM = Memory.RAM;
Cheat.SRAM = Memory.SRAM;
@@ -47,7 +47,7 @@ void S9xDeleteCheat(uint32_t which1)
}
}
-void S9xDeleteCheats()
+void S9xDeleteCheats(void)
{
S9xRemoveCheats();
Cheat.num_cheats = 0;
@@ -91,13 +91,15 @@ void S9xRemoveCheat(uint32_t which1)
void S9xApplyCheat(uint32_t which1)
{
+ int32_t block;
+ uint8_t *ptr;
uint32_t address = Cheat.c [which1].address;
if (!Cheat.c [which1].saved)
Cheat.c [which1].saved_byte = S9xGetByte(address);
- int32_t block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
- uint8_t* ptr = Memory.Map [block];
+ block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
+ ptr = Memory.Map [block];
if (ptr >= (uint8_t*) MAP_LAST)
*(ptr + (address & 0xffff)) = Cheat.c [which1].byte;
@@ -106,7 +108,7 @@ void S9xApplyCheat(uint32_t which1)
Cheat.c [which1].saved = true;
}
-void S9xApplyCheats()
+void S9xApplyCheats(void)
{
uint32_t i;
if (Settings.ApplyCheats)
@@ -117,7 +119,7 @@ void S9xApplyCheats()
}
}
-void S9xRemoveCheats()
+void S9xRemoveCheats(void)
{
uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
@@ -127,10 +129,12 @@ void S9xRemoveCheats()
bool S9xLoadCheatFile(const char* filename)
{
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
+ FILE* fs = NULL;
+
Cheat.num_cheats = 0;
- FILE* fs = fopen(filename, "rb");
- uint8_t data [8 + MAX_SFCCHEAT_NAME];
+ fs = fopen(filename, "rb");
if (!fs)
return (false);
@@ -159,19 +163,21 @@ bool S9xLoadCheatFile(const char* filename)
bool S9xSaveCheatFile(const char* filename)
{
+ uint32_t i;
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
+ FILE* fs = NULL;
+
if (Cheat.num_cheats == 0)
{
(void) remove(filename);
return (true);
}
- FILE* fs = fopen(filename, "wb");
- uint8_t data [8 + MAX_SFCCHEAT_NAME];
+ fs = fopen(filename, "wb");
if (!fs)
return (false);
- uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
{
memset(data, 0, 8 + MAX_SFCCHEAT_NAME);
diff --git a/source/cpuaddr.h b/source/cpuaddr.h
index 94cb6f0..4c0fb84 100644
--- a/source/cpuaddr.h
+++ b/source/cpuaddr.h
@@ -3,21 +3,23 @@
#ifndef _CPUADDR_H_
#define _CPUADDR_H_
+#include <retro_inline.h>
+
extern int32_t OpAddress;
-static inline void Immediate8()
+static INLINE void Immediate8(void)
{
OpAddress = ICPU.ShiftedPB + CPU.PC - CPU.PCBase;
CPU.PC++;
}
-static inline void Immediate16()
+static INLINE void Immediate16()
{
OpAddress = ICPU.ShiftedPB + CPU.PC - CPU.PCBase;
CPU.PC += 2;
}
-static inline void Relative()
+static INLINE void Relative()
{
int8_t Int8 = *CPU.PC++;
#ifndef SA1_OPCODES
@@ -26,7 +28,7 @@ static inline void Relative()
OpAddress = ((int32_t)(CPU.PC - CPU.PCBase) + Int8) & 0xffff;
}
-static inline void RelativeLong()
+static INLINE void RelativeLong()
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = *(uint16_t*) CPU.PC;
@@ -41,7 +43,7 @@ static inline void RelativeLong()
OpAddress &= 0xffff;
}
-static inline void AbsoluteIndexedIndirect(bool read)
+static INLINE void AbsoluteIndexedIndirect(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = (ICPU.Registers.X.W + * (uint16_t*) CPU.PC) & 0xffff;
@@ -58,7 +60,7 @@ static inline void AbsoluteIndexedIndirect(bool read)
OpenBus = (uint8_t)(OpAddress >> 8);
}
-static inline void AbsoluteIndirectLong(bool read)
+static INLINE void AbsoluteIndirectLong(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = *(uint16_t*) CPU.PC;
@@ -76,7 +78,7 @@ static inline void AbsoluteIndirectLong(bool read)
OpAddress = S9xGetWord(OpAddress) | (S9xGetByte(OpAddress + 2) << 16);
}
-static inline void AbsoluteIndirect(bool read)
+static INLINE void AbsoluteIndirect(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = *(uint16_t*) CPU.PC;
@@ -94,7 +96,7 @@ static inline void AbsoluteIndirect(bool read)
OpAddress += ICPU.ShiftedPB;
}
-static inline void Absolute(bool read)
+static INLINE void Absolute(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = *(uint16_t*) CPU.PC + ICPU.ShiftedDB;
@@ -109,7 +111,7 @@ static inline void Absolute(bool read)
#endif
}
-static inline void AbsoluteLong(bool read)
+static INLINE void AbsoluteLong(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = (*(uint32_t*) CPU.PC) & 0xffffff;
@@ -129,7 +131,7 @@ static inline void AbsoluteLong(bool read)
#endif
}
-static inline void Direct(bool read)
+static INLINE void Direct(bool read)
{
if (read)
OpenBus = *CPU.PC;
@@ -139,7 +141,7 @@ static inline void Direct(bool read)
#endif
}
-static inline void DirectIndirectIndexed(bool read)
+static INLINE void DirectIndirectIndexed(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
@@ -155,7 +157,7 @@ static inline void DirectIndirectIndexed(bool read)
// XXX: else Add one cycle if crosses page boundary
}
-static inline void DirectIndirectIndexedLong(bool read)
+static INLINE void DirectIndirectIndexedLong(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
@@ -168,7 +170,7 @@ static inline void DirectIndirectIndexedLong(bool read)
OpAddress = S9xGetWord(OpAddress) + (S9xGetByte(OpAddress + 2) << 16) + ICPU.Registers.Y.W;
}
-static inline void DirectIndexedIndirect(bool read)
+static INLINE void DirectIndexedIndirect(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.D.W + ICPU.Registers.X.W) & 0xffff;
@@ -184,7 +186,7 @@ static inline void DirectIndexedIndirect(bool read)
#endif
}
-static inline void DirectIndexedX(bool read)
+static INLINE void DirectIndexedX(bool read)
{
if (read)
OpenBus = *CPU.PC;
@@ -195,7 +197,7 @@ static inline void DirectIndexedX(bool read)
#endif
}
-static inline void DirectIndexedY(bool read)
+static INLINE void DirectIndexedY(bool read)
{
if (read)
OpenBus = *CPU.PC;
@@ -206,7 +208,7 @@ static inline void DirectIndexedY(bool read)
#endif
}
-static inline void AbsoluteIndexedX(bool read)
+static INLINE void AbsoluteIndexedX(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = ICPU.ShiftedDB + *(uint16_t*) CPU.PC + ICPU.Registers.X.W;
@@ -223,7 +225,7 @@ static inline void AbsoluteIndexedX(bool read)
// XXX: else is cross page boundary add one cycle
}
-static inline void AbsoluteIndexedY(bool read)
+static INLINE void AbsoluteIndexedY(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = ICPU.ShiftedDB + *(uint16_t*) CPU.PC + ICPU.Registers.Y.W;
@@ -240,7 +242,7 @@ static inline void AbsoluteIndexedY(bool read)
// XXX: else is cross page boundary add one cycle
}
-static inline void AbsoluteLongIndexedX(bool read)
+static INLINE void AbsoluteLongIndexedX(bool read)
{
#ifdef FAST_LSB_WORD_ACCESS
OpAddress = (*(uint32_t*) CPU.PC + ICPU.Registers.X.W) & 0xffffff;
@@ -260,7 +262,7 @@ static inline void AbsoluteLongIndexedX(bool read)
#endif
}
-static inline void DirectIndirect(bool read)
+static INLINE void DirectIndirect(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
@@ -273,7 +275,7 @@ static inline void DirectIndirect(bool read)
OpAddress += ICPU.ShiftedDB;
}
-static inline void DirectIndirectLong(bool read)
+static INLINE void DirectIndirectLong(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
@@ -286,7 +288,7 @@ static inline void DirectIndirectLong(bool read)
OpAddress = S9xGetWord(OpAddress) + (S9xGetByte(OpAddress + 2) << 16);
}
-static inline void StackRelative(bool read)
+static INLINE void StackRelative(bool read)
{
if (read)
OpenBus = *CPU.PC;
@@ -296,7 +298,7 @@ static inline void StackRelative(bool read)
#endif
}
-static inline void StackRelativeIndirectIndexed(bool read)
+static INLINE void StackRelativeIndirectIndexed(bool read)
{
OpenBus = *CPU.PC;
OpAddress = (*CPU.PC++ + ICPU.Registers.S.W) & 0xffff;
diff --git a/source/cpuexec.c b/source/cpuexec.c
index 98e321f..ef96339 100644
--- a/source/cpuexec.c
+++ b/source/cpuexec.c
@@ -366,9 +366,10 @@ void S9xDoHBlankProcessing_SFX()
if (!PPU.ForcedBlanking)
{
+ uint8_t tmp = 0;
+
PPU.OAMAddr = PPU.SavedOAMAddr;
- uint8_t tmp = 0;
if (PPU.OAMPriorityRotation)
tmp = (PPU.OAMAddr & 0xFE) >> 1;
if ((PPU.OAMFlip & 1) || PPU.FirstSprite != tmp)
@@ -499,9 +500,10 @@ void S9xDoHBlankProcessing_NoSFX()
if (!PPU.ForcedBlanking)
{
+ uint8_t tmp = 0;
+
PPU.OAMAddr = PPU.SavedOAMAddr;
- uint8_t tmp = 0;
if (PPU.OAMPriorityRotation)
tmp = (PPU.OAMAddr & 0xFE) >> 1;
if ((PPU.OAMFlip & 1) || PPU.FirstSprite != tmp)
diff --git a/source/cpuexec.h b/source/cpuexec.h
index 7d4008c..9654d86 100644
--- a/source/cpuexec.h
+++ b/source/cpuexec.h
@@ -6,15 +6,16 @@
typedef struct
{
#ifdef __WIN32__
- void (__cdecl* S9xOpcode)();
+ void (__cdecl* S9xOpcode)(void);
#else
- void (*S9xOpcode)();
+ void (*S9xOpcode)(void);
#endif
} SOpcodes;
#include "ppu.h"
#include "memmap.h"
#include "65c816.h"
+#include <retro_inline.h>
#define DO_HBLANK_CHECK_SFX() \
if (CPU.Cycles >= CPU.NextEvent) \
@@ -57,7 +58,7 @@ extern SOpcodes S9xOpcodesM0X0 [256];
extern SICPU ICPU;
-static inline void S9xUnpackStatus()
+static INLINE void S9xUnpackStatus(void)
{
ICPU._Zero = (ICPU.Registers.PL & Zero) == 0;
ICPU._Negative = (ICPU.Registers.PL & Negative);
@@ -65,20 +66,20 @@ static inline void S9xUnpackStatus()
ICPU._Overflow = (ICPU.Registers.PL & Overflow) >> 6;
}
-static inline void S9xPackStatus()
+static INLINE void S9xPackStatus(void)
{
ICPU.Registers.PL &= ~(Zero | Negative | Carry | Overflow);
ICPU.Registers.PL |= ICPU._Carry | ((ICPU._Zero == 0) << 1) | (ICPU._Negative & 0x80) | (ICPU._Overflow << 6);
}
-static inline void CLEAR_IRQ_SOURCE(uint32_t M)
+static INLINE void CLEAR_IRQ_SOURCE(uint32_t M)
{
CPU.IRQActive &= ~M;
if (!CPU.IRQActive)
CPU.Flags &= ~IRQ_PENDING_FLAG;
}
-static inline void S9xFixCycles()
+static INLINE void S9xFixCycles(void)
{
if (CheckEmulation())
ICPU.S9xOpcodes = S9xOpcodesE1;
@@ -98,7 +99,7 @@ static inline void S9xFixCycles()
}
}
-static inline void S9xReschedule()
+static INLINE void S9xReschedule(void)
{
uint8_t which;
int32_t max;
diff --git a/source/cpumacro.h b/source/cpumacro.h
index 7712e49..313e920 100644
--- a/source/cpumacro.h
+++ b/source/cpumacro.h
@@ -3,26 +3,29 @@
#ifndef _CPUMACRO_H_
#define _CPUMACRO_H_
+#include <retro_inline.h>
+
extern int32_t OpAddress;
-static inline void SetZN16(uint16_t Work)
+static INLINE void SetZN16(uint16_t Work)
{
ICPU._Zero = Work != 0;
ICPU._Negative = (uint8_t)(Work >> 8);
}
-static inline void SetZN8(uint8_t Work)
+static INLINE void SetZN8(uint8_t Work)
{
ICPU._Zero = Work;
ICPU._Negative = Work;
}
-static inline void ADC8()
+static INLINE void ADC8()
{
uint8_t Work8 = S9xGetByte(OpAddress);
if (CheckDecimal())
{
+ uint8_t Ans8;
uint8_t A1 = (ICPU.Registers.A.W) & 0x0f;
uint8_t A2 = (ICPU.Registers.A.W) & 0xf0;
uint8_t W1 = Work8 & 0x0f;
@@ -44,7 +47,7 @@ static inline void ADC8()
else
ClearCarry();
- uint8_t Ans8 = A2 | A1;
+ Ans8 = A2 | A1;
if (~(ICPU.Registers.AL ^ Work8) & (Work8 ^ Ans8) & 0x80)
SetOverflow();
else
@@ -64,12 +67,13 @@ static inline void ADC8()
SetZN8(ICPU.Registers.AL);
}
-static inline void ADC16()
+static INLINE void ADC16()
{
uint16_t Work16 = S9xGetWord(OpAddress);
if (CheckDecimal())
{
+ uint16_t Ans16;
uint16_t A1 = ICPU.Registers.A.W & 0x000f;
uint16_t A2 = ICPU.Registers.A.W & 0x00f0;
uint16_t A3 = ICPU.Registers.A.W & 0x0f00;
@@ -109,7 +113,7 @@ static inline void ADC16()
else
ClearCarry();
- uint16_t Ans16 = A4 | A3 | A2 | A1;
+ Ans16 = A4 | A3 | A2 | A1;
if (~(ICPU.Registers.A.W ^ Work16) & (Work16 ^ Ans16) & 0x8000)
SetOverflow();
else
@@ -130,19 +134,19 @@ static inline void ADC16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void AND16()
+static INLINE void AND16()
{
ICPU.Registers.A.W &= S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.A.W);
}
-static inline void AND8()
+static INLINE void AND8()
{
ICPU.Registers.AL &= S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.AL);
}
-static inline void A_ASL16()
+static INLINE void A_ASL16()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -152,7 +156,7 @@ static inline void A_ASL16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void A_ASL8()
+static INLINE void A_ASL8()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -162,12 +166,13 @@ static inline void A_ASL8()
SetZN8(ICPU.Registers.AL);
}
-static inline void ASL16()
+static INLINE void ASL16()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetWord(OpAddress);
+ Work16 = S9xGetWord(OpAddress);
ICPU._Carry = (Work16 & 0x8000) != 0;
Work16 <<= 1;
S9xSetByte(Work16 >> 8, OpAddress + 1);
@@ -175,19 +180,20 @@ static inline void ASL16()
SetZN16(Work16);
}
-static inline void ASL8()
+static INLINE void ASL8()
{
+ uint8_t Work8;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint8_t Work8 = S9xGetByte(OpAddress);
+ Work8 = S9xGetByte(OpAddress);
ICPU._Carry = (Work8 & 0x80) != 0;
Work8 <<= 1;
S9xSetByte(Work8, OpAddress);
SetZN8(Work8);
}
-static inline void BIT16()
+static INLINE void BIT16()
{
uint16_t Work16 = S9xGetWord(OpAddress);
ICPU._Overflow = (Work16 & 0x4000) != 0;
@@ -195,7 +201,7 @@ static inline void BIT16()
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
}
-static inline void BIT8()
+static INLINE void BIT8()
{
uint8_t Work8 = S9xGetByte(OpAddress);
ICPU._Overflow = (Work8 & 0x40) != 0;
@@ -203,49 +209,49 @@ static inline void BIT8()
ICPU._Zero = Work8 & ICPU.Registers.AL;
}
-static inline void CMP16()
+static INLINE void CMP16()
{
int32_t Int32 = (int32_t) ICPU.Registers.A.W - (int32_t) S9xGetWord(OpAddress);
ICPU._Carry = Int32 >= 0;
SetZN16((uint16_t) Int32);
}
-static inline void CMP8()
+static INLINE void CMP8()
{
int16_t Int16 = (int16_t) ICPU.Registers.AL - (int16_t) S9xGetByte(OpAddress);
ICPU._Carry = Int16 >= 0;
SetZN8((uint8_t) Int16);
}
-static inline void CMX16()
+static INLINE void CMX16()
{
int32_t Int32 = (int32_t) ICPU.Registers.X.W - (int32_t) S9xGetWord(OpAddress);
ICPU._Carry = Int32 >= 0;
SetZN16((uint16_t) Int32);
}
-static inline void CMX8()
+static INLINE void CMX8()
{
int16_t Int16 = (int16_t) ICPU.Registers.XL - (int16_t) S9xGetByte(OpAddress);
ICPU._Carry = Int16 >= 0;
SetZN8((uint8_t) Int16);
}
-static inline void CMY16()
+static INLINE void CMY16()
{
int32_t Int32 = (int32_t) ICPU.Registers.Y.W - (int32_t) S9xGetWord(OpAddress);
ICPU._Carry = Int32 >= 0;
SetZN16((uint16_t) Int32);
}
-static inline void CMY8()
+static INLINE void CMY8()
{
int16_t Int16 = (int16_t) ICPU.Registers.YL - (int16_t) S9xGetByte(OpAddress);
ICPU._Carry = Int16 >= 0;
SetZN8((uint8_t) Int16);
}
-static inline void A_DEC16()
+static INLINE void A_DEC16()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -255,7 +261,7 @@ static inline void A_DEC16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void A_DEC8()
+static INLINE void A_DEC8()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -265,42 +271,46 @@ static inline void A_DEC8()
SetZN8(ICPU.Registers.AL);
}
-static inline void DEC16()
+static INLINE void DEC16()
{
+ uint16_t Work16;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
CPU.WaitAddress = NULL;
- uint16_t Work16 = S9xGetWord(OpAddress) - 1;
+ Work16 = S9xGetWord(OpAddress) - 1;
S9xSetByte(Work16 >> 8, OpAddress + 1);
S9xSetByte(Work16 & 0xFF, OpAddress);
SetZN16(Work16);
}
-static inline void DEC8()
+static INLINE void DEC8()
{
+ uint8_t Work8;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
CPU.WaitAddress = NULL;
- uint8_t Work8 = S9xGetByte(OpAddress) - 1;
+ Work8 = S9xGetByte(OpAddress) - 1;
S9xSetByte(Work8, OpAddress);
SetZN8(Work8);
}
-static inline void EOR16()
+static INLINE void EOR16()
{
ICPU.Registers.A.W ^= S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.A.W);
}
-static inline void EOR8()
+static INLINE void EOR8()
{
ICPU.Registers.AL ^= S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.AL);
}
-static inline void A_INC16()
+static INLINE void A_INC16()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -310,7 +320,7 @@ static inline void A_INC16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void A_INC8()
+static INLINE void A_INC8()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -320,66 +330,69 @@ static inline void A_INC8()
SetZN8(ICPU.Registers.AL);
}
-static inline void INC16()
+static INLINE void INC16()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
CPU.WaitAddress = NULL;
- uint16_t Work16 = S9xGetWord(OpAddress) + 1;
+ Work16 = S9xGetWord(OpAddress) + 1;
S9xSetByte(Work16 >> 8, OpAddress + 1);
S9xSetByte(Work16 & 0xFF, OpAddress);
SetZN16(Work16);
}
-static inline void INC8()
+static INLINE void INC8()
{
+ uint8_t Work8;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
CPU.WaitAddress = NULL;
- uint8_t Work8 = S9xGetByte(OpAddress) + 1;
+ Work8 = S9xGetByte(OpAddress) + 1;
S9xSetByte(Work8, OpAddress);
SetZN8(Work8);
}
-static inline void LDA16()
+static INLINE void LDA16()
{
ICPU.Registers.A.W = S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.A.W);
}
-static inline void LDA8()
+static INLINE void LDA8()
{
ICPU.Registers.AL = S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.AL);
}
-static inline void LDX16()
+static INLINE void LDX16()
{
ICPU.Registers.X.W = S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.X.W);
}
-static inline void LDX8()
+static INLINE void LDX8()
{
ICPU.Registers.XL = S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.XL);
}
-static inline void LDY16()
+static INLINE void LDY16()
{
ICPU.Registers.Y.W = S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.Y.W);
}
-static inline void LDY8()
+static INLINE void LDY8()
{
ICPU.Registers.YL = S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.YL);
}
-static inline void A_LSR16()
+static INLINE void A_LSR16()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -389,7 +402,7 @@ static inline void A_LSR16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void A_LSR8()
+static INLINE void A_LSR8()
{
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
@@ -399,12 +412,14 @@ static inline void A_LSR8()
SetZN8(ICPU.Registers.AL);
}
-static inline void LSR16()
+static INLINE void LSR16()
{
+ uint16_t Work16;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetWord(OpAddress);
+ Work16 = S9xGetWord(OpAddress);
ICPU._Carry = Work16 & 1;
Work16 >>= 1;
S9xSetByte(Work16 >> 8, OpAddress + 1);
@@ -412,47 +427,51 @@ static inline void LSR16()
SetZN16(Work16);
}
-static inline void LSR8()
+static INLINE void LSR8()
{
+ uint8_t Work8;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint8_t Work8 = S9xGetByte(OpAddress);
+ Work8 = S9xGetByte(OpAddress);
ICPU._Carry = Work8 & 1;
Work8 >>= 1;
S9xSetByte(Work8, OpAddress);
SetZN8(Work8);
}
-static inline void ORA16()
+static INLINE void ORA16()
{
ICPU.Registers.A.W |= S9xGetWord(OpAddress);
SetZN16(ICPU.Registers.A.W);
}
-static inline void ORA8()
+static INLINE void ORA8()
{
ICPU.Registers.AL |= S9xGetByte(OpAddress);
SetZN8(ICPU.Registers.AL);
}
-static inline void A_ROL16()
+static INLINE void A_ROL16()
{
+ uint32_t Work32;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32_t Work32 = (ICPU.Registers.A.W << 1) | CheckCarry();
+ Work32 = (ICPU.Registers.A.W << 1) | CheckCarry();
ICPU._Carry = Work32 > 0xffff;
ICPU.Registers.A.W = (uint16_t) Work32;
SetZN16((uint16_t) Work32);
}
-static inline void A_ROL8()
+static INLINE void A_ROL8()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = ICPU.Registers.AL;
+ Work16 = ICPU.Registers.AL;
Work16 <<= 1;
Work16 |= CheckCarry();
ICPU._Carry = Work16 > 0xff;
@@ -460,12 +479,14 @@ static inline void A_ROL8()
SetZN8((uint8_t) Work16);
}
-static inline void ROL16()
+static INLINE void ROL16()
{
+ uint32_t Work32;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32_t Work32 = S9xGetWord(OpAddress);
+ Work32 = S9xGetWord(OpAddress);
Work32 <<= 1;
Work32 |= CheckCarry();
ICPU._Carry = Work32 > 0xffff;
@@ -474,12 +495,13 @@ static inline void ROL16()
SetZN16((uint16_t) Work32);
}
-static inline void ROL8()
+static INLINE void ROL8()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetByte(OpAddress);
+ Work16 = S9xGetByte(OpAddress);
Work16 <<= 1;
Work16 |= CheckCarry();
ICPU._Carry = Work16 > 0xff;
@@ -487,12 +509,13 @@ static inline void ROL8()
SetZN8((uint8_t) Work16);
}
-static inline void A_ROR16()
+static INLINE void A_ROR16()
{
+ uint32_t Work32;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32_t Work32 = ICPU.Registers.A.W;
+ Work32 = ICPU.Registers.A.W;
Work32 |= (int32_t) CheckCarry() << 16;
ICPU._Carry = (uint8_t)(Work32 & 1);
Work32 >>= 1;
@@ -500,24 +523,27 @@ static inline void A_ROR16()
SetZN16((uint16_t) Work32);
}
-static inline void A_ROR8()
+static INLINE void A_ROR8()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = ICPU.Registers.AL | ((uint16_t) CheckCarry() << 8);
+ Work16 = ICPU.Registers.AL | ((uint16_t) CheckCarry() << 8);
ICPU._Carry = (uint8_t) Work16 & 1;
Work16 >>= 1;
ICPU.Registers.AL = (uint8_t) Work16;
SetZN8((uint8_t) Work16);
}
-static inline void ROR16()
+static INLINE void ROR16()
{
+ uint32_t Work32;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint32_t Work32 = S9xGetWord(OpAddress);
+ Work32 = S9xGetWord(OpAddress);
Work32 |= (int32_t) CheckCarry() << 16;
ICPU._Carry = (uint8_t)(Work32 & 1);
Work32 >>= 1;
@@ -526,12 +552,13 @@ static inline void ROR16()
SetZN16((uint16_t) Work32);
}
-static inline void ROR8()
+static INLINE void ROR8()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetByte(OpAddress);
+ Work16 = S9xGetByte(OpAddress);
Work16 |= (int32_t) CheckCarry() << 8;
ICPU._Carry = (uint8_t)(Work16 & 1);
Work16 >>= 1;
@@ -539,12 +566,13 @@ static inline void ROR8()
SetZN8((uint8_t) Work16);
}
-static inline void SBC16()
+static INLINE void SBC16()
{
uint16_t Work16 = S9xGetWord(OpAddress);
if (CheckDecimal())
{
+ uint16_t Ans16;
uint16_t A1 = ICPU.Registers.A.W & 0x000f;
uint16_t A2 = ICPU.Registers.A.W & 0x00f0;
uint16_t A3 = ICPU.Registers.A.W & 0x0f00;
@@ -585,7 +613,7 @@ static inline void SBC16()
else
SetCarry();
- uint16_t Ans16 = A4 | A3 | A2 | A1;
+ Ans16 = A4 | A3 | A2 | A1;
if ((ICPU.Registers.A.W ^ Work16) & (ICPU.Registers.A.W ^ Ans16) & 0x8000)
SetOverflow();
else
@@ -605,11 +633,12 @@ static inline void SBC16()
SetZN16(ICPU.Registers.A.W);
}
-static inline void SBC8()
+static INLINE void SBC8()
{
uint8_t Work8 = S9xGetByte(OpAddress);
if (CheckDecimal())
{
+ uint8_t Ans8;
uint8_t A1 = ICPU.Registers.A.W & 0x0f;
uint8_t A2 = ICPU.Registers.A.W & 0xf0;
uint8_t W1 = Work8 & 0x0f;
@@ -632,7 +661,7 @@ static inline void SBC8()
else
SetCarry();
- uint8_t Ans8 = A2 | A1;
+ Ans8 = A2 | A1;
if ((ICPU.Registers.AL ^ Work8) & (ICPU.Registers.AL ^ Ans8) & 0x80)
SetOverflow();
else
@@ -652,87 +681,92 @@ static inline void SBC8()
SetZN8(ICPU.Registers.AL);
}
-static inline void STA16()
+static INLINE void STA16()
{
S9xSetWord(ICPU.Registers.A.W, OpAddress);
}
-static inline void STA8()
+static INLINE void STA8()
{
S9xSetByte(ICPU.Registers.AL, OpAddress);
}
-static inline void STX16()
+static INLINE void STX16()
{
S9xSetWord(ICPU.Registers.X.W, OpAddress);
}
-static inline void STX8()
+static INLINE void STX8()
{
S9xSetByte(ICPU.Registers.XL, OpAddress);
}
-static inline void STY16()
+static INLINE void STY16()
{
S9xSetWord(ICPU.Registers.Y.W, OpAddress);
}
-static inline void STY8()
+static INLINE void STY8()
{
S9xSetByte(ICPU.Registers.YL, OpAddress);
}
-static inline void STZ16()
+static INLINE void STZ16()
{
S9xSetWord(0, OpAddress);
}
-static inline void STZ8()
+static INLINE void STZ8()
{
S9xSetByte(0, OpAddress);
}
-static inline void TSB16()
+static INLINE void TSB16()
{
+ uint16_t Work16;
+
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetWord(OpAddress);
+ Work16 = S9xGetWord(OpAddress);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 |= ICPU.Registers.A.W;
S9xSetByte(Work16 >> 8, OpAddress + 1);
S9xSetByte(Work16 & 0xFF, OpAddress);
}
-static inline void TSB8()
+static INLINE void TSB8()
{
+ uint8_t Work8;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint8_t Work8 = S9xGetByte(OpAddress);
+ Work8 = S9xGetByte(OpAddress);
ICPU._Zero = Work8 & ICPU.Registers.AL;
Work8 |= ICPU.Registers.AL;
S9xSetByte(Work8, OpAddress);
}
-static inline void TRB16()
+static INLINE void TRB16()
{
+ uint16_t Work16;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint16_t Work16 = S9xGetWord(OpAddress);
+ Work16 = S9xGetWord(OpAddress);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 &= ~ICPU.Registers.A.W;
S9xSetByte(Work16 >> 8, OpAddress + 1);
S9xSetByte(Work16 & 0xFF, OpAddress);
}
-static inline void TRB8()
+static INLINE void TRB8()
{
+ uint8_t Work8;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint8_t Work8 = S9xGetByte(OpAddress);
+ Work8 = S9xGetByte(OpAddress);
ICPU._Zero = Work8 & ICPU.Registers.AL;
Work8 &= ~ICPU.Registers.AL;
S9xSetByte(Work8, OpAddress);
diff --git a/source/cpuops.c b/source/cpuops.c
index c86d9c1..2254713 100644
--- a/source/cpuops.c
+++ b/source/cpuops.c
@@ -16,6 +16,8 @@
#include "cpumacro.h"
#include "apu.h"
+#include <retro_inline.h>
+
int32_t OpAddress;
/* ADC *************************************************************************************** */
@@ -2411,7 +2413,7 @@ static void Op0CM0(void)
#endif
#ifndef SA1_OPCODES
-static inline void CPUShutdown(void)
+static INLINE void CPUShutdown(void)
{
if (Settings.Shutdown && CPU.PC == CPU.WaitAddress)
{
@@ -2444,7 +2446,7 @@ static inline void CPUShutdown(void)
}
}
#else
-static inline void CPUShutdown(void)
+static INLINE void CPUShutdown(void)
{
if (Settings.Shutdown && CPU.PC == CPU.WaitAddress)
{
@@ -2460,7 +2462,7 @@ static inline void CPUShutdown(void)
#endif
// From the speed-hacks branch of CatSFC
-static inline void ForceShutdown(void)
+static INLINE void ForceShutdown(void)
{
#ifndef SA1_OPCODES
CPU.WaitAddress = NULL;
@@ -3338,11 +3340,12 @@ static void OpBBX0(void)
/* XCE *************************************************************************************** */
static void OpFB(void)
{
+ uint8_t A1, A2;
#ifndef SA1_OPCODES
CPU.Cycles += ONE_CYCLE;
#endif
- uint8_t A1 = ICPU._Carry;
- uint8_t A2 = ICPU.Registers.PH;
+ A1 = ICPU._Carry;
+ A2 = ICPU.Registers.PH;
ICPU._Carry = A2 & 1;
ICPU.Registers.PH = A1;
@@ -3890,11 +3893,12 @@ static void OpCB(void)
static void OpDB(void)
{
#ifndef NO_SPEEDHACKS
+ int8_t BranchOffset;
uint8_t NextByte = *CPU.PC++;
ForceShutdown();
- int8_t BranchOffset = (NextByte & 0x7F) | ((NextByte & 0x40) << 1);
+ BranchOffset = (NextByte & 0x7F) | ((NextByte & 0x40) << 1);
// ^ -64 .. +63, sign extend bit 6 into 7 for unpacking
OpAddress = ((int32_t) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff;
@@ -3941,11 +3945,12 @@ static void OpDB(void)
static void Op42(void)
{
#ifndef NO_SPEEDHACKS
+ int8_t BranchOffset;
uint8_t NextByte = *CPU.PC++;
ForceShutdown();
- int8_t BranchOffset = 0xF0 | (NextByte & 0xF); // always negative
+ BranchOffset = 0xF0 | (NextByte & 0xF); // always negative
OpAddress = ((int32_t) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff;
switch (NextByte & 0xF0)
diff --git a/source/dma.c b/source/dma.c
index 399d956..eefe135 100644
--- a/source/dma.c
+++ b/source/dma.c
@@ -23,24 +23,27 @@ extern uint8_t* HDMABasePointers [8];
void S9xDoDMA(uint8_t Channel)
{
uint8_t Work;
+ int32_t count;
+ int32_t inc;
+ SDMA* d;
+ bool in_sa1_dma = false;
+ uint8_t* in_sdd1_dma = NULL;
+ uint8_t* spc7110_dma = NULL;
+ bool s7_wrap = false;
if (Channel > 7 || CPU.InDMA)
return;
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];
+ d = &DMA[Channel];
- int32_t count = d->TransferBytes;
+ count = d->TransferBytes;
// Prepare for custom chip DMA
if (count == 0)
count = 0x10000;
- int32_t inc = d->AAddressFixed ? 0 : (!d->AAddressDecrement ? 1 : -1);
+ inc = d->AAddressFixed ? 0 : (!d->AAddressDecrement ? 1 : -1);
if ((d->ABank == 0x7E || d->ABank == 0x7F) && d->BAddress == 0x80 && !d->TransferDirection)
{
@@ -63,11 +66,13 @@ void S9xDoDMA(uint8_t Channel)
{
if (d->AAddressFixed && Memory.FillRAM [0x4801] > 0)
{
+ uint8_t *in_ptr;
+
// XXX: Should probably verify that we're DMAing from ROM?
// And somewhere we should make sure we're not running across a mapping boundary too.
inc = !d->AAddressDecrement ? 1 : -1;
- uint8_t *in_ptr = GetBasePointer(((d->ABank << 16) | d->AAddress));
+ in_ptr = GetBasePointer(((d->ABank << 16) | d->AAddress));
if (in_ptr)
{
in_ptr += d->AAddress;
@@ -81,6 +86,7 @@ void S9xDoDMA(uint8_t Channel)
if (Settings.SPC7110 && (d->AAddress == 0x4800 || d->ABank == 0x50))
{
uint32_t i;
+ int32_t icount;
i = (s7r.reg4805 | (s7r.reg4806 << 8));
i *= s7r.AlignBy;
i += s7r.bank50Internal;
@@ -89,13 +95,16 @@ void S9xDoDMA(uint8_t Channel)
spc7110_dma = &s7r.bank50[i];
else
{
+ uint32_t j;
+
spc7110_dma = (uint8_t*)malloc(d->TransferBytes);
- uint32_t j = DECOMP_BUFFER_SIZE - i;
+ j = DECOMP_BUFFER_SIZE - i;
memcpy(spc7110_dma, &s7r.bank50[i], j);
memcpy(&spc7110_dma[j], s7r.bank50, d->TransferBytes - j);
s7_wrap = true;
}
- int32_t icount = s7r.reg4809 | (s7r.reg480A << 8);
+
+ icount = s7r.reg4809 | (s7r.reg480A << 8);
icount -= d->TransferBytes;
s7r.reg4809 = 0x00ff & icount;
s7r.reg480A = (0xff00 & icount) >> 8;
@@ -107,6 +116,7 @@ void S9xDoDMA(uint8_t Channel)
}
if (d->BAddress == 0x18 && SA1.in_char_dma && (d->ABank & 0xf0) == 0x40)
{
+ int32_t i;
// Perform packed bitmap to PPU character format conversion on the
// data before transmitting it to V-RAM via-DMA.
int32_t num_chars = 1 << ((Memory.FillRAM [0x2231] >> 2) & 7);
@@ -124,7 +134,6 @@ void S9xDoDMA(uint8_t Channel)
uint32_t char_count = inc / bytes_per_char;
in_sa1_dma = true;
- int32_t i;
switch (depth)
{
@@ -225,6 +234,9 @@ void S9xDoDMA(uint8_t Channel)
if (!d->TransferDirection)
{
+ uint8_t* base;
+ uint16_t p;
+
/* XXX: DMA is potentially broken here for cases where we DMA across
* XXX: memmap boundries. A possible solution would be to re-call
* XXX: GetBasePointer whenever we cross a boundry, and when
@@ -240,8 +252,8 @@ void S9xDoDMA(uint8_t Channel)
//reflects extra cycle used by DMA
CPU.Cycles += SLOW_ONE_CYCLE * (count + 1);
- uint8_t* base = GetBasePointer((d->ABank << 16) + d->AAddress);
- uint16_t p = d->AAddress;
+ base = GetBasePointer((d->ABank << 16) + d->AAddress);
+ p = d->AAddress;
if (!base)
base = Memory.ROM;
@@ -606,6 +618,8 @@ update_address:
void S9xStartHDMA()
{
+ uint8_t i;
+
if (Settings.DisableHDMA)
IPPU.HDMA = 0;
else
@@ -615,7 +629,6 @@ void S9xStartHDMA()
if (IPPU.HDMA != 0)
CPU.Cycles += ONE_CYCLE * 3;
- uint8_t i;
for (i = 0; i < 8; i++)
{
if (IPPU.HDMA & (1 << i))
@@ -633,23 +646,26 @@ void S9xStartHDMA()
uint8_t S9xDoHDMA(uint8_t byte)
{
+ uint8_t mask;
SDMA* p = &DMA [0];
-
int32_t d = 0;
CPU.InDMA = true;
CPU.Cycles += ONE_CYCLE * 3;
- uint8_t mask;
+
for (mask = 1; mask; mask <<= 1, p++, d++)
{
if (byte & mask)
{
if (!p->LineCount)
{
+ uint8_t line;
+
//remember, InDMA is set.
//Get/Set incur no charges!
CPU.Cycles += SLOW_ONE_CYCLE;
- uint8_t line = S9xGetByte((p->ABank << 16) + p->Address);
+ line = S9xGetByte((p->ABank << 16) + p->Address);
+
if (line == 0x80)
{
p->Repeat = true;
diff --git a/source/dsp1.c b/source/dsp1.c
index 2166e87..98c0077 100644
--- a/source/dsp1.c
+++ b/source/dsp1.c
@@ -624,6 +624,10 @@ uint8_t DSP1GetByte(uint16_t address)
void DSP2SetByte(uint8_t byte, uint16_t address)
{
+#ifndef FAST_LSB_WORD_ACCESS
+ uint32_t temp;
+#endif
+
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
@@ -715,7 +719,6 @@ void DSP2SetByte(uint8_t byte, uint16_t address)
#ifdef FAST_LSB_WORD_ACCESS
*(uint32_t*)DSP1.output = DSP2Op09Word1 * DSP2Op09Word2;
#else
- uint32_t temp;
temp = DSP2Op09Word1 * DSP2Op09Word2;
DSP1.output[0] = temp & 0xFF;
DSP1.output[1] = (temp >> 8) & 0xFF;
@@ -941,10 +944,11 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
// internal memory management (06)
case 0x0005:
{
+ int32_t lcv;
+
// clear OAM tables
op06_index = 0;
op06_offset = 0;
- int32_t lcv;
for (lcv = 0; lcv < 32; lcv++)
op06_OAM[lcv] = 0;
break;
@@ -959,8 +963,9 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
// sprite OAM post-table data
case 0x0006:
{
- DSP4.out_count = 32;
int32_t lcv;
+
+ DSP4.out_count = 32;
for (lcv = 0; lcv < 32; lcv++)
DSP4.output[lcv] = op06_OAM[lcv];
}
diff --git a/source/dsp1emu.c b/source/dsp1emu.c
index 3e34795..6ed470c 100644
--- a/source/dsp1emu.c
+++ b/source/dsp1emu.c
@@ -301,24 +301,28 @@ const int16_t DSP1_SinTable[256] =
int16_t DSP1_Sin(int16_t Angle)
{
+ int32_t S;
+
if (Angle < 0)
{
if (Angle == -32768) return 0;
return -DSP1_Sin(-Angle);
}
- int32_t S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15);
+ S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15);
if (S > 32767) S = 32767;
return (int16_t) S;
}
int16_t DSP1_Cos(int16_t Angle)
{
+ int32_t S;
+
if (Angle < 0)
{
if (Angle == -32768) return -32768;
Angle = -Angle;
}
- int32_t S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15);
+ S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15);
if (S < -32768) S = -32767;
return (int16_t) S;
}
diff --git a/source/dsp4emu.c b/source/dsp4emu.c
index 3b3d843..b2fcebf 100644
--- a/source/dsp4emu.c
+++ b/source/dsp4emu.c
@@ -47,6 +47,11 @@ void DSP4_Op06(bool size, bool msb)
void DSP4_Op01()
{
+ int16_t plane;
+
+ int16_t index, lcv;
+ int16_t py_dy, px_dx;
+ int16_t y_out, x_out;
uint16_t command;
DSP4.waiting4command = false;
@@ -123,11 +128,6 @@ DSP4_WAIT(1) resume1:
// process one iteration of projection
// inspect inputs
- int16_t plane;
-
- int16_t index, lcv;
- int16_t py_dy, px_dx;
- int16_t y_out, x_out;
resume2:
plane = DSP4_READ_WORD(0);
@@ -241,6 +241,10 @@ resume2:
void DSP4_Op07()
{
uint16_t command;
+ int16_t plane;
+ int16_t index, lcv;
+ int16_t y_out, x_out;
+ int16_t py_dy, px_dx;
DSP4.waiting4command = false;
@@ -309,11 +313,6 @@ DSP4_WAIT(1) resume1:
////////////////////////////////////////////////////
// process one loop of projection
- int16_t plane;
- int16_t index, lcv;
- int16_t y_out, x_out;
- int16_t py_dy, px_dx;
-
resume2:
px_dx = 0;
@@ -404,6 +403,11 @@ resume2:
void DSP4_Op08()
{
uint16_t command;
+ // used in envelope shaping
+ int16_t x1_final;
+ int16_t x2_final;
+ int16_t plane, x_left, y_left, x_right, y_right;
+ int16_t envelope1, envelope2;
DSP4.waiting4command = false;
@@ -494,20 +498,16 @@ DSP4_WAIT(2) resume2:
// debug
++block;
- // used in envelope shaping
- int16_t x1_final;
- int16_t x2_final;
-
// look at guidelines
- 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);
+ plane = DSP4_READ_WORD(0x00);
+ x_left = DSP4_READ_WORD(0x02);
+ y_left = DSP4_READ_WORD(0x04);
+ x_right = DSP4_READ_WORD(0x06);
+ y_right = DSP4_READ_WORD(0x08);
// envelope guidelines (one frame only)
- int16_t envelope1 = DSP4_READ_WORD(0x0a);
- int16_t envelope2 = DSP4_READ_WORD(0x0c);
+ envelope1 = DSP4_READ_WORD(0x0a);
+ envelope2 = DSP4_READ_WORD(0x0c);
// ignore invalid data
if ((uint16_t) plane == 0x8001) continue;
@@ -730,6 +730,11 @@ DSP4_WAIT(2) resume2:
void DSP4_Op0D()
{
uint16_t command;
+ // inspect inputs
+ int16_t plane;
+ int16_t index, lcv;
+ int16_t py_dy, px_dx;
+ int16_t y_out, x_out;
DSP4.waiting4command = false;
@@ -824,11 +829,6 @@ DSP4_WAIT(1) resume1:
////////////////////////////////////////////////////
// project section of the track
- // inspect inputs
- int16_t plane;
- int16_t index, lcv;
- int16_t py_dy, px_dx;
- int16_t y_out, x_out;
resume2:
@@ -940,6 +940,9 @@ resume2:
void DSP4_Op09()
{
uint16_t command;
+ bool clip;
+ int16_t sp_x, sp_y, sp_oam, sp_msb;
+ int16_t sp_dx, sp_dy;
DSP4.waiting4command = false;
@@ -1055,6 +1058,7 @@ sprite_found:
int16_t plane;
int16_t car_left, car_right;
int16_t focal_back;
+ int32_t height;
// we already have 4 bytes we want
DSP4.in_count = 6 + 12;
@@ -1096,7 +1100,6 @@ DSP4_WAIT(3) resume3:
DSP4_WAIT(4)
// store final values
- int32_t height;
resume4:
height = DSP4_READ_WORD(0);
@@ -1176,10 +1179,6 @@ DSP4_WAIT(6) resume6:
/////////////////////////////////////
// process tile data
- bool clip;
- int16_t sp_x, sp_y, sp_oam, sp_msb;
- int16_t sp_dx, sp_dy;
-
resume7:
// sprite deltas
diff --git a/source/fxemu.c b/source/fxemu.c
index dcbf04d..c3af12d 100644
--- a/source/fxemu.c
+++ b/source/fxemu.c
@@ -284,6 +284,8 @@ static void fx_writeRegisterSpaceAfterUse()
/* Reset the FxChip */
void FxReset(FxInit_s* psFxInfo)
{
+ int32_t i;
+
/* Clear all internal variables */
memset(&GSU, 0, sizeof(FxRegs_s));
@@ -310,7 +312,6 @@ void FxReset(FxInit_s* psFxInfo)
GSU.pvRegisters[0x3b] = 0;
/* Make ROM bank table */
- int32_t i;
for (i = 0; i < 256; i++)
{
uint32_t b = i & 0x7f;
diff --git a/source/fxinst.c b/source/fxinst.c
index 814825b..7eddcfe 100644
--- a/source/fxinst.c
+++ b/source/fxinst.c
@@ -7,6 +7,8 @@
#include <string.h>
#include <stdio.h>
+#include <retro_inline.h>
+
extern FxRegs_s GSU;
int32_t gsu_bank [512] = {0};
@@ -22,7 +24,7 @@ int32_t gsu_bank [512] = {0};
*/
/* 00 - stop - stop GSU execution (and maybe generate an IRQ) */
-static inline void fx_stop()
+static INLINE void fx_stop()
{
CF(G);
GSU.vCounter = 0;
@@ -39,7 +41,7 @@ static inline void fx_stop()
}
/* 01 - nop - no operation */
-static inline void fx_nop()
+static INLINE void fx_nop()
{
CLRFLAGS;
R15++;
@@ -48,7 +50,7 @@ static inline void fx_nop()
extern void fx_flushCache();
/* 02 - cache - reintialize GSU cache */
-static inline void fx_cache()
+static INLINE void fx_cache()
{
uint32_t c = R15 & 0xfff0;
if (GSU.vCacheBaseReg != c || !GSU.bCacheActive)
@@ -62,7 +64,7 @@ static inline void fx_cache()
}
/* 03 - lsr - logic shift right */
-static inline void fx_lsr()
+static INLINE void fx_lsr()
{
uint32_t v;
GSU.vCarry = SREG & 1;
@@ -76,7 +78,7 @@ static inline void fx_lsr()
}
/* 04 - rol - rotate left */
-static inline void fx_rol()
+static INLINE void fx_rol()
{
uint32_t v = USEX16((SREG << 1) + GSU.vCarry);
GSU.vCarry = (SREG >> 15) & 1;
@@ -89,7 +91,7 @@ static inline void fx_rol()
}
/* 05 - bra - branch always */
-static inline void fx_bra()
+static INLINE void fx_bra()
{
uint8_t v = PIPE;
R15++;
@@ -113,61 +115,61 @@ static inline void fx_bra()
#define TEST_CY (GSU.vCarry & 1)
/* 06 - blt - branch on less than */
-static inline void fx_blt()
+static INLINE void fx_blt()
{
BRA_COND((TEST_S != 0) != (TEST_OV != 0));
}
/* 07 - bge - branch on greater or equals */
-static inline void fx_bge()
+static INLINE void fx_bge()
{
BRA_COND((TEST_S != 0) == (TEST_OV != 0));
}
/* 08 - bne - branch on not equal */
-static inline void fx_bne()
+static INLINE void fx_bne()
{
BRA_COND(!TEST_Z);
}
/* 09 - beq - branch on equal */
-static inline void fx_beq()
+static INLINE void fx_beq()
{
BRA_COND(TEST_Z);
}
/* 0a - bpl - branch on plus */
-static inline void fx_bpl()
+static INLINE void fx_bpl()
{
BRA_COND(!TEST_S);
}
/* 0b - bmi - branch on minus */
-static inline void fx_bmi()
+static INLINE void fx_bmi()
{
BRA_COND(TEST_S);
}
/* 0c - bcc - branch on carry clear */
-static inline void fx_bcc()
+static INLINE void fx_bcc()
{
BRA_COND(!TEST_CY);
}
/* 0d - bcs - branch on carry set */
-static inline void fx_bcs()
+static INLINE void fx_bcs()
{
BRA_COND(TEST_CY);
}
/* 0e - bvc - branch on overflow clear */
-static inline void fx_bvc()
+static INLINE void fx_bvc()
{
BRA_COND(!TEST_OV);
}
/* 0f - bvs - branch on overflow set */
-static inline void fx_bvs()
+static INLINE void fx_bvs()
{
BRA_COND(TEST_OV);
}
@@ -207,67 +209,67 @@ static inline void fx_bvs()
R15++; \
}
-static inline void fx_to_r0()
+static INLINE void fx_to_r0()
{
FX_TO(0);
}
-static inline void fx_to_r1()
+static INLINE void fx_to_r1()
{
FX_TO(1);
}
-static inline void fx_to_r2()
+static INLINE void fx_to_r2()
{
FX_TO(2);
}
-static inline void fx_to_r3()
+static INLINE void fx_to_r3()
{
FX_TO(3);
}
-static inline void fx_to_r4()
+static INLINE void fx_to_r4()
{
FX_TO(4);
}
-static inline void fx_to_r5()
+static INLINE void fx_to_r5()
{
FX_TO(5);
}
-static inline void fx_to_r6()
+static INLINE void fx_to_r6()
{
FX_TO(6);
}
-static inline void fx_to_r7()
+static INLINE void fx_to_r7()
{
FX_TO(7);
}
-static inline void fx_to_r8()
+static INLINE void fx_to_r8()
{
FX_TO(8);
}
-static inline void fx_to_r9()
+static INLINE void fx_to_r9()
{
FX_TO(9);
}
-static inline void fx_to_r10()
+static INLINE void fx_to_r10()
{
FX_TO(10);
}
-static inline void fx_to_r11()
+static INLINE void fx_to_r11()
{
FX_TO(11);
}
-static inline void fx_to_r12()
+static INLINE void fx_to_r12()
{
FX_TO(12);
}
-static inline void fx_to_r13()
+static INLINE void fx_to_r13()
{
FX_TO(13);
}
-static inline void fx_to_r14()
+static INLINE void fx_to_r14()
{
FX_TO_R14(14);
}
-static inline void fx_to_r15()
+static INLINE void fx_to_r15()
{
FX_TO_R15(15);
}
@@ -278,67 +280,67 @@ static inline void fx_to_r15()
GSU.pvSreg = GSU.pvDreg = &GSU.avReg[reg]; \
R15++
-static inline void fx_with_r0()
+static INLINE void fx_with_r0()
{
FX_WITH(0);
}
-static inline void fx_with_r1()
+static INLINE void fx_with_r1()
{
FX_WITH(1);
}
-static inline void fx_with_r2()
+static INLINE void fx_with_r2()
{
FX_WITH(2);
}
-static inline void fx_with_r3()
+static INLINE void fx_with_r3()
{
FX_WITH(3);
}
-static inline void fx_with_r4()
+static INLINE void fx_with_r4()
{
FX_WITH(4);
}
-static inline void fx_with_r5()
+static INLINE void fx_with_r5()
{
FX_WITH(5);
}
-static inline void fx_with_r6()
+static INLINE void fx_with_r6()
{
FX_WITH(6);
}
-static inline void fx_with_r7()
+static INLINE void fx_with_r7()
{
FX_WITH(7);
}
-static inline void fx_with_r8()
+static INLINE void fx_with_r8()
{
FX_WITH(8);
}
-static inline void fx_with_r9()
+static INLINE void fx_with_r9()
{
FX_WITH(9);
}
-static inline void fx_with_r10()
+static INLINE void fx_with_r10()
{
FX_WITH(10);
}
-static inline void fx_with_r11()
+static INLINE void fx_with_r11()
{
FX_WITH(11);
}
-static inline void fx_with_r12()
+static INLINE void fx_with_r12()
{
FX_WITH(12);
}
-static inline void fx_with_r13()
+static INLINE void fx_with_r13()
{
FX_WITH(13);
}
-static inline void fx_with_r14()
+static INLINE void fx_with_r14()
{
FX_WITH(14);
}
-static inline void fx_with_r15()
+static INLINE void fx_with_r15()
{
FX_WITH(15);
}
@@ -351,51 +353,51 @@ static inline void fx_with_r15()
CLRFLAGS; \
R15++
-static inline void fx_stw_r0()
+static INLINE void fx_stw_r0()
{
FX_STW(0);
}
-static inline void fx_stw_r1()
+static INLINE void fx_stw_r1()
{
FX_STW(1);
}
-static inline void fx_stw_r2()
+static INLINE void fx_stw_r2()
{
FX_STW(2);
}
-static inline void fx_stw_r3()
+static INLINE void fx_stw_r3()
{
FX_STW(3);
}
-static inline void fx_stw_r4()
+static INLINE void fx_stw_r4()
{
FX_STW(4);
}
-static inline void fx_stw_r5()
+static INLINE void fx_stw_r5()
{
FX_STW(5);
}
-static inline void fx_stw_r6()
+static INLINE void fx_stw_r6()
{
FX_STW(6);
}
-static inline void fx_stw_r7()
+static INLINE void fx_stw_r7()
{
FX_STW(7);
}
-static inline void fx_stw_r8()
+static INLINE void fx_stw_r8()
{
FX_STW(8);
}
-static inline void fx_stw_r9()
+static INLINE void fx_stw_r9()
{
FX_STW(9);
}
-static inline void fx_stw_r10()
+static INLINE void fx_stw_r10()
{
FX_STW(10);
}
-static inline void fx_stw_r11()
+static INLINE void fx_stw_r11()
{
FX_STW(11);
}
@@ -407,57 +409,57 @@ static inline void fx_stw_r11()
CLRFLAGS; \
R15++
-static inline void fx_stb_r0()
+static INLINE void fx_stb_r0()
{
FX_STB(0);
}
-static inline void fx_stb_r1()
+static INLINE void fx_stb_r1()
{
FX_STB(1);
}
-static inline void fx_stb_r2()
+static INLINE void fx_stb_r2()
{
FX_STB(2);
}
-static inline void fx_stb_r3()
+static INLINE void fx_stb_r3()
{
FX_STB(3);
}
-static inline void fx_stb_r4()
+static INLINE void fx_stb_r4()
{
FX_STB(4);
}
-static inline void fx_stb_r5()
+static INLINE void fx_stb_r5()
{
FX_STB(5);
}
-static inline void fx_stb_r6()
+static INLINE void fx_stb_r6()
{
FX_STB(6);
}
-static inline void fx_stb_r7()
+static INLINE void fx_stb_r7()
{
FX_STB(7);
}
-static inline void fx_stb_r8()
+static INLINE void fx_stb_r8()
{
FX_STB(8);
}
-static inline void fx_stb_r9()
+static INLINE void fx_stb_r9()
{
FX_STB(9);
}
-static inline void fx_stb_r10()
+static INLINE void fx_stb_r10()
{
FX_STB(10);
}
-static inline void fx_stb_r11()
+static INLINE void fx_stb_r11()
{
FX_STB(11);
}
/* 3c - loop - decrement loop counter, and branch on not zero */
-static inline void fx_loop()
+static INLINE void fx_loop()
{
GSU.vSign = GSU.vZero = --R12;
if ((uint16_t) R12 != 0)
@@ -468,7 +470,7 @@ static inline void fx_loop()
}
/* 3d - alt1 - set alt1 mode */
-static inline void fx_alt1()
+static INLINE void fx_alt1()
{
SF(ALT1);
CF(B);
@@ -476,7 +478,7 @@ static inline void fx_alt1()
}
/* 3e - alt2 - set alt2 mode */
-static inline void fx_alt2()
+static INLINE void fx_alt2()
{
SF(ALT2);
CF(B);
@@ -484,7 +486,7 @@ static inline void fx_alt2()
}
/* 3f - alt3 - set alt3 mode */
-static inline void fx_alt3()
+static INLINE void fx_alt3()
{
SF(ALT1);
SF(ALT2);
@@ -503,51 +505,51 @@ static inline void fx_alt3()
TESTR14; \
CLRFLAGS
-static inline void fx_ldw_r0()
+static INLINE void fx_ldw_r0()
{
FX_LDW(0);
}
-static inline void fx_ldw_r1()
+static INLINE void fx_ldw_r1()
{
FX_LDW(1);
}
-static inline void fx_ldw_r2()
+static INLINE void fx_ldw_r2()
{
FX_LDW(2);
}
-static inline void fx_ldw_r3()
+static INLINE void fx_ldw_r3()
{
FX_LDW(3);
}
-static inline void fx_ldw_r4()
+static INLINE void fx_ldw_r4()
{
FX_LDW(4);
}
-static inline void fx_ldw_r5()
+static INLINE void fx_ldw_r5()
{
FX_LDW(5);
}
-static inline void fx_ldw_r6()
+static INLINE void fx_ldw_r6()
{
FX_LDW(6);
}
-static inline void fx_ldw_r7()
+static INLINE void fx_ldw_r7()
{
FX_LDW(7);
}
-static inline void fx_ldw_r8()
+static INLINE void fx_ldw_r8()
{
FX_LDW(8);
}
-static inline void fx_ldw_r9()
+static INLINE void fx_ldw_r9()
{
FX_LDW(9);
}
-static inline void fx_ldw_r10()
+static INLINE void fx_ldw_r10()
{
FX_LDW(10);
}
-static inline void fx_ldw_r11()
+static INLINE void fx_ldw_r11()
{
FX_LDW(11);
}
@@ -562,57 +564,57 @@ static inline void fx_ldw_r11()
TESTR14; \
CLRFLAGS
-static inline void fx_ldb_r0()
+static INLINE void fx_ldb_r0()
{
FX_LDB(0);
}
-static inline void fx_ldb_r1()
+static INLINE void fx_ldb_r1()
{
FX_LDB(1);
}
-static inline void fx_ldb_r2()
+static INLINE void fx_ldb_r2()
{
FX_LDB(2);
}
-static inline void fx_ldb_r3()
+static INLINE void fx_ldb_r3()
{
FX_LDB(3);
}
-static inline void fx_ldb_r4()
+static INLINE void fx_ldb_r4()
{
FX_LDB(4);
}
-static inline void fx_ldb_r5()
+static INLINE void fx_ldb_r5()
{
FX_LDB(5);
}
-static inline void fx_ldb_r6()
+static INLINE void fx_ldb_r6()
{
FX_LDB(6);
}
-static inline void fx_ldb_r7()
+static INLINE void fx_ldb_r7()
{
FX_LDB(7);
}
-static inline void fx_ldb_r8()
+static INLINE void fx_ldb_r8()
{
FX_LDB(8);
}
-static inline void fx_ldb_r9()
+static INLINE void fx_ldb_r9()
{
FX_LDB(9);
}
-static inline void fx_ldb_r10()
+static INLINE void fx_ldb_r10()
{
FX_LDB(10);
}
-static inline void fx_ldb_r11()
+static INLINE void fx_ldb_r11()
{
FX_LDB(11);
}
/* 4c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
-static inline void fx_plot_2bit()
+static INLINE void fx_plot_2bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -644,7 +646,7 @@ static inline void fx_plot_2bit()
}
/* 2c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
-static inline void fx_rpix_2bit()
+static INLINE void fx_rpix_2bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -664,7 +666,7 @@ static inline void fx_rpix_2bit()
}
/* 4c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
-static inline void fx_plot_4bit()
+static INLINE void fx_plot_4bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -704,7 +706,7 @@ static inline void fx_plot_4bit()
}
/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
-static inline void fx_rpix_4bit()
+static INLINE void fx_rpix_4bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -726,7 +728,7 @@ static inline void fx_rpix_4bit()
}
/* 8c - plot - plot pixel with R1,R2 as x,y and the color register as the color */
-static inline void fx_plot_8bit()
+static INLINE void fx_plot_8bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -784,7 +786,7 @@ static inline void fx_plot_8bit()
}
/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
-static inline void fx_rpix_8bit()
+static INLINE void fx_rpix_8bit()
{
uint32_t x = USEX8(R1);
uint32_t y = USEX8(R2);
@@ -812,12 +814,12 @@ static inline void fx_rpix_8bit()
/* 4o - plot - plot pixel with R1,R2 as x,y and the color register as the color */
/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */
-static inline void fx_obj_func()
+static INLINE void fx_obj_func()
{
}
/* 4d - swap - swap upper and lower byte of a register */
-static inline void fx_swap()
+static INLINE void fx_swap()
{
uint8_t c = (uint8_t)SREG;
uint8_t d = (uint8_t)(SREG >> 8);
@@ -831,7 +833,7 @@ static inline void fx_swap()
}
/* 4e - color - copy source register to color register */
-static inline void fx_color()
+static INLINE void fx_color()
{
uint8_t c = (uint8_t)SREG;
if (GSU.vPlotOptionReg & 0x04)
@@ -848,7 +850,7 @@ static inline void fx_color()
}
/* 4e(ALT1) - cmode - set plot option register */
-static inline void fx_cmode()
+static INLINE void fx_cmode()
{
GSU.vPlotOptionReg = SREG;
@@ -863,7 +865,7 @@ static inline void fx_cmode()
}
/* 4f - not - perform exclusive exor with 1 on all bits */
-static inline void fx_not()
+static INLINE void fx_not()
{
uint32_t v = ~SREG;
R15++;
@@ -886,67 +888,67 @@ static inline void fx_not()
TESTR14; \
CLRFLAGS
-static inline void fx_add_r0()
+static INLINE void fx_add_r0()
{
FX_ADD(0);
}
-static inline void fx_add_r1()
+static INLINE void fx_add_r1()
{
FX_ADD(1);
}
-static inline void fx_add_r2()
+static INLINE void fx_add_r2()
{
FX_ADD(2);
}
-static inline void fx_add_r3()
+static INLINE void fx_add_r3()
{
FX_ADD(3);
}
-static inline void fx_add_r4()
+static INLINE void fx_add_r4()
{
FX_ADD(4);
}
-static inline void fx_add_r5()
+static INLINE void fx_add_r5()
{
FX_ADD(5);
}
-static inline void fx_add_r6()
+static INLINE void fx_add_r6()
{
FX_ADD(6);
}
-static inline void fx_add_r7()
+static INLINE void fx_add_r7()
{
FX_ADD(7);
}
-static inline void fx_add_r8()
+static INLINE void fx_add_r8()
{
FX_ADD(8);
}
-static inline void fx_add_r9()
+static INLINE void fx_add_r9()
{
FX_ADD(9);
}
-static inline void fx_add_r10()
+static INLINE void fx_add_r10()
{
FX_ADD(10);
}
-static inline void fx_add_r11()
+static INLINE void fx_add_r11()
{
FX_ADD(11);
}
-static inline void fx_add_r12()
+static INLINE void fx_add_r12()
{
FX_ADD(12);
}
-static inline void fx_add_r13()
+static INLINE void fx_add_r13()
{
FX_ADD(13);
}
-static inline void fx_add_r14()
+static INLINE void fx_add_r14()
{
FX_ADD(14);
}
-static inline void fx_add_r15()
+static INLINE void fx_add_r15()
{
FX_ADD(15);
}
@@ -963,67 +965,67 @@ static inline void fx_add_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_adc_r0()
+static INLINE void fx_adc_r0()
{
FX_ADC(0);
}
-static inline void fx_adc_r1()
+static INLINE void fx_adc_r1()
{
FX_ADC(1);
}
-static inline void fx_adc_r2()
+static INLINE void fx_adc_r2()
{
FX_ADC(2);
}
-static inline void fx_adc_r3()
+static INLINE void fx_adc_r3()
{
FX_ADC(3);
}
-static inline void fx_adc_r4()
+static INLINE void fx_adc_r4()
{
FX_ADC(4);
}
-static inline void fx_adc_r5()
+static INLINE void fx_adc_r5()
{
FX_ADC(5);
}
-static inline void fx_adc_r6()
+static INLINE void fx_adc_r6()
{
FX_ADC(6);
}
-static inline void fx_adc_r7()
+static INLINE void fx_adc_r7()
{
FX_ADC(7);
}
-static inline void fx_adc_r8()
+static INLINE void fx_adc_r8()
{
FX_ADC(8);
}
-static inline void fx_adc_r9()
+static INLINE void fx_adc_r9()
{
FX_ADC(9);
}
-static inline void fx_adc_r10()
+static INLINE void fx_adc_r10()
{
FX_ADC(10);
}
-static inline void fx_adc_r11()
+static INLINE void fx_adc_r11()
{
FX_ADC(11);
}
-static inline void fx_adc_r12()
+static INLINE void fx_adc_r12()
{
FX_ADC(12);
}
-static inline void fx_adc_r13()
+static INLINE void fx_adc_r13()
{
FX_ADC(13);
}
-static inline void fx_adc_r14()
+static INLINE void fx_adc_r14()
{
FX_ADC(14);
}
-static inline void fx_adc_r15()
+static INLINE void fx_adc_r15()
{
FX_ADC(15);
}
@@ -1040,67 +1042,67 @@ static inline void fx_adc_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_add_i0()
+static INLINE void fx_add_i0()
{
FX_ADD_I(0);
}
-static inline void fx_add_i1()
+static INLINE void fx_add_i1()
{
FX_ADD_I(1);
}
-static inline void fx_add_i2()
+static INLINE void fx_add_i2()
{
FX_ADD_I(2);
}
-static inline void fx_add_i3()
+static INLINE void fx_add_i3()
{
FX_ADD_I(3);
}
-static inline void fx_add_i4()
+static INLINE void fx_add_i4()
{
FX_ADD_I(4);
}
-static inline void fx_add_i5()
+static INLINE void fx_add_i5()
{
FX_ADD_I(5);
}
-static inline void fx_add_i6()
+static INLINE void fx_add_i6()
{
FX_ADD_I(6);
}
-static inline void fx_add_i7()
+static INLINE void fx_add_i7()
{
FX_ADD_I(7);
}
-static inline void fx_add_i8()
+static INLINE void fx_add_i8()
{
FX_ADD_I(8);
}
-static inline void fx_add_i9()
+static INLINE void fx_add_i9()
{
FX_ADD_I(9);
}
-static inline void fx_add_i10()
+static INLINE void fx_add_i10()
{
FX_ADD_I(10);
}
-static inline void fx_add_i11()
+static INLINE void fx_add_i11()
{
FX_ADD_I(11);
}
-static inline void fx_add_i12()
+static INLINE void fx_add_i12()
{
FX_ADD_I(12);
}
-static inline void fx_add_i13()
+static INLINE void fx_add_i13()
{
FX_ADD_I(13);
}
-static inline void fx_add_i14()
+static INLINE void fx_add_i14()
{
FX_ADD_I(14);
}
-static inline void fx_add_i15()
+static INLINE void fx_add_i15()
{
FX_ADD_I(15);
}
@@ -1117,67 +1119,67 @@ static inline void fx_add_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_adc_i0()
+static INLINE void fx_adc_i0()
{
FX_ADC_I(0);
}
-static inline void fx_adc_i1()
+static INLINE void fx_adc_i1()
{
FX_ADC_I(1);
}
-static inline void fx_adc_i2()
+static INLINE void fx_adc_i2()
{
FX_ADC_I(2);
}
-static inline void fx_adc_i3()
+static INLINE void fx_adc_i3()
{
FX_ADC_I(3);
}
-static inline void fx_adc_i4()
+static INLINE void fx_adc_i4()
{
FX_ADC_I(4);
}
-static inline void fx_adc_i5()
+static INLINE void fx_adc_i5()
{
FX_ADC_I(5);
}
-static inline void fx_adc_i6()
+static INLINE void fx_adc_i6()
{
FX_ADC_I(6);
}
-static inline void fx_adc_i7()
+static INLINE void fx_adc_i7()
{
FX_ADC_I(7);
}
-static inline void fx_adc_i8()
+static INLINE void fx_adc_i8()
{
FX_ADC_I(8);
}
-static inline void fx_adc_i9()
+static INLINE void fx_adc_i9()
{
FX_ADC_I(9);
}
-static inline void fx_adc_i10()
+static INLINE void fx_adc_i10()
{
FX_ADC_I(10);
}
-static inline void fx_adc_i11()
+static INLINE void fx_adc_i11()
{
FX_ADC_I(11);
}
-static inline void fx_adc_i12()
+static INLINE void fx_adc_i12()
{
FX_ADC_I(12);
}
-static inline void fx_adc_i13()
+static INLINE void fx_adc_i13()
{
FX_ADC_I(13);
}
-static inline void fx_adc_i14()
+static INLINE void fx_adc_i14()
{
FX_ADC_I(14);
}
-static inline void fx_adc_i15()
+static INLINE void fx_adc_i15()
{
FX_ADC_I(15);
}
@@ -1194,67 +1196,67 @@ static inline void fx_adc_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_sub_r0()
+static INLINE void fx_sub_r0()
{
FX_SUB(0);
}
-static inline void fx_sub_r1()
+static INLINE void fx_sub_r1()
{
FX_SUB(1);
}
-static inline void fx_sub_r2()
+static INLINE void fx_sub_r2()
{
FX_SUB(2);
}
-static inline void fx_sub_r3()
+static INLINE void fx_sub_r3()
{
FX_SUB(3);
}
-static inline void fx_sub_r4()
+static INLINE void fx_sub_r4()
{
FX_SUB(4);
}
-static inline void fx_sub_r5()
+static INLINE void fx_sub_r5()
{
FX_SUB(5);
}
-static inline void fx_sub_r6()
+static INLINE void fx_sub_r6()
{
FX_SUB(6);
}
-static inline void fx_sub_r7()
+static INLINE void fx_sub_r7()
{
FX_SUB(7);
}
-static inline void fx_sub_r8()
+static INLINE void fx_sub_r8()
{
FX_SUB(8);
}
-static inline void fx_sub_r9()
+static INLINE void fx_sub_r9()
{
FX_SUB(9);
}
-static inline void fx_sub_r10()
+static INLINE void fx_sub_r10()
{
FX_SUB(10);
}
-static inline void fx_sub_r11()
+static INLINE void fx_sub_r11()
{
FX_SUB(11);
}
-static inline void fx_sub_r12()
+static INLINE void fx_sub_r12()
{
FX_SUB(12);
}
-static inline void fx_sub_r13()
+static INLINE void fx_sub_r13()
{
FX_SUB(13);
}
-static inline void fx_sub_r14()
+static INLINE void fx_sub_r14()
{
FX_SUB(14);
}
-static inline void fx_sub_r15()
+static INLINE void fx_sub_r15()
{
FX_SUB(15);
}
@@ -1271,67 +1273,67 @@ static inline void fx_sub_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_sbc_r0()
+static INLINE void fx_sbc_r0()
{
FX_SBC(0);
}
-static inline void fx_sbc_r1()
+static INLINE void fx_sbc_r1()
{
FX_SBC(1);
}
-static inline void fx_sbc_r2()
+static INLINE void fx_sbc_r2()
{
FX_SBC(2);
}
-static inline void fx_sbc_r3()
+static INLINE void fx_sbc_r3()
{
FX_SBC(3);
}
-static inline void fx_sbc_r4()
+static INLINE void fx_sbc_r4()
{
FX_SBC(4);
}
-static inline void fx_sbc_r5()
+static INLINE void fx_sbc_r5()
{
FX_SBC(5);
}
-static inline void fx_sbc_r6()
+static INLINE void fx_sbc_r6()
{
FX_SBC(6);
}
-static inline void fx_sbc_r7()
+static INLINE void fx_sbc_r7()
{
FX_SBC(7);
}
-static inline void fx_sbc_r8()
+static INLINE void fx_sbc_r8()
{
FX_SBC(8);
}
-static inline void fx_sbc_r9()
+static INLINE void fx_sbc_r9()
{
FX_SBC(9);
}
-static inline void fx_sbc_r10()
+static INLINE void fx_sbc_r10()
{
FX_SBC(10);
}
-static inline void fx_sbc_r11()
+static INLINE void fx_sbc_r11()
{
FX_SBC(11);
}
-static inline void fx_sbc_r12()
+static INLINE void fx_sbc_r12()
{
FX_SBC(12);
}
-static inline void fx_sbc_r13()
+static INLINE void fx_sbc_r13()
{
FX_SBC(13);
}
-static inline void fx_sbc_r14()
+static INLINE void fx_sbc_r14()
{
FX_SBC(14);
}
-static inline void fx_sbc_r15()
+static INLINE void fx_sbc_r15()
{
FX_SBC(15);
}
@@ -1348,67 +1350,67 @@ static inline void fx_sbc_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_sub_i0()
+static INLINE void fx_sub_i0()
{
FX_SUB_I(0);
}
-static inline void fx_sub_i1()
+static INLINE void fx_sub_i1()
{
FX_SUB_I(1);
}
-static inline void fx_sub_i2()
+static INLINE void fx_sub_i2()
{
FX_SUB_I(2);
}
-static inline void fx_sub_i3()
+static INLINE void fx_sub_i3()
{
FX_SUB_I(3);
}
-static inline void fx_sub_i4()
+static INLINE void fx_sub_i4()
{
FX_SUB_I(4);
}
-static inline void fx_sub_i5()
+static INLINE void fx_sub_i5()
{
FX_SUB_I(5);
}
-static inline void fx_sub_i6()
+static INLINE void fx_sub_i6()
{
FX_SUB_I(6);
}
-static inline void fx_sub_i7()
+static INLINE void fx_sub_i7()
{
FX_SUB_I(7);
}
-static inline void fx_sub_i8()
+static INLINE void fx_sub_i8()
{
FX_SUB_I(8);
}
-static inline void fx_sub_i9()
+static INLINE void fx_sub_i9()
{
FX_SUB_I(9);
}
-static inline void fx_sub_i10()
+static INLINE void fx_sub_i10()
{
FX_SUB_I(10);
}
-static inline void fx_sub_i11()
+static INLINE void fx_sub_i11()
{
FX_SUB_I(11);
}
-static inline void fx_sub_i12()
+static INLINE void fx_sub_i12()
{
FX_SUB_I(12);
}
-static inline void fx_sub_i13()
+static INLINE void fx_sub_i13()
{
FX_SUB_I(13);
}
-static inline void fx_sub_i14()
+static INLINE void fx_sub_i14()
{
FX_SUB_I(14);
}
-static inline void fx_sub_i15()
+static INLINE void fx_sub_i15()
{
FX_SUB_I(15);
}
@@ -1423,73 +1425,73 @@ static inline void fx_sub_i15()
R15++; \
CLRFLAGS
-static inline void fx_cmp_r0()
+static INLINE void fx_cmp_r0()
{
FX_CMP(0);
}
-static inline void fx_cmp_r1()
+static INLINE void fx_cmp_r1()
{
FX_CMP(1);
}
-static inline void fx_cmp_r2()
+static INLINE void fx_cmp_r2()
{
FX_CMP(2);
}
-static inline void fx_cmp_r3()
+static INLINE void fx_cmp_r3()
{
FX_CMP(3);
}
-static inline void fx_cmp_r4()
+static INLINE void fx_cmp_r4()
{
FX_CMP(4);
}
-static inline void fx_cmp_r5()
+static INLINE void fx_cmp_r5()
{
FX_CMP(5);
}
-static inline void fx_cmp_r6()
+static INLINE void fx_cmp_r6()
{
FX_CMP(6);
}
-static inline void fx_cmp_r7()
+static INLINE void fx_cmp_r7()
{
FX_CMP(7);
}
-static inline void fx_cmp_r8()
+static INLINE void fx_cmp_r8()
{
FX_CMP(8);
}
-static inline void fx_cmp_r9()
+static INLINE void fx_cmp_r9()
{
FX_CMP(9);
}
-static inline void fx_cmp_r10()
+static INLINE void fx_cmp_r10()
{
FX_CMP(10);
}
-static inline void fx_cmp_r11()
+static INLINE void fx_cmp_r11()
{
FX_CMP(11);
}
-static inline void fx_cmp_r12()
+static INLINE void fx_cmp_r12()
{
FX_CMP(12);
}
-static inline void fx_cmp_r13()
+static INLINE void fx_cmp_r13()
{
FX_CMP(13);
}
-static inline void fx_cmp_r14()
+static INLINE void fx_cmp_r14()
{
FX_CMP(14);
}
-static inline void fx_cmp_r15()
+static INLINE void fx_cmp_r15()
{
FX_CMP(15);
}
/* 70 - merge - R7 as upper byte, R8 as lower byte (used for texture-mapping) */
-static inline void fx_merge()
+static INLINE void fx_merge()
{
uint32_t v = (R7 & 0xff00) | ((R8 & 0xff00) >> 8);
R15++;
@@ -1512,63 +1514,63 @@ static inline void fx_merge()
TESTR14; \
CLRFLAGS
-static inline void fx_and_r1()
+static INLINE void fx_and_r1()
{
FX_AND(1);
}
-static inline void fx_and_r2()
+static INLINE void fx_and_r2()
{
FX_AND(2);
}
-static inline void fx_and_r3()
+static INLINE void fx_and_r3()
{
FX_AND(3);
}
-static inline void fx_and_r4()
+static INLINE void fx_and_r4()
{
FX_AND(4);
}
-static inline void fx_and_r5()
+static INLINE void fx_and_r5()
{
FX_AND(5);
}
-static inline void fx_and_r6()
+static INLINE void fx_and_r6()
{
FX_AND(6);
}
-static inline void fx_and_r7()
+static INLINE void fx_and_r7()
{
FX_AND(7);
}
-static inline void fx_and_r8()
+static INLINE void fx_and_r8()
{
FX_AND(8);
}
-static inline void fx_and_r9()
+static INLINE void fx_and_r9()
{
FX_AND(9);
}
-static inline void fx_and_r10()
+static INLINE void fx_and_r10()
{
FX_AND(10);
}
-static inline void fx_and_r11()
+static INLINE void fx_and_r11()
{
FX_AND(11);
}
-static inline void fx_and_r12()
+static INLINE void fx_and_r12()
{
FX_AND(12);
}
-static inline void fx_and_r13()
+static INLINE void fx_and_r13()
{
FX_AND(13);
}
-static inline void fx_and_r14()
+static INLINE void fx_and_r14()
{
FX_AND(14);
}
-static inline void fx_and_r15()
+static INLINE void fx_and_r15()
{
FX_AND(15);
}
@@ -1583,63 +1585,63 @@ static inline void fx_and_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_bic_r1()
+static INLINE void fx_bic_r1()
{
FX_BIC(1);
}
-static inline void fx_bic_r2()
+static INLINE void fx_bic_r2()
{
FX_BIC(2);
}
-static inline void fx_bic_r3()
+static INLINE void fx_bic_r3()
{
FX_BIC(3);
}
-static inline void fx_bic_r4()
+static INLINE void fx_bic_r4()
{
FX_BIC(4);
}
-static inline void fx_bic_r5()
+static INLINE void fx_bic_r5()
{
FX_BIC(5);
}
-static inline void fx_bic_r6()
+static INLINE void fx_bic_r6()
{
FX_BIC(6);
}
-static inline void fx_bic_r7()
+static INLINE void fx_bic_r7()
{
FX_BIC(7);
}
-static inline void fx_bic_r8()
+static INLINE void fx_bic_r8()
{
FX_BIC(8);
}
-static inline void fx_bic_r9()
+static INLINE void fx_bic_r9()
{
FX_BIC(9);
}
-static inline void fx_bic_r10()
+static INLINE void fx_bic_r10()
{
FX_BIC(10);
}
-static inline void fx_bic_r11()
+static INLINE void fx_bic_r11()
{
FX_BIC(11);
}
-static inline void fx_bic_r12()
+static INLINE void fx_bic_r12()
{
FX_BIC(12);
}
-static inline void fx_bic_r13()
+static INLINE void fx_bic_r13()
{
FX_BIC(13);
}
-static inline void fx_bic_r14()
+static INLINE void fx_bic_r14()
{
FX_BIC(14);
}
-static inline void fx_bic_r15()
+static INLINE void fx_bic_r15()
{
FX_BIC(15);
}
@@ -1654,63 +1656,63 @@ static inline void fx_bic_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_and_i1()
+static INLINE void fx_and_i1()
{
FX_AND_I(1);
}
-static inline void fx_and_i2()
+static INLINE void fx_and_i2()
{
FX_AND_I(2);
}
-static inline void fx_and_i3()
+static INLINE void fx_and_i3()
{
FX_AND_I(3);
}
-static inline void fx_and_i4()
+static INLINE void fx_and_i4()
{
FX_AND_I(4);
}
-static inline void fx_and_i5()
+static INLINE void fx_and_i5()
{
FX_AND_I(5);
}
-static inline void fx_and_i6()
+static INLINE void fx_and_i6()
{
FX_AND_I(6);
}
-static inline void fx_and_i7()
+static INLINE void fx_and_i7()
{
FX_AND_I(7);
}
-static inline void fx_and_i8()
+static INLINE void fx_and_i8()
{
FX_AND_I(8);
}
-static inline void fx_and_i9()
+static INLINE void fx_and_i9()
{
FX_AND_I(9);
}
-static inline void fx_and_i10()
+static INLINE void fx_and_i10()
{
FX_AND_I(10);
}
-static inline void fx_and_i11()
+static INLINE void fx_and_i11()
{
FX_AND_I(11);
}
-static inline void fx_and_i12()
+static INLINE void fx_and_i12()
{
FX_AND_I(12);
}
-static inline void fx_and_i13()
+static INLINE void fx_and_i13()
{
FX_AND_I(13);
}
-static inline void fx_and_i14()
+static INLINE void fx_and_i14()
{
FX_AND_I(14);
}
-static inline void fx_and_i15()
+static INLINE void fx_and_i15()
{
FX_AND_I(15);
}
@@ -1725,63 +1727,63 @@ static inline void fx_and_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_bic_i1()
+static INLINE void fx_bic_i1()
{
FX_BIC_I(1);
}
-static inline void fx_bic_i2()
+static INLINE void fx_bic_i2()
{
FX_BIC_I(2);
}
-static inline void fx_bic_i3()
+static INLINE void fx_bic_i3()
{
FX_BIC_I(3);
}
-static inline void fx_bic_i4()
+static INLINE void fx_bic_i4()
{
FX_BIC_I(4);
}
-static inline void fx_bic_i5()
+static INLINE void fx_bic_i5()
{
FX_BIC_I(5);
}
-static inline void fx_bic_i6()
+static INLINE void fx_bic_i6()
{
FX_BIC_I(6);
}
-static inline void fx_bic_i7()
+static INLINE void fx_bic_i7()
{
FX_BIC_I(7);
}
-static inline void fx_bic_i8()
+static INLINE void fx_bic_i8()
{
FX_BIC_I(8);
}
-static inline void fx_bic_i9()
+static INLINE void fx_bic_i9()
{
FX_BIC_I(9);
}
-static inline void fx_bic_i10()
+static INLINE void fx_bic_i10()
{
FX_BIC_I(10);
}
-static inline void fx_bic_i11()
+static INLINE void fx_bic_i11()
{
FX_BIC_I(11);
}
-static inline void fx_bic_i12()
+static INLINE void fx_bic_i12()
{
FX_BIC_I(12);
}
-static inline void fx_bic_i13()
+static INLINE void fx_bic_i13()
{
FX_BIC_I(13);
}
-static inline void fx_bic_i14()
+static INLINE void fx_bic_i14()
{
FX_BIC_I(14);
}
-static inline void fx_bic_i15()
+static INLINE void fx_bic_i15()
{
FX_BIC_I(15);
}
@@ -1796,67 +1798,67 @@ static inline void fx_bic_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_mult_r0()
+static INLINE void fx_mult_r0()
{
FX_MULT(0);
}
-static inline void fx_mult_r1()
+static INLINE void fx_mult_r1()
{
FX_MULT(1);
}
-static inline void fx_mult_r2()
+static INLINE void fx_mult_r2()
{
FX_MULT(2);
}
-static inline void fx_mult_r3()
+static INLINE void fx_mult_r3()
{
FX_MULT(3);
}
-static inline void fx_mult_r4()
+static INLINE void fx_mult_r4()
{
FX_MULT(4);
}
-static inline void fx_mult_r5()
+static INLINE void fx_mult_r5()
{
FX_MULT(5);
}
-static inline void fx_mult_r6()
+static INLINE void fx_mult_r6()
{
FX_MULT(6);
}
-static inline void fx_mult_r7()
+static INLINE void fx_mult_r7()
{
FX_MULT(7);
}
-static inline void fx_mult_r8()
+static INLINE void fx_mult_r8()
{
FX_MULT(8);
}
-static inline void fx_mult_r9()
+static INLINE void fx_mult_r9()
{
FX_MULT(9);
}
-static inline void fx_mult_r10()
+static INLINE void fx_mult_r10()
{
FX_MULT(10);
}
-static inline void fx_mult_r11()
+static INLINE void fx_mult_r11()
{
FX_MULT(11);
}
-static inline void fx_mult_r12()
+static INLINE void fx_mult_r12()
{
FX_MULT(12);
}
-static inline void fx_mult_r13()
+static INLINE void fx_mult_r13()
{
FX_MULT(13);
}
-static inline void fx_mult_r14()
+static INLINE void fx_mult_r14()
{
FX_MULT(14);
}
-static inline void fx_mult_r15()
+static INLINE void fx_mult_r15()
{
FX_MULT(15);
}
@@ -1871,67 +1873,67 @@ static inline void fx_mult_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_umult_r0()
+static INLINE void fx_umult_r0()
{
FX_UMULT(0);
}
-static inline void fx_umult_r1()
+static INLINE void fx_umult_r1()
{
FX_UMULT(1);
}
-static inline void fx_umult_r2()
+static INLINE void fx_umult_r2()
{
FX_UMULT(2);
}
-static inline void fx_umult_r3()
+static INLINE void fx_umult_r3()
{
FX_UMULT(3);
}
-static inline void fx_umult_r4()
+static INLINE void fx_umult_r4()
{
FX_UMULT(4);
}
-static inline void fx_umult_r5()
+static INLINE void fx_umult_r5()
{
FX_UMULT(5);
}
-static inline void fx_umult_r6()
+static INLINE void fx_umult_r6()
{
FX_UMULT(6);
}
-static inline void fx_umult_r7()
+static INLINE void fx_umult_r7()
{
FX_UMULT(7);
}
-static inline void fx_umult_r8()
+static INLINE void fx_umult_r8()
{
FX_UMULT(8);
}
-static inline void fx_umult_r9()
+static INLINE void fx_umult_r9()
{
FX_UMULT(9);
}
-static inline void fx_umult_r10()
+static INLINE void fx_umult_r10()
{
FX_UMULT(10);
}
-static inline void fx_umult_r11()
+static INLINE void fx_umult_r11()
{
FX_UMULT(11);
}
-static inline void fx_umult_r12()
+static INLINE void fx_umult_r12()
{
FX_UMULT(12);
}
-static inline void fx_umult_r13()
+static INLINE void fx_umult_r13()
{
FX_UMULT(13);
}
-static inline void fx_umult_r14()
+static INLINE void fx_umult_r14()
{
FX_UMULT(14);
}
-static inline void fx_umult_r15()
+static INLINE void fx_umult_r15()
{
FX_UMULT(15);
}
@@ -1946,67 +1948,67 @@ static inline void fx_umult_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_mult_i0()
+static INLINE void fx_mult_i0()
{
FX_MULT_I(0);
}
-static inline void fx_mult_i1()
+static INLINE void fx_mult_i1()
{
FX_MULT_I(1);
}
-static inline void fx_mult_i2()
+static INLINE void fx_mult_i2()
{
FX_MULT_I(2);
}
-static inline void fx_mult_i3()
+static INLINE void fx_mult_i3()
{
FX_MULT_I(3);
}
-static inline void fx_mult_i4()
+static INLINE void fx_mult_i4()
{
FX_MULT_I(4);
}
-static inline void fx_mult_i5()
+static INLINE void fx_mult_i5()
{
FX_MULT_I(5);
}
-static inline void fx_mult_i6()
+static INLINE void fx_mult_i6()
{
FX_MULT_I(6);
}
-static inline void fx_mult_i7()
+static INLINE void fx_mult_i7()
{
FX_MULT_I(7);
}
-static inline void fx_mult_i8()
+static INLINE void fx_mult_i8()
{
FX_MULT_I(8);
}
-static inline void fx_mult_i9()
+static INLINE void fx_mult_i9()
{
FX_MULT_I(9);
}
-static inline void fx_mult_i10()
+static INLINE void fx_mult_i10()
{
FX_MULT_I(10);
}
-static inline void fx_mult_i11()
+static INLINE void fx_mult_i11()
{
FX_MULT_I(11);
}
-static inline void fx_mult_i12()
+static INLINE void fx_mult_i12()
{
FX_MULT_I(12);
}
-static inline void fx_mult_i13()
+static INLINE void fx_mult_i13()
{
FX_MULT_I(13);
}
-static inline void fx_mult_i14()
+static INLINE void fx_mult_i14()
{
FX_MULT_I(14);
}
-static inline void fx_mult_i15()
+static INLINE void fx_mult_i15()
{
FX_MULT_I(15);
}
@@ -2021,73 +2023,73 @@ static inline void fx_mult_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_umult_i0()
+static INLINE void fx_umult_i0()
{
FX_UMULT_I(0);
}
-static inline void fx_umult_i1()
+static INLINE void fx_umult_i1()
{
FX_UMULT_I(1);
}
-static inline void fx_umult_i2()
+static INLINE void fx_umult_i2()
{
FX_UMULT_I(2);
}
-static inline void fx_umult_i3()
+static INLINE void fx_umult_i3()
{
FX_UMULT_I(3);
}
-static inline void fx_umult_i4()
+static INLINE void fx_umult_i4()
{
FX_UMULT_I(4);
}
-static inline void fx_umult_i5()
+static INLINE void fx_umult_i5()
{
FX_UMULT_I(5);
}
-static inline void fx_umult_i6()
+static INLINE void fx_umult_i6()
{
FX_UMULT_I(6);
}
-static inline void fx_umult_i7()
+static INLINE void fx_umult_i7()
{
FX_UMULT_I(7);
}
-static inline void fx_umult_i8()
+static INLINE void fx_umult_i8()
{
FX_UMULT_I(8);
}
-static inline void fx_umult_i9()
+static INLINE void fx_umult_i9()
{
FX_UMULT_I(9);
}
-static inline void fx_umult_i10()
+static INLINE void fx_umult_i10()
{
FX_UMULT_I(10);
}
-static inline void fx_umult_i11()
+static INLINE void fx_umult_i11()
{
FX_UMULT_I(11);
}
-static inline void fx_umult_i12()
+static INLINE void fx_umult_i12()
{
FX_UMULT_I(12);
}
-static inline void fx_umult_i13()
+static INLINE void fx_umult_i13()
{
FX_UMULT_I(13);
}
-static inline void fx_umult_i14()
+static INLINE void fx_umult_i14()
{
FX_UMULT_I(14);
}
-static inline void fx_umult_i15()
+static INLINE void fx_umult_i15()
{
FX_UMULT_I(15);
}
/* 90 - sbk - store word to last accessed RAM address */
-static inline void fx_sbk()
+static INLINE void fx_sbk()
{
RAM(GSU.vLastRamAdr) = (uint8_t)SREG;
RAM(GSU.vLastRamAdr ^ 1) = (uint8_t)(SREG >> 8);
@@ -2101,25 +2103,25 @@ static inline void fx_sbk()
CLRFLAGS; \
R15++
-static inline void fx_link_i1()
+static INLINE void fx_link_i1()
{
FX_LINK_I(1);
}
-static inline void fx_link_i2()
+static INLINE void fx_link_i2()
{
FX_LINK_I(2);
}
-static inline void fx_link_i3()
+static INLINE void fx_link_i3()
{
FX_LINK_I(3);
}
-static inline void fx_link_i4()
+static INLINE void fx_link_i4()
{
FX_LINK_I(4);
}
/* 95 - sex - sign extend 8 bit to 16 bit */
-static inline void fx_sex()
+static INLINE void fx_sex()
{
uint32_t v = (uint32_t)SEX8(SREG);
R15++;
@@ -2131,7 +2133,7 @@ static inline void fx_sex()
}
/* 96 - asr - aritmetric shift right by one */
-static inline void fx_asr()
+static INLINE void fx_asr()
{
uint32_t v;
GSU.vCarry = SREG & 1;
@@ -2145,7 +2147,7 @@ static inline void fx_asr()
}
/* 96(ALT1) - div2 - aritmetric shift right by one */
-static inline void fx_div2()
+static INLINE void fx_div2()
{
uint32_t v;
int32_t s = SEX16(SREG);
@@ -2163,7 +2165,7 @@ static inline void fx_div2()
}
/* 97 - ror - rotate right by one */
-static inline void fx_ror()
+static INLINE void fx_ror()
{
uint32_t v = (USEX16(SREG) >> 1) | (GSU.vCarry << 15);
GSU.vCarry = SREG & 1;
@@ -2180,27 +2182,27 @@ static inline void fx_ror()
R15 = GSU.avReg[reg]; \
CLRFLAGS
-static inline void fx_jmp_r8()
+static INLINE void fx_jmp_r8()
{
FX_JMP(8);
}
-static inline void fx_jmp_r9()
+static INLINE void fx_jmp_r9()
{
FX_JMP(9);
}
-static inline void fx_jmp_r10()
+static INLINE void fx_jmp_r10()
{
FX_JMP(10);
}
-static inline void fx_jmp_r11()
+static INLINE void fx_jmp_r11()
{
FX_JMP(11);
}
-static inline void fx_jmp_r12()
+static INLINE void fx_jmp_r12()
{
FX_JMP(12);
}
-static inline void fx_jmp_r13()
+static INLINE void fx_jmp_r13()
{
FX_JMP(13);
}
@@ -2214,33 +2216,33 @@ static inline void fx_jmp_r13()
fx_cache(); \
R15--
-static inline void fx_ljmp_r8()
+static INLINE void fx_ljmp_r8()
{
FX_LJMP(8);
}
-static inline void fx_ljmp_r9()
+static INLINE void fx_ljmp_r9()
{
FX_LJMP(9);
}
-static inline void fx_ljmp_r10()
+static INLINE void fx_ljmp_r10()
{
FX_LJMP(10);
}
-static inline void fx_ljmp_r11()
+static INLINE void fx_ljmp_r11()
{
FX_LJMP(11);
}
-static inline void fx_ljmp_r12()
+static INLINE void fx_ljmp_r12()
{
FX_LJMP(12);
}
-static inline void fx_ljmp_r13()
+static INLINE void fx_ljmp_r13()
{
FX_LJMP(13);
}
/* 9e - lob - set upper byte to zero (keep low byte) */
-static inline void fx_lob()
+static INLINE void fx_lob()
{
uint32_t v = USEX8(SREG);
R15++;
@@ -2252,7 +2254,7 @@ static inline void fx_lob()
}
/* 9f - fmult - 16 bit to 32 bit signed multiplication, upper 16 bits only */
-static inline void fx_fmult()
+static INLINE void fx_fmult()
{
uint32_t v;
uint32_t c = (uint32_t)(SEX16(SREG) * SEX16(R6));
@@ -2267,7 +2269,7 @@ static inline void fx_fmult()
}
/* 9f(ALT1) - lmult - 16 bit to 32 bit signed multiplication */
-static inline void fx_lmult()
+static INLINE void fx_lmult()
{
uint32_t v;
uint32_t c = (uint32_t)(SEX16(SREG) * SEX16(R6));
@@ -2292,68 +2294,68 @@ static inline void fx_lmult()
GSU.avReg[reg] = SEX8(v); \
CLRFLAGS
-static inline void fx_ibt_r0()
+static INLINE void fx_ibt_r0()
{
FX_IBT(0);
}
-static inline void fx_ibt_r1()
+static INLINE void fx_ibt_r1()
{
FX_IBT(1);
}
-static inline void fx_ibt_r2()
+static INLINE void fx_ibt_r2()
{
FX_IBT(2);
}
-static inline void fx_ibt_r3()
+static INLINE void fx_ibt_r3()
{
FX_IBT(3);
}
-static inline void fx_ibt_r4()
+static INLINE void fx_ibt_r4()
{
FX_IBT(4);
}
-static inline void fx_ibt_r5()
+static INLINE void fx_ibt_r5()
{
FX_IBT(5);
}
-static inline void fx_ibt_r6()
+static INLINE void fx_ibt_r6()
{
FX_IBT(6);
}
-static inline void fx_ibt_r7()
+static INLINE void fx_ibt_r7()
{
FX_IBT(7);
}
-static inline void fx_ibt_r8()
+static INLINE void fx_ibt_r8()
{
FX_IBT(8);
}
-static inline void fx_ibt_r9()
+static INLINE void fx_ibt_r9()
{
FX_IBT(9);
}
-static inline void fx_ibt_r10()
+static INLINE void fx_ibt_r10()
{
FX_IBT(10);
}
-static inline void fx_ibt_r11()
+static INLINE void fx_ibt_r11()
{
FX_IBT(11);
}
-static inline void fx_ibt_r12()
+static INLINE void fx_ibt_r12()
{
FX_IBT(12);
}
-static inline void fx_ibt_r13()
+static INLINE void fx_ibt_r13()
{
FX_IBT(13);
}
-static inline void fx_ibt_r14()
+static INLINE void fx_ibt_r14()
{
FX_IBT(14);
READR14;
}
-static inline void fx_ibt_r15()
+static INLINE void fx_ibt_r15()
{
FX_IBT(15);
}
@@ -2368,68 +2370,68 @@ static inline void fx_ibt_r15()
GSU.avReg[reg] |= ((uint32_t) RAM(GSU.vLastRamAdr + 1)) << 8; \
CLRFLAGS
-static inline void fx_lms_r0()
+static INLINE void fx_lms_r0()
{
FX_LMS(0);
}
-static inline void fx_lms_r1()
+static INLINE void fx_lms_r1()
{
FX_LMS(1);
}
-static inline void fx_lms_r2()
+static INLINE void fx_lms_r2()
{
FX_LMS(2);
}
-static inline void fx_lms_r3()
+static INLINE void fx_lms_r3()
{
FX_LMS(3);
}
-static inline void fx_lms_r4()
+static INLINE void fx_lms_r4()
{
FX_LMS(4);
}
-static inline void fx_lms_r5()
+static INLINE void fx_lms_r5()
{
FX_LMS(5);
}
-static inline void fx_lms_r6()
+static INLINE void fx_lms_r6()
{
FX_LMS(6);
}
-static inline void fx_lms_r7()
+static INLINE void fx_lms_r7()
{
FX_LMS(7);
}
-static inline void fx_lms_r8()
+static INLINE void fx_lms_r8()
{
FX_LMS(8);
}
-static inline void fx_lms_r9()
+static INLINE void fx_lms_r9()
{
FX_LMS(9);
}
-static inline void fx_lms_r10()
+static INLINE void fx_lms_r10()
{
FX_LMS(10);
}
-static inline void fx_lms_r11()
+static INLINE void fx_lms_r11()
{
FX_LMS(11);
}
-static inline void fx_lms_r12()
+static INLINE void fx_lms_r12()
{
FX_LMS(12);
}
-static inline void fx_lms_r13()
+static INLINE void fx_lms_r13()
{
FX_LMS(13);
}
-static inline void fx_lms_r14()
+static INLINE void fx_lms_r14()
{
FX_LMS(14);
READR14;
}
-static inline void fx_lms_r15()
+static INLINE void fx_lms_r15()
{
FX_LMS(15);
}
@@ -2446,67 +2448,67 @@ static inline void fx_lms_r15()
CLRFLAGS; \
R15++
-static inline void fx_sms_r0()
+static INLINE void fx_sms_r0()
{
FX_SMS(0);
}
-static inline void fx_sms_r1()
+static INLINE void fx_sms_r1()
{
FX_SMS(1);
}
-static inline void fx_sms_r2()
+static INLINE void fx_sms_r2()
{
FX_SMS(2);
}
-static inline void fx_sms_r3()
+static INLINE void fx_sms_r3()
{
FX_SMS(3);
}
-static inline void fx_sms_r4()
+static INLINE void fx_sms_r4()
{
FX_SMS(4);
}
-static inline void fx_sms_r5()
+static INLINE void fx_sms_r5()
{
FX_SMS(5);
}
-static inline void fx_sms_r6()
+static INLINE void fx_sms_r6()
{
FX_SMS(6);
}
-static inline void fx_sms_r7()
+static INLINE void fx_sms_r7()
{
FX_SMS(7);
}
-static inline void fx_sms_r8()
+static INLINE void fx_sms_r8()
{
FX_SMS(8);
}
-static inline void fx_sms_r9()
+static INLINE void fx_sms_r9()
{
FX_SMS(9);
}
-static inline void fx_sms_r10()
+static INLINE void fx_sms_r10()
{
FX_SMS(10);
}
-static inline void fx_sms_r11()
+static INLINE void fx_sms_r11()
{
FX_SMS(11);
}
-static inline void fx_sms_r12()
+static INLINE void fx_sms_r12()
{
FX_SMS(12);
}
-static inline void fx_sms_r13()
+static INLINE void fx_sms_r13()
{
FX_SMS(13);
}
-static inline void fx_sms_r14()
+static INLINE void fx_sms_r14()
{
FX_SMS(14);
}
-static inline void fx_sms_r15()
+static INLINE void fx_sms_r15()
{
FX_SMS(15);
}
@@ -2531,73 +2533,73 @@ static inline void fx_sms_r15()
R15++; \
}
-static inline void fx_from_r0()
+static INLINE void fx_from_r0()
{
FX_FROM(0);
}
-static inline void fx_from_r1()
+static INLINE void fx_from_r1()
{
FX_FROM(1);
}
-static inline void fx_from_r2()
+static INLINE void fx_from_r2()
{
FX_FROM(2);
}
-static inline void fx_from_r3()
+static INLINE void fx_from_r3()
{
FX_FROM(3);
}
-static inline void fx_from_r4()
+static INLINE void fx_from_r4()
{
FX_FROM(4);
}
-static inline void fx_from_r5()
+static INLINE void fx_from_r5()
{
FX_FROM(5);
}
-static inline void fx_from_r6()
+static INLINE void fx_from_r6()
{
FX_FROM(6);
}
-static inline void fx_from_r7()
+static INLINE void fx_from_r7()
{
FX_FROM(7);
}
-static inline void fx_from_r8()
+static INLINE void fx_from_r8()
{
FX_FROM(8);
}
-static inline void fx_from_r9()
+static INLINE void fx_from_r9()
{
FX_FROM(9);
}
-static inline void fx_from_r10()
+static INLINE void fx_from_r10()
{
FX_FROM(10);
}
-static inline void fx_from_r11()
+static INLINE void fx_from_r11()
{
FX_FROM(11);
}
-static inline void fx_from_r12()
+static INLINE void fx_from_r12()
{
FX_FROM(12);
}
-static inline void fx_from_r13()
+static INLINE void fx_from_r13()
{
FX_FROM(13);
}
-static inline void fx_from_r14()
+static INLINE void fx_from_r14()
{
FX_FROM(14);
}
-static inline void fx_from_r15()
+static INLINE void fx_from_r15()
{
FX_FROM(15);
}
/* c0 - hib - move high-byte to low-byte */
-static inline void fx_hib()
+static INLINE void fx_hib()
{
uint32_t v = USEX8(SREG >> 8);
R15++;
@@ -2618,63 +2620,63 @@ static inline void fx_hib()
TESTR14; \
CLRFLAGS
-static inline void fx_or_r1()
+static INLINE void fx_or_r1()
{
FX_OR(1);
}
-static inline void fx_or_r2()
+static INLINE void fx_or_r2()
{
FX_OR(2);
}
-static inline void fx_or_r3()
+static INLINE void fx_or_r3()
{
FX_OR(3);
}
-static inline void fx_or_r4()
+static INLINE void fx_or_r4()
{
FX_OR(4);
}
-static inline void fx_or_r5()
+static INLINE void fx_or_r5()
{
FX_OR(5);
}
-static inline void fx_or_r6()
+static INLINE void fx_or_r6()
{
FX_OR(6);
}
-static inline void fx_or_r7()
+static INLINE void fx_or_r7()
{
FX_OR(7);
}
-static inline void fx_or_r8()
+static INLINE void fx_or_r8()
{
FX_OR(8);
}
-static inline void fx_or_r9()
+static INLINE void fx_or_r9()
{
FX_OR(9);
}
-static inline void fx_or_r10()
+static INLINE void fx_or_r10()
{
FX_OR(10);
}
-static inline void fx_or_r11()
+static INLINE void fx_or_r11()
{
FX_OR(11);
}
-static inline void fx_or_r12()
+static INLINE void fx_or_r12()
{
FX_OR(12);
}
-static inline void fx_or_r13()
+static INLINE void fx_or_r13()
{
FX_OR(13);
}
-static inline void fx_or_r14()
+static INLINE void fx_or_r14()
{
FX_OR(14);
}
-static inline void fx_or_r15()
+static INLINE void fx_or_r15()
{
FX_OR(15);
}
@@ -2689,63 +2691,63 @@ static inline void fx_or_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_xor_r1()
+static INLINE void fx_xor_r1()
{
FX_XOR(1);
}
-static inline void fx_xor_r2()
+static INLINE void fx_xor_r2()
{
FX_XOR(2);
}
-static inline void fx_xor_r3()
+static INLINE void fx_xor_r3()
{
FX_XOR(3);
}
-static inline void fx_xor_r4()
+static INLINE void fx_xor_r4()
{
FX_XOR(4);
}
-static inline void fx_xor_r5()
+static INLINE void fx_xor_r5()
{
FX_XOR(5);
}
-static inline void fx_xor_r6()
+static INLINE void fx_xor_r6()
{
FX_XOR(6);
}
-static inline void fx_xor_r7()
+static INLINE void fx_xor_r7()
{
FX_XOR(7);
}
-static inline void fx_xor_r8()
+static INLINE void fx_xor_r8()
{
FX_XOR(8);
}
-static inline void fx_xor_r9()
+static INLINE void fx_xor_r9()
{
FX_XOR(9);
}
-static inline void fx_xor_r10()
+static INLINE void fx_xor_r10()
{
FX_XOR(10);
}
-static inline void fx_xor_r11()
+static INLINE void fx_xor_r11()
{
FX_XOR(11);
}
-static inline void fx_xor_r12()
+static INLINE void fx_xor_r12()
{
FX_XOR(12);
}
-static inline void fx_xor_r13()
+static INLINE void fx_xor_r13()
{
FX_XOR(13);
}
-static inline void fx_xor_r14()
+static INLINE void fx_xor_r14()
{
FX_XOR(14);
}
-static inline void fx_xor_r15()
+static INLINE void fx_xor_r15()
{
FX_XOR(15);
}
@@ -2760,63 +2762,63 @@ static inline void fx_xor_r15()
TESTR14; \
CLRFLAGS
-static inline void fx_or_i1()
+static INLINE void fx_or_i1()
{
FX_OR_I(1);
}
-static inline void fx_or_i2()
+static INLINE void fx_or_i2()
{
FX_OR_I(2);
}
-static inline void fx_or_i3()
+static INLINE void fx_or_i3()
{
FX_OR_I(3);
}
-static inline void fx_or_i4()
+static INLINE void fx_or_i4()
{
FX_OR_I(4);
}
-static inline void fx_or_i5()
+static INLINE void fx_or_i5()
{
FX_OR_I(5);
}
-static inline void fx_or_i6()
+static INLINE void fx_or_i6()
{
FX_OR_I(6);
}
-static inline void fx_or_i7()
+static INLINE void fx_or_i7()
{
FX_OR_I(7);
}
-static inline void fx_or_i8()
+static INLINE void fx_or_i8()
{
FX_OR_I(8);
}
-static inline void fx_or_i9()
+static INLINE void fx_or_i9()
{
FX_OR_I(9);
}
-static inline void fx_or_i10()
+static INLINE void fx_or_i10()
{
FX_OR_I(10);
}
-static inline void fx_or_i11()
+static INLINE void fx_or_i11()
{
FX_OR_I(11);
}
-static inline void fx_or_i12()
+static INLINE void fx_or_i12()
{
FX_OR_I(12);
}
-static inline void fx_or_i13()
+static INLINE void fx_or_i13()
{
FX_OR_I(13);
}
-static inline void fx_or_i14()
+static INLINE void fx_or_i14()
{
FX_OR_I(14);
}
-static inline void fx_or_i15()
+static INLINE void fx_or_i15()
{
FX_OR_I(15);
}
@@ -2831,63 +2833,63 @@ static inline void fx_or_i15()
TESTR14; \
CLRFLAGS
-static inline void fx_xor_i1()
+static INLINE void fx_xor_i1()
{
FX_XOR_I(1);
}
-static inline void fx_xor_i2()
+static INLINE void fx_xor_i2()
{
FX_XOR_I(2);
}
-static inline void fx_xor_i3()
+static INLINE void fx_xor_i3()
{
FX_XOR_I(3);
}
-static inline void fx_xor_i4()
+static INLINE void fx_xor_i4()
{
FX_XOR_I(4);
}
-static inline void fx_xor_i5()
+static INLINE void fx_xor_i5()
{
FX_XOR_I(5);
}
-static inline void fx_xor_i6()
+static INLINE void fx_xor_i6()
{
FX_XOR_I(6);
}
-static inline void fx_xor_i7()
+static INLINE void fx_xor_i7()
{
FX_XOR_I(7);
}
-static inline void fx_xor_i8()
+static INLINE void fx_xor_i8()
{
FX_XOR_I(8);
}
-static inline void fx_xor_i9()
+static INLINE void fx_xor_i9()
{
FX_XOR_I(9);
}
-static inline void fx_xor_i10()
+static INLINE void fx_xor_i10()
{
FX_XOR_I(10);
}
-static inline void fx_xor_i11()
+static INLINE void fx_xor_i11()
{
FX_XOR_I(11);
}
-static inline void fx_xor_i12()
+static INLINE void fx_xor_i12()
{
FX_XOR_I(12);
}
-static inline void fx_xor_i13()
+static INLINE void fx_xor_i13()
{
FX_XOR_I(13);
}
-static inline void fx_xor_i14()
+static INLINE void fx_xor_i14()
{
FX_XOR_I(14);
}
-static inline void fx_xor_i15()
+static INLINE void fx_xor_i15()
{
FX_XOR_I(15);
}
@@ -2900,70 +2902,70 @@ static inline void fx_xor_i15()
CLRFLAGS; \
R15++
-static inline void fx_inc_r0()
+static INLINE void fx_inc_r0()
{
FX_INC(0);
}
-static inline void fx_inc_r1()
+static INLINE void fx_inc_r1()
{
FX_INC(1);
}
-static inline void fx_inc_r2()
+static INLINE void fx_inc_r2()
{
FX_INC(2);
}
-static inline void fx_inc_r3()
+static INLINE void fx_inc_r3()
{
FX_INC(3);
}
-static inline void fx_inc_r4()
+static INLINE void fx_inc_r4()
{
FX_INC(4);
}
-static inline void fx_inc_r5()
+static INLINE void fx_inc_r5()
{
FX_INC(5);
}
-static inline void fx_inc_r6()
+static INLINE void fx_inc_r6()
{
FX_INC(6);
}
-static inline void fx_inc_r7()
+static INLINE void fx_inc_r7()
{
FX_INC(7);
}
-static inline void fx_inc_r8()
+static INLINE void fx_inc_r8()
{
FX_INC(8);
}
-static inline void fx_inc_r9()
+static INLINE void fx_inc_r9()
{
FX_INC(9);
}
-static inline void fx_inc_r10()
+static INLINE void fx_inc_r10()
{
FX_INC(10);
}
-static inline void fx_inc_r11()
+static INLINE void fx_inc_r11()
{
FX_INC(11);
}
-static inline void fx_inc_r12()
+static INLINE void fx_inc_r12()
{
FX_INC(12);
}
-static inline void fx_inc_r13()
+static INLINE void fx_inc_r13()
{
FX_INC(13);
}
-static inline void fx_inc_r14()
+static INLINE void fx_inc_r14()
{
FX_INC(14);
READR14;
}
/* df - getc - transfer ROM buffer to color register */
-static inline void fx_getc()
+static INLINE void fx_getc()
{
#ifndef FX_DO_ROMBUFFER
uint8_t c;
@@ -2985,7 +2987,7 @@ static inline void fx_getc()
}
/* df(ALT2) - ramb - set current RAM bank */
-static inline void fx_ramb()
+static INLINE void fx_ramb()
{
GSU.vRamBankReg = SREG & (FX_RAM_BANKS - 1);
GSU.pvRamBank = GSU.apvRamBank[GSU.vRamBankReg & 0x3];
@@ -2994,7 +2996,7 @@ static inline void fx_ramb()
}
/* df(ALT3) - romb - set current ROM bank */
-static inline void fx_romb()
+static INLINE void fx_romb()
{
GSU.vRomBankReg = USEX8(SREG) & 0x7f;
GSU.pvRomBank = GSU.apvRomBank[GSU.vRomBankReg];
@@ -3010,70 +3012,70 @@ static inline void fx_romb()
CLRFLAGS; \
R15++
-static inline void fx_dec_r0()
+static INLINE void fx_dec_r0()
{
FX_DEC(0);
}
-static inline void fx_dec_r1()
+static INLINE void fx_dec_r1()
{
FX_DEC(1);
}
-static inline void fx_dec_r2()
+static INLINE void fx_dec_r2()
{
FX_DEC(2);
}
-static inline void fx_dec_r3()
+static INLINE void fx_dec_r3()
{
FX_DEC(3);
}
-static inline void fx_dec_r4()
+static INLINE void fx_dec_r4()
{
FX_DEC(4);
}
-static inline void fx_dec_r5()
+static INLINE void fx_dec_r5()
{
FX_DEC(5);
}
-static inline void fx_dec_r6()
+static INLINE void fx_dec_r6()
{
FX_DEC(6);
}
-static inline void fx_dec_r7()
+static INLINE void fx_dec_r7()
{
FX_DEC(7);
}
-static inline void fx_dec_r8()
+static INLINE void fx_dec_r8()
{
FX_DEC(8);
}
-static inline void fx_dec_r9()
+static INLINE void fx_dec_r9()
{
FX_DEC(9);
}
-static inline void fx_dec_r10()
+static INLINE void fx_dec_r10()
{
FX_DEC(10);
}
-static inline void fx_dec_r11()
+static INLINE void fx_dec_r11()
{
FX_DEC(11);
}
-static inline void fx_dec_r12()
+static INLINE void fx_dec_r12()
{
FX_DEC(12);
}
-static inline void fx_dec_r13()
+static INLINE void fx_dec_r13()
{
FX_DEC(13);
}
-static inline void fx_dec_r14()
+static INLINE void fx_dec_r14()
{
FX_DEC(14);
READR14;
}
/* ef - getb - get byte from ROM at address R14 */
-static inline void fx_getb()
+static INLINE void fx_getb()
{
uint32_t v;
#ifndef FX_DO_ROMBUFFER
@@ -3088,7 +3090,7 @@ static inline void fx_getb()
}
/* ef(ALT1) - getbh - get high-byte from ROM at address R14 */
-static inline void fx_getbh()
+static INLINE void fx_getbh()
{
uint32_t v;
#ifndef FX_DO_ROMBUFFER
@@ -3105,7 +3107,7 @@ static inline void fx_getbh()
}
/* ef(ALT2) - getbl - get low-byte from ROM at address R14 */
-static inline void fx_getbl()
+static INLINE void fx_getbl()
{
uint32_t v;
#ifndef FX_DO_ROMBUFFER
@@ -3121,7 +3123,7 @@ static inline void fx_getbl()
}
/* ef(ALT3) - getbs - get sign extended byte from ROM at address R14 */
-static inline void fx_getbs()
+static INLINE void fx_getbs()
{
uint32_t v;
#ifndef FX_DO_ROMBUFFER
@@ -3149,68 +3151,68 @@ static inline void fx_getbs()
GSU.avReg[reg] = v; \
CLRFLAGS
-static inline void fx_iwt_r0()
+static INLINE void fx_iwt_r0()
{
FX_IWT(0);
}
-static inline void fx_iwt_r1()
+static INLINE void fx_iwt_r1()
{
FX_IWT(1);
}
-static inline void fx_iwt_r2()
+static INLINE void fx_iwt_r2()
{
FX_IWT(2);
}
-static inline void fx_iwt_r3()
+static INLINE void fx_iwt_r3()
{
FX_IWT(3);
}
-static inline void fx_iwt_r4()
+static INLINE void fx_iwt_r4()
{
FX_IWT(4);
}
-static inline void fx_iwt_r5()
+static INLINE void fx_iwt_r5()
{
FX_IWT(5);
}
-static inline void fx_iwt_r6()
+static INLINE void fx_iwt_r6()
{
FX_IWT(6);
}
-static inline void fx_iwt_r7()
+static INLINE void fx_iwt_r7()
{
FX_IWT(7);
}
-static inline void fx_iwt_r8()
+static INLINE void fx_iwt_r8()
{
FX_IWT(8);
}
-static inline void fx_iwt_r9()
+static INLINE void fx_iwt_r9()
{
FX_IWT(9);
}
-static inline void fx_iwt_r10()
+static INLINE void fx_iwt_r10()
{
FX_IWT(10);
}
-static inline void fx_iwt_r11()
+static INLINE void fx_iwt_r11()
{
FX_IWT(11);
}
-static inline void fx_iwt_r12()
+static INLINE void fx_iwt_r12()
{
FX_IWT(12);
}
-static inline void fx_iwt_r13()
+static INLINE void fx_iwt_r13()
{
FX_IWT(13);
}
-static inline void fx_iwt_r14()
+static INLINE void fx_iwt_r14()
{
FX_IWT(14);
READR14;
}
-static inline void fx_iwt_r15()
+static INLINE void fx_iwt_r15()
{
FX_IWT(15);
}
@@ -3228,68 +3230,68 @@ static inline void fx_iwt_r15()
GSU.avReg[reg] |= USEX8(RAM(GSU.vLastRamAdr ^ 1)) << 8; \
CLRFLAGS
-static inline void fx_lm_r0()
+static INLINE void fx_lm_r0()
{
FX_LM(0);
}
-static inline void fx_lm_r1()
+static INLINE void fx_lm_r1()
{
FX_LM(1);
}
-static inline void fx_lm_r2()
+static INLINE void fx_lm_r2()
{
FX_LM(2);
}
-static inline void fx_lm_r3()
+static INLINE void fx_lm_r3()
{
FX_LM(3);
}
-static inline void fx_lm_r4()
+static INLINE void fx_lm_r4()
{
FX_LM(4);
}
-static inline void fx_lm_r5()
+static INLINE void fx_lm_r5()
{
FX_LM(5);
}
-static inline void fx_lm_r6()
+static INLINE void fx_lm_r6()
{
FX_LM(6);
}
-static inline void fx_lm_r7()
+static INLINE void fx_lm_r7()
{
FX_LM(7);
}
-static inline void fx_lm_r8()
+static INLINE void fx_lm_r8()
{
FX_LM(8);
}
-static inline void fx_lm_r9()
+static INLINE void fx_lm_r9()
{
FX_LM(9);
}
-static inline void fx_lm_r10()
+static INLINE void fx_lm_r10()
{
FX_LM(10);
}
-static inline void fx_lm_r11()
+static INLINE void fx_lm_r11()
{
FX_LM(11);
}
-static inline void fx_lm_r12()
+static INLINE void fx_lm_r12()
{
FX_LM(12);
}
-static inline void fx_lm_r13()
+static INLINE void fx_lm_r13()
{
FX_LM(13);
}
-static inline void fx_lm_r14()
+static INLINE void fx_lm_r14()
{
FX_LM(14);
READR14;
}
-static inline void fx_lm_r15()
+static INLINE void fx_lm_r15()
{
FX_LM(15);
}
@@ -3309,67 +3311,67 @@ static inline void fx_lm_r15()
CLRFLAGS; \
R15++
-static inline void fx_sm_r0()
+static INLINE void fx_sm_r0()
{
FX_SM(0);
}
-static inline void fx_sm_r1()
+static INLINE void fx_sm_r1()
{
FX_SM(1);
}
-static inline void fx_sm_r2()
+static INLINE void fx_sm_r2()
{
FX_SM(2);
}
-static inline void fx_sm_r3()
+static INLINE void fx_sm_r3()
{
FX_SM(3);
}
-static inline void fx_sm_r4()
+static INLINE void fx_sm_r4()
{
FX_SM(4);
}
-static inline void fx_sm_r5()
+static INLINE void fx_sm_r5()
{
FX_SM(5);
}
-static inline void fx_sm_r6()
+static INLINE void fx_sm_r6()
{
FX_SM(6);
}
-static inline void fx_sm_r7()
+static INLINE void fx_sm_r7()
{
FX_SM(7);
}
-static inline void fx_sm_r8()
+static INLINE void fx_sm_r8()
{
FX_SM(8);
}
-static inline void fx_sm_r9()
+static INLINE void fx_sm_r9()
{
FX_SM(9);
}
-static inline void fx_sm_r10()
+static INLINE void fx_sm_r10()
{
FX_SM(10);
}
-static inline void fx_sm_r11()
+static INLINE void fx_sm_r11()
{
FX_SM(11);
}
-static inline void fx_sm_r12()
+static INLINE void fx_sm_r12()
{
FX_SM(12);
}
-static inline void fx_sm_r13()
+static INLINE void fx_sm_r13()
{
FX_SM(13);
}
-static inline void fx_sm_r14()
+static INLINE void fx_sm_r14()
{
FX_SM(14);
}
-static inline void fx_sm_r15()
+static INLINE void fx_sm_r15()
{
FX_SM(15);
}
diff --git a/source/gfx.c b/source/gfx.c
index 5694be6..e28c4f3 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -10,6 +10,8 @@
#include "apu.h"
#include "cheats.h"
+#include <retro_inline.h>
+
#define M7 19
void ComputeClipWindows();
@@ -165,6 +167,7 @@ void DrawLargePixel16Sub1_2(uint32_t Tile, int32_t Offset,
bool S9xInitGFX()
{
+ uint32_t r, g, b;
uint32_t PixelOdd = 1;
uint32_t PixelEven = 2;
@@ -297,7 +300,6 @@ bool S9xInitGFX()
}
return (false);
}
- uint32_t r, g, b;
// Build a lookup table that multiplies a packed RGB value by 2 with
// saturation.
@@ -556,7 +558,7 @@ void S9xEndScreenRefresh()
CPU.SRAMModified = false;
}
-static inline void SelectTileRenderer(bool normal)
+static INLINE void SelectTileRenderer(bool normal)
{
if (normal)
{
@@ -621,6 +623,9 @@ static inline void SelectTileRenderer(bool normal)
void S9xSetupOBJ()
{
+ int32_t Height;
+ uint8_t S;
+
int32_t SmallWidth, SmallHeight;
int32_t LargeWidth, LargeHeight;
@@ -667,24 +672,25 @@ void S9xSetupOBJ()
* normal FirstSprite, or priority is FirstSprite+Y. The first two are
* easy, the last is somewhat more ... interesting. So we split them up. */
- int32_t Height;
- uint8_t S;
-
if (!PPU.OAMPriorityRotation || !(PPU.OAMFlip & PPU.OAMAddr & 1))
{
+ int32_t Y;
+ int32_t i;
+ uint8_t FirstSprite;
/* normal case */
uint8_t LineOBJ[SNES_HEIGHT_EXTENDED];
+
memset(LineOBJ, 0, sizeof(LineOBJ));
- int32_t i;
for (i = 0; i < SNES_HEIGHT_EXTENDED; i++)
{
GFX.OBJLines[i].RTOFlags = 0;
GFX.OBJLines[i].Tiles = 34;
}
- uint8_t FirstSprite = PPU.FirstSprite;
+ FirstSprite = PPU.FirstSprite;
S = FirstSprite;
do
{
+ int32_t HPos;
if (PPU.OBJ[S].Size)
{
GFX.OBJWidths[S] = LargeWidth;
@@ -695,17 +701,17 @@ void S9xSetupOBJ()
GFX.OBJWidths[S] = SmallWidth;
Height = SmallHeight;
}
- int32_t HPos = PPU.OBJ[S].HPos;
+ HPos = PPU.OBJ[S].HPos;
if (HPos == -256) HPos = 256;
if (HPos > -GFX.OBJWidths[S] && HPos <= 256)
{
+ uint8_t line, Y;
if (HPos < 0)
GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3;
else if (HPos + GFX.OBJWidths[S] >= 257)
GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3;
else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
- 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;
@@ -732,7 +738,6 @@ void S9xSetupOBJ()
}
while (S != FirstSprite);
- int32_t Y;
for (Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++)
{
if (LineOBJ[Y] < 32) // Add the sentinel
@@ -743,6 +748,7 @@ void S9xSetupOBJ()
}
else
{
+ int32_t j, Y;
/* evil FirstSprite+Y case */
/* First, find out which sprites are on which lines */
@@ -755,6 +761,7 @@ void S9xSetupOBJ()
for (S = 0; S < 128; S++)
{
+ int32_t HPos;
if (PPU.OBJ[S].Size)
{
GFX.OBJWidths[S] = LargeWidth;
@@ -765,17 +772,17 @@ void S9xSetupOBJ()
GFX.OBJWidths[S] = SmallWidth;
Height = SmallHeight;
}
- int32_t HPos = PPU.OBJ[S].HPos;
+ HPos = PPU.OBJ[S].HPos;
if (HPos == -256) HPos = 256;
if (HPos > -GFX.OBJWidths[S] && HPos <= 256)
{
+ uint8_t line, Y;
if (HPos < 0)
GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3;
else if (HPos + GFX.OBJWidths[S] >= 257)
GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3;
else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
- 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;
@@ -797,7 +804,6 @@ void S9xSetupOBJ()
}
/* Now go through and pull out those OBJ that are actually visible. */
- int32_t j, Y;
for (Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++)
{
GFX.OBJLines[Y].RTOFlags = Y ? GFX.OBJLines[Y - 1].RTOFlags : 0;
@@ -835,6 +841,14 @@ void S9xSetupOBJ()
static void DrawOBJS(bool OnMain, uint8_t D)
{
+ int32_t clipcount;
+ struct
+ {
+ uint16_t Pos;
+ bool Value;
+ } Windows[7];
+ uint32_t Y, Offset;
+
BG.BitShift = 4;
BG.TileShift = 5;
BG.TileAddress = PPU.OBJNameBase;
@@ -848,13 +862,7 @@ static void DrawOBJS(bool OnMain, uint8_t D)
GFX.PixSize = 1;
- struct
- {
- uint16_t Pos;
- bool Value;
- } Windows[7];
-
- int32_t clipcount = GFX.pCurrentClip->Count [4];
+ clipcount = GFX.pCurrentClip->Count [4];
if (!clipcount)
{
Windows[0].Pos = 0;
@@ -866,14 +874,14 @@ static void DrawOBJS(bool OnMain, uint8_t D)
}
else
{
+ int32_t clip, i;
Windows[0].Pos = 1000;
Windows[0].Value = false;
- int32_t clip, i;
for (clip = 0, i = 1; clip < clipcount; clip++)
{
+ int32_t j;
if (GFX.pCurrentClip->Right[clip][4] <= GFX.pCurrentClip->Left[clip][4])
continue;
- int32_t 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;
@@ -924,7 +932,6 @@ static void DrawOBJS(bool OnMain, uint8_t D)
GFX.Z1 = D + 2;
- uint32_t Y, Offset;
for (Y = GFX.StartY, Offset = Y * GFX.PPL; Y <= GFX.EndY;
Y++, Offset += GFX.PPL)
{
@@ -934,6 +941,15 @@ static void DrawOBJS(bool OnMain, uint8_t D)
for (S = GFX.OBJLines[Y].OBJ[I].Sprite; S >= 0
&& I < 32; S = GFX.OBJLines[Y].OBJ[++I].Sprite)
{
+ int32_t TileInc = 1;
+ int32_t TileLine;
+ int32_t TileX;
+ int32_t BaseTile;
+ bool WinStat = true;
+ int32_t WinIdx = 0, NextPos = -1000;
+ int32_t t, O;
+ int32_t X;
+
tiles += GFX.OBJVisibleTiles[S];
if (tiles <= 0)
continue;
@@ -941,11 +957,10 @@ static void DrawOBJS(bool OnMain, uint8_t D)
if (OnMain && SUB_OR_ADD(4))
SelectTileRenderer(!GFX.Pseudo && PPU.OBJ [S].Palette < 4);
- int32_t BaseTile = (((GFX.OBJLines[Y].OBJ[I].Line << 1) + (PPU.OBJ[S].Name & 0xf0))
+ BaseTile = (((GFX.OBJLines[Y].OBJ[I].Line << 1) + (PPU.OBJ[S].Name & 0xf0))
& 0xf0) | (PPU.OBJ[S].Name & 0x100) | (PPU.OBJ[S].Palette << 10);
- int32_t TileX = PPU.OBJ[S].Name & 0x0f;
- int32_t TileLine = (GFX.OBJLines[Y].OBJ[I].Line & 7) * 8;
- int32_t TileInc = 1;
+ TileX = PPU.OBJ[S].Name & 0x0f;
+ TileLine = (GFX.OBJLines[Y].OBJ[I].Line & 7) * 8;
if (PPU.OBJ[S].HFlip)
{
@@ -956,11 +971,8 @@ static void DrawOBJS(bool OnMain, uint8_t D)
GFX.Z2 = (PPU.OBJ[S].Priority + 1) * 4 + D;
- bool WinStat = true;
- int32_t WinIdx = 0, NextPos = -1000;
- int32_t X = PPU.OBJ[S].HPos;
+ X = PPU.OBJ[S].HPos;
if (X == -256) X = 256;
- int32_t t, O;
for (t = tiles, O = Offset + X * GFX.PixSize; X <= 256
&& X < PPU.OBJ[S].HPos + GFX.OBJWidths[S];
TileX = (TileX + TileInc) & 0x0f, X += 8, O += 8 * GFX.PixSize)
@@ -1000,12 +1012,21 @@ static void DrawOBJS(bool OnMain, uint8_t D)
static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{
+ uint32_t Lines;
+ uint32_t OffsetMask;
+ uint32_t OffsetShift;
+ uint32_t Y;
+ int32_t m5;
+
uint32_t Tile;
uint16_t* SC0;
uint16_t* SC1;
uint16_t* SC2;
uint16_t* SC3;
- uint8_t depths [2] = {Z1, Z2};
+ uint8_t depths [2];
+
+ depths[0] = Z1;
+ depths[1] = Z2;
if (BGMode == 0)
BG.StartPalette = bg << 5;
@@ -1040,10 +1061,6 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
- uint32_t Lines;
- uint32_t OffsetMask;
- uint32_t OffsetShift;
-
if (BG.TileSize == 16)
{
OffsetMask = 0x3ff;
@@ -1055,11 +1072,20 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
OffsetShift = 3;
}
- int32_t m5 = (BGMode == 5 || BGMode == 6) ? 1 : 0;
+ m5 = (BGMode == 5 || BGMode == 6) ? 1 : 0;
- uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y += Lines)
{
+ uint16_t* b1;
+ uint16_t* b2;
+ uint32_t MosaicLine;
+ uint32_t VirtAlign;
+ uint32_t ScreenLine, Rem16;
+ uint16_t* t;
+ uint32_t Left = 0;
+ uint32_t Right;
+ uint32_t clip;
+ uint32_t ClipCount, HPos, PixWidth;
uint32_t VOffset = LineData [Y].BG[bg].VOffset;
uint32_t HOffset = LineData [Y].BG[bg].HOffset;
uint32_t MosaicOffset = Y % PPU.Mosaic;
@@ -1069,17 +1095,14 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
(HOffset != LineData [Y + Lines].BG[bg].HOffset))
break;
- uint32_t MosaicLine = VOffset + Y - MosaicOffset;
+ MosaicLine = VOffset + Y - MosaicOffset;
if (Y + Lines > GFX.EndY)
Lines = GFX.EndY + 1 - Y;
- uint32_t VirtAlign = (MosaicLine & 7) << 3;
-
- uint16_t* b1;
- uint16_t* b2;
+ VirtAlign = (MosaicLine & 7) << 3;
- uint32_t ScreenLine = MosaicLine >> OffsetShift;
- uint32_t Rem16 = MosaicLine & 15;
+ ScreenLine = MosaicLine >> OffsetShift;
+ Rem16 = MosaicLine & 15;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -1088,34 +1111,31 @@ static void DrawBackgroundMosaic(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
b1 += (ScreenLine & 0x1f) << 5;
b2 += (ScreenLine & 0x1f) << 5;
- uint16_t* t;
- uint32_t Left = 0;
- uint32_t Right = 256 << m5;
+ Right = 256 << m5;
HOffset <<= m5;
- uint32_t ClipCount = GFX.pCurrentClip->Count [bg];
- uint32_t HPos = HOffset;
- uint32_t PixWidth = (PPU.Mosaic << m5);
-
+ ClipCount = GFX.pCurrentClip->Count [bg];
+ HPos = HOffset;
+ PixWidth = (PPU.Mosaic << m5);
if (!ClipCount)
ClipCount = 1;
- uint32_t clip;
for (clip = 0; clip < ClipCount; clip++)
{
+ uint32_t s, x;
if (GFX.pCurrentClip->Count [bg])
{
+ uint32_t r;
Left = GFX.pCurrentClip->Left [clip][bg] << m5;
Right = GFX.pCurrentClip->Right [clip][bg] << m5;
- uint32_t r = Left % (PPU.Mosaic << m5);
+ r = Left % (PPU.Mosaic << m5);
HPos = HOffset + Left;
PixWidth = (PPU.Mosaic << m5) - r;
}
- uint32_t s = Y * GFX.PPL + Left * GFX.PixSize;
- uint32_t x;
+ s = Y * GFX.PPL + Left * GFX.PixSize;
for (x = Left; x < Right; x += PixWidth,
s += (IPPU.HalfWidthPixels ? PixWidth >> 1 : PixWidth) * GFX.PixSize,
HPos += PixWidth, PixWidth = (PPU.Mosaic << m5))
@@ -1239,6 +1259,11 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
uint16_t* BPS2;
uint16_t* BPS3;
uint32_t Width;
+ uint32_t Y;
+ int32_t OffsetEnableMask;
+ static const int32_t Lines = 1;
+ int32_t OffsetMask;
+ int32_t OffsetShift;
int32_t VOffsetOffset = BGMode == 4 ? 0 : 32;
uint8_t depths [2] = {Z1, Z2};
@@ -1289,11 +1314,7 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
-
- static const int32_t Lines = 1;
- int32_t OffsetMask;
- int32_t OffsetShift;
- int32_t OffsetEnableMask = 1 << (bg + 13);
+ OffsetEnableMask = 1 << (bg + 13);
if (BG.TileSize == 16)
{
@@ -1306,7 +1327,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
OffsetShift = 3;
}
- uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y++)
{
uint32_t VOff = LineData [Y].BG[2].VOffset - 1;
@@ -1319,6 +1339,8 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
uint16_t* s0;
uint16_t* s1;
uint16_t* s2;
+ int32_t clipcount;
+ int32_t clip;
if (ScreenLine & 0x20)
s1 = BPS2, s2 = BPS3;
@@ -1341,15 +1363,30 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
VOffsetOffset = 32;
}
- int32_t clipcount = GFX.pCurrentClip->Count [bg];
+ clipcount = GFX.pCurrentClip->Count [bg];
if (!clipcount)
clipcount = 1;
- int32_t clip;
for (clip = 0; clip < clipcount; clip++)
{
uint32_t Left;
uint32_t Right;
+ uint32_t VOffset;
+ uint32_t 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 LineHOffset, s;
+ bool left_hand_edge;
if (!GFX.pCurrentClip->Count [bg])
{
@@ -1365,26 +1402,11 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
continue;
}
- uint32_t VOffset;
- uint32_t HOffset;
- 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;
+ LineHOffset = LineData [Y].BG[bg].HOffset;
+ s = Left * GFX.PixSize + Y * GFX.PPL;
+ left_hand_edge = (Left == 0);
+ Width = Right - Left;
if (Left & 7)
MaxCount = 8 - (Left & 7);
@@ -1539,21 +1561,28 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
{
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint32_t Width;
+ int32_t Lines;
+ int32_t VOffsetShift;
+ int32_t Y;
+ int32_t endy;
+ uint8_t depths[2];
+
if (IPPU.Interlace)
{
GFX.Pitch = GFX.RealPitch;
GFX.PPL = GFX.PPLx2 >> 1;
}
GFX.PixSize = 1;
- uint8_t depths [2] = {Z1, Z2};
- uint32_t Tile;
- uint16_t* SC0;
- uint16_t* SC1;
- uint16_t* SC2;
- uint16_t* SC3;
- uint32_t Width;
+ depths[0] = Z1;
+ depths[1] = Z2;
BG.StartPalette = 0;
SC0 = (uint16_t*) &Memory.VRAM[PPU.BG[bg].SCBase << 1];
@@ -1581,18 +1610,24 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
- int32_t Lines;
- int32_t VOffsetShift;
-
if (BG.TileSize == 16)
VOffsetShift = 4;
else
VOffsetShift = 3;
- int32_t endy = IPPU.Interlace ? 1 + (GFX.EndY << 1) : GFX.EndY;
- int32_t Y;
+ endy = IPPU.Interlace ? 1 + (GFX.EndY << 1) : GFX.EndY;
+
for (Y = IPPU.Interlace ? GFX.StartY << 1 : GFX.StartY; Y <= endy; Y += Lines)
{
+ int32_t ScreenLine;
+ int32_t t1;
+ int32_t t2;
+ uint16_t* b1;
+ uint16_t* b2;
+
+ int32_t clipcount;
+ int32_t clip;
+
int32_t y = IPPU.Interlace ? (Y >> 1) : Y;
uint32_t VOffset = LineData [y].BG[bg].VOffset;
uint32_t HOffset = LineData [y].BG[bg].HOffset;
@@ -1608,9 +1643,8 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
Lines = endy + 1 - Y;
VirtAlign <<= 3;
- int32_t ScreenLine = (VOffset + Y) >> VOffsetShift;
- int32_t t1;
- int32_t t2;
+ ScreenLine = (VOffset + Y) >> VOffsetShift;
+
if (((VOffset + Y) & 15) > 7)
{
t1 = 16;
@@ -1621,8 +1655,6 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
t1 = 0;
t2 = 16;
}
- uint16_t* b1;
- uint16_t* b2;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -1632,15 +1664,20 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
b1 += (ScreenLine & 0x1f) << 5;
b2 += (ScreenLine & 0x1f) << 5;
- int32_t clipcount = GFX.pCurrentClip->Count [bg];
+ clipcount = GFX.pCurrentClip->Count [bg];
if (!clipcount)
clipcount = 1;
- int32_t clip;
for (clip = 0; clip < clipcount; clip++)
{
+ int32_t C;
+ uint32_t Count = 0;
+ uint16_t* t;
int32_t Left;
int32_t Right;
+ uint32_t s;
+ int32_t Middle;
+ uint32_t HPos, Quot;
if (!GFX.pCurrentClip->Count [bg])
{
@@ -1656,13 +1693,11 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
continue;
}
- uint32_t s = (IPPU.HalfWidthPixels ? Left >> 1 : Left) * GFX.PixSize + Y * GFX.PPL;
- uint32_t HPos = (HOffset + Left * GFX.PixSize) & 0x3ff;
+ s = (IPPU.HalfWidthPixels ? Left >> 1 : Left) * GFX.PixSize + Y * GFX.PPL;
+ HPos = (HOffset + Left * GFX.PixSize) & 0x3ff;
- uint32_t Quot = HPos >> 3;
- uint32_t Count = 0;
+ Quot = HPos >> 3;
- uint16_t* t;
if (Quot > 63)
t = b2 + ((Quot >> 1) & 0x1f);
else
@@ -1737,10 +1772,9 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
// Middle, unclipped tiles
Count = Width - Count;
- int32_t Middle = Count >> 3;
+ Middle = Count >> 3;
Count &= 7;
- int32_t C;
for (C = Middle; C > 0; s += (IPPU.HalfWidthPixels ? 4 : 8), Quot++, C--)
{
Tile = READ_2BYTES(t);
@@ -1857,6 +1891,19 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{
+ uint32_t Tile;
+ uint16_t* SC0;
+ uint16_t* SC1;
+ uint16_t* SC2;
+ uint16_t* SC3;
+ uint32_t Width;
+ uint8_t depths[2];
+ uint32_t Y;
+ int32_t Lines;
+ int32_t OffsetMask;
+ int32_t OffsetShift;
+
+
GFX.PixSize = 1;
BG.TileSize = BGSizes [PPU.BG[bg].BGSize];
@@ -1889,13 +1936,8 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
return;
}
- uint32_t Tile;
- uint16_t* SC0;
- uint16_t* SC1;
- uint16_t* SC2;
- uint16_t* SC3;
- uint32_t Width;
- uint8_t depths [2] = {Z1, Z2};
+ depths [0] = Z1;
+ depths [1] = Z2;
if (BGMode == 0)
BG.StartPalette = bg << 5;
@@ -1927,10 +1969,6 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
if (((uint8_t*)SC3 - Memory.VRAM) >= 0x10000)
SC3 -= 0x08000;
- int32_t Lines;
- int32_t OffsetMask;
- int32_t OffsetShift;
-
if (BG.TileSize == 16)
{
OffsetMask = 0x3ff;
@@ -1942,9 +1980,15 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
OffsetShift = 3;
}
- uint32_t Y;
for (Y = GFX.StartY; Y <= GFX.EndY; Y += Lines)
{
+ uint32_t ScreenLine;
+ uint32_t t1;
+ uint32_t t2;
+ uint16_t* b1;
+ uint16_t* b2;
+ int32_t clip;
+ int32_t clipcount;
uint32_t VOffset = LineData [Y].BG[bg].VOffset;
uint32_t HOffset = LineData [Y].BG[bg].HOffset;
int32_t VirtAlign = (Y + VOffset) & 7;
@@ -1959,9 +2003,8 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
VirtAlign <<= 3;
- uint32_t ScreenLine = (VOffset + Y) >> OffsetShift;
- uint32_t t1;
- uint32_t t2;
+ ScreenLine = (VOffset + Y) >> OffsetShift;
+
if (((VOffset + Y) & 15) > 7)
{
t1 = 16;
@@ -1972,8 +2015,6 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
t1 = 0;
t2 = 16;
}
- uint16_t* b1;
- uint16_t* b2;
if (ScreenLine & 0x20)
b1 = SC2, b2 = SC3;
@@ -1983,14 +2024,18 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
b1 += (ScreenLine & 0x1f) << 5;
b2 += (ScreenLine & 0x1f) << 5;
- int32_t clipcount = GFX.pCurrentClip->Count [bg];
+ clipcount = GFX.pCurrentClip->Count [bg];
if (!clipcount)
clipcount = 1;
- int32_t clip;
for (clip = 0; clip < clipcount; clip++)
{
uint32_t Left;
uint32_t Right;
+ uint32_t Count = 0;
+ uint16_t* t;
+ uint32_t s, HPos, Quot;
+ int32_t C;
+ int32_t Middle;
if (!GFX.pCurrentClip->Count [bg])
{
@@ -2006,13 +2051,12 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
continue;
}
- uint32_t s = Left * GFX.PixSize + Y * GFX.PPL;
- uint32_t HPos = (HOffset + Left) & OffsetMask;
- uint32_t Quot = HPos >> 3;
- uint32_t Count = 0;
+ s = Left * GFX.PixSize + Y * GFX.PPL;
+ HPos = (HOffset + Left) & OffsetMask;
+
+ Quot = HPos >> 3;
- uint16_t* t;
if (BG.TileSize == 8)
{
if (Quot > 31)
@@ -2098,9 +2142,8 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
// Middle, unclipped tiles
Count = Width - Count;
- int32_t Middle = Count >> 3;
+ Middle = Count >> 3;
Count &= 7;
- int32_t C;
for (C = Middle; C > 0;
s += (IPPU.HalfWidthPixels ? 4 : 8) * GFX.PixSize, Quot++, C--)
{
@@ -2210,10 +2253,21 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
}
#define RENDER_BACKGROUND_MODE7(TYPE,FUNC) \
+ uint32_t clip; \
+ int32_t aa, cc; \
+ int32_t dir; \
+ int32_t startx, endx; \
+ uint32_t Left = 0; \
+ uint32_t Right = 256; \
+ uint32_t ClipCount; \
uint16_t *ScreenColors = IPPU.ScreenColors; \
+ uint8_t *VRAM1; \
+ uint32_t Line; \
+ uint8_t *Depth; \
+ SLineMatrixData *l; \
(void)ScreenColors; \
\
- uint8_t *VRAM1 = Memory.VRAM + 1; \
+ VRAM1 = Memory.VRAM + 1; \
if (GFX.r2130 & 1) \
{ \
if (IPPU.DirectColourMapsNeedRebuild) \
@@ -2221,24 +2275,19 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
ScreenColors = DirectColourMaps [0]; \
} \
\
- int32_t aa, cc; \
- int32_t dir; \
- int32_t startx, endx; \
- uint32_t Left = 0; \
- uint32_t Right = 256; \
- uint32_t ClipCount = GFX.pCurrentClip->Count [bg]; \
+ ClipCount = GFX.pCurrentClip->Count [bg]; \
\
if (!ClipCount) \
ClipCount = 1; \
\
Screen += GFX.StartY * GFX.Pitch; \
- uint8_t *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
- SLineMatrixData *l = &LineMatrixData [GFX.StartY]; \
+ Depth = GFX.DB + GFX.StartY * GFX.PPL; \
+ l = &LineMatrixData [GFX.StartY]; \
\
- uint32_t Line; \
for (Line = GFX.StartY; Line <= GFX.EndY; Line++, Screen += GFX.Pitch, Depth += GFX.PPL, l++) \
{ \
int32_t yy; \
+ int32_t BB,DD; \
\
int32_t HOffset = ((int32_t) LineData [Line].BG[0].HOffset << M7) >> M7; \
int32_t VOffset = ((int32_t) LineData [Line].BG[0].VOffset << M7) >> M7; \
@@ -2253,12 +2302,14 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
\
yy += CLIP_10_BIT_SIGNED(VOffset - CentreY); \
\
- int32_t BB = l->MatrixB * yy + (CentreX << 8); \
- int32_t DD = l->MatrixD * yy + (CentreY << 8); \
+ BB = l->MatrixB * yy + (CentreX << 8); \
+ DD = l->MatrixD * yy + (CentreY << 8); \
\
- uint32_t clip; \
for (clip = 0; clip < ClipCount; clip++) \
{ \
+ TYPE *p; \
+ uint8_t *d; \
+ int32_t xx, AA, CC; \
if (GFX.pCurrentClip->Count [bg]) \
{ \
Left = GFX.pCurrentClip->Left [clip][bg]; \
@@ -2266,8 +2317,8 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
if (Right <= Left) \
continue; \
} \
- TYPE *p = (TYPE *) Screen + Left; \
- uint8_t *d = Depth + Left; \
+ p = (TYPE *) Screen + Left; \
+ d = Depth + Left; \
\
if (PPU.Mode7HFlip) \
{ \
@@ -2286,9 +2337,9 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
cc = l->MatrixC; \
} \
\
- int32_t xx = startx + CLIP_10_BIT_SIGNED(HOffset - CentreX); \
- int32_t AA = l->MatrixA * xx; \
- int32_t CC = l->MatrixC * xx; \
+ xx = startx + CLIP_10_BIT_SIGNED(HOffset - CentreX); \
+ AA = l->MatrixA * xx; \
+ CC = l->MatrixC * xx; \
\
if (!PPU.Mode7Repeat) \
{ \
@@ -2330,9 +2381,10 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
{ \
if (PPU.Mode7Repeat == 3) \
{ \
+ uint32_t b; \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint32_t b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2401,8 +2453,20 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
}
#define RENDER_BACKGROUND_MODE7_i(TYPE,FUNC,COLORFUNC) \
+ int32_t aa, cc; \
+ uint32_t clip; \
+ int32_t dir; \
+ int32_t startx, endx; \
+ uint32_t ClipCount; \
uint16_t *ScreenColors; \
+ uint8_t *Depth; \
+ uint32_t Line; \
+ SLineMatrixData *l; \
+ uint32_t Left = 0; \
+ uint32_t Right = 256; \
+ bool allowSimpleCase = false; \
uint8_t *VRAM1 = Memory.VRAM + 1; \
+ uint32_t b; \
if (GFX.r2130 & 1) \
{ \
if (IPPU.DirectColourMapsNeedRebuild) \
@@ -2412,29 +2476,25 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
else \
ScreenColors = IPPU.ScreenColors; \
\
- int32_t aa, cc; \
- int32_t dir; \
- int32_t startx, endx; \
- uint32_t Left = 0; \
- uint32_t Right = 256; \
- uint32_t ClipCount = GFX.pCurrentClip->Count [bg]; \
+ ClipCount = GFX.pCurrentClip->Count [bg]; \
\
if (!ClipCount) \
ClipCount = 1; \
\
Screen += GFX.StartY * GFX.Pitch; \
- uint8_t *Depth = GFX.DB + GFX.StartY * GFX.PPL; \
- SLineMatrixData *l = &LineMatrixData [GFX.StartY]; \
- bool allowSimpleCase = false; \
+ Depth = GFX.DB + GFX.StartY * GFX.PPL; \
+ l = &LineMatrixData [GFX.StartY]; \
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; \
\
- uint32_t Line; \
for (Line = GFX.StartY; Line <= GFX.EndY; Line++, Screen += GFX.Pitch, Depth += GFX.PPL, l++) \
{ \
+ bool simpleCase = false; \
+ int32_t BB; \
+ int32_t DD; \
int32_t yy; \
\
int32_t HOffset = ((int32_t) LineData [Line].BG[0].HOffset << M7) >> M7; \
@@ -2450,9 +2510,6 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
\
\
yy += CLIP_10_BIT_SIGNED(VOffset - CentreY); \
- bool simpleCase = false; \
- int32_t BB; \
- int32_t DD; \
/* Make a special case for the identity matrix, since it's a common case and */ \
/* can be done much more quickly without special effects */ \
if (allowSimpleCase && !l->MatrixB && !l->MatrixC && (l->MatrixA == 0x0100) && (l->MatrixD == 0x0100)) \
@@ -2467,9 +2524,12 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
DD = l->MatrixD * yy + (CentreY << 8); \
} \
\
- uint32_t clip; \
for (clip = 0; clip < ClipCount; clip++) \
{ \
+ TYPE *p; \
+ uint8_t *d; \
+ int32_t xx; \
+ int32_t AA, CC = 0; \
if (GFX.pCurrentClip->Count [bg]) \
{ \
Left = GFX.pCurrentClip->Left [clip][bg]; \
@@ -2477,8 +2537,8 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
if (Right <= Left) \
continue; \
} \
- TYPE *p = (TYPE *) Screen + Left; \
- uint8_t *d = Depth + Left; \
+ p = (TYPE *) Screen + Left; \
+ d = Depth + Left; \
\
if (PPU.Mode7HFlip) \
{ \
@@ -2496,10 +2556,8 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
aa = l->MatrixA; \
cc = l->MatrixC; \
} \
- int32_t xx; \
\
xx = startx + CLIP_10_BIT_SIGNED(HOffset - CentreX); \
- int32_t AA, CC = 0; \
if (simpleCase) \
{ \
AA = xx << 8; \
@@ -2519,7 +2577,7 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
int32_t X = ((AA + BB) >> 8) & 0x3ff; \
int32_t Y = (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)); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2541,7 +2599,7 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
if (((X | Y) & ~0x3ff) == 0) \
{ \
uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2552,10 +2610,12 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
} \
else if (PPU.Mode7Repeat == 3) \
{ \
+ uint8_t *TileData; \
+ uint32_t b; \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
@@ -2593,35 +2653,37 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
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)); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
+ uint32_t p1, p2, p3, p4; \
+ uint32_t Xdel, Ydel, XY, area1, area2, area3, area4, tempColor; \
/* X10 and Y01 are the X and Y coordinates of the next source point over. */ \
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 = COLORFUNC; \
p1 = (p1 & FIRST_THIRD_COLOR_MASK) | ((p1 & SECOND_COLOR_MASK) << 16); \
b = *(TileData10 + ((Y & 7) << 4) + ((X10 & 7) << 1)); \
- uint32_t p2 = COLORFUNC; \
+ p2 = COLORFUNC; \
p2 = (p2 & FIRST_THIRD_COLOR_MASK) | ((p2 & SECOND_COLOR_MASK) << 16); \
b = *(TileData11 + ((Y01 & 7) << 4) + ((X10 & 7) << 1)); \
- uint32_t p4 = COLORFUNC; \
+ p4 = COLORFUNC; \
p4 = (p4 & FIRST_THIRD_COLOR_MASK) | ((p4 & SECOND_COLOR_MASK) << 16); \
b = *(TileData01 + ((Y01 & 7) << 4) + ((X & 7) << 1)); \
- uint32_t p3 = COLORFUNC; \
+ p3 = COLORFUNC; \
p3 = (p3 & FIRST_THIRD_COLOR_MASK) | ((p3 & SECOND_COLOR_MASK) << 16); \
/* Xdel, Ydel: position (in 1/32nds) between the points */ \
- 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; \
+ Xdel = (xPos >> 3) & 0x1F; \
+ Ydel = (yPos >> 3) & 0x1F; \
+ XY = (Xdel*Ydel) >> 5; \
+ area1 = 0x20 + XY - Xdel - Ydel; \
+ area2 = Xdel - XY; \
+ area3 = Ydel - XY; \
+ area4 = XY; \
if(PPU.Mode7HFlip){ \
uint32_t tmp=area1; area1=area2; area2=tmp; \
tmp=area3; area3=area4; area4=tmp; \
@@ -2630,7 +2692,7 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
uint32_t tmp=area1; area1=area3; area3=tmp; \
tmp=area2; area2=area4; area4=tmp; \
} \
- uint32_t tempColor = ((area1 * p1) + \
+ tempColor = ((area1 * p1) + \
(area2 * p2) + \
(area3 * p3) + \
(area4 * p4)) >> 5; \
@@ -2645,6 +2707,8 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
/* in the _displayed_ image, and average them. It's sharp and clean, but */ \
/* gives the usual huge pixels when the source image gets "close." */ \
{ \
+ uint32_t BB10, BB01, BB11, DD10, DD01, DD11; \
+ int32_t x; \
/* Find the dimensions of the square in the source image whose corners will be examined. */ \
uint32_t aaDelX = aa >> 1; \
uint32_t ccDelX = cc >> 1; \
@@ -2656,22 +2720,22 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
DD -= (ddDelY >> 1); \
AA -= (aaDelX >> 1); \
CC -= (ccDelX >> 1); \
- 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; \
- int32_t x; \
+ BB10 = BB + aaDelX; \
+ BB01 = BB + bbDelY; \
+ BB11 = BB + aaDelX + bbDelY; \
+ DD10 = DD + ccDelX; \
+ DD01 = DD + ddDelY; \
+ DD11 = DD + ccDelX + ddDelY; \
for (x = startx; x != endx; x += dir, AA += aa, CC += cc, p++, d++) \
{ \
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)); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
+ TYPE p1, p2, p3, p4, theColor; \
/* X, Y, X10, Y10, etc. are the coordinates of the four pixels within the */ \
/* source image that we're going to examine. */ \
uint32_t X10 = ((AA + BB10) >> 8) & 0x3ff; \
@@ -2683,14 +2747,14 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
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; \
+ p1 = COLORFUNC; \
b = *(TileData10 + ((Y10 & 7) << 4) + ((X10 & 7) << 1)); \
- TYPE p2 = COLORFUNC; \
+ p2 = COLORFUNC; \
b = *(TileData01 + ((Y01 & 7) << 4) + ((X01 & 7) << 1)); \
- TYPE p3 = COLORFUNC; \
+ p3 = COLORFUNC; \
b = *(TileData11 + ((Y11 & 7) << 4) + ((X11 & 7) << 1)); \
- TYPE p4 = COLORFUNC; \
- TYPE theColor = Q_INTERPOLATE(p1, p2, p3, p4); \
+ p4 = COLORFUNC; \
+ theColor = Q_INTERPOLATE(p1, p2, p3, p4); \
*p = (FUNC) | ALPHA_BITS_MASK; \
*d = GFX.Z1; \
} \
@@ -2713,40 +2777,44 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
if (((X | Y) & ~0x3ff) == 0) \
{ \
uint8_t *TileData = VRAM1 + (Memory.VRAM[((Y & ~7) << 5) + ((X >> 2) & ~1)] << 7); \
- uint32_t b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ b = *(TileData + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
+ uint32_t p1, p2, p4, p3; \
+ uint32_t Xdel, Ydel, XY, area1, area2, area3, area4; \
+ uint32_t tempColor; \
+ TYPE theColor; \
/* X10 and Y01 are the X and Y coordinates of the next source point over. */ \
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 = COLORFUNC; \
p1 = (p1 & FIRST_THIRD_COLOR_MASK) | ((p1 & SECOND_COLOR_MASK) << 16); \
b = *(TileData10 + ((Y & 7) << 4) + ((X10 & 7) << 1)); \
- uint32_t p2 = COLORFUNC; \
+ p2 = COLORFUNC; \
p2 = (p2 & FIRST_THIRD_COLOR_MASK) | ((p2 & SECOND_COLOR_MASK) << 16); \
b = *(TileData11 + ((Y01 & 7) << 4) + ((X10 & 7) << 1)); \
- uint32_t p4 = COLORFUNC; \
+ p4 = COLORFUNC; \
p4 = (p4 & FIRST_THIRD_COLOR_MASK) | ((p4 & SECOND_COLOR_MASK) << 16); \
b = *(TileData01 + ((Y01 & 7) << 4) + ((X & 7) << 1)); \
- uint32_t p3 = COLORFUNC; \
+ p3 = COLORFUNC; \
p3 = (p3 & FIRST_THIRD_COLOR_MASK) | ((p3 & SECOND_COLOR_MASK) << 16); \
/* Xdel, Ydel: position (in 1/32nds) between the points */ \
- 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) + \
+ Xdel = (xPos >> 3) & 0x1F; \
+ Ydel = (yPos >> 3) & 0x1F; \
+ XY = (Xdel*Ydel) >> 5; \
+ area1 = 0x20 + XY - Xdel - Ydel; \
+ area2 = Xdel - XY; \
+ area3 = Ydel - XY; \
+ area4 = XY; \
+ tempColor = ((area1 * p1) + \
(area2 * p2) + \
(area3 * p3) + \
(area4 * p4)) >> 5; \
- TYPE theColor = (tempColor & FIRST_THIRD_COLOR_MASK) | ((tempColor >> 16) & SECOND_COLOR_MASK); \
+ theColor = (tempColor & FIRST_THIRD_COLOR_MASK) | ((tempColor >> 16) & SECOND_COLOR_MASK); \
*p = (FUNC) | ALPHA_BITS_MASK; \
*d = GFX.Z1; \
} \
@@ -2757,7 +2825,7 @@ static void DrawBGMode7Background16Sub1_2(uint8_t* Screen, int32_t bg)
{ \
X = (x + HOffset) & 7; \
Y = (yy + CentreY) & 7; \
- uint32_t b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
+ b = *(VRAM1 + ((Y & 7) << 4) + ((X & 7) << 1)); \
GFX.Z1 = Mode7Depths [(b & GFX.Mode7PriorityMask) >> 7]; \
if (GFX.Z1 > *d && (b & GFX.Mode7Mask) ) \
{ \
diff --git a/source/gfx.h b/source/gfx.h
index c6b01cc..1b4cc6a 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -7,6 +7,8 @@
#include "ppu.h"
#include "snes9x.h"
+#include <retro_inline.h>
+
void S9xStartScreenRefresh(void);
void S9xDrawScanLine(uint8_t Line);
void S9xEndScreenRefresh(void);
@@ -145,7 +147,7 @@ extern uint8_t mul_brightness [16][32];
#define SUB_SCREEN_DEPTH 0
#define MAIN_SCREEN_DEPTH 32
-static inline uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
+static INLINE uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
{
if (C1 == 0)
return C2;
diff --git a/source/port.h b/source/port.h
index 12d210c..3d96509 100644
--- a/source/port.h
+++ b/source/port.h
@@ -6,6 +6,7 @@
#include <limits.h>
#include <string.h>
#include <sys/types.h>
+#include <retro_inline.h>
#ifdef PSP
#define PIXEL_FORMAT BGR555
@@ -23,11 +24,25 @@
#define PATH_MAX 1024
#endif
+#ifndef _MAX_DIR
#define _MAX_DIR PATH_MAX
+#endif
+
+#ifndef _MAX_DRIVE
#define _MAX_DRIVE 1
+#endif
+
+#ifndef _MAX_FNAME
#define _MAX_FNAME PATH_MAX
+#endif
+
+#ifndef _MAX_EXT
#define _MAX_EXT PATH_MAX
+#endif
+
+#ifndef _MAX_PATH
#define _MAX_PATH PATH_MAX
+#endif
void _makepath(char* path, const char* drive, const char* dir, const char* fname, const char* ext);
void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext);
@@ -55,7 +70,7 @@ void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext
#define MAX(A,B) ((A) > (B) ? (A) : (B))
/* Integer square root by Halleck's method, with Legalize's speedup */
-static inline int32_t _isqrt(int32_t val)
+static INLINE int32_t _isqrt(int32_t val)
{
int32_t squaredbit, remainder, root;
diff --git a/source/ppu.h b/source/ppu.h
index d700497..ba1a857 100644
--- a/source/ppu.h
+++ b/source/ppu.h
@@ -1,8 +1,9 @@
-#include "../copyright"
-
#ifndef _PPU_H_
#define _PPU_H_
+#include "../copyright"
+#include <retro_inline.h>
+
#define FIRST_VISIBLE_LINE 1
extern uint8_t GetBank;
@@ -199,20 +200,20 @@ typedef struct
bool FirstLine;
} SDMA;
-void S9xUpdateScreen();
-void S9xResetPPU();
-void S9xSoftResetPPU();
-void S9xFixColourBrightness();
-void S9xUpdateJoypads();
+void S9xUpdateScreen(void);
+void S9xResetPPU(void);
+void S9xSoftResetPPU(void);
+void S9xFixColourBrightness(void);
+void S9xUpdateJoypads(void);
void S9xProcessMouse(int32_t which1);
-void S9xSuperFXExec();
+void S9xSuperFXExec(void);
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 S9xInitC4(void);
void S9xSetC4(uint8_t Byte, uint16_t Address);
uint8_t S9xGetC4(uint16_t Address);
void S9xSetC4RAM(uint8_t Byte, uint16_t Address);
@@ -241,27 +242,29 @@ extern SnesModel M2SNES;
//Platform specific input functions used by PPU.CPP
void JustifierButtons(uint32_t*);
-bool JustifierOffscreen();
+bool JustifierOffscreen(void);
-static inline void FLUSH_REDRAW()
+static INLINE void FLUSH_REDRAW(void)
{
if (IPPU.PreviousLine != IPPU.CurrentLine)
S9xUpdateScreen();
}
-static inline void REGISTER_2104(uint8_t byte)
+static INLINE void REGISTER_2104(uint8_t byte)
{
if (PPU.OAMAddr & 0x100)
{
int32_t addr = ((PPU.OAMAddr & 0x10f) << 1) + (PPU.OAMFlip & 1);
if (byte != PPU.OAMData [addr])
{
+ SOBJ* pObj = NULL;
+
FLUSH_REDRAW();
PPU.OAMData [addr] = byte;
IPPU.OBJChanged = true;
// X position high bit, and sprite size (x4)
- SOBJ* pObj = &PPU.OBJ [(addr & 0x1f) * 4];
+ pObj = &PPU.OBJ [(addr & 0x1f) * 4];
pObj->HPos = (pObj->HPos & 0xFF) | SignExtend[(byte >> 0) & 1];
pObj++->Size = byte & 2;
@@ -296,12 +299,15 @@ static inline void REGISTER_2104(uint8_t byte)
}
else
{
+ int32_t addr;
+ uint8_t lowbyte, highbyte;
+
PPU.OAMWriteRegister &= 0x00ff;
- uint8_t lowbyte = (uint8_t)(PPU.OAMWriteRegister);
- uint8_t highbyte = byte;
+ lowbyte = (uint8_t)(PPU.OAMWriteRegister);
+ highbyte = byte;
PPU.OAMWriteRegister |= byte << 8;
- int32_t addr = (PPU.OAMAddr << 1);
+ addr = (PPU.OAMAddr << 1);
if (lowbyte != PPU.OAMData [addr] ||
highbyte != PPU.OAMData [addr + 1])
@@ -343,7 +349,7 @@ static inline void REGISTER_2104(uint8_t byte)
Memory.FillRAM [0x2104] = byte;
}
-static inline void REGISTER_2118(uint8_t Byte)
+static INLINE void REGISTER_2118(uint8_t Byte)
{
uint32_t address;
if (PPU.VMA.FullGraphicCount)
@@ -363,7 +369,7 @@ static inline void REGISTER_2118(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2118_tile(uint8_t Byte)
+static INLINE void REGISTER_2118_tile(uint8_t Byte)
{
uint32_t address;
uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
@@ -378,7 +384,7 @@ static inline void REGISTER_2118_tile(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2118_linear(uint8_t Byte)
+static INLINE void REGISTER_2118_linear(uint8_t Byte)
{
uint32_t address;
Memory.VRAM[address = (PPU.VMA.Address << 1) & 0xFFFF] = Byte;
@@ -389,7 +395,7 @@ static inline void REGISTER_2118_linear(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2119(uint8_t Byte)
+static INLINE void REGISTER_2119(uint8_t Byte)
{
uint32_t address;
if (PPU.VMA.FullGraphicCount)
@@ -409,7 +415,7 @@ static inline void REGISTER_2119(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2119_tile(uint8_t Byte)
+static INLINE void REGISTER_2119_tile(uint8_t Byte)
{
uint32_t rem = PPU.VMA.Address & PPU.VMA.Mask1;
uint32_t address = ((((PPU.VMA.Address & ~PPU.VMA.Mask1) +
@@ -423,7 +429,7 @@ static inline void REGISTER_2119_tile(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2119_linear(uint8_t Byte)
+static INLINE void REGISTER_2119_linear(uint8_t Byte)
{
uint32_t address;
Memory.VRAM[address = ((PPU.VMA.Address << 1) + 1) & 0xFFFF] = Byte;
@@ -434,7 +440,7 @@ static inline void REGISTER_2119_linear(uint8_t Byte)
PPU.VMA.Address += PPU.VMA.Increment;
}
-static inline void REGISTER_2122(uint8_t Byte)
+static INLINE void REGISTER_2122(uint8_t Byte)
{
if (PPU.CGFLIP)
{
@@ -465,14 +471,14 @@ static inline void REGISTER_2122(uint8_t Byte)
PPU.CGFLIP = !PPU.CGFLIP;
}
-static inline void REGISTER_2180(uint8_t Byte)
+static INLINE void REGISTER_2180(uint8_t Byte)
{
Memory.RAM[PPU.WRAM++] = Byte;
PPU.WRAM &= 0x1FFFF;
Memory.FillRAM [0x2180] = Byte;
}
-static inline uint8_t REGISTER_4212()
+static INLINE uint8_t REGISTER_4212(void)
{
uint8_t GetBank = 0;
if (CPU.V_Counter >= PPU.ScreenHeight + FIRST_VISIBLE_LINE &&
diff --git a/source/sa1.h b/source/sa1.h
index 7bd02cb..6679a1c 100644
--- a/source/sa1.h
+++ b/source/sa1.h
@@ -5,6 +5,7 @@
#include "memmap.h"
#include "cpuexec.h"
+#include <retro_inline.h>
typedef struct
{
@@ -85,15 +86,15 @@ extern SOpcodes S9xSA1OpcodesM0X1 [256];
extern SOpcodes S9xSA1OpcodesM0X0 [256];
extern SSA1 SA1;
-void S9xSA1MainLoop();
-void S9xSA1Init();
-void S9xFixSA1AfterSnapshotLoad();
+void S9xSA1MainLoop(void);
+void S9xSA1Init(void);
+void S9xFixSA1AfterSnapshotLoad(void);
#define SNES_IRQ_SOURCE (1 << 7)
#define TIMER_IRQ_SOURCE (1 << 6)
#define DMA_IRQ_SOURCE (1 << 5)
-static inline void S9xSA1UnpackStatus()
+static INLINE void S9xSA1UnpackStatus(void)
{
SA1._Zero = (SA1.Registers.PL & Zero) == 0;
SA1._Negative = (SA1.Registers.PL & Negative);
@@ -101,13 +102,13 @@ static inline void S9xSA1UnpackStatus()
SA1._Overflow = (SA1.Registers.PL & Overflow) >> 6;
}
-static inline void S9xSA1PackStatus()
+static INLINE void S9xSA1PackStatus(void)
{
SA1.Registers.PL &= ~(Zero | Negative | Carry | Overflow);
SA1.Registers.PL |= SA1._Carry | ((SA1._Zero == 0) << 1) | (SA1._Negative & 0x80) | (SA1._Overflow << 6);
}
-static inline void S9xSA1FixCycles()
+static INLINE void S9xSA1FixCycles(void)
{
if (SA1CheckEmulation())
SA1.S9xOpcodes = S9xSA1OpcodesE1;
diff --git a/source/sar.h b/source/sar.h
index 635477a..487cdaa 100644
--- a/source/sar.h
+++ b/source/sar.h
@@ -4,6 +4,7 @@
#define _SAR_H_
#include <stdint.h>
+#include <retro_inline.h>
#include "port.h"
@@ -14,7 +15,7 @@
#define SAR64(b, n) ((b) >> (n))
#else
-static inline int8_t SAR8(const int8_t b, const int32_t n)
+static INLINE int8_t SAR8(const int8_t b, const int32_t n)
{
#ifndef RIGHTSHIFT_INT8_IS_SAR
if (b < 0)
@@ -23,7 +24,7 @@ static inline int8_t SAR8(const int8_t b, const int32_t n)
return b >> n;
}
-static inline int16_t SAR16(const int16_t b, const int32_t n)
+static INLINE int16_t SAR16(const int16_t b, const int32_t n)
{
#ifndef RIGHTSHIFT_INT16_IS_SAR
if (b < 0)
@@ -32,7 +33,7 @@ static inline int16_t SAR16(const int16_t b, const int32_t n)
return b >> n;
}
-static inline int32_t SAR32(const int32_t b, const int32_t n)
+static INLINE int32_t SAR32(const int32_t b, const int32_t n)
{
#ifndef RIGHTSHIFT_INT32_IS_SAR
if (b < 0)
@@ -41,7 +42,7 @@ static inline int32_t SAR32(const int32_t b, const int32_t n)
return b >> n;
}
-static inline int64_t SAR64(const int64_t b, const int32_t n)
+static INLINE int64_t SAR64(const int64_t b, const int32_t n)
{
#ifndef RIGHTSHIFT_INT64_IS_SAR
if (b < 0)