endian fixes from lantus for Gauntlet, Raiden, Varia Metal and the nec core
This commit is contained in:
parent
011951ac9f
commit
d8fe30059a
|
@ -600,7 +600,7 @@ static void atarigen_render_display_list (/*struct osd_bitmap *bitmap, atarigen_
|
|||
|
||||
INT32 xscroll = DrvScrollX;
|
||||
UINT16 *AlphaRam = (UINT16*)DrvAlphaRam;
|
||||
INT32 yscroll = AlphaRam[0xf6e >> 1] >> 7;
|
||||
INT32 yscroll = BURN_ENDIAN_SWAP_INT16(AlphaRam[0xf6e >> 1]) >> 7;
|
||||
yscroll &= 0x1ff;
|
||||
|
||||
/* create a clipping rectangle so that only partial sections are updated at a time */
|
||||
|
@ -2326,10 +2326,10 @@ inline static UINT32 CalcCol(UINT16 nColour)
|
|||
static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 };
|
||||
INT32 i, r, g, b;
|
||||
|
||||
i = ztable[(nColour >> 12) & 15];
|
||||
r = ((nColour >> 8) & 15) * i;
|
||||
g = ((nColour >> 4) & 15) * i;
|
||||
b = ((nColour >> 0) & 15) * i;
|
||||
i = ztable[(BURN_ENDIAN_SWAP_INT16(nColour) >> 12) & 15];
|
||||
r = ((BURN_ENDIAN_SWAP_INT16(nColour) >> 8) & 15) * i;
|
||||
g = ((BURN_ENDIAN_SWAP_INT16(nColour) >> 4) & 15) * i;
|
||||
b = ((BURN_ENDIAN_SWAP_INT16(nColour) >> 0) & 15) * i;
|
||||
|
||||
return BurnHighCol(r, g, b, 0);
|
||||
}
|
||||
|
@ -2364,7 +2364,7 @@ static void DrvRenderPlayfield(INT32 PriorityDraw)
|
|||
for (mx = 0; mx < 64; mx++) {
|
||||
for (my = 0; my < 64; my++) {
|
||||
TileIndex = (my * 64) + mx;
|
||||
Data = VideoRam[TileIndex];
|
||||
Data = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex]);
|
||||
Code = ((DrvTileBank * 0x1000) + (Data & 0xfff)) ^ 0x800;
|
||||
|
||||
if (Code < 0x3000) {
|
||||
|
@ -2407,7 +2407,7 @@ static void DrvRenderCharLayer()
|
|||
|
||||
for (my = 0; my < 32; my++) {
|
||||
for (mx = 0; mx < 64; mx++) {
|
||||
UINT16 Data = VideoRam[TileIndex];
|
||||
UINT16 Data = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex]);
|
||||
Code = Data & 0x3ff;
|
||||
Colour = ((Data >> 10) & 0x0f) | ((Data >> 9) & 0x20);
|
||||
Opaque = Data & 0x8000;
|
||||
|
@ -2445,7 +2445,7 @@ static INT32 DrvFrame()
|
|||
INT32 nSoundBufferPos = 0;
|
||||
|
||||
if (DrvReset) DrvDoReset();
|
||||
|
||||
|
||||
DrvMakeInputs();
|
||||
|
||||
nCyclesTotal[0] = (14318180 / 2) / 60;
|
||||
|
@ -2457,7 +2457,7 @@ static INT32 DrvFrame()
|
|||
INT32 NextScanline = 0;
|
||||
|
||||
UINT16 *AlphaRam = (UINT16*)DrvAlphaRam;
|
||||
DrvScrollY = AlphaRam[0xf6e >> 1];
|
||||
DrvScrollY = BURN_ENDIAN_SWAP_INT16(AlphaRam[0xf6e >> 1]);
|
||||
DrvTileBank = DrvScrollY & 0x03;
|
||||
DrvScrollY >>= 7;
|
||||
DrvScrollY &= 0x1ff;
|
||||
|
|
|
@ -997,9 +997,9 @@ static void drawBackground()
|
|||
|
||||
if (x<=-16 || x>=256 || y<=-16 || y>=224) continue;
|
||||
else {
|
||||
UINT32 tileno = RamBg[offs] & 0x0FFF;
|
||||
UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0x0FFF;
|
||||
//if (tileno == 0) continue;
|
||||
UINT32 c = (RamBg[offs] & 0xF000) >> 8;
|
||||
UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0xF000) >> 8;
|
||||
UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x;
|
||||
UINT8 *d = RomGfx2 + (tileno << 8);
|
||||
|
||||
|
@ -1083,9 +1083,9 @@ static void drawForeground()
|
|||
|
||||
if (x<=-16 || x>=256 || y<=-16 || y>=224) continue;
|
||||
else {
|
||||
UINT32 tileno = RamFg[offs] & 0x0FFF;
|
||||
UINT32 tileno = BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0x0FFF;
|
||||
if (tileno == 0) continue;
|
||||
UINT32 c = (RamFg[offs] & 0xF000) >> 8;
|
||||
UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamFg[offs]) & 0xF000) >> 8;
|
||||
UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x;
|
||||
UINT8 *d = RomGfx3 + (tileno << 8);
|
||||
|
||||
|
@ -1403,9 +1403,9 @@ static void drawText()
|
|||
|
||||
if ( y<0 || y>=224) continue;
|
||||
else {
|
||||
UINT32 tileno = (RamTxt[offs] & 0x00FF) | ((RamTxt[offs] & 0xC000) >> 6);
|
||||
UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6);
|
||||
if (tileno == 0) continue;
|
||||
UINT32 c = (RamTxt[offs] & 0x0F00) >> 4;
|
||||
UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4;
|
||||
UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x;
|
||||
UINT8 *d = RomGfx1 + (tileno << 6);
|
||||
|
||||
|
@ -1444,9 +1444,9 @@ static void drawTextAlt()
|
|||
|
||||
if ( y<0 || y>=224) continue;
|
||||
else {
|
||||
UINT32 tileno = (RamTxt[offs] & 0x00FF) | ((RamTxt[offs] & 0xC000) >> 6);
|
||||
UINT32 tileno = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x00FF) | ((BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0xC000) >> 6);
|
||||
if (tileno == 0) continue;
|
||||
UINT32 c = (RamTxt[offs] & 0x0F00) >> 4;
|
||||
UINT32 c = (BURN_ENDIAN_SWAP_INT16(RamTxt[offs]) & 0x0F00) >> 4;
|
||||
UINT16 * p = (UINT16 *) pBurnDraw + y * 256 + x;
|
||||
UINT8 *d = RomGfx1 + (tileno << 6);
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ UINT16 __fastcall vmetal_read_word(UINT32 address)
|
|||
if ((address & 0xffff0000) == 0x160000) {
|
||||
UINT16 *vreg = (UINT16*)DrvVidRegs;
|
||||
|
||||
INT32 offset = ((address & 0xfffe) | ((vreg[0x0ab/2] & 0x7f) << 16)) * 2;
|
||||
INT32 offset = ((address & 0xfffe) | ((BURN_ENDIAN_SWAP_INT16(vreg[0x0ab/2]) & 0x7f) << 16)) * 2;
|
||||
|
||||
return (DrvGfxROM[offset + 0] << 12) | (DrvGfxROM[offset + 1] << 8) | (DrvGfxROM[offset + 2] << 4) | (DrvGfxROM[offset + 3] << 0);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ UINT16 __fastcall vmetal_read_word(UINT32 address)
|
|||
static inline void palette_write(INT32 offset)
|
||||
{
|
||||
if (offset & 0x2000) {
|
||||
INT32 rgb = *((UINT16*)(DrvPalRAM + offset));
|
||||
INT32 rgb = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset)));
|
||||
|
||||
if (rgb == 0) blackpen = offset/2;
|
||||
|
||||
|
@ -229,7 +229,7 @@ void __fastcall vmetal_palette_write_byte(UINT32 address, UINT8 data)
|
|||
|
||||
void __fastcall vmetal_palette_write_word(UINT32 address, UINT16 data)
|
||||
{
|
||||
*((UINT16*)(DrvPalRAM + (address & 0x3ffe))) = data;
|
||||
*((UINT16*)(DrvPalRAM + (address & 0x3ffe))) = BURN_ENDIAN_SWAP_INT16(data);
|
||||
|
||||
palette_write(address & 0x3ffe);
|
||||
}
|
||||
|
@ -385,11 +385,11 @@ static void draw_layer_8x8()
|
|||
INT32 sy = y << 3;
|
||||
if (sy >= nScreenHeight || sx >= nScreenWidth) continue;
|
||||
|
||||
INT32 data = vram[offs];
|
||||
INT32 data = BURN_ENDIAN_SWAP_INT16(vram[offs]);
|
||||
if (data & 0x8000) continue;
|
||||
|
||||
INT32 index = (data & 0x7ff0) >> 3;
|
||||
UINT32 lut = (vlut[index] << 16) | (vlut[index + 1]);
|
||||
UINT32 lut = (BURN_ENDIAN_SWAP_INT16(vlut[index]) << 16) | (BURN_ENDIAN_SWAP_INT16(vlut[index + 1]));
|
||||
|
||||
INT32 code = (data & 0x0f) | (lut & 0x3fff0);
|
||||
INT32 color = (lut >> 20) & 0x1f;
|
||||
|
@ -410,17 +410,17 @@ static void draw_layer_16x16(UINT8 *ram, INT32 scrolloff)
|
|||
INT32 sx = (offs & 0xff) << 4;
|
||||
INT32 sy = (offs >> 8) << 4;
|
||||
|
||||
sx -= scrl[0] & 0xfff;
|
||||
sx -= BURN_ENDIAN_SWAP_INT16(scrl[0]) & 0xfff;
|
||||
if (sx < -15) sx += 0x1000;
|
||||
|
||||
if (sy >= nScreenHeight || sx >= nScreenWidth) continue;
|
||||
|
||||
INT32 data = vram[offs];
|
||||
INT32 data = BURN_ENDIAN_SWAP_INT16(vram[offs]);
|
||||
if (data & 0x8000) continue;
|
||||
|
||||
INT32 index = (data & 0x7ff0) >> 3;
|
||||
|
||||
UINT32 lu = (vlut[index] << 16) | (vlut[index + 1] << 0);
|
||||
UINT32 lu = (BURN_ENDIAN_SWAP_INT16(vlut[index]) << 16) | (BURN_ENDIAN_SWAP_INT16(vlut[index + 1]) << 0);
|
||||
|
||||
INT32 code = (data & 0x0f) | ((lu >> 2) & 0xfff0);
|
||||
INT32 color = (lu >> 20) & 0xff;
|
||||
|
@ -479,10 +479,10 @@ static void draw_sprites() // metro_draw_sprites
|
|||
UINT16 *spriteram = (UINT16*)DrvSprRAM;
|
||||
UINT8 *gfx_max = DrvGfxROM + 0x1000000;
|
||||
|
||||
INT32 sprites = videoregs[0x00] & 0x1ff;
|
||||
INT32 sprites = BURN_ENDIAN_SWAP_INT16(videoregs[0x00]) & 0x1ff;
|
||||
if (sprites == 0) return;
|
||||
|
||||
INT32 color_start = (videoregs[0x04] & 0x0f) << 4;
|
||||
INT32 color_start = (BURN_ENDIAN_SWAP_INT16(videoregs[0x04]) & 0x0f) << 4;
|
||||
|
||||
static const INT32 primask[4] = { 0x0000, 0xff00, 0xfff0, 0xfffc };
|
||||
|
||||
|
@ -502,7 +502,7 @@ static void draw_sprites() // metro_draw_sprites
|
|||
|
||||
for (INT32 i = 0; i < 0x20; i++)
|
||||
{
|
||||
if (videoregs[0x02/2] & 0x8000)
|
||||
if (BURN_ENDIAN_SWAP_INT16(videoregs[0x02/2]) & 0x8000)
|
||||
{
|
||||
src = spriteram;
|
||||
inc = (8 / 2);
|
||||
|
@ -513,7 +513,7 @@ static void draw_sprites() // metro_draw_sprites
|
|||
|
||||
for (INT32 j = 0; j < sprites; j++)
|
||||
{
|
||||
INT32 x = src[0];
|
||||
INT32 x = BURN_ENDIAN_SWAP_INT16(src[0]);
|
||||
INT32 curr_pri = (x & 0xf800) >> 11;
|
||||
|
||||
if ((curr_pri == 0x1f) || (curr_pri != i))
|
||||
|
@ -522,17 +522,17 @@ static void draw_sprites() // metro_draw_sprites
|
|||
continue;
|
||||
}
|
||||
|
||||
INT32 pri = (videoregs[0x01] & 0x0300) >> 8;
|
||||
INT32 pri = (BURN_ENDIAN_SWAP_INT16(videoregs[0x01]) & 0x0300) >> 8;
|
||||
|
||||
if (!(videoregs[0x01] & 0x8000))
|
||||
if (!(BURN_ENDIAN_SWAP_INT16(videoregs[0x01]) & 0x8000))
|
||||
{
|
||||
if (curr_pri > (videoregs[0x01] & 0x001f))
|
||||
pri = (videoregs[0x01] & 0x0c00) >> 10;
|
||||
if (curr_pri > (BURN_ENDIAN_SWAP_INT16(videoregs[0x01]) & 0x001f))
|
||||
pri = (BURN_ENDIAN_SWAP_INT16(videoregs[0x01]) & 0x0c00) >> 10;
|
||||
}
|
||||
|
||||
INT32 y = src[1];
|
||||
INT32 attr = src[2];
|
||||
INT32 code = src[3];
|
||||
INT32 y = BURN_ENDIAN_SWAP_INT16(src[1]);
|
||||
INT32 attr = BURN_ENDIAN_SWAP_INT16(src[2]);
|
||||
INT32 code = BURN_ENDIAN_SWAP_INT16(src[3]);
|
||||
|
||||
INT32 flipx = attr & 0x8000;
|
||||
INT32 flipy = attr & 0x4000;
|
||||
|
|
|
@ -472,7 +472,7 @@ void necInit(int cpu, int type)
|
|||
|
||||
case V30_TYPE:
|
||||
{
|
||||
nec_state->fetch_xor = BYTE_XOR_LE(0);
|
||||
nec_state->fetch_xor = 0;
|
||||
nec_state->chip_type=V30_TYPE;
|
||||
nec_state->prefetch_size = 6; /* 3 words */
|
||||
nec_state->prefetch_cycles = 2; /* two cycles per byte / four per word */
|
||||
|
@ -481,7 +481,7 @@ void necInit(int cpu, int type)
|
|||
|
||||
case V33_TYPE:
|
||||
{
|
||||
nec_state->fetch_xor = 0;//BYTE_XOR_LE(0);
|
||||
nec_state->fetch_xor = 0;
|
||||
nec_state->chip_type=V33_TYPE;
|
||||
nec_state->prefetch_size = 6;
|
||||
/* FIXME: Need information about prefetch size and cycles for V33.
|
||||
|
|
Loading…
Reference in New Issue