Applied BigEndian patches from lantus for nec core and irem drivers and moved LSB_FIRST define from burnint.h to makefile flag
This commit is contained in:
parent
0a904d1c43
commit
74b0152ff8
3
makefile
3
makefile
|
@ -48,6 +48,9 @@ FASTCALL = 1
|
|||
# Perl is available
|
||||
PERL = 1
|
||||
|
||||
# Endianness
|
||||
LSB_FIRST = 1
|
||||
|
||||
|
||||
#
|
||||
# execute an appropriate system-specific makefile
|
||||
|
|
|
@ -274,6 +274,10 @@ ifdef ROM_VERIFY
|
|||
DEF := $(DEF) -DROM_VERIFY
|
||||
endif
|
||||
|
||||
ifdef ROM_VERIFY
|
||||
DEF := $(DEF) -DLSB_FIRST
|
||||
endif
|
||||
|
||||
ifdef BUILD_A68K
|
||||
DEF := $(DEF) -DBUILD_A68K
|
||||
endif
|
||||
|
|
10
makefile.vc
10
makefile.vc
|
@ -183,16 +183,20 @@ ifdef ROM_VERIFY
|
|||
DEF := $(DEF) /DROM_VERIFY
|
||||
endif
|
||||
|
||||
ifdef LSB_FIRST
|
||||
DEF := $(DEF) /DLSB_FIRST
|
||||
endif
|
||||
|
||||
ifdef BUILD_A68K
|
||||
DEF := $(DEF) -DBUILD_A68K
|
||||
DEF := $(DEF) /DBUILD_A68K
|
||||
endif
|
||||
|
||||
ifdef BUILD_X86_ASM
|
||||
DEF := $(DEF) -DBUILD_X86_ASM
|
||||
DEF := $(DEF) /DBUILD_X86_ASM
|
||||
endif
|
||||
|
||||
ifdef BUILD_X64_EXE
|
||||
DEF := $(DEF) -DBUILD_X64_EXE
|
||||
DEF := $(DEF) /DBUILD_X64_EXE
|
||||
endif
|
||||
|
||||
ifdef SYMBOL
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
#include "tchar.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
#define LSB_FIRST
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "burn.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -999,9 +999,9 @@ static void palette_write(INT32 offset, INT32 offset2)
|
|||
pal += 0x1000 / 2;
|
||||
}
|
||||
|
||||
INT32 r = pal[offset + 0x000] & 0x1f;
|
||||
INT32 g = pal[offset + 0x200] & 0x1f;
|
||||
INT32 b = pal[offset + 0x400] & 0x1f;
|
||||
INT32 r = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x000]) & 0x1f;
|
||||
INT32 g = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x200]) & 0x1f;
|
||||
INT32 b = BURN_ENDIAN_SWAP_INT16(pal[offset + 0x400]) & 0x1f;
|
||||
|
||||
DrvPalette[offset3] = BurnHighCol((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), 0);
|
||||
}
|
||||
|
@ -1822,7 +1822,7 @@ static void draw_layer(INT32 layer, INT32 forcelayer, INT32 type, INT32 start, I
|
|||
INT32 flipy, flipx, prio, scrollx1, offs;
|
||||
|
||||
if (majtitle_rowscroll_enable && type == 3 && layer == 1) {
|
||||
scrollx1 = 256 + xscroll[scrolly1] + sx + 64 + video_offsets[1];
|
||||
scrollx1 = 256 + BURN_ENDIAN_SWAP_INT16(xscroll[scrolly1]) + sx + 64 + video_offsets[1];
|
||||
} else {
|
||||
scrollx1 = scrollx + sx;
|
||||
if (type == 3 && layer == 1) scrollx1 += 256;
|
||||
|
@ -1836,8 +1836,8 @@ static void draw_layer(INT32 layer, INT32 forcelayer, INT32 type, INT32 start, I
|
|||
offs = ((scrolly1 >> 3) << 6) | (scrollx1 >> 3);
|
||||
}
|
||||
|
||||
INT32 code = vram[offs * 2 + 0];
|
||||
INT32 color = vram[offs * 2 + 1];
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
|
||||
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]);
|
||||
|
||||
if (type == 1||type==3) {
|
||||
flipy = color & 0x0040;
|
||||
|
@ -1888,10 +1888,10 @@ static void draw_sprites()
|
|||
|
||||
for (INT32 offs = 0; offs < 0x400/2;)
|
||||
{
|
||||
INT32 sx = -256+(sprram[offs+3] & 0x3ff);
|
||||
INT32 attr = sprram[offs+2];
|
||||
INT32 code = sprram[offs+1];
|
||||
INT32 sy = 384-(sprram[offs+0] & 0x1ff);
|
||||
INT32 sx = -256+(BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & 0x3ff);
|
||||
INT32 attr = BURN_ENDIAN_SWAP_INT16(sprram[offs+2]);
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+1]);
|
||||
INT32 sy = 384-(BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x1ff);
|
||||
|
||||
INT32 color = attr & 0x0f;
|
||||
INT32 flipx = attr & 0x0800;
|
||||
|
@ -1959,15 +1959,15 @@ static void majtitle_draw_sprites()
|
|||
{
|
||||
INT32 code,color,sx,sy,flipx,flipy,w,h,x,y;
|
||||
|
||||
code = spriteram16_2[offs+1];
|
||||
color = spriteram16_2[offs+2] & 0x0f;
|
||||
sx = -256+(spriteram16_2[offs+3] & 0x3ff);
|
||||
sy = 384-(spriteram16_2[offs+0] & 0x1ff);
|
||||
flipx = spriteram16_2[offs+2] & 0x0800;
|
||||
flipy = spriteram16_2[offs+2] & 0x0400;
|
||||
code = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+1]);
|
||||
color = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0f;
|
||||
sx = -256+(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+3]) & 0x3ff);
|
||||
sy = 384-(BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+0]) & 0x1ff);
|
||||
flipx = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0800;
|
||||
flipy = BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x0400;
|
||||
|
||||
w = 1;// << ((spriteram16_2[offs+2] & 0xc000) >> 14);
|
||||
h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12);
|
||||
h = 1 << ((BURN_ENDIAN_SWAP_INT16(spriteram16_2[offs+2]) & 0x3000) >> 12);
|
||||
sy -= 16 * h;
|
||||
|
||||
sy -= start_screen;
|
||||
|
|
|
@ -811,6 +811,11 @@ static void setvector_callback(INT32 param)
|
|||
static inline void update_palette_entry(INT32 entry)
|
||||
{
|
||||
UINT16 d = *((UINT16*)(DrvPalRAM + entry));
|
||||
|
||||
#ifndef LSB_FIRST
|
||||
d = BURN_ENDIAN_SWAP_INT16(d);
|
||||
#endif
|
||||
|
||||
UINT8 r = (d >> 0) & 0x1f;
|
||||
UINT8 g = (d >> 5) & 0x1f;
|
||||
UINT8 b = (d >> 10) & 0x1f;
|
||||
|
@ -1203,9 +1208,9 @@ static void draw_sprites()
|
|||
|
||||
for (INT32 offs = 0x1f2/2; offs >= 0; offs -= 3)
|
||||
{
|
||||
INT32 sy = sram[offs + 0];
|
||||
INT32 code = sram[offs + 1];
|
||||
INT32 sx = sram[offs + 2];
|
||||
INT32 sy = BURN_ENDIAN_SWAP_INT16(sram[offs + 0]);
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(sram[offs + 1]);
|
||||
INT32 sx = BURN_ENDIAN_SWAP_INT16(sram[offs + 2]);
|
||||
|
||||
INT32 flipy = sy & 0x8000;
|
||||
INT32 flipx = sx & 0x0200;
|
||||
|
@ -1260,10 +1265,10 @@ static void draw_layer(INT32 layer)
|
|||
UINT16 *dest = pTransDraw + (sy * nScreenWidth);
|
||||
UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth);
|
||||
|
||||
if (enable_rowscroll) scrollx_1 += xscroll[sy];
|
||||
if (enable_rowscroll) scrollx_1 += BURN_ENDIAN_SWAP_INT16(xscroll[sy]);
|
||||
|
||||
if (enable_colscroll) {
|
||||
scrolly_1 += (scrolly + sy + yscroll[sy] + 128) & 0x1ff;
|
||||
scrolly_1 += (scrolly + sy + BURN_ENDIAN_SWAP_INT16(yscroll[sy]) + 128) & 0x1ff;
|
||||
} else {
|
||||
scrolly_1 += (scrolly + sy) & 0x1ff;
|
||||
}
|
||||
|
@ -1276,8 +1281,8 @@ static void draw_layer(INT32 layer)
|
|||
|
||||
INT32 offs = ((scrolly_1 / 8) * wide) | (scrollx_2 / 8);
|
||||
|
||||
INT32 code = vram[offs * 2 + 0] & code_mask[0];
|
||||
INT32 color = vram[offs * 2 + 1];
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]) & code_mask[0];
|
||||
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]);
|
||||
|
||||
INT32 flipy = color & 0x80;
|
||||
INT32 flipx = color & 0x40;
|
||||
|
|
|
@ -1818,18 +1818,18 @@ static void draw_sprites()
|
|||
{
|
||||
for (INT32 offs = 0; offs < m92_sprite_list; )
|
||||
{
|
||||
INT32 y = (((384 - 16 - (ram[offs+0] & 0x1ff)) - nScreenOffsets[1]) & 0x1ff) - 8;
|
||||
INT32 x = (ram[offs+3] & 0x1ff) - 96;
|
||||
INT32 y = (((384 - 16 - (BURN_ENDIAN_SWAP_INT16(ram[offs+0]) & 0x1ff)) - nScreenOffsets[1]) & 0x1ff) - 8;
|
||||
INT32 x = (BURN_ENDIAN_SWAP_INT16(ram[offs+3]) & 0x1ff) - 96;
|
||||
|
||||
INT32 pri_s = (ram[offs+0] & 0xe000) >> 13;
|
||||
INT32 pri_b = (ram[offs+2] & 0x0080) ? 0x80 : 0x82;
|
||||
INT32 code = ram[offs+1];
|
||||
INT32 color = ram[offs+2] & 0x007f;
|
||||
INT32 pri_s = (BURN_ENDIAN_SWAP_INT16(ram[offs+0]) & 0xe000) >> 13;
|
||||
INT32 pri_b = (BURN_ENDIAN_SWAP_INT16(ram[offs+2]) & 0x0080) ? 0x80 : 0x82;
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(ram[offs+1]);
|
||||
INT32 color = BURN_ENDIAN_SWAP_INT16(ram[offs+2]) & 0x007f;
|
||||
|
||||
INT32 flipx = ram[offs+2] & 0x0100;
|
||||
INT32 flipy = ram[offs+2] & 0x0200;
|
||||
INT32 y_multi= 1 << ((ram[offs+0] >> 9) & 3);
|
||||
INT32 x_multi= 1 << ((ram[offs+0] >> 11) & 3);
|
||||
INT32 flipx = BURN_ENDIAN_SWAP_INT16(ram[offs+2]) & 0x0100;
|
||||
INT32 flipy = BURN_ENDIAN_SWAP_INT16(ram[offs+2]) & 0x0200;
|
||||
INT32 y_multi= 1 << ((BURN_ENDIAN_SWAP_INT16(ram[offs+0]) >> 9) & 3);
|
||||
INT32 x_multi= 1 << ((BURN_ENDIAN_SWAP_INT16(ram[offs+0]) >> 11) & 3);
|
||||
|
||||
offs += 4 * x_multi;
|
||||
if (pri_s != k) continue;
|
||||
|
@ -1881,15 +1881,15 @@ static void draw_layer_byline(INT32 start, INT32 finish, INT32 layer, INT32 forc
|
|||
UINT8 *pri = RamPrioBitmap + (sy * nScreenWidth);
|
||||
|
||||
INT32 scrollx_1 = scrollx;
|
||||
if (ptr->enable_rowscroll) scrollx_1 += ptr->scroll[(sy+scrolly)&0x1ff];
|
||||
if (ptr->enable_rowscroll) scrollx_1 += BURN_ENDIAN_SWAP_INT16(ptr->scroll[(sy+scrolly)&0x1ff]);
|
||||
INT32 scrolly_1 = (scrolly + sy) & 0x1ff;
|
||||
INT32 romoff_1 = (scrolly_1 & 0x07) << 3;
|
||||
|
||||
for (INT32 sx = 0; sx < nScreenWidth + 8; sx+=8)
|
||||
{
|
||||
INT32 offs = ((scrolly_1 / 8) * wide) + (((scrollx_1 + sx) / 8) & (wide - 1));
|
||||
INT32 attr = ptr->vram[(offs * 2) + 1];
|
||||
INT32 code = ptr->vram[(offs * 2) + 0] | ((attr & 0x8000) << 1);
|
||||
INT32 attr = BURN_ENDIAN_SWAP_INT16(ptr->vram[(offs * 2) + 1]);
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(ptr->vram[(offs * 2) + 0]) | ((attr & 0x8000) << 1);
|
||||
INT32 color =(attr & 0x007f) << 4;
|
||||
INT32 flipy = attr & 0x0400;
|
||||
INT32 flipx = attr & 0x0200;
|
||||
|
|
|
@ -76,6 +76,8 @@ struct _nec_state_t
|
|||
|
||||
typedef enum { DS1, PS, SS, DS0 } SREGS;
|
||||
typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS;
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
typedef enum {
|
||||
AL = 0, //NATIVE_ENDIAN_VALUE_LE_BE(0x0, 0x1),
|
||||
AH = 1, //NATIVE_ENDIAN_VALUE_LE_BE(0x1, 0x0),
|
||||
|
@ -86,6 +88,18 @@ typedef enum {
|
|||
BL = 6, //NATIVE_ENDIAN_VALUE_LE_BE(0x6, 0x7),
|
||||
BH = 7 //NATIVE_ENDIAN_VALUE_LE_BE(0x7, 0x6),
|
||||
} BREGS;
|
||||
#else
|
||||
typedef enum {
|
||||
AL = 1, //NATIVE_ENDIAN_VALUE_LE_BE(0x0, 0x1),
|
||||
AH = 0, //NATIVE_ENDIAN_VALUE_LE_BE(0x1, 0x0),
|
||||
CL = 3, //NATIVE_ENDIAN_VALUE_LE_BE(0x2, 0x3),
|
||||
CH = 2, //NATIVE_ENDIAN_VALUE_LE_BE(0x3, 0x2),
|
||||
DL = 5, //NATIVE_ENDIAN_VALUE_LE_BE(0x4, 0x5),
|
||||
DH = 4, //NATIVE_ENDIAN_VALUE_LE_BE(0x5, 0x4),
|
||||
BL = 7, //NATIVE_ENDIAN_VALUE_LE_BE(0x6, 0x7),
|
||||
BH = 6 //NATIVE_ENDIAN_VALUE_LE_BE(0x7, 0x6),
|
||||
} BREGS;
|
||||
#endif
|
||||
|
||||
#define Sreg(x) nec_state->sregs[x]
|
||||
#define Wreg(x) nec_state->regs.w[x]
|
||||
|
|
|
@ -153,6 +153,7 @@ typedef enum {
|
|||
IY = 0x10/2
|
||||
} WREGS;
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
typedef enum {
|
||||
AL = 0x1e, //NATIVE_ENDIAN_VALUE_LE_BE(0x1E, 0x1F),
|
||||
AH = 0x1f, //NATIVE_ENDIAN_VALUE_LE_BE(0x1F, 0x1E),
|
||||
|
@ -163,6 +164,18 @@ typedef enum {
|
|||
BL = 0x18, //NATIVE_ENDIAN_VALUE_LE_BE(0x18, 0x19),
|
||||
BH = 0x19 //NATIVE_ENDIAN_VALUE_LE_BE(0x19, 0x18)
|
||||
} BREGS;
|
||||
#else
|
||||
typedef enum {
|
||||
AL = 0x1f, //NATIVE_ENDIAN_VALUE_LE_BE(0x1E, 0x1F),
|
||||
AH = 0x1e, //NATIVE_ENDIAN_VALUE_LE_BE(0x1F, 0x1E),
|
||||
CL = 0x1d, //NATIVE_ENDIAN_VALUE_LE_BE(0x1C, 0x1D),
|
||||
CH = 0x1c, //NATIVE_ENDIAN_VALUE_LE_BE(0x1D, 0x1C),
|
||||
DL = 0x1b, //NATIVE_ENDIAN_VALUE_LE_BE(0x1A, 0x1B),
|
||||
DH = 0x1a, //NATIVE_ENDIAN_VALUE_LE_BE(0x1B, 0x1A),
|
||||
BL = 0x19, //NATIVE_ENDIAN_VALUE_LE_BE(0x18, 0x19),
|
||||
BH = 0x18 //NATIVE_ENDIAN_VALUE_LE_BE(0x19, 0x18)
|
||||
} BREGS;
|
||||
#endif
|
||||
|
||||
#define SetRB(x) do { nec_state->RBW = (x) << 4; nec_state->RBB = (x) << 5; } while (0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue