Beispiel #1
0
bool sat_cart_slot_device::call_load()
{
	if (m_cart)
	{
		UINT32 *ROM;
		UINT32 len;

		if (software_entry() != NULL)
			len = get_software_region_length("cart");
		else
			len = length();

		m_cart->rom_alloc(machine(), len);
		ROM = m_cart->get_rom_base();

		if (software_entry() != NULL)
			memcpy(ROM, get_software_region("cart"), len);
		else
			fread(ROM, len);

		// fix endianness....
		for (int i = 0; i < len/4; i ++)
			ROM[i] = BITSWAP32(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
//          UINT8 tempa = ROM[i+0];
//          UINT8 tempb = ROM[i+1];
//          ROM[i+1] = ROM[i+2];
//          ROM[i+0] = ROM[i+3];
//          ROM[i+3] = tempa;
//          ROM[i+2] = tempb;
//      }
		return IMAGE_INIT_PASS;
	}

	return IMAGE_INIT_PASS;
}
Beispiel #2
0
UINT32 rocvfd_t::set_display(UINT32 segin)
{


	return BITSWAP32(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);

}
Beispiel #3
0
bool sat_cart_slot_device::call_load()
{
	if (m_cart)
	{
		bool is_rom = ((software_entry() == NULL) || ((software_entry() != NULL) && get_software_region("rom")));

		if (is_rom)
		{
			// from fullpath, only ROM carts
			UINT32 len = (software_entry() != NULL) ? get_software_region_length("rom") : length();
			UINT32 *ROM;
			
			m_cart->rom_alloc(len, tag());
			ROM = m_cart->get_rom_base();
			
			if (software_entry() != NULL)
				memcpy(ROM, get_software_region("rom"), len);
			else
				fread(ROM, len);
			
			// fix endianness....
			for (int i = 0; i < len/4; i ++)
				ROM[i] = BITSWAP32(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
//          {
//              UINT8 tempa = ROM[i+0];
//              UINT8 tempb = ROM[i+1];
//              ROM[i+1] = ROM[i+2];
//              ROM[i+0] = ROM[i+3];
//              ROM[i+3] = tempa;
//              ROM[i+2] = tempb;
//          }
		}
		else
		{
			// DRAM or BRAM carts from softlist
			if (get_software_region("bram"))
				m_cart->bram_alloc(get_software_region_length("bram"));
			if (get_software_region("dram0"))
				m_cart->dram0_alloc(get_software_region_length("dram0"));
			if (get_software_region("dram1"))
				m_cart->dram1_alloc(get_software_region_length("dram1"));
		}
		return IMAGE_INIT_PASS;
	}

	return IMAGE_INIT_PASS;
}
Beispiel #4
0
ROM_END

DRIVER_INIT( drill )
{
	// rearrange gfx roms to something we can decode, two of the roms form 4bpp of the graphics, the third forms another 2bpp but is in a different format
	UINT32 *src    = (UINT32*)memory_region       ( REGION_GFX2 );
	UINT32 *dst    = (UINT32*)memory_region       ( REGION_GFX1 );// + 0x400000;
	int i;


	for (i=0; i< 0x400000/4; i++)
	{
		UINT32 dat1 = src[i];
	    dat1 = BITSWAP32(dat1, 3, 11, 19, 27, 2, 10, 18, 26, 1, 9, 17, 25, 0, 8, 16, 24, 7, 15, 23, 31, 6, 14, 22, 30, 5, 13, 21, 29, 4, 12, 20, 28 );
		dst[(0x400000/4)+i] = dat1;
	}
}
Beispiel #5
0
static void decrypt(UINT32 *src, UINT32 *dst, int length)
{
	int a;

	for (a = 0; a < length/4; a++)
	{
		int addr, dword;

		addr = (a & 0xff0000) | 0x92c6;

		if (a & 0x0001) addr ^= 0xce4a;
		if (a & 0x0002) addr ^= 0x4db2;
		if (a & 0x0004) addr ^= 0xef60;
		if (a & 0x0008) addr ^= 0x5737;
		if (a & 0x0010) addr ^= 0x13dc;
		if (a & 0x0020) addr ^= 0x4bd9;
		if (a & 0x0040) addr ^= 0xa209;
		if (a & 0x0080) addr ^= 0xd996;
		if (a & 0x0100) addr ^= 0xa700;
		if (a & 0x0200) addr ^= 0xeca0;
		if (a & 0x0400) addr ^= 0x7529;
		if (a & 0x0800) addr ^= 0x3100;
		if (a & 0x1000) addr ^= 0x33b4;
		if (a & 0x2000) addr ^= 0x6161;
		if (a & 0x4000) addr ^= 0x1eef;
		if (a & 0x8000) addr ^= 0xf5a5;

		dword = src[addr];

		// note that each of the following lines affects exactly two bits

		if (a & 0x00004) dword ^= 0x04400000;
		if (a & 0x00008) dword ^= 0x40000004;
		if (a & 0x00010) dword ^= 0x00048000;
		if (a & 0x00020) dword ^= 0x00000280;
		if (a & 0x00040) dword ^= 0x00200040;
		if (a & 0x00080) dword ^= 0x09000000;
		if (a & 0x00100) dword ^= 0x00001100;
		if (a & 0x00200) dword ^= 0x20002000;
		if (a & 0x00400) dword ^= 0x00000022;
		if (a & 0x00800) dword ^= 0x000a0000;
		if (a & 0x01000) dword ^= 0x10004000;
		if (a & 0x02000) dword ^= 0x00010400;
		if (a & 0x04000) dword ^= 0x80000010;
		if (a & 0x08000) dword ^= 0x00000009;
		if (a & 0x10000) dword ^= 0x02100000;
		if (a & 0x20000) dword ^= 0x00800800;

		switch (a & 3)
		{
			case 0:
				dword = BITSWAP32( dword ^ 0xec63197a,
					 1,	 4,	 7,	28,	22,	18,	20,	 9,
					16,	10,	30,	 2,	31,	24,	19,	29,
					 6,	21,	23,	11,	12,	13,	 5,	 0,
					 8,	26,	27,	15,	14,	17,	25,	 3 );
				break;

			case 1:
				dword = BITSWAP32( dword ^ 0x58a5a55f,
					14,	23,	28,	29,	 6,	24,	10,	 1,
					 5,	16,	 7,	 2,	30,	 8,	18,	 3,
					31,	22,	25,	20,	17,	 0,	19,	27,
					 9,	12,	21,	15,	26,	13,	 4,	11 );
				break;

			case 2:
				dword = BITSWAP32( dword ^ 0xe3a65f16,
					19,	30,	21,	 4,	 2,	18,	15,	 1,
					12,	25,	 8,	 0,	24,	20,	17,	23,
					22,	26,	28,	16,	 9,	27,	 6,	11,
					31,	10,	 3,	13,	14,	 7,	29,	 5 );
				break;

			case 3:
				dword = BITSWAP32( dword ^ 0x28d93783,
					30,	 6,	15,	 0,	31,	18,	26,	22,
					14,	23,	19,	17,	10,	 8,	11,	20,
					 1,	28,	 2,	 4,	 9,	24,	25,	27,
					 7,	21,	13,	29,	 5,	 3,	16,	12 );
				break;
		}

		dst[a] = dword;
	}
}