當前位置: 首頁>>代碼示例>>C++>>正文


C++ BITSWAP8函數代碼示例

本文整理匯總了C++中BITSWAP8函數的典型用法代碼示例。如果您正苦於以下問題:C++ BITSWAP8函數的具體用法?C++ BITSWAP8怎麽用?C++ BITSWAP8使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BITSWAP8函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: DRIVER_INIT

ROM_END

static DRIVER_INIT( wink )
{
	unsigned int i;
	UINT8 *ROM = memory_region(REGION_CPU1);
	UINT8 *buffer = malloc(0x8000);

	// protection module reverse engineered by HIGHWAYMAN

	if (buffer)
	{
		memcpy(buffer,ROM,0x8000);

		for (i = 0x0000; i <= 0x1fff; i++)
			ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

		for (i = 0x2000; i <= 0x3fff; i++)
			ROM[i] = buffer[BITSWAP16(i,15,14,13, 10, 7,12, 9, 8,11, 6, 3, 1, 5, 2, 4, 0)];

		for (i = 0x4000; i <= 0x5fff; i++)
			ROM[i] = buffer[BITSWAP16(i,15,14,13,  7,10,11, 9, 8,12, 6, 1, 3, 4, 2, 5, 0)];

		for (i = 0x6000; i <= 0x7fff; i++)
			ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

		free(buffer);
	}

	for (i = 0; i < 0x8000; i++)
		ROM[i] += BITSWAP8(i & 0xff, 7,5,3,1,6,4,2,0);
}
開發者ID:joolswills,項目名稱:advancemame,代碼行數:32,代碼來源:wink.c

示例2: DRIVER_INIT

static DRIVER_INIT( togenkyo )
{
#if 0
	UINT8 *prot = machine.region("protdata")->base();
	int i;

	/* this is one possible way to rearrange the protection ROM data to get the
       expected 0x5ece checksum. It's probably completely wrong! But since the
       game doesn't do anything else with that ROM, this is more than enough. I
       could just fill this are with fake data, the only thing that matters is
       the checksum. */
	for (i = 0;i < 0x20000;i++)
	{
		prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
	}
#else
	unsigned char *ROM = machine.region("maincpu")->base();

	// Protection ROM check skip
	ROM[0x010b] = 0x00;
	ROM[0x010c] = 0x00;
	ROM[0x010d] = 0x00;
	// Program ROM SUM check skip
//  ROM[0x025c] = 0x00;
//  ROM[0x025d] = 0x00;
#endif

	nb1413m3_type = NB1413M3_TOGENKYO;

//S init_nb1413m3(machine);
}
開發者ID:vikke,項目名稱:mame_0145,代碼行數:31,代碼來源:nbmj8900.c

示例3: DRIVER_INIT_MEMBER

MACHINE_CONFIG_END

DRIVER_INIT_MEMBER(forte2_state,pesadelo)
{
	int i;
	UINT8 *mem = memregion("maincpu")->base();
	int memsize = memregion("maincpu")->bytes();
	UINT8 *buf;

	// data swap
	for ( i = 0; i < memsize; i++ )
	{
		mem[i] = BITSWAP8(mem[i],3,5,6,7,0,4,2,1);
	}

	// address line swap
	buf = auto_alloc_array(machine(), UINT8, memsize);
	memcpy(buf, mem, memsize);
	for ( i = 0; i < memsize; i++ )
	{
		mem[BITSWAP16(i,11,9,8,13,14,15,12,7,6,5,4,3,2,1,0,10)] = buf[i];
	}
	auto_free(machine(), buf);

}
開發者ID:cyberkni,項目名稱:276in1JAMMA,代碼行數:25,代碼來源:forte2.c

示例4: BITSWAP8

UINT8 deco_cpu6_device::mi_decrypt::read_decrypted(UINT16 adr)
{
	if (adr&1)
		return BITSWAP8(direct->read_raw_byte(adr),6,4,7,5,3,2,1,0);
	else
		return direct->read_raw_byte(adr);
}
開發者ID:CJBass,項目名稱:mame2013-libretro,代碼行數:7,代碼來源:decocpu6.c

示例5: DRIVER_INIT_MEMBER

ROM_END

DRIVER_INIT_MEMBER(wink_state,wink)
{
	UINT32 i;
	UINT8 *ROM = memregion("maincpu")->base();
	dynamic_buffer buffer(0x8000);

	// protection module reverse engineered by HIGHWAYMAN

	memcpy(&buffer[0],ROM,0x8000);

	for (i = 0x0000; i <= 0x1fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

	for (i = 0x2000; i <= 0x3fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 10, 7,12, 9, 8,11, 6, 3, 1, 5, 2, 4, 0)];

	for (i = 0x4000; i <= 0x5fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13,  7,10,11, 9, 8,12, 6, 1, 3, 4, 2, 5, 0)];

	for (i = 0x6000; i <= 0x7fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

	for (i = 0; i < 0x8000; i++)
		ROM[i] += BITSWAP8(i & 0xff, 7,5,3,1,6,4,2,0);
}
開發者ID:bradhugh,項目名稱:mame,代碼行數:27,代碼來源:wink.cpp

示例6: DRIVER_INIT

ROM_END


static DRIVER_INIT( hnfubuki )
{
	UINT8 *rom = memory_region(REGION_GFX1);
	int len = memory_region_length(REGION_GFX1);
	int i,j;

	/* interestingly, the blitter data has a slight encryption */

	/* swap address bits 4 and 5 */
	for (i = 0;i < len;i += 0x40)
	{
		for (j = 0;j < 0x10;j++)
		{
			UINT8 t = rom[i + j + 0x10];
			rom[i + j + 0x10] = rom[i + j + 0x20];
			rom[i + j + 0x20] = t;
		}
	}

	/* swap data bits 0 and 1 */
	for (i = 0;i < len;i++)
	{
		rom[i] = BITSWAP8(rom[i],7,6,5,4,3,2,0,1);
	}
}
開發者ID:shangma,項目名稱:mame0112,代碼行數:28,代碼來源:hnayayoi.c

示例7: DRIVER_INIT

ROM_END

static DRIVER_INIT( wink )
{
	UINT32 i;
	UINT8 *ROM = memory_region(machine, "maincpu");
	UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x8000);

	// protection module reverse engineered by HIGHWAYMAN

	memcpy(buffer,ROM,0x8000);

	for (i = 0x0000; i <= 0x1fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

	for (i = 0x2000; i <= 0x3fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 10, 7,12, 9, 8,11, 6, 3, 1, 5, 2, 4, 0)];

	for (i = 0x4000; i <= 0x5fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13,  7,10,11, 9, 8,12, 6, 1, 3, 4, 2, 5, 0)];

	for (i = 0x6000; i <= 0x7fff; i++)
		ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];

	auto_free(machine, buffer);

	for (i = 0; i < 0x8000; i++)
		ROM[i] += BITSWAP8(i & 0xff, 7,5,3,1,6,4,2,0);
}
開發者ID:DarrenBranford,項目名稱:MAME4iOS,代碼行數:29,代碼來源:wink.c

示例8: DRIVER_INIT_MEMBER

ROM_END


DRIVER_INIT_MEMBER(hnayayoi_state,hnfubuki)
{
	UINT8 *rom = machine().root_device().memregion("gfx1")->base();
	int len = machine().root_device().memregion("gfx1")->bytes();
	int i, j;

	/* interestingly, the blitter data has a slight encryption */

	/* swap address bits 4 and 5 */
	for (i = 0; i < len; i += 0x40)
	{
		for (j = 0; j < 0x10; j++)
		{
			UINT8 t = rom[i + j + 0x10];
			rom[i + j + 0x10] = rom[i + j + 0x20];
			rom[i + j + 0x20] = t;
		}
	}

	/* swap data bits 0 and 1 */
	for (i = 0; i < len; i++)
	{
		rom[i] = BITSWAP8(rom[i],7,6,5,4,3,2,0,1);
	}
}
開發者ID:broftkd,項目名稱:mess-svn,代碼行數:28,代碼來源:hnayayoi.c

示例9: DRIVER_INIT_MEMBER

ROM_END


/**************************************
*            Driver Init              *
**************************************/

/* This reflect how was connected the bus to the EPROM
   inside the epoxy CPU block. They used ultra-thin wires,
   just to melt down with the epoxy in case someone try to
   use a heat gun for epoxy removal purposes...

   Bus / Eprom

    D0-> D5
    D1-> D6
    D2-> D0
    D3-> D7
    D4-> D2
    D5-> D4
    D6-> D3
    D7-> D1

   A00-> A10
   A01-> A08
   A02-> A01
   A03-> A11
   A04-> A05
   A05-> A13
   A06-> A12
   A07-> A04
   A08-> A02
   A09-> A07
   A10-> A03
   A11-> A00
   A12-> A09
   A13-> A06
   A14-> A14
*/
DRIVER_INIT_MEMBER(kas89_state,kas89)
{
	int i;
	uint8_t *mem = memregion("maincpu")->base();
	int memsize = memregion("maincpu")->bytes();

	/* Unscrambling data lines */
	for ( i = 0; i < memsize; i++ )
	{
		mem[i] = BITSWAP8(mem[i], 3, 1, 0, 5, 6, 4, 7, 2);
	}

	/* Unscrambling address lines */
	std::vector<uint8_t> buf(memsize);
	memcpy(&buf[0], mem, memsize);
	for ( i = 0; i < memsize; i++ )
	{
		mem[BITSWAP16(i, 15, 14, 5, 6, 3, 0, 12, 1, 9, 13, 4, 7, 10, 8, 2, 11)] = buf[i];
	}
}
開發者ID:goofwear,項目名稱:mame,代碼行數:59,代碼來源:kas89.cpp

示例10: decrypt_snd

static void decrypt_snd(running_machine *machine)
{
	int i;
	UINT8 *ROM = memory_region(machine, "t5182");

	for(i=0x8000;i<0x10000;i++)
		ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
}
開發者ID:Paulodx,項目名稱:sdl-mame-wii,代碼行數:8,代碼來源:darkmist.c

示例11: decrypt_snd

static void decrypt_snd(running_machine &machine)
{
	int i;
	UINT8 *ROM = machine.region("t5182")->base();

	for(i=0x8000;i<0x10000;i++)
		ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
}
開發者ID:vikke,項目名稱:mame_0145,代碼行數:8,代碼來源:darkmist.c

示例12: BITSWAP8

void fidel68k_state::eag_prepare_display()
{
	// Excel 68000: 4*7seg leds, 8*8 chessboard leds
	// EAG: 8*7seg leds(2 panels), (8+1)*8 chessboard leds
	uint8_t seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4);
	set_display_segmask(0x1ff, 0x7f);
	display_matrix(16, 9, m_led_data << 8 | seg_data, m_inp_mux);
}
開發者ID:crazii,項目名稱:mameui,代碼行數:8,代碼來源:fidel68k.cpp

示例13: DRIVER_INIT

ROM_END

static DRIVER_INIT(mv4in1)
{
	int i;
	for(i=0;i<0x10000;i++)
		memory_region(REGION_CPU1)[i]=BITSWAP8(memory_region(REGION_CPU1)[i],7,6,5,4,3,1,2,0);
}
開發者ID:broftkd,項目名稱:historic-mame,代碼行數:8,代碼來源:ltcasino.c

示例14: memregion

void darkmist_state::decrypt_snd()
{
	int i;
	UINT8 *ROM = memregion("t5182_z80")->base();

	for(i=0x0000;i<0x2000;i++)
		ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
}
開發者ID:MisterTea,項目名稱:MAMEHub,代碼行數:8,代碼來源:darkmist.c

示例15: DRIVER_INIT_MEMBER

// this should be correct, the areas of the ROM that differ to the original
// after this decode look like intentional changes
DRIVER_INIT_MEMBER(md_boot_state,mk3mdb)
{
	UINT8 *rom = machine().root_device().memregion("maincpu")->base();

	for (int x = 0x000001; x < 0x100001; x += 2)
	{
		if (x & 0x80000)
		{
			rom[x] = rom[x] ^ 0xff;
			rom[x] = BITSWAP8(rom[x], 0,3,2,5,4,6,7,1);
		}
		else
		{
			rom[x] = rom[x] ^ 0xff;
			rom[x] = BITSWAP8(rom[x], 4,0,7,1,3,6,2,5);
		}
	}

	for (int x = 0x100001; x < 0x400000; x += 2)
	{
		if (x & 0x80000)
		{
			rom[x] = rom[x] ^ 0xff;
			rom[x] = BITSWAP8(rom[x], 2,7,5,4,1,0,3,6);
		}
		else
		{
			rom[x] = BITSWAP8(rom[x], 6,1,4,2,7,0,3,5);
		}
	}

	// boot vectors don't seem to be valid, so they are patched...
	rom[0x01] = 0x01;
	rom[0x00] = 0x00;
	rom[0x03] = 0x00;
	rom[0x02] = 0x00;
	rom[0x05] = 0x00;
	rom[0x04] = 0x00;
	rom[0x07] = 0x02;
	rom[0x06] = 0x10;

	machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770070, 0x770075, FUNC(mk3mdb_dsw_r) );

	megadrive_6buttons_pad = 1;
	DRIVER_INIT_CALL(megadriv);
}
開發者ID:broftkd,項目名稱:mess-svn,代碼行數:48,代碼來源:megadrvb.c


注:本文中的BITSWAP8函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。