From 741516b02c03c7af9fe2ec303edf0ccaccfd39a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 10 Nov 2015 04:30:51 +0100 Subject: Use MSB_FIRST --- old/gfx16.cpp.last | 70 +++++++++++++++++++++++------------------------ old/gfx16.cpp.old2 | 70 +++++++++++++++++++++++------------------------ old/spc700/debug/port.h | 4 --- old/spc700/debug/spc700.h | 6 ++-- 4 files changed, 73 insertions(+), 77 deletions(-) (limited to 'old') 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 -- cgit v1.2.3