当前位置: 首页>>代码示例>>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;未经允许,请勿转载。