First batch of big-endian fixes for pst_90s from lantus

This commit is contained in:
Barry Harris 2012-02-03 11:39:44 +00:00
parent 5b5d665f97
commit 4992891c5b
21 changed files with 430 additions and 430 deletions

View File

@ -274,33 +274,33 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
if ((!disabled)){
group_enable = (sprite_regs[0x00/4] & 0x0040) >> 6; // RWR0
group_enable = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x00/4]) & 0x0040) >> 6; // RWR0
/* Sengekis uses global flip */
sprite_flip = (sprite_regs[0x04/4] & 0x03); // RWR1
sprite_flip = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x04/4]) & 0x03); // RWR1
sprite_y_scroll = ((sprite_regs[0x08/4] & 0x7fc0) >> 6); // RWR2
sprite_x_scroll = ((sprite_regs[0x10/4] & 0x7fc0) >> 6); // RWR4
sprite_y_scroll = ((BURN_ENDIAN_SWAP_INT32(sprite_regs[0x08/4]) & 0x7fc0) >> 6); // RWR2
sprite_x_scroll = ((BURN_ENDIAN_SWAP_INT32(sprite_regs[0x10/4]) & 0x7fc0) >> 6); // RWR4
if (sprite_y_scroll&0x100) sprite_y_scroll -= 0x200; // Signed
if (sprite_x_scroll&0x100) sprite_x_scroll -= 0x200; // Signed
group_x_offset[0] = (sprite_regs[0x18/4] & 0xffc0) >> 6; // RWR6
group_y_offset[0] = (sprite_regs[0x1c/4] & 0xffc0) >> 6; // RWR7
group_x_offset[0] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x18/4]) & 0xffc0) >> 6; // RWR6
group_y_offset[0] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x1c/4]) & 0xffc0) >> 6; // RWR7
if (group_x_offset[0]&0x200) group_x_offset[0] -= 0x400; // Signed
if (group_y_offset[0]&0x200) group_y_offset[0] -= 0x400; // Signed
group_x_offset[1] = (sprite_regs[0x20/4] & 0xffc0) >> 6; // RWR8
group_y_offset[1] = (sprite_regs[0x24/4] & 0xffc0) >> 6; // RWR9
group_x_offset[1] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x20/4]) & 0xffc0) >> 6; // RWR8
group_y_offset[1] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x24/4]) & 0xffc0) >> 6; // RWR9
if (group_x_offset[1]&0x200) group_x_offset[1] -= 0x400; // Signed
if (group_y_offset[1]&0x200) group_y_offset[1] -= 0x400; // Signed
group_x_offset[2] = (sprite_regs[0x28/4] & 0xffc0) >> 6; // RWR10
group_y_offset[2] = (sprite_regs[0x2c/4] & 0xffc0) >> 6; // RWR11
group_x_offset[2] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x28/4]) & 0xffc0) >> 6; // RWR10
group_y_offset[2] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x2c/4]) & 0xffc0) >> 6; // RWR11
if (group_x_offset[2]&0x200) group_x_offset[2] -= 0x400; // Signed
if (group_y_offset[2]&0x200) group_y_offset[2] -= 0x400; // Signed
group_x_offset[3] = (sprite_regs[0x30/4] & 0xffc0) >> 6; // RWR12
group_y_offset[3] = (sprite_regs[0x34/4] & 0xffc0) >> 6; // RWR13
group_x_offset[3] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x30/4]) & 0xffc0) >> 6; // RWR12
group_y_offset[3] = (BURN_ENDIAN_SWAP_INT32(sprite_regs[0x34/4]) & 0xffc0) >> 6; // RWR13
if (group_x_offset[3]&0x200) group_x_offset[3] -= 0x400; // Signed
if (group_y_offset[3]&0x200) group_y_offset[3] -= 0x400; // Signed
@ -313,11 +313,11 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
gfxlen = gfx_length;
while( source<finish )
{
xflip = (source[0] & 0x00000200) >> 9;
yflip = (source[0] & 0x00000100) >> 8;
xflip = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x00000200) >> 9;
yflip = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x00000100) >> 8;
ysize = (source[0] & 0x30000000) >> 28;
xsize = (source[0] & 0x03000000) >> 24;
ysize = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x30000000) >> 28;
xsize = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x03000000) >> 24;
xsize ++;
ysize ++;
@ -326,19 +326,19 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
size = xsize * ysize;
joint = (source[0] & 0x0000e000) >> 13;
joint = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x0000e000) >> 13;
if (!(joint & 1))
{
xpos = (source[2] & 0x0000ffc0) >> 6;
ypos = (source[3] & 0x0000ffc0) >> 6;
xpos = (BURN_ENDIAN_SWAP_INT32(source[2]) & 0x0000ffc0) >> 6;
ypos = (BURN_ENDIAN_SWAP_INT32(source[3]) & 0x0000ffc0) >> 6;
xpos += sprite_x_scroll; // Global offset
ypos += sprite_y_scroll;
if (group_enable)
{
group_number = (source[0] & 0x00001800) >> 11;
group_number = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x00001800) >> 11;
/* the group positioning doesn't seem to be working as i'd expect,
if I apply the x position the cursor on galpani4 ends up moving
@ -357,8 +357,8 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
}
else
{
xpos += (source[2] & 0x0000ffc0) >> 6;
ypos += (source[3] & 0x0000ffc0) >> 6;
xpos += (BURN_ENDIAN_SWAP_INT32(source[2]) & 0x0000ffc0) >> 6;
ypos += (BURN_ENDIAN_SWAP_INT32(source[3]) & 0x0000ffc0) >> 6;
}
if (xpos > 0x1ff) xpos -= 0x400;
@ -383,26 +383,26 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
/* Palette linking */
if (!(joint & 2))
{
colour = (source[0] & 0x0000003f) >> 0;
colour = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x0000003f) >> 0;
}
/* Priority and Tile linking */
if (!(joint & 4))
{
romoffset = (source[1] & 0x07ffffff) >> 0;
pri = (source[0] & 0x000000c0) >> 6;
romoffset = (BURN_ENDIAN_SWAP_INT32(source[1]) & 0x07ffffff) >> 0;
pri = (BURN_ENDIAN_SWAP_INT32(source[0]) & 0x000000c0) >> 6;
} else {
romoffset = endromoffs;
}
grow = (source[0]>>23) & 1;
grow = (BURN_ENDIAN_SWAP_INT32(source[0])>>23) & 1;
if (!grow)
{
zoomx_m = (source[2] >> 24)&0x00fc;
zoomx_s = (source[2] >> 16)&0x00fc;
zoomy_m = (source[3] >> 24)&0x00fc;
zoomy_s = (source[3] >> 16)&0x00fc;
zoomx_m = (BURN_ENDIAN_SWAP_INT32(source[2]) >> 24)&0x00fc;
zoomx_s = (BURN_ENDIAN_SWAP_INT32(source[2]) >> 16)&0x00fc;
zoomy_m = (BURN_ENDIAN_SWAP_INT32(source[3]) >> 24)&0x00fc;
zoomy_s = (BURN_ENDIAN_SWAP_INT32(source[3]) >> 16)&0x00fc;
}
else
{
@ -413,9 +413,9 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
// convinced this implementation is correct because we simply end up ignoring
// part of the data)
zoomx_m = 0;
zoomx_s = (source[2] >> 24)&0x00fc;
zoomx_s = (BURN_ENDIAN_SWAP_INT32(source[2]) >> 24)&0x00fc;
zoomy_m = 0;
zoomy_s = (source[3] >> 24)&0x00fc;
zoomy_s = (BURN_ENDIAN_SWAP_INT32(source[3]) >> 24)&0x00fc;
}

View File

@ -189,7 +189,7 @@ void __fastcall k1945iiiWriteWord(UINT32 sekAddress, UINT16 wordValue)
void __fastcall k1945iiiWriteWordPalette(UINT32 sekAddress, UINT16 wordValue)
{
sekAddress = (sekAddress & 0xffe) / 2;
RamPal[sekAddress] = wordValue;
RamPal[sekAddress] = BURN_ENDIAN_SWAP_INT16(wordValue);
if (sekAddress < 0x200) RamCurPal[sekAddress] = CalcCol(wordValue);
}
@ -333,7 +333,7 @@ static void DrawBackground()
if (sx <= -16 || sx >= 320 || sy <= -16 || sy >= 224)
continue;
INT32 code = RamBg[offs] & 0x1fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(RamBg[offs]) & 0x1fff;
if (sx >= 0 && sx <= 304 && sy >= 0 && sy <= 208) {
Render16x16Tile(pTransDraw, code, sx, sy, 0, 8, 0, RomBg);
@ -347,10 +347,10 @@ static void DrawSprites()
{
for (INT32 i = 0; i < 0x1000/2; i++)
{
INT32 sx = RamSpr0[i] >> 8;
INT32 sy = RamSpr0[i] & 0xff;
INT32 code = (RamSpr1[i] & 0x7ffe) >> 1;
sx |= (RamSpr1[i] & 0x0001) << 8;
INT32 sx = BURN_ENDIAN_SWAP_INT16(RamSpr0[i]) >> 8;
INT32 sy = BURN_ENDIAN_SWAP_INT16(RamSpr0[i]) & 0xff;
INT32 code = (BURN_ENDIAN_SWAP_INT16(RamSpr1[i]) & 0x7ffe) >> 1;
sx |= (BURN_ENDIAN_SWAP_INT16(RamSpr1[i]) & 0x0001) << 8;
if (sx >= 336) sx -= 512;
if (sy >= 240) sy -= 256;

View File

@ -413,7 +413,7 @@ void __fastcall aerofgtWriteWord(UINT32 sekAddress, UINT16 wordValue)
if (( sekAddress & 0xFF0000 ) == 0x1A0000) {
sekAddress &= 0xFFFF;
if (sekAddress < 0x800)
*((UINT16 *)&RamPal[sekAddress]) = wordValue;
*((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue);
RamCurPal[sekAddress>>1] = CalcCol( wordValue );
return;
}
@ -915,24 +915,24 @@ static void aerofgt_drawsprites(INT32 priority)
priority <<= 12;
INT32 offs = 0;
while (offs < 0x0400 && (RamSpr2[offs] & 0x8000) == 0) {
INT32 attr_start = (RamSpr2[offs] & 0x03ff) * 4;
while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x8000) == 0) {
INT32 attr_start = (BURN_ENDIAN_SWAP_INT16(RamSpr2[offs]) & 0x03ff) * 4;
/* is the way I handle priority correct? Or should I just check bit 13? */
if ((RamSpr2[attr_start + 2] & 0x3000) == priority) {
if ((BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x3000) == priority) {
INT32 map_start;
INT32 ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color;
ox = RamSpr2[attr_start + 1] & 0x01ff;
xsize = (RamSpr2[attr_start + 1] & 0x0e00) >> 9;
zoomx = (RamSpr2[attr_start + 1] & 0xf000) >> 12;
oy = RamSpr2[attr_start + 0] & 0x01ff;
ysize = (RamSpr2[attr_start + 0] & 0x0e00) >> 9;
zoomy = (RamSpr2[attr_start + 0] & 0xf000) >> 12;
flipx = RamSpr2[attr_start + 2] & 0x4000;
flipy = RamSpr2[attr_start + 2] & 0x8000;
color = (RamSpr2[attr_start + 2] & 0x0f00) >> 4;
map_start = RamSpr2[attr_start + 3] & 0x3fff;
ox = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x01ff;
xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0x0e00) >> 9;
zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 1]) & 0xf000) >> 12;
oy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x01ff;
ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0x0e00) >> 9;
zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 0]) & 0xf000) >> 12;
flipx = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x4000;
flipy = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x8000;
color = (BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 2]) & 0x0f00) >> 4;
map_start = BURN_ENDIAN_SWAP_INT16(RamSpr2[attr_start + 3]) & 0x3fff;
ox += (xsize*zoomx+2)/4;
oy += (ysize*zoomy+2)/4;
@ -951,7 +951,7 @@ static void aerofgt_drawsprites(INT32 priority)
else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
//if (map_start < 0x2000)
INT32 code = RamSpr1[map_start] & 0x1fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start]) & 0x1fff;
drawgfxzoom(map_start&0x2000,code,color,flipx,flipy,sx,sy,zoomx<<11, zoomy<<11);
@ -986,7 +986,7 @@ static void TileBackground_1(UINT16 *bg, UINT16 *pal)
my++;
}
x = mx * 8 - RamRaster[0x0000] + 18;
x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0000]) + 18;
if (x <= -192) x += 512;
y = my * 8 - (bg1scrolly & 0x1FF);
@ -997,8 +997,8 @@ static void TileBackground_1(UINT16 *bg, UINT16 *pal)
else
if ( x >=0 && x < 312 && y >= 0 && y < 216) {
UINT8 *d = DeRomBg + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -1016,8 +1016,8 @@ static void TileBackground_1(UINT16 *bg, UINT16 *pal)
}
} else {
UINT8 *d = DeRomBg + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -1053,7 +1053,7 @@ static void TileBackground_2(UINT16 *bg, UINT16 *pal)
my++;
}
x = mx * 8 - RamRaster[0x0200] + 20;
x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0200]) + 20;
if (x <= -192) x += 512;
y = my * 8 - (bg2scrolly & 0x1FF);
@ -1064,8 +1064,8 @@ static void TileBackground_2(UINT16 *bg, UINT16 *pal)
else
if ( x >=0 && x < 312 && y >= 0 && y < 216) {
UINT8 *d = DeRomBg + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -1084,8 +1084,8 @@ static void TileBackground_2(UINT16 *bg, UINT16 *pal)
}
} else {
UINT8 *d = DeRomBg + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = DeRomBg + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -1417,7 +1417,7 @@ void __fastcall turbofrcWriteWord(UINT32 sekAddress, UINT16 wordValue)
{
if (( sekAddress & 0x0FF000 ) == 0x0FE000) {
sekAddress &= 0x07FE;
*((UINT16 *)&RamPal[sekAddress]) = wordValue;
*((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue);
RamCurPal[sekAddress>>1] = CalcCol( wordValue );
return;
}
@ -1689,7 +1689,7 @@ static void turbofrcTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
my++;
}
x = mx * 8 - (RamRaster[7] & 0x1FF) - 11;
x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF) - 11;
if (x <= (352-512)) x += 512;
y = my * 8 - (bg1scrolly & 0x1FF) - 2;
@ -1701,8 +1701,8 @@ static void turbofrcTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -1720,8 +1720,8 @@ static void turbofrcTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -1768,8 +1768,8 @@ static void turbofrcTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -1788,8 +1788,8 @@ static void turbofrcTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -2075,7 +2075,7 @@ static void turbofrc_drawsprites(INT32 chip,INT32 chip_disabled_pri)
INT32 attr_start,base,first;
base = chip * 0x0200;
first = 4 * RamSpr3[0x1fe + base];
first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]);
//for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) {
for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) {
@ -2084,21 +2084,21 @@ static void turbofrc_drawsprites(INT32 chip,INT32 chip_disabled_pri)
// some other drivers still use this wrong table, they have to be upgraded
// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
if (!(RamSpr3[attr_start + 2] & 0x0080)) continue;
pri = RamSpr3[attr_start + 2] & 0x0010;
if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue;
pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010;
if ( chip_disabled_pri & !pri) continue;
if (!chip_disabled_pri & (pri>>4)) continue;
ox = RamSpr3[attr_start + 1] & 0x01ff;
xsize = (RamSpr3[attr_start + 2] & 0x0700) >> 8;
zoomx = (RamSpr3[attr_start + 1] & 0xf000) >> 12;
oy = RamSpr3[attr_start + 0] & 0x01ff;
ysize = (RamSpr3[attr_start + 2] & 0x7000) >> 12;
zoomy = (RamSpr3[attr_start + 0] & 0xf000) >> 12;
flipx = RamSpr3[attr_start + 2] & 0x0800;
flipy = RamSpr3[attr_start + 2] & 0x8000;
color = (RamSpr3[attr_start + 2] & 0x000f) << 4; // + 16 * spritepalettebank;
ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff;
xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8;
zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12;
oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff;
ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12;
zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12;
flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800;
flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000;
color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank;
map_start = RamSpr3[attr_start + 3];
map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]);
// aerofgt has this adjustment, but doing it here would break turbo force title screen
// ox += (xsize*zoomx+2)/4;
@ -2119,8 +2119,8 @@ static void turbofrc_drawsprites(INT32 chip,INT32 chip_disabled_pri)
if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8;
else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8;
if (chip == 0) code = RamSpr1[map_start & RamSpr1SizeMask];
else code = RamSpr2[map_start & RamSpr2SizeMask];
if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]);
else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]);
pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11);
@ -2662,8 +2662,8 @@ static void karatblzTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -2681,8 +2681,8 @@ static void karatblzTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[0] << 13 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -2729,8 +2729,8 @@ static void karatblzTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -2749,8 +2749,8 @@ static void karatblzTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1FFF) + ( RamGfxBank[1] << 13 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -3203,7 +3203,7 @@ void __fastcall spinlbrkWriteWord(UINT32 sekAddress, UINT16 wordValue)
if (( sekAddress & 0xFFF000 ) == 0xFFE000) {
sekAddress &= 0x07FF;
*((UINT16 *)&RamPal[sekAddress]) = wordValue;
*((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue);
RamCurPal[sekAddress>>1] = CalcCol( wordValue );
return;
}
@ -3364,7 +3364,7 @@ static INT32 spinlbrkInit()
bg2scrollx = 0; //
for (UINT16 i=0; i<0x2000;i++)
RamSpr1[i] = i;
RamSpr1[i] = BURN_ENDIAN_SWAP_INT16(i);
DrvDoReset();
@ -3384,7 +3384,7 @@ static void spinlbrkTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
my++;
}
x = mx * 8 - (RamRaster[my*8] & 0x1FF); // + 8
x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[my*8]) & 0x1FF); // + 8
if (x <= (352-512)) x += 512;
y = my * 8;
@ -3395,8 +3395,8 @@ static void spinlbrkTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (352-8) && y >= 0 && y < (240-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64;
UINT16 c = (bg[offs] & 0xF000) >> 8;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -3414,8 +3414,8 @@ static void spinlbrkTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64;
UINT16 c = (bg[offs] & 0xF000) >> 8;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x0FFF) + ( RamGfxBank[0] << 12 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xF000) >> 8;
UINT16 * p = (UINT16 *) pBurnDraw + y * 352 + x;
for (INT32 k=0;k<8;k++) {
@ -3679,7 +3679,7 @@ void __fastcall aerofgtbWriteWord(UINT32 sekAddress, UINT16 wordValue)
{
if (( sekAddress & 0x0FF000 ) == 0x0FD000) {
sekAddress &= 0x07FE;
*((UINT16 *)&RamPal[sekAddress]) = wordValue;
*((UINT16 *)&RamPal[sekAddress]) = BURN_ENDIAN_SWAP_INT16(wordValue);
RamCurPal[sekAddress>>1] = CalcCol( wordValue );
return;
}
@ -3888,7 +3888,7 @@ static void aerofgtbTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
my++;
}
x = mx * 8 - (RamRaster[7] & 0x1FF);
x = mx * 8 - (BURN_ENDIAN_SWAP_INT16(RamRaster[7]) & 0x1FF);
if (x <= (320-512)) x += 512;
y = my * 8 - (((INT16)bg1scrolly + 2) & 0x1FF);
@ -3900,8 +3900,8 @@ static void aerofgtbTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -3919,8 +3919,8 @@ static void aerofgtbTileBackground_1(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11)] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -3967,8 +3967,8 @@ static void aerofgtbTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
else
if ( x >=0 && x < (320-8) && y >= 0 && y < (224-8)) {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -3987,8 +3987,8 @@ static void aerofgtbTileBackground_2(UINT16 *bg, UINT8 *BgGfx, UINT16 *pal)
}
} else {
UINT8 *d = BgGfx + ( (bg[offs] & 0x07FF) + ( RamGfxBank[((bg[offs] & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (bg[offs] & 0xE000) >> 9;
UINT8 *d = BgGfx + ( (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x07FF) + ( RamGfxBank[((BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0x1800) >> 11) + 4] << 11 ) ) * 64;
UINT16 c = (BURN_ENDIAN_SWAP_INT16(bg[offs]) & 0xE000) >> 9;
UINT16 * p = (UINT16 *) pBurnDraw + y * 320 + x;
for (INT32 k=0;k<8;k++) {
@ -4274,7 +4274,7 @@ static void aerofgtb_drawsprites(INT32 chip,INT32 chip_disabled_pri)
INT32 attr_start,base,first;
base = chip * 0x0200;
first = 4 * RamSpr3[0x1fe + base];
first = 4 * BURN_ENDIAN_SWAP_INT16(RamSpr3[0x1fe + base]);
//for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4) {
for (attr_start = first + base; attr_start <= base + 0x0200-8; attr_start += 4) {
@ -4283,21 +4283,21 @@ static void aerofgtb_drawsprites(INT32 chip,INT32 chip_disabled_pri)
// some other drivers still use this wrong table, they have to be upgraded
// INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
if (!(RamSpr3[attr_start + 2] & 0x0080)) continue;
pri = RamSpr3[attr_start + 2] & 0x0010;
if (!(BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0080)) continue;
pri = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0010;
if ( chip_disabled_pri & !pri) continue;
if (!chip_disabled_pri & (pri>>4)) continue;
ox = RamSpr3[attr_start + 1] & 0x01ff;
xsize = (RamSpr3[attr_start + 2] & 0x0700) >> 8;
zoomx = (RamSpr3[attr_start + 1] & 0xf000) >> 12;
oy = RamSpr3[attr_start + 0] & 0x01ff;
ysize = (RamSpr3[attr_start + 2] & 0x7000) >> 12;
zoomy = (RamSpr3[attr_start + 0] & 0xf000) >> 12;
flipx = RamSpr3[attr_start + 2] & 0x0800;
flipy = RamSpr3[attr_start + 2] & 0x8000;
color = (RamSpr3[attr_start + 2] & 0x000f) << 4; // + 16 * spritepalettebank;
ox = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0x01ff;
xsize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0700) >> 8;
zoomx = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 1]) & 0xf000) >> 12;
oy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0x01ff;
ysize = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x7000) >> 12;
zoomy = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 0]) & 0xf000) >> 12;
flipx = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x0800;
flipy = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x8000;
color = (BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 2]) & 0x000f) << 4; // + 16 * spritepalettebank;
map_start = RamSpr3[attr_start + 3];
map_start = BURN_ENDIAN_SWAP_INT16(RamSpr3[attr_start + 3]);
// aerofgt has this adjustment, but doing it here would break turbo force title screen
// ox += (xsize*zoomx+2)/4;
@ -4318,8 +4318,8 @@ static void aerofgtb_drawsprites(INT32 chip,INT32 chip_disabled_pri)
if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16 - 8;
else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16 - 8;
if (chip == 0) code = RamSpr1[map_start & RamSpr1SizeMask];
else code = RamSpr2[map_start & RamSpr2SizeMask];
if (chip == 0) code = BURN_ENDIAN_SWAP_INT16(RamSpr1[map_start & RamSpr1SizeMask]);
else code = BURN_ENDIAN_SWAP_INT16(RamSpr2[map_start & RamSpr2SizeMask]);
aerofgtb_pdrawgfxzoom(chip,code,color,flipx,flipy,sx,sy,zoomx << 11, zoomy << 11);

View File

@ -448,7 +448,7 @@ static INT32 DrvExit()
static inline void palette_write(INT32 offset)
{
UINT8 r,g,b;
UINT16 data = *((UINT16*)(DrvPalRAM + offset));
UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset)));
r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01);
g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01);
@ -467,7 +467,7 @@ static void draw_bg_layer(UINT8 *src, UINT8 *gfx_base, INT32 scrollx, INT32 scro
for (INT32 offs = 0; offs < 32 * 32; offs++)
{
INT32 color = vram[(offs * 2) + 1];
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs * 2) + 1]);
INT32 prior = (color & 0x0020) >> 5;
if (prior != priority) continue;
@ -483,7 +483,7 @@ static void draw_bg_layer(UINT8 *src, UINT8 *gfx_base, INT32 scrollx, INT32 scro
INT32 flipx = color & 0x0100;
INT32 flipy = color & 0x0200;
INT32 code = vram[offs * 2] & 0x0fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2]) & 0x0fff;
if (transp) {
if (flipy) {
@ -531,8 +531,8 @@ static void draw_tx_layer(INT32 scrollx, INT32 scrolly)
sy -= scrolly + 16;
if (sy < -7) sy += 0x200;
INT32 code = vram[offs] & 0xfff;
INT32 color = vram[offs] >> 12;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff;
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12;
if (sx >= nScreenWidth || sy >= nScreenHeight || code == 0) continue;
@ -546,19 +546,19 @@ static void draw_sprites()
for (INT32 offs = 0; offs < 0x0800; offs += 8)
{
INT32 code = (sram[offs+5] & 0xff) | ((sram[offs+6] & 0x3f) << 8);
INT32 code = (BURN_ENDIAN_SWAP_INT16(sram[offs+5]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+6]) & 0x3f) << 8);
if (~sram[offs+4] & 0x80)
if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x80)
{
INT32 x = (((sram[offs+0] & 0xff) | ((sram[offs+1] & 0x7f) << 8)) - ((sram[offs+1] & 0x80) << 9)) - 16;
INT32 y = (((sram[offs+2] & 0xff) | ((sram[offs+3] & 0x7f) << 8)) - ((sram[offs+3] & 0x80) << 9)) - 16;
INT32 x = (((BURN_ENDIAN_SWAP_INT16(sram[offs+0]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+1]) & 0x80) << 9)) - 16;
INT32 y = (((BURN_ENDIAN_SWAP_INT16(sram[offs+2]) & 0xff) | ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x7f) << 8)) - ((BURN_ENDIAN_SWAP_INT16(sram[offs+3]) & 0x80) << 9)) - 16;
INT32 col = sram[offs+7] & 0x0f;
INT32 chain = sram[offs+4] & 0x07;
INT32 flipy = sram[offs+4] & 0x10;
INT32 flipx = sram[offs+4] & 0x20;
INT32 col = BURN_ENDIAN_SWAP_INT16(sram[offs+7]) & 0x0f;
INT32 chain = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x07;
INT32 flipy = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x10;
INT32 flipx = BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x20;
if (~sram[offs+4] & 0x08) {
if (~BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08) {
if (flipy) y += chain << 4;
if (flipx) x += chain << 4;
}
@ -585,7 +585,7 @@ static void draw_sprites()
code++;
if (sram[offs+4] & 0x08)
if (BURN_ENDIAN_SWAP_INT16(sram[offs+4]) & 0x08)
{
if (flipy) y -= 16;
else y += 16;

View File

@ -346,12 +346,12 @@ UINT16 __fastcall Blmbycar68KReadWord(UINT32 a)
{
if (a >= 0x204000 && a <= 0x2045ff) {
UINT16 *RAM = (UINT16*)DrvPaletteRam;
return RAM[(a - 0x204000) >> 1];
return BURN_ENDIAN_SWAP_INT16(RAM[(a - 0x204000) >> 1]);
}
if (a >= 0x204600 && a <= 0x207fff) {
UINT16 *RAM = (UINT16*)Drv68KRam + (0x8000 / 2);
return RAM[(a - 0x204600) >> 1];
return BURN_ENDIAN_SWAP_INT16(RAM[(a - 0x204600) >> 1]);
}
switch (a) {
@ -380,19 +380,19 @@ void __fastcall Blmbycar68KWriteWord(UINT32 a, UINT16 d)
if (a >= 0x200000 && a <= 0x2005ff) {
UINT16 *RAM = (UINT16*)DrvPaletteRam;
RAM[(a - 0x200000) >> 1] = d;
RAM[(a - 0x200000) >> 1] = BURN_ENDIAN_SWAP_INT16(d);
return;
}
if (a >= 0x204000 && a <= 0x2045ff) {
UINT16 *RAM = (UINT16*)DrvPaletteRam;
RAM[(a - 0x204000) >> 1] = d;
RAM[(a - 0x204000) >> 1] = BURN_ENDIAN_SWAP_INT16(d);
return;
}
if (a >= 0x204600 && a <= 0x207fff) {
UINT16 *RAM = (UINT16*)Drv68KRam + (0x8000 / 2);
RAM[(a - 0x204600) >> 1] = d;
RAM[(a - 0x204600) >> 1] = BURN_ENDIAN_SWAP_INT16(d);
return;
}
@ -400,14 +400,14 @@ void __fastcall Blmbycar68KWriteWord(UINT32 a, UINT16 d)
case 0x10c000:
case 0x10c002: {
UINT16 *RAM = (UINT16*)DrvScroll1;
RAM[(a - 0x10c000) >> 1] = d;
RAM[(a - 0x10c000) >> 1] = BURN_ENDIAN_SWAP_INT16(d);
return;
}
case 0x10c004:
case 0x10c006: {
UINT16 *RAM = (UINT16*)DrvScroll0;
RAM[(a - 0x10c004) >> 1] = d;
RAM[(a - 0x10c004) >> 1] = BURN_ENDIAN_SWAP_INT16(d);
return;
}
@ -458,9 +458,9 @@ static INT32 DrvInit()
if (DrvEncrypted) {
UINT16 *RAM = (UINT16*)Drv68KRom;
for (INT32 i = 0; i < 0x80000; i++) {
UINT16 x = RAM[i];
UINT16 x = BURN_ENDIAN_SWAP_INT16(RAM[i]);
x = (x & ~0x0606) | ((x & 0x0202) << 1) | ((x & 0x0404) >> 1);
RAM[i] = x;
RAM[i] = BURN_ENDIAN_SWAP_INT16(x);
}
}
@ -544,7 +544,7 @@ static void DrvCalcPalette()
UINT32* pd;
for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x300; i++, ps++, pd++) {
*pd = CalcCol(*ps);
*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps));
}
}
@ -557,8 +557,8 @@ static void DrvRenderBgLayer(INT32 RenderCategory)
for (my = 0; my < 32; my++) {
for (mx = 0; mx < 64; mx++) {
Code = RAM[(TileIndex << 1) + 0];
Attr = RAM[(TileIndex << 1) + 1];
Code = BURN_ENDIAN_SWAP_INT16(RAM[(TileIndex << 1) + 0]);
Attr = BURN_ENDIAN_SWAP_INT16(RAM[(TileIndex << 1) + 1]);
Colour = Attr & 0x1f;
xFlip = (Attr >> 6) & 0x01;
yFlip = (Attr >> 6) & 0x02;
@ -568,8 +568,8 @@ static void DrvRenderBgLayer(INT32 RenderCategory)
x = 16 * mx;
y = 16 * my;
x -= ScrollRAM[1] & 0x3ff;
y -= ScrollRAM[0] & 0x1ff;
x -= BURN_ENDIAN_SWAP_INT16(ScrollRAM[1]) & 0x3ff;
y -= BURN_ENDIAN_SWAP_INT16(ScrollRAM[0]) & 0x1ff;
if (x < -16) x += 1024;
if (y < -16) y += 512;
@ -620,8 +620,8 @@ static void DrvRenderFgLayer(INT32 RenderCategory)
for (my = 0; my < 32; my++) {
for (mx = 0; mx < 64; mx++) {
Code = RAM[(TileIndex << 1) + 0];
Attr = RAM[(TileIndex << 1) + 1];
Code = BURN_ENDIAN_SWAP_INT16(RAM[(TileIndex << 1) + 0]);
Attr = BURN_ENDIAN_SWAP_INT16(RAM[(TileIndex << 1) + 1]);
Colour = Attr & 0x1f;
xFlip = (Attr >> 6) & 0x01;
yFlip = (Attr >> 6) & 0x02;
@ -631,8 +631,8 @@ static void DrvRenderFgLayer(INT32 RenderCategory)
x = 16 * mx;
y = 16 * my;
x -= (ScrollRAM[1] + 5) & 0x3ff;
y -= (ScrollRAM[0] + 1) & 0x1ff;
x -= (BURN_ENDIAN_SWAP_INT16(ScrollRAM[1]) + 5) & 0x3ff;
y -= (BURN_ENDIAN_SWAP_INT16(ScrollRAM[0]) + 1) & 0x1ff;
if (x < -16) x += 1024;
if (y < -16) y += 512;
@ -683,17 +683,17 @@ static void DrawSprites(INT32 RenderPriority)
Finish = RAM + (0x2000 / 2) - (8 / 2);
for (; Source < Finish; Source += 8 / 2) {
if (Source[0] & 0x8000) break;
if (BURN_ENDIAN_SWAP_INT16(Source[0]) & 0x8000) break;
}
Source -= 8 / 2;
Finish = RAM;
for (; Source >= Finish; Source -= 8 / 2) {
INT32 y = Source[0];
INT32 Code = Source[1];
INT32 Attr = Source[2];
INT32 x = Source[3];
INT32 y = BURN_ENDIAN_SWAP_INT16(Source[0]);
INT32 Code = BURN_ENDIAN_SWAP_INT16(Source[1]);
INT32 Attr = BURN_ENDIAN_SWAP_INT16(Source[2]);
INT32 x = BURN_ENDIAN_SWAP_INT16(Source[3]);
INT32 xFlip = Attr & 0x4000;
INT32 yFlip = Attr & 0x8000;

View File

@ -434,7 +434,7 @@ void __fastcall bloodbro_write_word(UINT32 address, UINT16 data)
}
if ((address & 0xfffff80) == 0xc0000) {
*((UINT16*)(DrvScrollRAM + (address & 0x7e))) = data;
*((UINT16*)(DrvScrollRAM + (address & 0x7e))) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
}
@ -713,8 +713,8 @@ static void draw_layer(UINT8 *src, INT32 palette_offset, INT32 transp, INT32 scr
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 code = (vram[offs] & 0xfff) | (transp << 12);
INT32 color = vram[offs] >> 12;
INT32 code = (BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff) | (transp << 12);
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12;
if (transp) {
Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, palette_offset, DrvGfxROM1);
@ -730,12 +730,12 @@ static void draw_text_layer()
for (INT32 offs = 0x40; offs < 0x3c0; offs++)
{
INT32 code = vram[offs] & 0xfff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff;
if (!code) continue;
INT32 sx = (offs & 0x1f) << 3;
INT32 sy = (offs >> 5) << 3;
INT32 color = vram[offs] >> 12;
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12;
Render8x8Tile_Mask(pTransDraw, code, sx, sy-16, color, 4, 15, 0x700, DrvGfxROM0);
}
@ -747,15 +747,15 @@ static void draw_sprites(INT32 priority)
for (INT32 offs = 0x800-4; offs >= 0; offs -= 4)
{
INT32 attr = ram[offs];
INT32 attr = BURN_ENDIAN_SWAP_INT16(ram[offs]);
INT32 prio = (attr & 0x0800) >> 11;
if (attr & 0x8000 || prio != priority) continue;
INT32 width = (attr >> 7) & 7;
INT32 height = (attr >> 4) & 7;
INT32 code = ram[offs+1] & 0x1fff;
INT32 sx = ram[offs+2] & 0x01ff;
INT32 sy = ram[offs+3] & 0x01ff;
INT32 code = BURN_ENDIAN_SWAP_INT16(ram[offs+1]) & 0x1fff;
INT32 sx = BURN_ENDIAN_SWAP_INT16(ram[offs+2]) & 0x01ff;
INT32 sy = BURN_ENDIAN_SWAP_INT16(ram[offs+3]) & 0x01ff;
if (sx > 255) sx -= 512;
if (sy > 255) sy -= 512;
sy -= 16;
@ -796,7 +796,7 @@ static inline void DrvRecalcPalette()
for (INT32 i = 0; i < 0x1000/2; i++)
{
INT32 data = p[i];
INT32 data = BURN_ENDIAN_SWAP_INT16(p[i]);
r = (data >> 0) & 0x0f;
g = (data >> 4) & 0x0f;
@ -819,11 +819,11 @@ static INT32 DrvDraw()
UINT16 *scroll = (UINT16*)DrvScrollRAM;
scroll += 0x10 >> (nGameSelect & 1); // skysmash
draw_layer(DrvBgRAM, 0x400, 0, scroll[0] & 0x1ff, scroll[1] & 0x0ff);
draw_layer(DrvBgRAM, 0x400, 0, BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x1ff, BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0x0ff);
draw_sprites(1);
draw_layer(DrvFgRAM, 0x500, 1, scroll[2] & 0x1ff, scroll[3] & 0x0ff);
draw_layer(DrvFgRAM, 0x500, 1, BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x1ff, BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0x0ff);
draw_sprites(0);

View File

@ -502,7 +502,7 @@ static void draw_layer(UINT8 *src, INT32 coloffs, INT32 scrollx, INT32 scrolly,
if (sy >= nScreenHeight || sx >= nScreenWidth) continue;
INT32 data = vram[offs];
INT32 data = BURN_ENDIAN_SWAP_INT16(vram[offs]);
INT32 code = (data & 0xfff) + (*tile_bank << 12);
INT32 color = (data >> 12) + coloffs;
@ -522,13 +522,13 @@ static void draw_sprites()
for (INT32 offs = 0;offs < 0x400;offs += 4)
{
INT32 sprite = ram[offs + 1] & 0x7fff;
INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs + 1]) & 0x7fff;
if (!sprite) continue;
INT32 y = ram[offs];
INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs]);
if ((y & 0x1000) && (GetCurrentFrame() & 1)) continue; // flash
INT32 x = ram[offs + 2];
INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs + 2]);
INT32 color = (x >>9) & 0xf;
INT32 fx = y & 0x2000;
@ -577,9 +577,9 @@ static INT32 DrvDraw()
UINT8 r,g,b;
UINT16 *pal = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x300; i++) {
r = (pal[i] >> 10) & 0x1f;
g = (pal[i] >> 5) & 0x1f;
b = (pal[i] >> 0) & 0x1f;
r = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 10) & 0x1f;
g = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 5) & 0x1f;
b = (BURN_ENDIAN_SWAP_INT16(pal[i]) >> 0) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);

View File

@ -200,7 +200,7 @@ static void crshrace_drawtile(INT32 offset)
INT32 sx = (offset & 0x3f) << 4;
INT32 sy = (offset >> 6) << 4;
INT32 code = *((UINT16*)(DrvVidRAM1 + (offset << 1)));
INT32 code = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM1 + (offset << 1))));
INT32 color = code >> 12;
code = (code & 0xfff) | (*roz_bank << 12);
color = (color << 4) | 0x100;
@ -213,7 +213,7 @@ static void crshrace_drawtile(INT32 offset)
INT32 pxl = *src++;
if (pxl == 0x0f) pxl = ~0;
dst[x] = pxl | color;
dst[x] = BURN_ENDIAN_SWAP_INT16(pxl | color);
}
dst += 1024;
}
@ -222,12 +222,12 @@ static void crshrace_drawtile(INT32 offset)
void __fastcall crshrace_write_word(UINT32 address, UINT16 data)
{
if (address >= 0xfff020 && address <= 0xfff03f) { // K053936_0_ctrl
DrvGfxCtrl[(address & 0x1f)/2] = data;
DrvGfxCtrl[(address & 0x1f)/2] = BURN_ENDIAN_SWAP_INT16(data);
return;
}
if ((address & 0xfffe000) == 0xd00000) {
*((UINT16*)(DrvVidRAM1 + (address & 0x1ffe))) = data;
*((UINT16*)(DrvVidRAM1 + (address & 0x1ffe))) = BURN_ENDIAN_SWAP_INT16(data);
crshrace_drawtile((address & 0x1ffe)/2);
return;
}
@ -559,25 +559,25 @@ static void draw_sprites()
static const INT32 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
while (offs < 0x0400 && (sprbuf1[offs] & 0x4000) == 0)
while (offs < 0x0400 && (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs]) & 0x4000) == 0)
{
INT32 attr_start = 4 * (sprbuf1[offs++] & 0x03ff);
INT32 attr_start = 4 * (BURN_ENDIAN_SWAP_INT16(sprbuf1[offs++]) & 0x03ff);
INT32 ox = sprbuf1[attr_start + 1] & 0x01ff;
INT32 xsize = (sprbuf1[attr_start + 1] & 0x0e00) >> 9;
INT32 zoomx = (sprbuf1[attr_start + 1] & 0xf000) >> 12;
INT32 oy = sprbuf1[attr_start + 0] & 0x01ff;
INT32 ysize = (sprbuf1[attr_start + 0] & 0x0e00) >> 9;
INT32 zoomy = (sprbuf1[attr_start + 0] & 0xf000) >> 12;
INT32 flipx = sprbuf1[attr_start + 2] & 0x4000;
INT32 flipy = sprbuf1[attr_start + 2] & 0x8000;
INT32 color = (sprbuf1[attr_start + 2] & 0x1f00) >> 8;
INT32 map_start = sprbuf1[attr_start + 3] & 0x7fff;
INT32 ox = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x01ff;
INT32 xsize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0x0e00) >> 9;
INT32 zoomx = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 1]) & 0xf000) >> 12;
INT32 oy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x01ff;
INT32 ysize = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0x0e00) >> 9;
INT32 zoomy = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 0]) & 0xf000) >> 12;
INT32 flipx = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x4000;
INT32 flipy = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x8000;
INT32 color = (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x1f00) >> 8;
INT32 map_start = BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 3]) & 0x7fff;
zoomx = 16 - zoomtable[zoomx]/8;
zoomy = 16 - zoomtable[zoomy]/8;
if (sprbuf1[attr_start + 2] & 0x20ff) color = 1; // what?? mame_rand? why?
if (BURN_ENDIAN_SWAP_INT16(sprbuf1[attr_start + 2]) & 0x20ff) color = 1; // what?? mame_rand? why?
for (INT32 y = 0;y <= ysize;y++)
{
@ -593,7 +593,7 @@ static void draw_sprites()
else
sx = ((ox + zoomx * x + 16) & 0x1ff) - 16;
INT32 code = sprbuf2[map_start & 0x7fff] & 0x7fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(sprbuf2[map_start & 0x7fff]) & 0x7fff;
map_start++;
RenderZoomedTile(pTransDraw, DrvGfxROM2, code, (color << 4) | 0x200, 0x0f, sx, sy, flipx, flipy, 16, 16, zoomx << 12, zoomy << 12);
@ -613,7 +613,7 @@ static void draw_background()
INT32 sy = (offs >> 6) << 3;
INT32 code = vram[offs] & 0x3fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x3fff;
if (code == 0) continue;
Render8x8Tile_Mask(pTransDraw, code, sx, sy, 0, 4, 0xff, 0, DrvGfxROM0);
@ -632,7 +632,7 @@ static inline void copy_roz(UINT32 startx, UINT32 starty, INT32 incxx, INT32 inc
for (INT32 x = 0; x < nScreenWidth; x++, cx+=incxx, cy+=incxy, dst++)
{
INT32 p = src[(((cy >> 16) & 0x3ff) * 1024) + ((cx >> 16) & 0x3ff)];
INT32 p = BURN_ENDIAN_SWAP_INT16(src[(((cy >> 16) & 0x3ff) * 1024) + ((cx >> 16) & 0x3ff)]);
if (p != 0xffff) {
*dst = p;
@ -648,15 +648,15 @@ static void draw_foreground()
UINT32 startx,starty;
INT32 incxx,incxy,incyx,incyy;
startx = 256 * (INT16)(ctrl[0x00]);
starty = 256 * (INT16)(ctrl[0x01]);
incyx = (INT16)(ctrl[0x02]);
incyy = (INT16)(ctrl[0x03]);
incxx = (INT16)(ctrl[0x04]);
incxy = (INT16)(ctrl[0x05]);
startx = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x00]));
starty = 256 * (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x01]));
incyx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x02]));
incyy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x03]));
incxx = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x04]));
incxy = (INT16)(BURN_ENDIAN_SWAP_INT16(ctrl[0x05]));
if (ctrl[0x06] & 0x4000) { incyx *= 256; incyy *= 256; }
if (ctrl[0x06] & 0x0040) { incxx *= 256; incxy *= 256; }
if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x4000) { incyx *= 256; incyy *= 256; }
if (BURN_ENDIAN_SWAP_INT16(ctrl[0x06]) & 0x0040) { incxx *= 256; incxy *= 256; }
startx -= -21 * incyx;
starty -= -21 * incyy;
@ -673,9 +673,9 @@ static INT32 DrvDraw()
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x400; i++) {
r = (p[i] >> 0) & 0x1f;
g = (p[i] >> 10) & 0x1f;
b = (p[i] >> 5) & 0x1f;
r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f;
g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f;
b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);

View File

@ -401,7 +401,7 @@ static void draw_txt_layer(INT32 scrollx, INT32 scrolly)
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 code = vram[offs];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
INT32 color = code >> 12;
code &= 0xfff;
@ -426,7 +426,7 @@ static void draw_layer(UINT8 *ram, UINT8 *gfx, INT32 col, INT32 scrollx, INT32 s
sy -= scrolly;
if (sy < -15) sy += 512;
INT32 code = vram[offs];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
INT32 color = (code >> 12) & 0x0f;
code &= 0xfff;
code |= bank;
@ -466,18 +466,18 @@ static void draw_sprites(INT32 priority, INT32 yoffset)
for (INT32 offs = 0x400; offs >= 0; offs -= 4)
{
INT32 attr = ram[offs];
INT32 attr = BURN_ENDIAN_SWAP_INT16(ram[offs]);
if (~attr & 0x8000) continue;
INT32 sprite = ram[offs+1];
INT32 sprite = BURN_ENDIAN_SWAP_INT16(ram[offs+1]);
INT32 prio = (sprite >> 14) & 3;
if (prio != priority) continue;
sprite &= 0x3fff;
INT32 y = ram[offs+3];
INT32 x = ram[offs+2];
INT32 y = BURN_ENDIAN_SWAP_INT16(ram[offs+3]);
INT32 x = BURN_ENDIAN_SWAP_INT16(ram[offs+2]);
if (x & 0x8000) x = 0 - (0x200 - (x & 0x1ff));
else x &= 0x1ff;
@ -533,7 +533,7 @@ static inline void DrvRecalcPalette()
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x1000/2; i++) {
INT32 d = p[i];
INT32 d = BURN_ENDIAN_SWAP_INT16(p[i]);
b = (d >> 10) & 0x1f;
g = (d >> 5) & 0x1f;

View File

@ -1690,7 +1690,7 @@ static void DrvCalcPalette()
UINT32* pd;
for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) {
*pd = CalcCol(*ps);
*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps));
}
}
@ -1701,7 +1701,7 @@ static void CtribeCalcPalette()
UINT32* pd;
for (i = 0, ps = (UINT16*)DrvPaletteRam, pd = DrvPalette; i < 0x600; i++, ps++, pd++) {
*pd = CtribeCalcCol(*ps);
*pd = CtribeCalcCol(BURN_ENDIAN_SWAP_INT16(*ps));
}
}
@ -1713,7 +1713,7 @@ static void DrvRenderBgLayer(INT32 Opaque)
for (my = 0; my < 32; my++) {
for (mx = 0; mx < 32; mx++) {
Attr = VideoRam[TileIndex];
Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[TileIndex]);
Code = (Attr & 0xfff) | ((DrvBgTileBase & 0x01) << 12);
Colour = ((Attr & 0xf000) >> 12);
@ -1755,8 +1755,8 @@ static void DrvRenderFgLayer(INT32 Opaque)
for (my = 0; my < 32; my++) {
for (mx = 0; mx < 32; mx++) {
Offset = TileIndex * 2;
Attr = VideoRam[Offset];
Code = VideoRam[Offset + 1] & 0x1fff;
Attr = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset]);
Code = BURN_ENDIAN_SWAP_INT16(VideoRam[Offset + 1]) & 0x1fff;
Colour = Attr & 0x0f;
xFlip = Attr & 0x40;
@ -1811,17 +1811,17 @@ static void DrvRenderSprites()
UINT16 *Finish = Source + 0x800;
while (Source < Finish) {
UINT16 Attr = Source[1];
UINT16 Attr = BURN_ENDIAN_SWAP_INT16(Source[1]);
if (Attr & 0x01) {
INT32 i;
INT32 Bank = Source[3] & 0xff;
INT32 Code = (Source[2] & 0xff) + (Bank * 256);
INT32 Colour = Source[4] & 0xf;
INT32 Bank = BURN_ENDIAN_SWAP_INT16(Source[3]) & 0xff;
INT32 Code = (BURN_ENDIAN_SWAP_INT16(Source[2]) & 0xff) + (Bank * 256);
INT32 Colour = BURN_ENDIAN_SWAP_INT16(Source[4]) & 0xf;
INT32 xFlip = Attr & 0x10;
INT32 yFlip = Attr & 0x08;
INT32 sx = Source[5] & 0xff;
INT32 sy = Source[0] & 0xff;
INT32 sx = BURN_ENDIAN_SWAP_INT16(Source[5]) & 0xff;
INT32 sy = BURN_ENDIAN_SWAP_INT16(Source[0]) & 0xff;
INT32 Height = (Attr >> 5) & 0x07;
if (Attr & 0x04) sx |= 0x100;

View File

@ -498,7 +498,7 @@ static INT32 DrvExit()
static void palette_write(INT32 offset)
{
UINT8 r,g,b;
UINT16 data = *((UINT16*)(DrvPalRAM + offset));
UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset)));
r = ((data << 1) & 0x1e) | ((data >> 12) & 1);
g = ((data >> 3) & 0x1e) | ((data >> 13) & 1);
@ -517,23 +517,23 @@ static void draw_sprites(INT32 priority)
for (INT32 offs = 0;offs < 0x800/2;offs += 8)
{
if (priority != ((source[offs+4]&0xc0) >> 6)) continue;
if (priority != ((BURN_ENDIAN_SWAP_INT16(source[offs+4])&0xc0) >> 6)) continue;
INT32 sx = (source[offs+1] & 0x01ff) + 16*8 - 1;
INT32 sx = (BURN_ENDIAN_SWAP_INT16(source[offs+1]) & 0x01ff) + 16*8 - 1;
if (sx >= 512) sx -= 512;
sx -= 192;
INT32 starty = source[offs+0] & 0xff;
INT32 starty = BURN_ENDIAN_SWAP_INT16(source[offs+0]) & 0xff;
if (starty >= nScreenHeight) continue;
INT32 endy = source[offs+0] >> 8;
INT32 endy = BURN_ENDIAN_SWAP_INT16(source[offs+0]) >> 8;
if (endy >= nScreenHeight) endy = nScreenHeight-1;
INT32 width = source[offs+2] & 0x007f;
INT32 flipx = source[offs+2] & 0x0100;
INT32 width = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x007f;
INT32 flipx = BURN_ENDIAN_SWAP_INT16(source[offs+2]) & 0x0100;
if (flipx) sx++;
INT32 color = (0x40 + (source[offs+4] & 0x3f)) << 4;
INT32 color = (0x40 + (BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x3f)) << 4;
INT32 start = source[offs+3] + ((source[offs+4] & 0x1f00) << 8);
INT32 start = BURN_ENDIAN_SWAP_INT16(source[offs+3]) + ((BURN_ENDIAN_SWAP_INT16(source[offs+4]) & 0x1f00) << 8);
UINT8 *rom = DrvGfxROM1 + start * 2;
for (INT32 y = starty+1;y <= endy;y++)
@ -636,7 +636,7 @@ static void draw_layer(INT32 *in_page, INT32 scrollx, INT32 scrolly, INT32 trans
INT32 ofst = DrvLayerTable[offs];
INT32 attr = vram[in_page[ofst>>11] * 0x0800 + (ofst & 0x7ff)];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[in_page[ofst>>11] * 0x0800 + (ofst & 0x7ff)]);
INT32 code = attr;
if (transp && !code) continue;
INT32 color = (attr & 0x1fc0) >> 6;
@ -668,7 +668,7 @@ static void draw_text()
INT32 sx = ((offs & 0x3f) << 3) - 192;
INT32 sy = (offs >> 6) << 3;
INT32 attr = vram[DrvTxtTable[offs]];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[DrvTxtTable[offs]]);
INT32 code = attr & 0xf1ff;
INT32 color = (attr & 0x0e00) >> 9;
@ -698,9 +698,9 @@ static INT32 DrvDraw()
// draw_sprites(0);
INT32 bg_scrollx = (txtram[bg_scrollx_reg] - bg_scrollx_offs) & 0x1ff;
INT32 bg_scrolly = ((txtram[bg_scrolly_reg] & 0xff) - bg_scrolly_offs) & 0xff;
INT32 page = txtram[bg_page_reg];
INT32 bg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[bg_scrollx_reg]) - bg_scrollx_offs) & 0x1ff;
INT32 bg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[bg_scrolly_reg]) & 0xff) - bg_scrolly_offs) & 0xff;
INT32 page = BURN_ENDIAN_SWAP_INT16(txtram[bg_page_reg]);
pages[3] = (page >> 12) & 0x0f;
pages[2] = (page >> 8) & 0x0f;
@ -711,9 +711,9 @@ static INT32 DrvDraw()
draw_sprites(1);
INT32 fg_scrollx = (txtram[fg_scrollx_reg] - fg_scrollx_offs) & 0x1ff;
INT32 fg_scrolly = ((txtram[fg_scrolly_reg] & 0xff) - fg_scrolly_offs) & 0xff;
page = txtram[fg_page_reg];
INT32 fg_scrollx = (BURN_ENDIAN_SWAP_INT16(txtram[fg_scrollx_reg]) - fg_scrollx_offs) & 0x1ff;
INT32 fg_scrolly = ((BURN_ENDIAN_SWAP_INT16(txtram[fg_scrolly_reg]) & 0xff) - fg_scrolly_offs) & 0xff;
page = BURN_ENDIAN_SWAP_INT16(txtram[fg_page_reg]);
pages[3] = (page >> 12) & 0x0f;
pages[2] = (page >> 8) & 0x0f;

View File

@ -339,10 +339,10 @@ static void draw_sprites()
for (INT32 offs = 0; offs < 0x4000 / 2; offs+=8)
{
INT32 sy = ( 256 - vram[offs + 4]) - 16;
INT32 sx = ((480 - vram[offs + 0]) & 0x1ff) - 173;
INT32 attr = vram[offs + 1];
INT32 code = vram[offs + 3];
INT32 sy = ( 256 - BURN_ENDIAN_SWAP_INT16(vram[offs + 4])) - 16;
INT32 sx = ((480 - BURN_ENDIAN_SWAP_INT16(vram[offs + 0])) & 0x1ff) - 173;
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs + 1]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs + 3]);
INT32 color = ((attr & 0x00f0) >> 4) | ((attr & 0x000c) << 2);
INT32 flash = (attr & 0x1000);
INT32 bank = (attr & 0x0002) >> 1;
@ -364,9 +364,9 @@ static INT32 DrvDraw()
UINT8 r,g,b;
UINT16 *pal = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x800 / 2; i++, pal++) {
r = ((*pal << 4) & 0xf0) | ((*pal << 0) & 0x0f);
g = ((*pal >> 0) & 0xf0) | ((*pal >> 4) & 0x0f);
b = ((*pal >> 4) & 0xf0) | ((*pal >> 8) & 0x0f);
r = ((BURN_ENDIAN_SWAP_INT16(*pal) << 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) << 0) & 0x0f);
g = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 0) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0x0f);
b = ((BURN_ENDIAN_SWAP_INT16(*pal) >> 4) & 0xf0) | ((BURN_ENDIAN_SWAP_INT16(*pal) >> 8) & 0x0f);
DrvPalette[i] = BurnHighCol(r, g, b, 0);
}

View File

@ -319,11 +319,11 @@ static void draw_sprites()
UINT16 *spriteram = (UINT16*)SprRam;
for (i = 3; i < 0x1000/2; i+=4){
INT32 sx = spriteram[i+2] & 0x01ff;
INT32 sy = (240 - (spriteram[i] & 0x00ff)) & 0x00ff;
INT32 number = spriteram[i+3];
INT32 color = (spriteram[i+2] & 0x1e00) >> 9;
INT32 attr = (spriteram[i] & 0xfe00) >> 9;
INT32 sx = BURN_ENDIAN_SWAP_INT16(spriteram[i+2]) & 0x01ff;
INT32 sy = (240 - (BURN_ENDIAN_SWAP_INT16(spriteram[i]) & 0x00ff)) & 0x00ff;
INT32 number = BURN_ENDIAN_SWAP_INT16(spriteram[i+3]);
INT32 color = (BURN_ENDIAN_SWAP_INT16(spriteram[i+2]) & 0x1e00) >> 9;
INT32 attr = (BURN_ENDIAN_SWAP_INT16(spriteram[i]) & 0xfe00) >> 9;
INT32 xflip = attr & 0x20;
INT32 yflip = attr & 0x40;
@ -390,14 +390,14 @@ static INT32 DrvDraw()
sy -= 0x10;
// background
code = bg_ram[offs] & 0xfff;
color = bg_ram[offs] >> 12;
code = BURN_ENDIAN_SWAP_INT16(bg_ram[offs]) & 0xfff;
color = BURN_ENDIAN_SWAP_INT16(bg_ram[offs]) >> 12;
Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 4, 0, Gfx1);
// foreground
code = fg_ram[offs] & 0xfff;
color = fg_ram[offs] >> 12;
code = BURN_ENDIAN_SWAP_INT16(fg_ram[offs]) & 0xfff;
color = BURN_ENDIAN_SWAP_INT16(fg_ram[offs]) >> 12;
if (!code) continue;

View File

@ -333,7 +333,7 @@ void __fastcall hedpanic_write_word(UINT32 address, UINT16 data)
case 0xd00008:
INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
*((UINT16*)(DrvVidRAM1 + ofst)) = data;
*((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
return;
@ -418,7 +418,7 @@ void __fastcall mchampdx_write_word(UINT32 address, UINT16 data)
case 0xd00008:
INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
*((UINT16*)(DrvVidRAM1 + ofst)) = data;
*((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
return;
@ -510,7 +510,7 @@ void __fastcall tangtang_write_word(UINT32 address, UINT16 data)
case 0x600008:
INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
*((UINT16*)(DrvVidRAM1 + ofst)) = data;
*((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
return;
@ -914,12 +914,12 @@ static void esd16_draw_sprites(INT32 priority)
{
INT32 y, starty, endy;
INT32 sx = spriteram16[ offs + 2 ];
INT32 sx = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs + 2 ]);
if ((sx >> 15) != priority) continue;
int sy = spriteram16[ offs ];
int code = spriteram16[ offs + 1 ];
int sy = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs ]);
int code = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs + 1 ]);
INT32 dimy = 0x10 << ((sy >> 9) & 3);
@ -979,7 +979,7 @@ static void draw_background_8x8(UINT8 *vidram, INT32 color, INT32 transp, INT32
scrolly &= 0x1ff;
for (offs = 0; offs < 0x4000 / 2; offs++) {
INT32 code = vram[offs];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
if (DrvGfx1Trans[code] && transp) continue;
@ -1022,7 +1022,7 @@ static void draw_background_16x16(UINT8 *vidram, INT32 color, INT32 transp, INT3
scrolly &= 0x3ff;
for (offs = 0; offs < 0x1000 / 2; offs++) {
INT32 code = vram[offs] & 0x3fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x3fff;
if (DrvGfx2Trans[code] && transp) continue;

View File

@ -993,31 +993,31 @@ static void draw_sprites(INT32 layerpriority)
for (offs = 0; offs < 0x1000 / 2; offs += 8)
{
if (pFstarfrcSpriteRam[offs] & 0x04) /* enable */
if (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x04) /* enable */
{
INT32 code,color,sizex,sizey,flipx,flipy,xpos,ypos;
INT32 x,y,priority;
code = pFstarfrcSpriteRam[offs+1];
color = (pFstarfrcSpriteRam[offs+2] & 0xf0) >> 4;
sizex = 1 << ((pFstarfrcSpriteRam[offs+2] & 0x03) >> 0);
code = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+1]);
color = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0xf0) >> 4;
sizex = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x03) >> 0);
if(Riot)
sizey = sizex;
else
sizey = 1 << ((pFstarfrcSpriteRam[offs+2] & 0x0c) >> 2);
sizey = 1 << ((BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+2]) & 0x0c) >> 2);
if (sizex >= 2) code &= ~0x01;
if (sizey >= 2) code &= ~0x02;
if (sizex >= 4) code &= ~0x04;
if (sizey >= 4) code &= ~0x08;
if (sizex >= 8) code &= ~0x10;
if (sizey >= 8) code &= ~0x20;
flipx = pFstarfrcSpriteRam[offs] & 0x01;
flipy = pFstarfrcSpriteRam[offs] & 0x02;
xpos = pFstarfrcSpriteRam[offs+4];
flipx = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x01;
flipy = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0x02;
xpos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+4]);
if (xpos >= 0x8000) xpos -= 0x10000;
ypos = pFstarfrcSpriteRam[offs+3];
ypos = BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs+3]);
if (ypos >= 0x8000) ypos -= 0x10000;
priority = (pFstarfrcSpriteRam[offs] & 0xc0) >> 6;
priority = (BURN_ENDIAN_SWAP_INT16(pFstarfrcSpriteRam[offs]) & 0xc0) >> 6;
if (priority != layerpriority) continue;
@ -1089,7 +1089,7 @@ INT32 FstarfrcCalcPalette()
UINT32* pd;
for (i = 0, ps = (UINT16*)FstarfrcPaletteRam, pd = FstarfrcPalette; i < 0x2000; i++, ps++, pd++) {
*pd = CalcCol(*ps);
*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps));
}
return 0;

View File

@ -175,7 +175,7 @@ void __fastcall fuuki32_write_word(UINT32 address, UINT16 data)
DrvRasterPos[0] = data & 0xff;
}
*((UINT16*)(DrvVidRegs + (address & 0x1e))) = data;
*((UINT16*)(DrvVidRegs + (address & 0x1e))) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
@ -231,7 +231,7 @@ UINT16 __fastcall fuuki32_read_word(UINT32 address)
return DrvInputs[3];
case 0x8c001e:
return *((UINT16*)(DrvVidRegs + 0x1e));
return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0x1e)));
}
return 0;
@ -575,10 +575,10 @@ static void draw_sprites(INT32 prio)
for (INT32 offs = 0; offs < 0x2000 / 2; offs += 4)
{
INT32 sx = src[offs + 0];
INT32 sy = src[offs + 1];
INT32 attr = src[offs + 2];
INT32 code = src[offs + 3];
INT32 sx = BURN_ENDIAN_SWAP_INT16(src[offs + 0]);
INT32 sy = BURN_ENDIAN_SWAP_INT16(src[offs + 1]);
INT32 attr = BURN_ENDIAN_SWAP_INT16(src[offs + 2]);
INT32 code = BURN_ENDIAN_SWAP_INT16(src[offs + 3]);
if (prio != ((attr >> 6) & 0x0003) || sx & 0x0400) continue;
@ -664,9 +664,9 @@ static void draw_background_layer(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT32 colo
sy -= scrolly;
if (sy < -15) sy += 512;
INT32 code = vram[offs*2] & 0x7fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]) & 0x7fff;
if (tab[code] == 2) continue;
INT32 attr = vram[offs*2 + 1];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2 + 1]);
INT32 color = (attr & 0x30) >> 4;
INT32 flipx = (attr >> 6) & 1;
@ -760,9 +760,9 @@ static void draw_background_layer_byline(UINT8 *ram, UINT8 *gfx, UINT8 *tab, INT
INT32 ofst = (yy << 3) | xx;
INT32 code = vram[ofst] & 0x7fff;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0x7fff;
if (tab[code] == 2) continue;
INT32 attr = vram[ofst + 1];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]);
INT32 color = (attr & 0x30) << 4;
INT32 flipx = ((attr >> 6) & 1) * 0x0f;
@ -844,9 +844,9 @@ static void draw_foreground_layer(UINT8 *ram)
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 code = vram[offs*2];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs*2]);
if (DrvTransTab3[code] == 2) continue;
INT32 attr = vram[offs*2+1];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs*2+1]);
INT32 color = attr & 0x3f;
INT32 flipx = (attr >> 6) & 1;
@ -936,9 +936,9 @@ static void draw_foreground_layer_byline(UINT8 *ram)
INT32 ofst = (yy << 4) | xx;
INT32 code = vram[ofst];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]);
if (DrvTransTab3[code] == 2) continue;
INT32 attr = vram[ofst + 1];
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[ofst + 1]);
INT32 color = attr & 0x3f;
INT32 flipx = ((attr >> 6) & 1) * 0x07;
@ -1060,9 +1060,9 @@ static INT32 DrvDraw()
UINT8 r,g,b;
UINT16 *p = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x2000 / 2; i++) {
r = (p[i] >> 10) & 0x1f;
g = (p[i] >> 5) & 0x1f;
b = (p[i] >> 0) & 0x1f;
r = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f;
g = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 5) & 0x1f;
b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 0) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
@ -1086,7 +1086,7 @@ static INT32 DrvDraw()
INT32 tm_front = pri_table[ priority[0] ][0];
INT32 tm_middle = pri_table[ priority[0] ][1];
INT32 tm_back = pri_table[ priority[0] ][2];
INT32 buffer = vregs[0x1e/4] & 0x40;
INT32 buffer = BURN_ENDIAN_SWAP_INT32(vregs[0x1e/4]) & 0x40;
for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
pTransDraw[i] = 0x1fff;
@ -1159,10 +1159,10 @@ static INT32 DrvFrame()
// hack -- save scroll/offset registers so the
// lines can be drawn in one pass -- should save
// quite a few cycles...
DrvScrollBuf[i + 0x000] = vregs[0];
DrvScrollBuf[i + 0x100] = vregs[1];
DrvScrollBuf[i + 0x200] = vregs[2];
DrvScrollBuf[i + 0x300] = vregs[3];
DrvScrollBuf[i + 0x000] = BURN_ENDIAN_SWAP_INT32(vregs[0]);
DrvScrollBuf[i + 0x100] = BURN_ENDIAN_SWAP_INT32(vregs[1]);
DrvScrollBuf[i + 0x200] = BURN_ENDIAN_SWAP_INT32(vregs[2]);
DrvScrollBuf[i + 0x300] = BURN_ENDIAN_SWAP_INT32(vregs[3]);
}
BurnTimerEndFrame(nCyclesTotal[1]);

View File

@ -138,7 +138,7 @@ static void toxboy_handle_04_subcommand(UINT8 mcu_subcmd, UINT16 *mcu_ram)
UINT16 romstart = mcu_rom[offs+2] | (mcu_rom[offs+3]<<8);
UINT16 romlength = mcu_rom[offs+4] | (mcu_rom[offs+5]<<8);
UINT16 ramdest = mcu_ram[0x0012/2];
UINT16 ramdest = BURN_ENDIAN_SWAP_INT16(mcu_ram[0x0012/2]);
for (INT32 x = 0; x < romlength; x++) {
DrvMCURAM[(ramdest+x)] = mcu_rom[(romstart+x)];
@ -148,9 +148,9 @@ static void toxboy_handle_04_subcommand(UINT8 mcu_subcmd, UINT16 *mcu_ram)
static void jchan_mcu_run()
{
UINT16 *mcu_ram = (UINT16*)DrvMCURAM;
UINT16 mcu_command = mcu_ram[0x0010/2]; // command nb
UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; // offset in shared RAM where MCU will write
UINT16 mcu_subcmd = mcu_ram[0x0014/2]; // sub-command parameter, happens only for command #4
UINT16 mcu_command = BURN_ENDIAN_SWAP_INT16(mcu_ram[0x0010/2]); // command nb
UINT16 mcu_offset = BURN_ENDIAN_SWAP_INT16(mcu_ram[0x0012/2]) / 2; // offset in shared RAM where MCU will write
UINT16 mcu_subcmd = BURN_ENDIAN_SWAP_INT16(mcu_ram[0x0014/2]); // sub-command parameter, happens only for command #4
switch (mcu_command >> 8)
{
@ -159,7 +159,7 @@ static void jchan_mcu_run()
break;
case 0x03:
mcu_ram[mcu_offset] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
mcu_ram[mcu_offset] = BURN_ENDIAN_SWAP_INT16((DrvDips[1] << 8) | (DrvDips[0] << 0));
break;
case 0x02:
@ -180,7 +180,7 @@ void __fastcall jchan_main_write_word(UINT32 address, UINT16 data)
case 0x340000:
case 0x350000:
case 0x360000:
mcu_com[(address - 0x330000) >> 16] = data;
mcu_com[(address - 0x330000) >> 16] = BURN_ENDIAN_SWAP_INT16(data);
if (mcu_com[0] == 0xffff && mcu_com[1] == 0xffff && mcu_com[2] == 0xffff && mcu_com[3] == 0xffff) {
memset (mcu_com, 0, 4 * sizeof(UINT16));
jchan_mcu_run();
@ -277,7 +277,7 @@ UINT8 __fastcall jchan_sub_read_byte(UINT32 /*address*/)
void __fastcall jchan_main_command_write_word(UINT32 address, UINT16 data)
{
*((UINT16*)(DrvShareRAM + (address & 0x3ffe))) = data;
*((UINT16*)(DrvShareRAM + (address & 0x3ffe))) = BURN_ENDIAN_SWAP_INT16(data);
if (address == 0x403ffe) {
SekClose();
@ -295,7 +295,7 @@ void __fastcall jchan_main_command_write_byte(UINT32 address, UINT8 data)
void __fastcall jchan_sub_command_write_word(UINT32 address, UINT16 data)
{
*((UINT16*)(DrvShareRAM + (address & 0x3ffe))) = data;
*((UINT16*)(DrvShareRAM + (address & 0x3ffe))) = BURN_ENDIAN_SWAP_INT16(data);
if (address == 0x400000) { // not used?
SekClose();
@ -313,7 +313,7 @@ void __fastcall jchan_sub_command_write_byte(UINT32 address, UINT8 data)
static inline void palette_update(UINT16 offset)
{
INT32 p = *((UINT16*)(DrvPalRAM + offset));
INT32 p = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset)));
INT32 r = (p >> 5) & 0x1f;
INT32 g = (p >> 10) & 0x1f;
@ -328,7 +328,7 @@ static inline void palette_update(UINT16 offset)
void __fastcall jchan_palette_write_word(UINT32 address, UINT16 data)
{
*((UINT16*)(DrvPalRAM + (address & 0xfffe))) = data;
*((UINT16*)(DrvPalRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data);
palette_update(address);
}
@ -592,7 +592,7 @@ static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
UINT16 *sram = (UINT16*)scr;
UINT16 *regs = (UINT16*)DrvVidRegs;
INT32 tmflip = regs[4];
INT32 tmflip = BURN_ENDIAN_SWAP_INT16(regs[4]);
INT32 enable = ~tmflip & (layer ? 0x0010 : 0x1000);
if (enable == 0) return; // disable!
@ -602,8 +602,8 @@ static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
INT32 lsenable = tmflip & (layer ? 0x0008 : 0x0800); // linescroll
INT32 xscroll = regs[2 - (layer * 2)];
INT32 yscroll = regs[3 - (layer * 2)] >> 6;
INT32 xscroll = BURN_ENDIAN_SWAP_INT16(regs[2 - (layer * 2)]);
INT32 yscroll = BURN_ENDIAN_SWAP_INT16(regs[3 - (layer * 2)]) >> 6;
xscroll += (tmflipx) ? -((344 + (layer * 2)) * 64) : ((25 + (layer * 2)) * 64);
yscroll += (tmflipy) ? -260 : 11;
@ -616,7 +616,7 @@ static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
for (INT32 y = 0; y < nScreenHeight; y++, dest += nScreenWidth) // line by line
{
INT32 scrollyy = (yscroll + y) & 0x1ff;
INT32 scrollxx = ((xscroll + sram[scrollyy]) >> 16) & 0x1ff;
INT32 scrollxx = ((xscroll + BURN_ENDIAN_SWAP_INT16(sram[scrollyy])) >> 16) & 0x1ff;
INT32 srcy = (scrollyy & 0x1ff) >> 4;
INT32 srcx = (scrollxx & 0x1ff) >> 4;
@ -625,8 +625,8 @@ static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
{
INT32 offs = ((srcy << 5) | ((srcx + (x >> 4)) & 0x1f));
INT32 attr = vram[offs * 2 + 0];
INT32 code = vram[offs * 2 + 1] & 0x1fff;
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = (attr & 0x00fc) << 2;
INT32 flipx = (attr & 0x0002) ? 0x0f : 0;
INT32 flipy = (attr & 0x0001) ? 0xf0 : 0;
@ -666,8 +666,8 @@ static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 attr = vram[offs * 2 + 0];
INT32 code = vram[offs * 2 + 1] & 0x1fff;
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = (attr & 0x00fc) >> 2;
INT32 flipx = (attr & 0x0002);
INT32 flipy = (attr & 0x0001);

View File

@ -104,7 +104,7 @@ void __fastcall midas_write_byte(UINT32 address, UINT8 data)
void __fastcall midas_write_word(UINT32 address, UINT16 data)
{
if (address >= 0xa00000 && address <= 0xa3ffff) {
*((UINT16*)(DrvPalRAM + (address & 0x3fffe))) = data;
*((UINT16*)(DrvPalRAM + (address & 0x3fffe))) = BURN_ENDIAN_SWAP_INT16(data);
palette_write(address & 0x3fffc);
return;
}
@ -118,7 +118,7 @@ void __fastcall midas_write_word(UINT32 address, UINT16 data)
case 0x9c0002:
{
DrvGfxRegs[1] = data;
*((UINT16*)(DrvGfxRAM + (DrvGfxRegs[0] << 1))) = data;
*((UINT16*)(DrvGfxRAM + (DrvGfxRegs[0] << 1))) = BURN_ENDIAN_SWAP_INT16(data);
DrvGfxRegs[0] += DrvGfxRegs[2];
}
return;
@ -318,7 +318,7 @@ static INT32 DrvInit()
DrvGfxDecode();
}
*((UINT16*)(Drv68KROM + 0x13345a)) = 0x4e75; // patch out protection
*((UINT16*)(Drv68KROM + 0x13345a)) = BURN_ENDIAN_SWAP_INT16(0x4e75); // patch out protection
SekInit(0, 0x68000);
SekOpen(0);
@ -411,9 +411,9 @@ static void draw_sprites()
for (INT32 i = 0; i < 0x180; i++, s++, codes+=0x40)
{
INT32 zoom = s[0x000];
INT32 sy = s[0x200];
INT32 sx = s[0x400];
INT32 zoom = BURN_ENDIAN_SWAP_INT16(s[0x000]);
INT32 sy = BURN_ENDIAN_SWAP_INT16(s[0x200]);
INT32 sx = BURN_ENDIAN_SWAP_INT16(s[0x400]);
INT32 xzoom = ((zoom >> 8) & 0x0f) + 1;
INT32 yzoom = (zoom & 0x7f) + 1;
@ -447,10 +447,10 @@ static void draw_sprites()
for (INT32 y = 0; y < ynum; y++)
{
INT32 code = codes[y * 2];
INT32 code = BURN_ENDIAN_SWAP_INT16(codes[y * 2]);
if (code & 0x8000) continue; // only 8mb of sprites...
INT32 attr = codes[y * 2 + 1];
INT32 attr = BURN_ENDIAN_SWAP_INT16(codes[y * 2 + 1]);
INT32 yy = (((sy + y * ydim) >> 16) & 0x1ff) - 16;
@ -535,8 +535,8 @@ static void draw_layer()
INT32 sx = (offs >> 5) << 3;
INT32 sy = ((offs & 0x1f) << 3) - 16;
INT32 code = vram[offs] & 0xfff;
INT32 color = vram[offs] >> 12;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0xfff;
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12;
if (sy < 0 || sy >= nScreenHeight || !DrvTxtTransTab[code]) continue;

View File

@ -235,23 +235,23 @@ void __fastcall mugsmash_write_word(UINT32 address, UINT16 data)
switch (address)
{
case 0x0c0000:
*((UINT16*)(DrvVidRegs + (address & 7))) = data;
DrvScrollX[1] = *((UINT16*)(DrvVidRegs + 4)) + 7;
*((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data);
DrvScrollX[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 4))) + 7;
return;
case 0x0c0002:
*((UINT16*)(DrvVidRegs + (address & 7))) = data;
DrvScrollY[1] = *((UINT16*)(DrvVidRegs + 6)) + 12;
*((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data);
DrvScrollY[1] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 6))) + 12;
return;
case 0x0c0004:
*((UINT16*)(DrvVidRegs + (address & 7))) = data;
DrvScrollX[0] = *((UINT16*)(DrvVidRegs + 0)) + 3;
*((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data);
DrvScrollX[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 0))) + 3;
return;
case 0x0c0006:
*((UINT16*)(DrvVidRegs + (address & 7))) = data;
DrvScrollY[0] = *((UINT16*)(DrvVidRegs + 2)) + 12;
*((UINT16*)(DrvVidRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data);
DrvScrollY[0] = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRegs + 2))) + 12;
return;
case 0x140002:
@ -259,7 +259,7 @@ void __fastcall mugsmash_write_word(UINT32 address, UINT16 data)
case 0x140000:
case 0x140004:
case 0x140006:
*((UINT16*)(DrvSndRegs + (address & 7))) = data;
*((UINT16*)(DrvSndRegs + (address & 7))) = BURN_ENDIAN_SWAP_INT16(data);
return;
}
}
@ -487,10 +487,10 @@ static void draw_sprites()
while (source < finish)
{
INT32 xpos = source[0] & 0x00ff;
INT32 ypos = source[4] & 0x00ff;
INT32 num = (source[3] & 0x00ff) | ((source[2] & 0x00ff) << 8);
INT32 attr = source[1];
INT32 xpos = BURN_ENDIAN_SWAP_INT16(source[0]) & 0x00ff;
INT32 ypos = BURN_ENDIAN_SWAP_INT16(source[4]) & 0x00ff;
INT32 num = (BURN_ENDIAN_SWAP_INT16(source[3]) & 0x00ff) | ((BURN_ENDIAN_SWAP_INT16(source[2]) & 0x00ff) << 8);
INT32 attr = BURN_ENDIAN_SWAP_INT16(source[1]);
INT32 flipx = (attr & 0x0080)>>7;
INT32 color = attr & 0x000f;
@ -519,8 +519,8 @@ static void draw_layer(UINT8 *source, INT32 colofst, INT32 scroll)
INT32 sx = (offs & 0x1f) << 4;
INT32 sy = (offs >> 5) << 4;
INT32 code = vram[(offs << 1) | 1];
INT32 color = vram[(offs << 1)];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1) | 1]);
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[(offs << 1)]);
INT32 flipx = color & 0x40;
INT32 flipy = color & 0x80;
color &= 0x000f;

View File

@ -1879,24 +1879,24 @@ void NMK112_init(UINT8 disable_page_mask, UINT8 *rgn0, UINT8 *rgn1, INT32 len0,
#define STRANGE_RAM_WRITE_WORD(value) \
if ((address & 0xffff0000) == value) { \
*((UINT16*)(Drv68KRAM + (address & 0xfffe))) = data; \
*((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); \
return; \
} \
#define PROT_JSR(_offs_,_protvalue_,_pc_) \
if(nmk16_mainram[(_offs_)/2] == _protvalue_) \
if(nmk16_mainram[(_offs_)/2] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \
{ \
nmk16_mainram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \
nmk16_mainram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
nmk16_mainram[(_offs_+2-0x10)/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9);/*JMP*/\
nmk16_mainram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
nmk16_mainram[(_offs_+6-0x10)/2] = _pc_; /*LO-DWORD*/\
nmk16_mainram[(_offs_+6-0x10)/2] = BURN_ENDIAN_SWAP_INT16(_pc_); /*LO-DWORD*/\
} \
#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \
if(nmk16_mainram[_offs_] == _protvalue_) \
if(nmk16_mainram[_offs_] == BURN_ENDIAN_SWAP_INT16(_protvalue_)) \
{\
nmk16_mainram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
nmk16_mainram[_protinput_+1] = (_input_ & 0x0000ffff);\
nmk16_mainram[_protinput_] = BURN_ENDIAN_SWAP_INT16((_input_ & 0xffff0000)>>16);\
nmk16_mainram[_protinput_+1] = BURN_ENDIAN_SWAP_INT16(_input_ & 0x0000ffff);\
}
//------------------------------------------------------------------------------------------------------------
@ -1915,10 +1915,10 @@ static UINT8 tharrier_mcu_r()
INT32 res;
if (SekGetPC(-1)==0x08aa) res = (nmk16_mainram[0x9064/2])|0x20;
else if (SekGetPC(-1)==0x08ce) res = (nmk16_mainram[0x9064/2])|0x60;
else if (SekGetPC(-1)==0x0332) res = (nmk16_mainram[0x90f6/2])|0x00;
else if (SekGetPC(-1)==0x64f4) res = (nmk16_mainram[0x90f6/2])|0x00;
if (SekGetPC(-1)==0x08aa) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x20;
else if (SekGetPC(-1)==0x08ce) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9064/2]))|0x60;
else if (SekGetPC(-1)==0x0332) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00;
else if (SekGetPC(-1)==0x64f4) res = (BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x90f6/2]))|0x00;
else
{
res = to_main[prot_count++];
@ -1971,13 +1971,13 @@ static void HachaRAMProt(INT32 offset)
case 0xe1fe/2: PROT_JSR(0xe1fe,0x8026,0x8c36); // 8c36
PROT_JSR(0xe1fe,0x8016,0xd620); break; // unused
case 0xef00/2:
if(nmk16_mainram[0xef00/2] == 0x60fe)
if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe))
{
nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter
nmk16_mainram[0xef02/2] = 0x0000;
nmk16_mainram[0xef04/2] = 0x4ef9;
nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9);
nmk16_mainram[0xef06/2] = 0x0000;
nmk16_mainram[0xef08/2] = 0x7dc2;
nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x7dc2);
}
break;
}
@ -2026,13 +2026,13 @@ static void tdragon_mainram_w(INT32 offset)
case 0xe7fe/2: PROT_JSR(0xe7fe,0x8026,0xa57a);
PROT_JSR(0xe7fe,0x8016,0xa57a); break;
case 0xef00/2:
if(nmk16_mainram[0xef00/2] == 0x60fe)
if(nmk16_mainram[0xef00/2] == BURN_ENDIAN_SWAP_INT16(0x60fe))
{
nmk16_mainram[0xef00/2] = 0x0000; // this is the coin counter
nmk16_mainram[0xef02/2] = 0x0000;
nmk16_mainram[0xef04/2] = 0x4ef9;
nmk16_mainram[0xef04/2] = BURN_ENDIAN_SWAP_INT16(0x4ef9);
nmk16_mainram[0xef06/2] = 0x0000;
nmk16_mainram[0xef08/2] = 0x92f4;
nmk16_mainram[0xef08/2] = BURN_ENDIAN_SWAP_INT16(0x92f4);
}
break;
}
@ -2049,12 +2049,12 @@ static void mcu_run(UINT8 dsw_setting)
UINT16 *nmk16_mainram = (UINT16*)Drv68KRAM;
if(start_helper & 1 && nmk16_mainram[0x9000/2] & 0x0200) // start 1
if(start_helper & 1 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0200) // start 1
{
nmk16_mainram[0xef00/2]--;
start_helper = start_helper & 2;
}
if(start_helper & 2 && nmk16_mainram[0x9000/2] & 0x0100) // start 2
if(start_helper & 2 && BURN_ENDIAN_SWAP_INT16(nmk16_mainram[0x9000/2]) & 0x0100) // start 2
{
nmk16_mainram[0xef00/2]--;
start_helper = start_helper & 1;
@ -2068,7 +2068,7 @@ static void mcu_run(UINT8 dsw_setting)
{
switch(dsw[i] & 7)
{
case 0: nmk16_mainram[0x9000/2]|=0x4000; break; // free play
case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play
case 1: coin_count_frac[i] = 1; coin_count[i] = 4; break;
case 2: coin_count_frac[i] = 1; coin_count[i] = 3; break;
case 3: coin_count_frac[i] = 1; coin_count[i] = 2; break;
@ -2087,7 +2087,7 @@ static void mcu_run(UINT8 dsw_setting)
{
switch(dsw[i] & 7)
{
case 0: nmk16_mainram[0x9000/2]|=0x4000; break; // free play
case 0: nmk16_mainram[0x9000/2]|=BURN_ENDIAN_SWAP_INT16(0x4000); break; // free play
case 1: coin_count_frac[i] = 4; coin_count[i] = 1; break;
case 2: coin_count_frac[i] = 3; coin_count[i] = 1; break;
case 3: coin_count_frac[i] = 2; coin_count[i] = 1; break;
@ -3054,7 +3054,7 @@ UINT16 __fastcall tdragon_main_read_word(UINT32 address)
void __fastcall tdragon_main_write_word(UINT32 address, UINT16 data)
{
if ((address & 0xffff0000) == 0x0b0000) {
*((UINT16*)(Drv68KRAM + (address & 0xfffe))) = data;
*((UINT16*)(Drv68KRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data);
tdragon_mainram_w((address >> 1) & 0x7fff);
return;
}
@ -4528,7 +4528,7 @@ static void DrvPaletteRecalc()
UINT8 r,g,b;
UINT16 *pal = (UINT16*)DrvPalRAM;
for (INT32 i = 0; i < 0x400; i++) {
INT32 data = pal[i];
INT32 data = BURN_ENDIAN_SWAP_INT16(pal[i]);
r = ((data >> 11) & 0x1e) | ((data >> 3) & 0x01);
g = ((data >> 7) & 0x1e) | ((data >> 2) & 0x01);
@ -4548,17 +4548,17 @@ static void draw_sprites(INT32 flip, INT32 coloff, INT32 coland, INT32 priority)
for (INT32 offs = 0; offs < 0x1000/2; offs += 8)
{
if (sprram[offs] & 0x0001)
if (BURN_ENDIAN_SWAP_INT16(sprram[offs]) & 0x0001)
{
INT32 sx = (sprram[offs+4] & 0x01ff) + videoshift;
INT32 sy = (sprram[offs+6] & 0x01ff);
INT32 code = sprram[offs+3] & nGraphicsMask[2];
INT32 color = sprram[offs+7] & coland;
INT32 w = (sprram[offs+1] & 0x000f);
INT32 h = ((sprram[offs+1] & 0x00f0) >> 4);
INT32 pri = ((sprram[offs+0] & 0x00c0) >> 6);
INT32 flipy = ((sprram[offs+1] & 0x0200) >> 9);
INT32 flipx = ((sprram[offs+1] & 0x0100) >> 8);
INT32 sx = (BURN_ENDIAN_SWAP_INT16(sprram[offs+4]) & 0x01ff) + videoshift;
INT32 sy = (BURN_ENDIAN_SWAP_INT16(sprram[offs+6]) & 0x01ff);
INT32 code = BURN_ENDIAN_SWAP_INT16(sprram[offs+3]) & nGraphicsMask[2];
INT32 color = BURN_ENDIAN_SWAP_INT16(sprram[offs+7]) & coland;
INT32 w = (BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x000f);
INT32 h = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x00f0) >> 4);
INT32 pri = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+0]) & 0x00c0) >> 6);
INT32 flipy = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0200) >> 9);
INT32 flipx = ((BURN_ENDIAN_SWAP_INT16(sprram[offs+1]) & 0x0100) >> 8);
if (!flip) flipy = flipx = 0;
@ -4636,12 +4636,12 @@ static void draw_macross_background(UINT8 *ram, INT32 scrollx, INT32 scrolly, IN
INT32 ofst = ((row >> 4) << 12) | (row & 0x0f) | (col << 4);
if (is_8bpp) {
INT32 code = vram[ofst] & nGraphicsMask[1];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[ofst]) & nGraphicsMask[1];
Render16x16Tile_Clip(pTransDraw, code, sx, sy, 0, 8, coloff, DrvGfxROM1);
} else {
INT32 code = ((vram[ofst] & 0xfff) | (*tilebank << 12)) & nGraphicsMask[1];
INT32 color = vram[ofst] >> 12;
INT32 code = ((BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | (*tilebank << 12)) & nGraphicsMask[1];
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12;
if (t) {
Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 15, coloff, DrvGfxROM1);
@ -4660,13 +4660,13 @@ static void draw_gunnail_background(UINT8 *ram)
for (INT32 y = 16; y < nScreenHeight + 16; y++)
{
INT32 yscroll = (scroll[0x100] + scroll[0x100 | y] + y) & 0x1ff;
INT32 yscroll = (BURN_ENDIAN_SWAP_INT16(scroll[0x100]) + BURN_ENDIAN_SWAP_INT16(scroll[0x100 | y]) + y) & 0x1ff;
INT32 row = yscroll >> 4;
INT32 yl = (yscroll & 0x0f) << 4;
INT32 ofst0 = ((row >> 4) << 12) | (row & 0x0f);
INT32 xscroll0 = scroll[0] + scroll[y] - videoshift;
INT32 xscroll0 = BURN_ENDIAN_SWAP_INT16(scroll[0]) + BURN_ENDIAN_SWAP_INT16(scroll[y]) - videoshift;
UINT16 *dest = pTransDraw + (y - 16) * nScreenWidth;
@ -4677,8 +4677,8 @@ static void draw_gunnail_background(UINT8 *ram)
INT32 ofst = ofst0 | (xscroll & 0xff0);
INT32 code = (vram[ofst] & 0xfff) | bank;
INT32 color = (vram[ofst] >> 12) << 4;
INT32 code = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) & 0xfff) | bank;
INT32 color = (BURN_ENDIAN_SWAP_INT16(vram[ofst]) >> 12) << 4;
UINT8 *src = DrvGfxROM1 + (code << 8) + yl;
@ -4704,7 +4704,7 @@ static void draw_bjtwin_background(INT32 scrollx)
sx = (((sx - scrollx) + 8) & 0x1ff) - 8;
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 code = vram[offs];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
INT32 color = code >> 12;
INT32 bank = code & 0x800;
code &= 0x7ff;
@ -4730,14 +4730,14 @@ static void bioship_draw_background(INT32 scrollx, INT32 scrolly)
if (sx >= nScreenWidth) continue;
INT32 code = tilerom[offs | bank];
INT32 code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank]);
sy = (((sy + 16) - scrolly) & 0x1ff) - 16;
if (sy < nScreenHeight) {
Render16x16Tile_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 0, DrvGfxROM1 + 0x100000);
}
code = tilerom[offs | bank | 0x1000];
code = BURN_ENDIAN_SWAP_INT16(tilerom[offs | bank | 0x1000]);
sy = (((sy + 16) + 256) & 0x1ff) - 16;
if (sy < nScreenHeight) {
@ -4764,7 +4764,7 @@ static void draw_macross_text_layer(INT32 scrollx, INT32 scrolly, INT32 wide, IN
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 code = vram[offs];
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
Render8x8Tile_Mask_Clip(pTransDraw, code & 0xfff, sx, sy, code >> 12, 4, 15, coloff, DrvGfxROM0);
}
@ -4806,7 +4806,7 @@ static inline void common_draw(INT32 spriteflip, INT32 bgscrollx, INT32 bgscroll
static INT32 TharrierDraw()
{
INT32 scrollx = *((UINT16*)(Drv68KRAM + 0x9f00)) & 0xfff;
INT32 scrollx = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRAM + 0x9f00))) & 0xfff;
common_draw(1, scrollx, 0, 0, 0, 0);
@ -4816,8 +4816,8 @@ static INT32 TharrierDraw()
static INT32 ManyblocDraw()
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = scroll[0x82 / 2] & 0xfff;
INT32 scrolly = scroll[0xc2 / 2] & 0x1ff;
INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[0x82 / 2]) & 0xfff;
INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[0xc2 / 2]) & 0x1ff;
common_draw(1, scrollx, scrolly, 0, 0, 0);
@ -4827,8 +4827,8 @@ static INT32 ManyblocDraw()
static INT32 MacrossDraw()
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = ((scroll[0] & 0x0f) << 8) | (scroll[1] & 0xff);
INT32 scrolly = ((scroll[2] & 0x01) << 8) | (scroll[3] & 0xff);
INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff);
INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff);
common_draw(0, scrollx, scrolly, 0, 0, 0x200);
@ -4838,8 +4838,8 @@ static INT32 MacrossDraw()
static INT32 VandykeDraw()
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = ((scroll[0] & 0x0f) << 8) | (scroll[1] >> 8);
INT32 scrolly = ((scroll[2] & 0x01) << 8) | (scroll[3] >> 8);
INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) >> 8);
INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) >> 8);
common_draw(0, scrollx, scrolly, 0, 0, 0x200);
@ -4849,8 +4849,8 @@ static INT32 VandykeDraw()
static INT32 RedhawkiDraw()
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = scroll[2] & 0xff;
INT32 scrolly = scroll[3] & 0xff;
INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff;
INT32 scrolly = BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff;
common_draw(0, scrollx, scrolly, 0, 0, 0x300);
@ -4860,8 +4860,8 @@ static INT32 RedhawkiDraw()
static INT32 FirehawkDraw()
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrolly = (scroll[3] + 0x100) & 0x1ff;
INT32 scrollx = (scroll[2] + 0x000) & 0xfff;
INT32 scrolly = (BURN_ENDIAN_SWAP_INT16(scroll[3]) + 0x100) & 0x1ff;
INT32 scrollx = (BURN_ENDIAN_SWAP_INT16(scroll[2]) + 0x000) & 0xfff;
common_draw(1, scrollx, scrolly, 0, 0, 0x200);
@ -4877,8 +4877,8 @@ static INT32 HachamfDraw()
}
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = ((scroll[0] & 0x0f) << 8) | (scroll[1] & 0xff);
INT32 scrolly = ((scroll[2] & 0x01) << 8) | (scroll[3] & 0xff);
INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff);
INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff);
common_draw(0, scrollx, scrolly, 0, 0, 0x200);
@ -4891,10 +4891,10 @@ static INT32 StrahlDraw()
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 bgscrollx = ((scroll[0x000] & 0x0f) << 8) | (scroll[0x001] & 0xff);
INT32 bgscrolly = ((scroll[0x002] & 0x01) << 8) | (scroll[0x003] & 0xff);
INT32 fgscrollx = ((scroll[0x200] & 0x0f) << 8) | (scroll[0x201] & 0xff);
INT32 fgscrolly = ((scroll[0x202] & 0x01) << 8) | (scroll[0x203] & 0xff);
INT32 bgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x000]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x001]) & 0xff);
INT32 bgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x002]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x003]) & 0xff);
INT32 fgscrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0x200]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x201]) & 0xff);
INT32 fgscrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[0x202]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[0x203]) & 0xff);
draw_macross_background(DrvBgRAM0, bgscrollx, bgscrolly, 0x300, 0);
@ -4922,8 +4922,8 @@ static INT32 Macross2Draw()
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 scrollx = ((scroll[0] & 0x0f) << 8) | (scroll[1] & 0xff);
INT32 scrolly = ((scroll[2] & 0x01) << 8) | (scroll[3] & 0xff);
INT32 scrollx = ((BURN_ENDIAN_SWAP_INT16(scroll[0]) & 0x0f) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[1]) & 0xff);
INT32 scrolly = ((BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0x01) << 8) | (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff);
switch (scroll[0] & 0x30)
{
@ -4953,7 +4953,7 @@ static INT32 GunnailDraw()
videoshift = 64;
UINT16 *scroll = (UINT16*)DrvScrollRAM;
switch ((scroll[0] >> 8) & 0x30)
switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30)
{
case 0x00: draw_gunnail_background(DrvBgRAM0); break;
//case 0x10: draw_gunnail_background(DrvBgRAM1); break;
@ -4990,7 +4990,7 @@ static INT32 RapheroDraw()
videoshift = 64;
UINT16 *scroll = (UINT16*)DrvScrollRAM;
switch ((scroll[0] >> 8) & 0x30)
switch ((BURN_ENDIAN_SWAP_INT16(scroll[0]) >> 8) & 0x30)
{
case 0x00: draw_gunnail_background(DrvBgRAM0); break;
case 0x10: draw_gunnail_background(DrvBgRAM1); break;
@ -5016,10 +5016,10 @@ static INT32 BioshipDraw()
DrvPaletteRecalc();
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 bgscrolly = (scroll[0x02] & 0x100) | (scroll[0x03] >> 8);
INT32 bgscrollx = (scroll[0x00] & 0xf00) | (scroll[0x01] >> 8);
INT32 fgscrolly = (scroll[0x02] & 0x100) | (scroll[0x03] >> 8);
INT32 fgscrollx = (scroll[0x00] & 0xf00) | (scroll[0x01] >> 8);
INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8);
INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8);
INT32 fgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0x02]) & 0x100) | (BURN_ENDIAN_SWAP_INT16(scroll[0x03]) >> 8);
INT32 fgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[0x00]) & 0xf00) | (BURN_ENDIAN_SWAP_INT16(scroll[0x01]) >> 8);
bioship_draw_background(bgscrollx, bgscrolly);
@ -5062,10 +5062,10 @@ static INT32 BjtwinDraw()
static void AfegaCommonDraw(INT32 , INT32 xoffset, INT32 yoffset)
{
UINT16 *scroll = (UINT16*)DrvScrollRAM;
INT32 bgscrollx = (scroll[1] + xoffset) & 0xfff;
INT32 bgscrolly = (scroll[0] + yoffset) & 0x1ff;
INT32 txscrollx = (scroll[3] & 0xff);
INT32 txscrolly = (scroll[2] & 0xff);
INT32 bgscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[1]) + xoffset) & 0xfff;
INT32 bgscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[0]) + yoffset) & 0x1ff;
INT32 txscrollx = (BURN_ENDIAN_SWAP_INT16(scroll[3]) & 0xff);
INT32 txscrolly = (BURN_ENDIAN_SWAP_INT16(scroll[2]) & 0xff);
common_draw(1, bgscrollx, bgscrolly, txscrollx, txscrolly, 0x200);
}
@ -7604,8 +7604,8 @@ static INT32 TdragonLoadCallback()
}
{
*((UINT16*)(Drv68KROM + 0x048a)) = 0x4e71;
*((UINT16*)(Drv68KROM + 0x04aa)) = 0x4e71;
*((UINT16*)(Drv68KROM + 0x048a)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
*((UINT16*)(Drv68KROM + 0x04aa)) = BURN_ENDIAN_SWAP_INT16(0x4e71);
}
SekInit(0, 0x68000);
@ -7721,7 +7721,7 @@ static INT32 TdragonbLoadCallback()
decode_tdragonb();
DrvGfxDecode(0x20000, 0x100000, 0x100000);
*((UINT16 *)(Drv68KROM + 0x00308)) = 0x4e71; // fix intro sprites
*((UINT16 *)(Drv68KROM + 0x00308)) = BURN_ENDIAN_SWAP_INT16(0x4e71); // fix intro sprites
return 0;
}

View File

@ -397,10 +397,10 @@ static INT32 DrvDraw()
sx -= 8;
if (sy < 0 || sx < 0 || sy >= nScreenHeight || sx >= nScreenWidth) continue;
INT32 code = vram[offs] & 0x7ff;
INT32 color = vram[offs] >> 12;
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x7ff;
INT32 color = BURN_ENDIAN_SWAP_INT16(vram[offs]) >> 12;
code += tilebank * (vram[offs] & 0x800);
code += tilebank * (BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x800);
Render8x8Tile(pTransDraw, code, sx, sy, color, 4, 0, DrvGfxROM);
}