Core/burn/drv/pst90s/d_aerofgt.cpp
/*
 * aerofgt Background Tile 
 *   16-bit tile code in RamBg1V and RamBg2V
 * 0xE000 shr 13 is Color
 * 0x1800 shr 11 is Gfx Bank
 * 0x07FF shr  0 or Tile element index (low part)
 * 
 */
aerofgt Background Tile
16-bit tile code in RamBg1V and RamBg2V
0xE000 shr 13 is Color
0x1800 shr 11 is Gfx Bank
0x07FF shr  0 or Tile element index (low part)
aerofgt Background Tile 16 - bit tile code in RamBg1V and RamBg2V 0xE000 shr 13 is Color 0x1800 shr 11 is Gfx Bank 0x07FF shr 0 or Tile element index ( low part )
static void TileBackground_1(UINT16 *bg, UINT16 *pal)
{
	INT32 offs, mx, my, x, y;
	mx = -1;
	my = 0;
	for (offs = 0; offs < 64*64; offs++) {
		mx++;
		if (mx == 64) {
			mx = 0;
			my++;
		}
		x = mx * 8 - BURN_ENDIAN_SWAP_INT16(RamRaster[0x0000]) + 18;
		if (x <= -192) x += 512;
		y = my * 8 - (bg1scrolly & 0x1FF);
		if (y <= (224-512)) y += 512;
		if ( x<=-8 || x>=320 || y<=-8 || y>= 224 ) 
			continue;
		else
		if ( x >=0 && x < 312 && y >= 0 && y < 216) {
			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++) {
 				p[0] = pal[ d[0] | c ];
 				p[1] = pal[ d[1] | c ];
 				p[2] = pal[ d[2] | c ];
 				p[3] = pal[ d[3] | c ];
 				p[4] = pal[ d[4] | c ];
 				p[5] = pal[ d[5] | c ];
 				p[6] = pal[ d[6] | c ];
 				p[7] = pal[ d[7] | c ];
 				d += 8;
 				p += 320;
 			}
		} else {
			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++) {
				if ( (y+k)>=0 && (y+k)<224 ) {
	 				if ((x + 0) >= 0 && (x + 0)<320) p[0] = pal[ d[0] | c ];
	 				if ((x + 1) >= 0 && (x + 1)<320) p[1] = pal[ d[1] | c ];
	 				if ((x + 2) >= 0 && (x + 2)<320) p[2] = pal[ d[2] | c ];
	 				if ((x + 3) >= 0 && (x + 3)<320) p[3] = pal[ d[3] | c ];
	 				if ((x + 4) >= 0 && (x + 4)<320) p[4] = pal[ d[4] | c ];
	 				if ((x + 5) >= 0 && (x + 5)<320) p[5] = pal[ d[5] | c ];
	 				if ((x + 6) >= 0 && (x + 6)<320) p[6] = pal[ d[6] | c ];
	 				if ((x + 7) >= 0 && (x + 7)<320) p[7] = pal[ d[7] | c ];
	 			}
 				d += 8;
 				p += 320;
 			}
		}
	}
}
static void TileBackground_1 ( UINT16 * bg , UINT16 * pal ) { INT32 offs , mx , my , x , y ; mx = -1 ; my = 0 ; for ( offs = 0 ; offs < 64 * 64 ; offs ++ ) { mx ++ ; if ( mx == 64 ) { mx = 0 ; my ++ ; } x = mx * 8 - BURN_ENDIAN_SWAP_INT16 ( RamRaster [ 0x0000 ] ) + 18 ; if ( x <= -192 ) x += 512 ; y = my * 8 - ( bg1scrolly & 0x1FF ) ; if ( y <= ( 224 - 512 ) ) y += 512 ; if ( x <= -8 || x >= 320 || y <= -8 || y >= 224 ) continue ; else if ( x >= 0 && x < 312 && y >= 0 && y < 216 ) { 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 ++ ) { p [ 0 ] = pal [ d [ 0 ] | c ] ; p [ 1 ] = pal [ d [ 1 ] | c ] ; p [ 2 ] = pal [ d [ 2 ] | c ] ; p [ 3 ] = pal [ d [ 3 ] | c ] ; p [ 4 ] = pal [ d [ 4 ] | c ] ; p [ 5 ] = pal [ d [ 5 ] | c ] ; p [ 6 ] = pal [ d [ 6 ] | c ] ; p [ 7 ] = pal [ d [ 7 ] | c ] ; d += 8 ; p += 320 ; } } else { 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 ++ ) { if ( ( y + k ) >= 0 && ( y + k ) < 224 ) { if ( ( x + 0 ) >= 0 && ( x + 0 ) < 320 ) p [ 0 ] = pal [ d [ 0 ] | c ] ; if ( ( x + 1 ) >= 0 && ( x + 1 ) < 320 ) p [ 1 ] = pal [ d [ 1 ] | c ] ; if ( ( x + 2 ) >= 0 && ( x + 2 ) < 320 ) p [ 2 ] = pal [ d [ 2 ] | c ] ; if ( ( x + 3 ) >= 0 && ( x + 3 ) < 320 ) p [ 3 ] = pal [ d [ 3 ] | c ] ; if ( ( x + 4 ) >= 0 && ( x + 4 ) < 320 ) p [ 4 ] = pal [ d [ 4 ] | c ] ; if ( ( x + 5 ) >= 0 && ( x + 5 ) < 320 ) p [ 5 ] = pal [ d [ 5 ] | c ] ; if ( ( x + 6 ) >= 0 && ( x + 6 ) < 320 ) p [ 6 ] = pal [ d [ 6 ] | c ] ; if ( ( x + 7 ) >= 0 && ( x + 7 ) < 320 ) p [ 7 ] = pal [ d [ 7 ] | c ] ; } d += 8 ; p += 320 ; } } } }
aerofgt Background Tile
   16-bit tile code in RamBg1V and RamBg2V
 0xE000 shr 13 is Color
 0x1800 shr 11 is Gfx Bank
 0x07FF shr  0 or Tile element index (low part)
aerofgt Background Tile 16 - bit tile code in RamBg1V and RamBg2V 0xE000 shr 13 is Color 0x1800 shr 11 is Gfx Bank 0x07FF shr 0 or Tile element index ( low part )