Commit 741516b0 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Use MSB_FIRST

parent bed2a54f
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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
};
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment