Core/burn/drv/toaplan/toaplan.cpp
// This function decodes the tile data for the GP9001 chip in place.
This function decodes the tile data for the GP9001 chip in place.
This function decodes the tile data for the GP9001 chip in place .
INT32 ToaLoadGP9001Tiles(UINT8* pDest, INT32 nStart, INT32 nNumFiles, INT32 nROMSize, bool bSwap)	
{
	UINT8* pTile;
	INT32 nSwap;
	for (INT32 i = 0; i < (nNumFiles >> 1); i++) {
		BurnLoadRom(pDest + (i * 2 * nROMSize / nNumFiles), nStart + i, 2);
		BurnLoadRom(pDest + (i * 2 * nROMSize / nNumFiles) + 1, nStart + (nNumFiles >> 1) + i, 2);
	}
	BurnUpdateProgress(0.0, _T("Decoding graphics..."), 0);
	if (bSwap) {
		nSwap = 2;
	} else {
		nSwap = 0;
	}
	for (pTile = pDest; pTile < (pDest + nROMSize); pTile += 4) {
		UINT8 data[4];
		for (INT32 n = 0; n < 4; n++) {
			INT32 m = 7 - (n << 1);
			UINT8 nPixels = ((pTile[0 ^ nSwap] >> m) & 1) << 0;
			nPixels |= ((pTile[2 ^ nSwap] >> m) & 1) << 1;
			nPixels |= ((pTile[1 ^ nSwap] >> m) & 1) << 2;
			nPixels |= ((pTile[3 ^ nSwap] >> m) & 1) << 3;
			nPixels |= ((pTile[0 ^ nSwap] >> (m - 1)) & 1) << 4;
			nPixels |= ((pTile[2 ^ nSwap] >> (m - 1)) & 1) << 5;
			nPixels |= ((pTile[1 ^ nSwap] >> (m - 1)) & 1) << 6;
			nPixels |= ((pTile[3 ^ nSwap] >> (m - 1)) & 1) << 7;
			data[n] = nPixels;
		}
		for (INT32 n = 0; n < 4; n++) {
			pTile[n] = data[n];
		}
	}
	return 0;
}
INT32 ToaLoadGP9001Tiles ( UINT8 * pDest , INT32 nStart , INT32 nNumFiles , INT32 nROMSize , bool bSwap ) { UINT8 * pTile ; INT32 nSwap ; for ( INT32 i = 0 ; i < ( nNumFiles >> 1 ) ; i ++ ) { BurnLoadRom ( pDest + ( i * 2 * nROMSize / nNumFiles ) , nStart + i , 2 ) ; BurnLoadRom ( pDest + ( i * 2 * nROMSize / nNumFiles ) + 1 , nStart + ( nNumFiles >> 1 ) + i , 2 ) ; } BurnUpdateProgress ( 0.0 , _T ( " " ) , 0 ) ; if ( bSwap ) { nSwap = 2 ; } else { nSwap = 0 ; } for ( pTile = pDest ; pTile < ( pDest + nROMSize ) ; pTile += 4 ) { UINT8 data [ 4 ] ; for ( INT32 n = 0 ; n < 4 ; n ++ ) { INT32 m = 7 - ( n << 1 ) ; UINT8 nPixels = ( ( pTile [ 0 ^ nSwap ] >> m ) & 1 ) << 0 ; nPixels |= ( ( pTile [ 2 ^ nSwap ] >> m ) & 1 ) << 1 ; nPixels |= ( ( pTile [ 1 ^ nSwap ] >> m ) & 1 ) << 2 ; nPixels |= ( ( pTile [ 3 ^ nSwap ] >> m ) & 1 ) << 3 ; nPixels |= ( ( pTile [ 0 ^ nSwap ] >> ( m - 1 ) ) & 1 ) << 4 ; nPixels |= ( ( pTile [ 2 ^ nSwap ] >> ( m - 1 ) ) & 1 ) << 5 ; nPixels |= ( ( pTile [ 1 ^ nSwap ] >> ( m - 1 ) ) & 1 ) << 6 ; nPixels |= ( ( pTile [ 3 ^ nSwap ] >> ( m - 1 ) ) & 1 ) << 7 ; data [ n ] = nPixels ; } for ( INT32 n = 0 ; n < 4 ; n ++ ) { pTile [ n ] = data [ n ] ; } } return 0 ; }
This function decodes the tile data for the GP9001 chip in place.
This function decodes the tile data for the GP9001 chip in place .
// bSwap = false