summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--old/gfx16.cpp.last70
-rw-r--r--old/gfx16.cpp.old270
-rw-r--r--old/spc700/debug/port.h4
-rw-r--r--old/spc700/debug/spc700.h6
-rw-r--r--src/65c816.h6
-rw-r--r--src/gfx.c68
-rw-r--r--src/gfx.h14
-rw-r--r--src/gfx16.c70
-rw-r--r--src/globals.c12
-rw-r--r--src/port.h2
-rw-r--r--src/snaporig.h12
-rw-r--r--src/spc700.h6
-rw-r--r--src/srtc.c12
13 files changed, 172 insertions, 180 deletions
diff --git a/old/gfx16.cpp.last b/old/gfx16.cpp.last
index fb57f65..916d3dd 100644
--- a/old/gfx16.cpp.last
+++ b/old/gfx16.cpp.last
@@ -253,25 +253,7 @@ bool8_32 S9xGraphicsInit ()
register uint32 h = 0;
register uint32 l = 0;
-#if defined(LSB_FIRST)
-// Wiz usa LSB_FIRST
- if (i & 8)
- h |= PixelOdd;
- if (i & 4)
- h |= PixelOdd << 8;
- if (i & 2)
- h |= PixelOdd << 16;
- if (i & 1)
- h |= PixelOdd << 24;
- if (i & 8)
- l |= PixelOdd;
- if (i & 4)
- l |= PixelOdd << 8;
- if (i & 2)
- l |= PixelOdd << 16;
- if (i & 1)
- l |= PixelOdd << 24;
-#else
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelOdd << 24);
if (i & 4)
@@ -288,30 +270,31 @@ bool8_32 S9xGraphicsInit ()
l |= (PixelOdd << 8);
if (i & 1)
l |= PixelOdd;
-#endif
-
- odd_high[bitshift][i] = h;
- odd_low[bitshift][i] = l;
- h = l = 0;
-
-#if defined(LSB_FIRST)
+#else
+// Wiz usa
if (i & 8)
- h |= PixelEven;
+ h |= PixelOdd;
if (i & 4)
- h |= PixelEven << 8;
+ h |= PixelOdd << 8;
if (i & 2)
- h |= PixelEven << 16;
+ h |= PixelOdd << 16;
if (i & 1)
- h |= PixelEven << 24;
+ h |= PixelOdd << 24;
if (i & 8)
- l |= PixelEven;
+ l |= PixelOdd;
if (i & 4)
- l |= PixelEven << 8;
+ l |= PixelOdd << 8;
if (i & 2)
- l |= PixelEven << 16;
+ l |= PixelOdd << 16;
if (i & 1)
- l |= PixelEven << 24;
-#else
+ l |= PixelOdd << 24;
+#endif
+
+ odd_high[bitshift][i] = h;
+ odd_low[bitshift][i] = l;
+ h = l = 0;
+
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelEven << 24);
if (i & 4)
@@ -328,6 +311,23 @@ bool8_32 S9xGraphicsInit ()
l |= (PixelEven << 8);
if (i & 1)
l |= PixelEven;
+#else
+ if (i & 8)
+ h |= PixelEven;
+ if (i & 4)
+ h |= PixelEven << 8;
+ if (i & 2)
+ h |= PixelEven << 16;
+ if (i & 1)
+ h |= PixelEven << 24;
+ if (i & 8)
+ l |= PixelEven;
+ if (i & 4)
+ l |= PixelEven << 8;
+ if (i & 2)
+ l |= PixelEven << 16;
+ if (i & 1)
+ l |= PixelEven << 24;
#endif
even_high[bitshift][i] = h;
diff --git a/old/gfx16.cpp.old2 b/old/gfx16.cpp.old2
index 80133c3..d5e27a0 100644
--- a/old/gfx16.cpp.old2
+++ b/old/gfx16.cpp.old2
@@ -258,25 +258,7 @@ bool8_32 S9xGraphicsInit ()
register uint32 h = 0;
register uint32 l = 0;
-#if defined(LSB_FIRST)
-// Wiz usa LSB_FIRST
- if (i & 8)
- h |= PixelOdd;
- if (i & 4)
- h |= PixelOdd << 8;
- if (i & 2)
- h |= PixelOdd << 16;
- if (i & 1)
- h |= PixelOdd << 24;
- if (i & 8)
- l |= PixelOdd;
- if (i & 4)
- l |= PixelOdd << 8;
- if (i & 2)
- l |= PixelOdd << 16;
- if (i & 1)
- l |= PixelOdd << 24;
-#else
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelOdd << 24);
if (i & 4)
@@ -293,30 +275,31 @@ bool8_32 S9xGraphicsInit ()
l |= (PixelOdd << 8);
if (i & 1)
l |= PixelOdd;
-#endif
-
- odd_high[bitshift][i] = h;
- odd_low[bitshift][i] = l;
- h = l = 0;
-
-#if defined(LSB_FIRST)
+#else
+// Wiz usa
if (i & 8)
- h |= PixelEven;
+ h |= PixelOdd;
if (i & 4)
- h |= PixelEven << 8;
+ h |= PixelOdd << 8;
if (i & 2)
- h |= PixelEven << 16;
+ h |= PixelOdd << 16;
if (i & 1)
- h |= PixelEven << 24;
+ h |= PixelOdd << 24;
if (i & 8)
- l |= PixelEven;
+ l |= PixelOdd;
if (i & 4)
- l |= PixelEven << 8;
+ l |= PixelOdd << 8;
if (i & 2)
- l |= PixelEven << 16;
+ l |= PixelOdd << 16;
if (i & 1)
- l |= PixelEven << 24;
-#else
+ l |= PixelOdd << 24;
+#endif
+
+ odd_high[bitshift][i] = h;
+ odd_low[bitshift][i] = l;
+ h = l = 0;
+
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelEven << 24);
if (i & 4)
@@ -333,6 +316,23 @@ bool8_32 S9xGraphicsInit ()
l |= (PixelEven << 8);
if (i & 1)
l |= PixelEven;
+#else
+ if (i & 8)
+ h |= PixelEven;
+ if (i & 4)
+ h |= PixelEven << 8;
+ if (i & 2)
+ h |= PixelEven << 16;
+ if (i & 1)
+ h |= PixelEven << 24;
+ if (i & 8)
+ l |= PixelEven;
+ if (i & 4)
+ l |= PixelEven << 8;
+ if (i & 2)
+ l |= PixelEven << 16;
+ if (i & 1)
+ l |= PixelEven << 24;
#endif
even_high[bitshift][i] = h;
diff --git a/old/spc700/debug/port.h b/old/spc700/debug/port.h
index dfc3030..1a056fb 100644
--- a/old/spc700/debug/port.h
+++ b/old/spc700/debug/port.h
@@ -117,7 +117,6 @@ EXTERN_C void S9xGenerateSound ();
#define SLASH_STR "\\"
#define SLASH_CHAR '\\'
-#define LSB_FIRST
#define STATIC static
#define FASTCALL
#define INLINE inline
@@ -431,7 +430,6 @@ typedef void (*SignalHandler)(int);
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || \
defined(__WIN32kk__) || defined(__alpha__)
-#define LSB_FIRST
#define FAST_LSB_WORD_ACCESS
#define PACKING
#define ALIGN_BY_ONE
@@ -439,14 +437,12 @@ typedef void (*SignalHandler)(int);
#else
#ifdef __GP32__
-#define LSB_FIRST
#define STATIC static
#define FASTCALL
#define INLINE inline
#define VOID void
#else
// must be gp2x
-#define LSB_FIRST
#define STATIC static
#define FASTCALL
#define INLINE inline
diff --git a/old/spc700/debug/spc700.h b/old/spc700/debug/spc700.h
index 507c247..433fe6f 100644
--- a/old/spc700/debug/spc700.h
+++ b/old/spc700/debug/spc700.h
@@ -86,10 +86,10 @@
typedef union
{
-#ifdef LSB_FIRST
- struct { uint8 A, Y; } B;
-#else
+#ifdef MSB_FIRST
struct { uint8 Y, A; } B;
+#else
+ struct { uint8 A, Y; } B;
#endif
uint16 W;
uint32 _padder; // make sure this whole thing takes 4 bytes
diff --git a/src/65c816.h b/src/65c816.h
index f1e21f5..fe040c6 100644
--- a/src/65c816.h
+++ b/src/65c816.h
@@ -99,15 +99,15 @@
typedef union
{
-#ifdef LSB_FIRST
+#ifdef MSB_FIRST
struct
{
- uint8 l, h;
+ uint8 h, l;
} PACKING B;
#else
struct
{
- uint8 h, l;
+ uint8 l, h;
} PACKING B;
#endif
uint16 W;
diff --git a/src/gfx.c b/src/gfx.c
index b37dd24..5f27b25 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -259,24 +259,7 @@ bool8_32 S9xGraphicsInit()
register uint32 h = 0;
register uint32 l = 0;
-#if defined(LSB_FIRST)
- if (i & 8)
- h |= PixelOdd;
- if (i & 4)
- h |= PixelOdd << 8;
- if (i & 2)
- h |= PixelOdd << 16;
- if (i & 1)
- h |= PixelOdd << 24;
- if (i & 8)
- l |= PixelOdd;
- if (i & 4)
- l |= PixelOdd << 8;
- if (i & 2)
- l |= PixelOdd << 16;
- if (i & 1)
- l |= PixelOdd << 24;
-#else
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelOdd << 24);
if (i & 4)
@@ -293,30 +276,30 @@ bool8_32 S9xGraphicsInit()
l |= (PixelOdd << 8);
if (i & 1)
l |= PixelOdd;
-#endif
-
- odd_high[bitshift][i] = h;
- odd_low[bitshift][i] = l;
- h = l = 0;
-
-#if defined(LSB_FIRST)
+#else
if (i & 8)
- h |= PixelEven;
+ h |= PixelOdd;
if (i & 4)
- h |= PixelEven << 8;
+ h |= PixelOdd << 8;
if (i & 2)
- h |= PixelEven << 16;
+ h |= PixelOdd << 16;
if (i & 1)
- h |= PixelEven << 24;
+ h |= PixelOdd << 24;
if (i & 8)
- l |= PixelEven;
+ l |= PixelOdd;
if (i & 4)
- l |= PixelEven << 8;
+ l |= PixelOdd << 8;
if (i & 2)
- l |= PixelEven << 16;
+ l |= PixelOdd << 16;
if (i & 1)
- l |= PixelEven << 24;
-#else
+ l |= PixelOdd << 24;
+#endif
+
+ odd_high[bitshift][i] = h;
+ odd_low[bitshift][i] = l;
+ h = l = 0;
+
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelEven << 24);
if (i & 4)
@@ -333,6 +316,23 @@ bool8_32 S9xGraphicsInit()
l |= (PixelEven << 8);
if (i & 1)
l |= PixelEven;
+#else
+ if (i & 8)
+ h |= PixelEven;
+ if (i & 4)
+ h |= PixelEven << 8;
+ if (i & 2)
+ h |= PixelEven << 16;
+ if (i & 1)
+ h |= PixelEven << 24;
+ if (i & 8)
+ l |= PixelEven;
+ if (i & 4)
+ l |= PixelEven << 8;
+ if (i & 2)
+ l |= PixelEven << 16;
+ if (i & 1)
+ l |= PixelEven << 24;
#endif
even_high[bitshift][i] = h;
diff --git a/src/gfx.h b/src/gfx.h
index e9ec04a..ff197cf 100644
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -183,18 +183,16 @@ extern uint8 mul_brightness [16][32];
#define READ_2BYTES(s) (*(uint16 *) (s))
#define WRITE_2BYTES(s, d) *(uint16 *) (s) = (d)
#else
-#ifdef LSB_FIRST
-#define READ_2BYTES(s) (*(uint16 *) (s))
-#define WRITE_2BYTES(s, d) *(uint16 *) (s) = (d)
-//#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8))
-//#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \
-// *((uint8 *) (s) + 1) = (d) >> 8
-#else // else MSB_FISRT
+#ifdef MSB_FIRST
#define READ_2BYTES(s) (*(uint8 *) (s) | (*((uint8 *) (s) + 1) << 8))
#define WRITE_2BYTES(s, d) *(uint8 *) (s) = (d), \
*((uint8 *) (s) + 1) = (d) >> 8
-#endif // LSB_FIRST
+#else
+#define READ_2BYTES(s) (*(uint16 *) (s))
+#define WRITE_2BYTES(s, d) *(uint16 *) (s) = (d)
+#endif
+
#endif // i386
#define SUB_SCREEN_DEPTH 0
diff --git a/src/gfx16.c b/src/gfx16.c
index 3bea6c6..63c5c2d 100644
--- a/src/gfx16.c
+++ b/src/gfx16.c
@@ -263,25 +263,7 @@ bool8_32 S9xGraphicsInit()
register uint32 h = 0;
register uint32 l = 0;
-#if defined(LSB_FIRST)
- // Wiz usa LSB_FIRST
- if (i & 8)
- h |= PixelOdd;
- if (i & 4)
- h |= PixelOdd << 8;
- if (i & 2)
- h |= PixelOdd << 16;
- if (i & 1)
- h |= PixelOdd << 24;
- if (i & 8)
- l |= PixelOdd;
- if (i & 4)
- l |= PixelOdd << 8;
- if (i & 2)
- l |= PixelOdd << 16;
- if (i & 1)
- l |= PixelOdd << 24;
-#else
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelOdd << 24);
if (i & 4)
@@ -298,30 +280,31 @@ bool8_32 S9xGraphicsInit()
l |= (PixelOdd << 8);
if (i & 1)
l |= PixelOdd;
-#endif
-
- odd_high[bitshift][i] = h;
- odd_low[bitshift][i] = l;
- h = l = 0;
-
-#if defined(LSB_FIRST)
+#else
+ // Wiz usa
if (i & 8)
- h |= PixelEven;
+ h |= PixelOdd;
if (i & 4)
- h |= PixelEven << 8;
+ h |= PixelOdd << 8;
if (i & 2)
- h |= PixelEven << 16;
+ h |= PixelOdd << 16;
if (i & 1)
- h |= PixelEven << 24;
+ h |= PixelOdd << 24;
if (i & 8)
- l |= PixelEven;
+ l |= PixelOdd;
if (i & 4)
- l |= PixelEven << 8;
+ l |= PixelOdd << 8;
if (i & 2)
- l |= PixelEven << 16;
+ l |= PixelOdd << 16;
if (i & 1)
- l |= PixelEven << 24;
-#else
+ l |= PixelOdd << 24;
+#endif
+
+ odd_high[bitshift][i] = h;
+ odd_low[bitshift][i] = l;
+ h = l = 0;
+
+#if defined(MSB_FIRST)
if (i & 8)
h |= (PixelEven << 24);
if (i & 4)
@@ -338,6 +321,23 @@ bool8_32 S9xGraphicsInit()
l |= (PixelEven << 8);
if (i & 1)
l |= PixelEven;
+#else
+ if (i & 8)
+ h |= PixelEven;
+ if (i & 4)
+ h |= PixelEven << 8;
+ if (i & 2)
+ h |= PixelEven << 16;
+ if (i & 1)
+ h |= PixelEven << 24;
+ if (i & 8)
+ l |= PixelEven;
+ if (i & 4)
+ l |= PixelEven << 8;
+ if (i & 2)
+ l |= PixelEven << 16;
+ if (i & 1)
+ l |= PixelEven << 24;
#endif
even_high[bitshift][i] = h;
diff --git a/src/globals.c b/src/globals.c
index a433fa4..5edbe14 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -268,19 +268,19 @@ int NoiseFreq [32] =
uint32 HeadMask [4] =
{
-#ifdef LSB_FIRST
- 0xffffffff, 0xffffff00, 0xffff0000, 0xff000000
-#else
+#ifdef MSB_FIRST
0xffffffff, 0x00ffffff, 0x0000ffff, 0x000000ff
+#else
+ 0xffffffff, 0xffffff00, 0xffff0000, 0xff000000
#endif
};
uint32 TailMask [5] =
{
-#ifdef LSB_FIRST
- 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff
-#else
+#ifdef MSB_FIRST
0x00000000, 0xff000000, 0xffff0000, 0xffffff00, 0xffffffff
+#else
+ 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff
#endif
};
diff --git a/src/port.h b/src/port.h
index 0c48da6..b203d8d 100644
--- a/src/port.h
+++ b/src/port.h
@@ -122,7 +122,6 @@ typedef short int16_32;
//Misc Items
#define VAR_CYCLES
//#define SPC700_SHUTDOWN
-#define LSB_FIRST
#define STATIC static
#define FASTCALL
#define PIXEL_FORMAT RGB565
@@ -133,7 +132,6 @@ typedef short int16_32;
#define ZeroMemory(a,b) memset((a),0,(b))
#define PACKING __attribute__ ((packed))
#define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))
-#define LSB_FIRST
#undef FAST_LSB_WORD_ACCESS
#define SUPER_FX
#ifdef ASMCPU
diff --git a/src/snaporig.h b/src/snaporig.h
index 13f1556..e8b77be 100644
--- a/src/snaporig.h
+++ b/src/snaporig.h
@@ -94,15 +94,15 @@ struct SOrigAPU
typedef union
{
-#ifdef LSB_FIRST
+#ifdef MSB_FIRST
struct
{
- uint8 A, Y;
+ uint8 Y, A;
} B;
#else
struct
{
- uint8 Y, A;
+ uint8 A, Y;
} B;
#endif
uint16 W;
@@ -320,15 +320,15 @@ struct SOrigDMA
typedef union
{
-#ifdef LSB_FIRST
+#ifdef MSB_FIRST
struct
{
- uint8 l, h;
+ uint8 h, l;
} B;
#else
struct
{
- uint8 h, l;
+ uint8 l, h;
} B;
#endif
uint16 W;
diff --git a/src/spc700.h b/src/spc700.h
index 9dd1180..805392c 100644
--- a/src/spc700.h
+++ b/src/spc700.h
@@ -86,15 +86,15 @@
typedef union
{
-#ifdef LSB_FIRST
+#ifdef MSB_FIRST
struct
{
- uint8 A, Y;
+ uint8 Y, A;
} B;
#else
struct
{
- uint8 Y, A;
+ uint8 A, Y;
} B;
#endif
uint16 W;
diff --git a/src/srtc.c b/src/srtc.c
index e9fa4ee..136599b 100644
--- a/src/srtc.c
+++ b/src/srtc.c
@@ -469,9 +469,7 @@ void S9xSRTCPreSaveState()
SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index;
SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode;
-#ifdef LSB_FIRST
- memmove(&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
-#else
+#ifdef MSB_FIRST
SRAM [s + 5 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 0);
SRAM [s + 6 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 8);
SRAM [s + 7 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 16);
@@ -480,6 +478,8 @@ void S9xSRTCPreSaveState()
SRAM [s + 10 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 40);
SRAM [s + 11 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 48);
SRAM [s + 12 + MAX_RTC_INDEX] = (uint8)(rtc.system_timestamp >> 56);
+#else
+ memmove(&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
#endif
}
}
@@ -499,9 +499,7 @@ void S9xSRTCPostLoadState()
rtc.index = SRAM [s + 3 + MAX_RTC_INDEX];
rtc.mode = SRAM [s + 4 + MAX_RTC_INDEX];
-#ifdef LSB_FIRST
- memmove(&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8);
-#else
+#ifdef MSB_FIRST
rtc.system_timestamp |= (SRAM [s + 5 + MAX_RTC_INDEX] << 0);
rtc.system_timestamp |= (SRAM [s + 6 + MAX_RTC_INDEX] << 8);
rtc.system_timestamp |= (SRAM [s + 7 + MAX_RTC_INDEX] << 16);
@@ -510,6 +508,8 @@ void S9xSRTCPostLoadState()
rtc.system_timestamp |= (SRAM [s + 10 + MAX_RTC_INDEX] << 40);
rtc.system_timestamp |= (SRAM [s + 11 + MAX_RTC_INDEX] << 48);
rtc.system_timestamp |= (SRAM [s + 12 + MAX_RTC_INDEX] << 56);
+#else
+ memmove(&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8);
#endif
S9xUpdateSrtcTime();
}