本文整理汇总了C++中BITSWAP16函数的典型用法代码示例。如果您正苦于以下问题:C++ BITSWAP16函数的具体用法?C++ BITSWAP16怎么用?C++ BITSWAP16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BITSWAP16函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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:ursine,项目名称:mame,代码行数:27,代码来源:wink.cpp
示例2: DRIVER_INIT
ROM_END
static DRIVER_INIT( wink )
{
UINT32 i;
UINT8 *ROM = machine.region("maincpu")->base();
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:LibXenonProject,项目名称:mame-lx,代码行数:29,代码来源:wink.c
示例3: 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:CrouchingLlama,项目名称:openlase-mame,代码行数:32,代码来源:wink.c
示例4: BITSWAP16
ROM_END
/***************************************************************************/
/* This is based on code by Niclas Karlsson Mate, who figured out the
encryption method! The technique is a combination of a XOR table plus
bit-swapping */
void raiden_state::common_decrypt()
{
UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
int i;
for (i = 0; i < 0x20000; i++)
{
static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 };
UINT16 data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x0f];
data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0);
RAM[0xc0000/2 + i] = data;
}
RAM = (UINT16 *)memregion("sub")->base();
for (i = 0; i < 0x20000; i++)
{
static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 };
UINT16 data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x07];
data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6);
RAM[0xc0000/2 + i] = data;
}
}
开发者ID:dinkc64,项目名称:mame,代码行数:33,代码来源:raiden.c
示例5: buf
void darkmist_state::decrypt_gfx()
{
std::vector<uint8_t> buf(0x40000);
uint8_t *rom;
int size;
int i;
rom = memregion("tx_gfx")->base();
size = memregion("tx_gfx")->bytes();
/* data lines */
for (i = 0;i < size/2;i++)
{
int w1;
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
}
/* address lines */
for (i = 0;i < size;i++)
{
rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12, 3,2,1, 11,10,9,8, 0, 7,6,5,4)];
}
decrypt_fgbgtiles(memregion("bg_gfx")->base(), memregion("bg_gfx")->bytes());
decrypt_fgbgtiles(memregion("fg_gfx")->base(), memregion("fg_gfx")->bytes());
rom = memregion("spr_gfx")->base();
size = memregion("spr_gfx")->bytes();
/* data lines */
for (i = 0;i < size/2;i++)
{
int w1;
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
}
/* address lines */
for (i = 0;i < size;i++)
{
rom[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
}
}
开发者ID:Robbbert,项目名称:store1,代码行数:55,代码来源:darkmist.cpp
示例6: MCFG_SPEAKER_STANDARD_MONO
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_YM2151_ADD("ymsnd", YM_CLOCK)
MCFG_YM2151_IRQ_HANDLER(WRITELINE(driver_device, member_wrapper_line<t5182_ym2151_irq_handler>))
MCFG_SOUND_ROUTE(0, "mono", 1.0)
MCFG_SOUND_ROUTE(1, "mono", 1.0)
MACHINE_CONFIG_END
ROM_START( mustache )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) )
ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) )
ROM_REGION( 0x10000, "t5182", 0 ) /* Toshiba T5182 module */
ROM_LOAD( "t5182.rom", 0x0000, 0x2000, CRC(d354c8fc) SHA1(a1c9e1ac293f107f69cc5788cf6abc3db1646e33) )
ROM_LOAD( "mustache.e5", 0x8000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )
ROM_REGION( 0x0c000, "gfx1",0) /* BG tiles */
ROM_LOAD( "mustache.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
ROM_LOAD( "mustache.a14", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
ROM_LOAD( "mustache.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )
ROM_REGION( 0x20000, "gfx2",0 ) /* sprites */
ROM_LOAD( "mustache.a4", 0x00000, 0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) )
ROM_LOAD( "mustache.a7", 0x08000, 0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) )
ROM_LOAD( "mustache.a5", 0x10000, 0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) )
ROM_LOAD( "mustache.a8", 0x18000, 0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) )
ROM_REGION( 0x1300, "proms",0 ) /* proms */
ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )
ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END
DRIVER_INIT_MEMBER(mustache_state,mustache)
{
t5182_init(machine());
int i;
int G1 = memregion("gfx1")->bytes()/3;
int G2 = memregion("gfx2")->bytes()/2;
UINT8 *gfx1 = memregion("gfx1")->base();
UINT8 *gfx2 = memregion("gfx2")->base();
UINT8 *buf=auto_alloc_array(machine(), UINT8, G2*2);
/* BG data lines */
for (i=0;i<G1; i++)
{
UINT16 w;
buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3);
w = (gfx1[i+G1] << 8) | gfx1[i+G1*2];
w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
buf[i+G1] = w >> 8;
buf[i+G1*2] = w & 0xff;
}
/* BG address lines */
for (i = 0; i < 3*G1; i++)
gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
/* SPR data lines */
for (i=0;i<G2; i++)
{
UINT16 w;
w = (gfx2[i] << 8) | gfx2[i+G2];
w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
buf[i] = w >> 8;
buf[i+G2] = w & 0xff;
}
/* SPR address lines */
for (i = 0; i < 2*G2; i++)
gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];
auto_free(machine(), buf);
seibu_sound_decrypt(machine(),"maincpu",0x8000);
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:86,代码来源:mustache.c
示例7: photoy2k_spritenum
static unsigned int photoy2k_spritenum()
{
UINT32 base = photoy2k_seqpos & 0xffc00;
UINT32 low = photoy2k_seqpos & 0x003ff;
switch((photoy2k_seqpos >> 10) & 0xf) {
case 0x0:
case 0xa:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 0,8,3,1,5,9,4,2,6,7) ^ 0x124);
case 0x1:
case 0xb:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 5,1,7,4,0,8,3,6,9,2) ^ 0x088);
case 0x2:
case 0x8:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 3,5,9,7,6,4,1,8,2,0) ^ 0x011);
case 0x3:
case 0x9:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 1,8,3,6,0,4,5,2,9,7) ^ 0x154);
case 0x4:
case 0xe:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 2,1,7,4,5,8,3,6,9,0) ^ 0x0a9);
case 0x5:
case 0xf:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 9,4,6,8,2,1,7,5,3,0) ^ 0x201);
case 0x6:
case 0xd:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 4,6,0,8,9,7,3,5,1,2) ^ 0x008);
case 0x7:
case 0xc:
return base | (BITSWAP16(low, 15,14,13,12,11,10, 8,9,3,2,0,1,6,7,5,4) ^ 0x000);
}
return 0;
}
开发者ID:mrcaytao000,项目名称:FBA4PSP,代码行数:33,代码来源:pgm_prot.cpp
示例8: MDRV_VIDEO_ATTRIBUTES
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_VISIBLE_AREA(1*8, 31*8-1, 2*8, 31*8-1)
MDRV_GFXDECODE(gfxdecodeinfo)
MDRV_PALETTE_LENGTH(8*16+16*8)
MDRV_PALETTE_INIT(mustache)
MDRV_VIDEO_START(mustache)
MDRV_VIDEO_UPDATE(mustache)
MACHINE_DRIVER_END
ROM_START( mustache )
ROM_REGION( 0x20000, REGION_CPU1, 0 )
ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) )
ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) )
ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* T5182 */
ROM_LOAD( "mustache.e5",0x0000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )
ROM_REGION( 0x0c000, REGION_GFX1,0) /* BG tiles */
ROM_LOAD( "mustache.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
ROM_LOAD( "mustache.a14", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
ROM_LOAD( "mustache.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )
ROM_REGION( 0x20000, REGION_GFX2,0 ) /* sprites */
ROM_LOAD( "mustache.a4", 0x00000, 0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) )
ROM_LOAD( "mustache.a7", 0x08000, 0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) )
ROM_LOAD( "mustache.a5", 0x10000, 0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) )
ROM_LOAD( "mustache.a8", 0x18000, 0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) )
ROM_REGION( 0x1300, REGION_PROMS,0 ) /* proms */
ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )
ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END
static DRIVER_INIT( mustache )
{
int i;
#define G1 (memory_region_length(REGION_GFX1)/3)
#define G2 (memory_region_length(REGION_GFX2)/2)
UINT8 *buf=auto_malloc(G2*2);
/* BG data lines */
for (i=0;i<G1; i++)
{
UINT16 w;
buf[i] = BITSWAP8(memory_region(REGION_GFX1)[i], 0,5,2,6,4,1,7,3);
w = (memory_region(REGION_GFX1)[i+G1] << 8) | memory_region(REGION_GFX1)[i+G1*2];
w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
buf[i+G1] = w >> 8;
buf[i+G1*2] = w & 0xff;
}
/* BG address lines */
for (i = 0; i < 3*G1; i++)
memory_region(REGION_GFX1)[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
/* SPR data lines */
for (i=0;i<G2; i++)
{
UINT16 w;
w = (memory_region(REGION_GFX2)[i] << 8) | memory_region(REGION_GFX2)[i+G2];
w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
buf[i] = w >> 8;
buf[i+G2] = w & 0xff;
}
/* SPR address lines */
for (i = 0; i < 2*G2; i++)
memory_region(REGION_GFX2)[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];
seibu_sound_decrypt(REGION_CPU1,0x8000);
install_mem_read_handler( 0, 0xd400, 0xd401, mustache_coin_hack_r);
}
开发者ID:Ezio-PS,项目名称:mame2003-libretro,代码行数:86,代码来源:mustache.c
示例9: MCFG_DEVICE_ADD
/* sound hardware */
MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0) // for seibu_sound_decrypt on the MAIN cpu (not sound)
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_YM2151_ADD("ymsnd", YM_CLOCK)
MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("t5182", t5182_device, ym2151_irq_handler))
MCFG_SOUND_ROUTE(0, "mono", 1.0)
MCFG_SOUND_ROUTE(1, "mono", 1.0)
MACHINE_CONFIG_END
ROM_START( mustache )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) )
ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) )
ROM_REGION( 0x10000, "t5182_z80", 0 ) /* Toshiba T5182 module */
ROM_LOAD( "t5182.rom", 0x0000, 0x2000, CRC(d354c8fc) SHA1(a1c9e1ac293f107f69cc5788cf6abc3db1646e33) )
ROM_LOAD( "mustache.e5", 0x8000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )
ROM_REGION( 0x0c000, "gfx1",0) /* BG tiles */
ROM_LOAD( "mustache.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
ROM_LOAD( "mustache.a14", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
ROM_LOAD( "mustache.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )
ROM_REGION( 0x20000, "gfx2",0 ) /* sprites */
ROM_LOAD( "mustache.a4", 0x00000, 0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) )
ROM_LOAD( "mustache.a7", 0x08000, 0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) )
ROM_LOAD( "mustache.a5", 0x10000, 0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) )
ROM_LOAD( "mustache.a8", 0x18000, 0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) )
ROM_REGION( 0x1300, "proms",0 ) /* proms */
ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )
ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END
DRIVER_INIT_MEMBER(mustache_state,mustache)
{
int i;
int G1 = memregion("gfx1")->bytes()/3;
int G2 = memregion("gfx2")->bytes()/2;
UINT8 *gfx1 = memregion("gfx1")->base();
UINT8 *gfx2 = memregion("gfx2")->base();
dynamic_buffer buf(G2*2);
/* BG data lines */
for (i=0;i<G1; i++)
{
UINT16 w;
buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3);
w = (gfx1[i+G1] << 8) | gfx1[i+G1*2];
w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
buf[i+G1] = w >> 8;
buf[i+G1*2] = w & 0xff;
}
/* BG address lines */
for (i = 0; i < 3*G1; i++)
gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
/* SPR data lines */
for (i=0;i<G2; i++)
{
UINT16 w;
w = (gfx2[i] << 8) | gfx2[i+G2];
w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
buf[i] = w >> 8;
buf[i+G2] = w & 0xff;
}
/* SPR address lines */
for (i = 0; i < 2*G2; i++)
gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];
m_cpu_decrypt->decrypt("maincpu",0x8000);
}
开发者ID:Archlogic,项目名称:libretro-mame,代码行数:85,代码来源:mustache.c
示例10: decrypt
static UINT16 decrypt(UINT16 data, int address, int select_xor)
{
static const UINT16 xors[16] =
{
0xb52c,0x2458,0x139a,0xc998,0xce8e,0x5144,0x0429,0xaad4,0xa331,0x3645,0x69a3,0xac64,0x1a53,0x5083,0x4dea,0xd237
};
static const UINT8 bitswaps[16][16] =
{
{ 12,8,13,11,14,10,15,9, 3,2,1,0,4,5,6,7 }, { 10,11,14,12,15,13,8,9, 6,7,5,3,0,4,2,1 },
{ 14,13,15,9,8,12,11,10, 7,4,1,5,6,0,3,2 }, { 15,14,8,9,10,11,13,12, 1,2,7,3,4,6,0,5 },
{ 10,9,13,14,15,8,12,11, 5,2,1,0,3,4,7,6 }, { 8,9,15,14,10,11,13,12, 0,6,5,4,1,2,3,7 },
{ 14,8,15,9,10,11,13,12, 4,5,3,0,2,7,6,1 }, { 13,11,12,10,15,9,14,8, 6,0,7,5,1,4,3,2 },
{ 12,11,13,10,9,8,14,15, 0,2,4,6,7,5,3,1 }, { 15,13,9,8,10,11,12,14, 2,1,0,7,6,5,4,3 },
{ 13,8,9,10,11,12,15,14, 6,0,1,2,3,7,4,5 }, { 12,11,10,8,9,13,14,15, 6,5,4,0,7,1,2,3 },
{ 12,15,8,13,9,11,14,10, 6,5,4,3,2,1,0,7 }, { 11,12,13,14,15,8,9,10, 4,5,7,1,6,3,2,0 },
{ 13,8,12,14,11,15,10,9, 7,6,5,4,3,2,1,0 }, { 15,14,13,12,11,10,9,8, 0,6,7,4,3,2,1,5 }
};
int j, xorval;
const UINT8 *bs;
// calculate bitswap to use
j = ((address ^ select_xor) & 0xf0) >> 4;
if (address & 0x20000) j ^= 4;
bs = bitswaps[j];
// calculate xor to use
j = (address ^ select_xor) & 0x0f;
if (address & 0x40000) j ^= 2; // boogwing
xorval = xors[j];
// decrypt
return xorval ^ BITSWAP16(data,
bs[0],bs[1],bs[2],bs[3],bs[4],bs[5],bs[6],bs[7],
bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]);
}
开发者ID:NULUSIOS,项目名称:mame,代码行数:35,代码来源:deco102.c
示例11: nec_v25_cpu_decrypt
void nec_v25_cpu_decrypt(void)
{
int i;
unsigned char *rom = memory_region(REGION_CPU3);
UINT8* decrypted = auto_malloc(0x100000);
UINT8* temp = malloc_or_die(0x100000);
// set CPU3 opcode base
memory_set_decrypted_region(2, 0x00000, 0xfffff, decrypted);
// make copy of ROM so original can be overwritten
memcpy(temp, rom, 0x10000);
for(i = 0; i < 0x10000; i++)
{
int j = BITSWAP16(i, 14, 11, 15, 12, 13, 4, 3, 7, 5, 10, 2, 8, 9, 6, 1, 0);
// normal ROM data with address swap undone
rom[i] = temp[j];
// decryped opcodes with address swap undone
decrypted[i] = ga2_v25_opcode_table[ temp[j] ];
}
memcpy(rom+0xf0000, rom, 0x10000);
memcpy(decrypted+0xf0000, decrypted, 0x10000);
free(temp);
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:29,代码来源:segas32.c
示例12: DRIVER_INIT_MEMBER
MACHINE_CONFIG_END
DRIVER_INIT_MEMBER(forte2_state,pesadelo)
{
int i;
UINT8 *mem = machine().root_device().memregion("maincpu")->base();
int memsize = machine().root_device().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:coinhelper,项目名称:jsmess,代码行数:25,代码来源:forte2.c
示例13: DRIVER_INIT
MACHINE_DRIVER_END
static DRIVER_INIT(pesadelo)
{
int i;
UINT8 *mem = memory_region(machine, "maincpu");
int memsize = memory_region_length(machine, "maincpu");
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 = alloc_array_or_die(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];
}
free(buf);
}
开发者ID:nitrologic,项目名称:emu,代码行数:25,代码来源:forte2.c
示例14: BITSWAP16
GFXDECODE_END
// An encrypted single rom starts with 02, decrypted with 20.
// The 2nd and 3rd part of a multi-rom set will have no obvious byte,
// so we check the first 4 bytes for a signature, and decrypt if found.
void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM)
{
bool doit = FALSE;
UINT8 b;
UINT16 j;
dynamic_buffer temp_copy;
temp_copy.resize(0x1000);
if (ROM[0] == 0x02) doit = TRUE;
if (ROM[0] == 0x1e && ROM[1] == 0xfa && ROM[2] == 0x60 && ROM[3] == 0x71) doit = TRUE; // xbasic 2nd rom
if (ROM[0] == 0x72 && ROM[1] == 0x62 && ROM[2] == 0xc6 && ROM[3] == 0x36) doit = TRUE; // xbasic 3rd rom
if (ROM[0] == 0xf0 && ROM[1] == 0x40 && ROM[2] == 0xce && ROM[3] == 0x80) doit = TRUE; // forth 2nd rom (both sets)
if (ROM[0] == 0x80 && ROM[1] == 0x06 && ROM[2] == 0x68 && ROM[3] == 0x14) doit = TRUE; // pascal 2nd rom
if (doit)
{
for (int i = 0; i < 0x1000; i++)
{
b = ROM[i];
j = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7);
b = BITSWAP8(b, 3, 2, 1, 0, 7, 6, 5, 4);
temp_copy[j & 0xfff] = b;
}
memcpy(ROM, &temp_copy[0], 0x1000);
}
}
开发者ID:Fulg,项目名称:mame,代码行数:32,代码来源:pegasus.cpp
示例15: 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
示例16: DRIVER_INIT_MEMBER
DRIVER_INIT_MEMBER(tsispch_state,prose2k)
{
UINT8 *dspsrc = (UINT8 *)(memregion("dspprgload")->base());
UINT32 *dspprg = (UINT32 *)(memregion("dspprg")->base());
fprintf(stderr,"driver init\n");
// unpack 24 bit 7720 data into 32 bit space and shuffle it so it can run as 7725 code
// data format as-is in dspsrc: (L = always 0, X = doesn't matter)
// source upd7720 dest upd7725
// bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0
// for OP/RT:
// b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15
// b2 L 8 9 10 11 12 13 14 -> 14 13 12 L 11 10 9 8
// b3 0 1 2 3 4 5 6 7 -> 7 6 5 4 3 2 1 0
// for JP:
// b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15
// b2 L 8 9 10 11 12 13 14 -> 14 13 L L L 12 11 10
// b3 0 1 2 3 4 5 6 7 -> 9 8 7 6 5 4 X X
// for LD:
// b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15
// b2 L 8 9 10 11 12 13 14 -> 14 13 12 11 10 9 8 7
// b3 0 1 2 3 4 5 6 7 -> 6 5 X X 3 2 1 0
UINT8 byte1t;
UINT16 byte23t;
for (int i = 0; i < 0x600; i+= 3)
{
byte1t = BITSWAP8(dspsrc[0+i], 0, 1, 2, 3, 4, 5, 6, 7);
// here's where things get disgusting: if the first byte was an OP or RT, do the following:
if ((byte1t&0x80) == 0x00) // op or rt instruction
{
byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 15, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7);
}
else if ((byte1t&0xC0) == 0x80) // jp instruction
{
byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 15, 15, 15, 10, 11, 12, 13, 14, 0, 1, 2, 3, 6, 7);
}
else // ld instruction
{
byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 3, 4, 5, 6, 7);
}
*dspprg = byte1t<<24 | byte23t<<8;
dspprg++;
}
m_paramReg = 0x00; // on power up, all leds on, reset to upd7720 is high
m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // starts in reset
}
开发者ID:dinkc64,项目名称:mame,代码行数:46,代码来源:tsispch.c
示例17: pgm_decode_kovassg_program
static void pgm_decode_kovassg_program()
{
INT32 i, j;
UINT16 *src = (UINT16 *)PGM68KROM;
UINT16 *dst = (UINT16 *)BurnMalloc(0x400000);
for (i = 0; i < 0x400000/2; i++)
{
j = (i & ~0xffff) | (BITSWAP16(i, 15, 14, 13, 12, 11, 10, 7, 3, 1, 9, 4, 8, 6, 0, 2, 5) ^ 0x019c);
dst[i] = BITSWAP16(src[j], 13, 9, 10, 11, 2, 0, 12 ,5, 4, 1, 14, 8, 15, 6, 3, 7) ^ 0x9d05;
}
memcpy (src, dst, 0x400000);
BurnFree (dst);
}
开发者ID:aquasnake,项目名称:fba-sdl,代码行数:17,代码来源:pgm_crypt.cpp
示例18: MCFG_SPEAKER_STANDARD_MONO
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_YM2151_ADD("ymsnd", YM_CLOCK)
MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("t5182", t5182_device, ym2151_irq_handler))
MCFG_SOUND_ROUTE(0, "mono", 1.0)
MCFG_SOUND_ROUTE(1, "mono", 1.0)
MACHINE_CONFIG_END
ROM_START( mustache )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "mustache.h18", 0x0000, 0x8000, CRC(123bd9b8) SHA1(33a7cba5c3a54b0b1a15dd1e24d298b6f7274321) )
ROM_LOAD( "mustache.h16", 0x8000, 0x4000, CRC(62552beb) SHA1(ee10991d7de0596608fa1db48805781cbfbbdb9f) )
ROM_REGION( 0x8000, "t5182_z80", 0 ) /* Toshiba T5182 external ROM */
ROM_LOAD( "mustache.e5", 0x0000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )
ROM_REGION( 0x0c000, "gfx1",0) /* BG tiles */
ROM_LOAD( "mustache.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
ROM_LOAD( "mustache.a14", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
ROM_LOAD( "mustache.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )
ROM_REGION( 0x20000, "gfx2",0 ) /* sprites */
ROM_LOAD( "mustache.a4", 0x00000, 0x8000, CRC(d5c3bbbf) SHA1(914e3feea54246476701f492c31bd094ad9cea10) )
ROM_LOAD( "mustache.a7", 0x08000, 0x8000, CRC(e2a6012d) SHA1(4e4cd1a186870c8a88924d5bff917c6889da953d) )
ROM_LOAD( "mustache.a5", 0x10000, 0x8000, CRC(c975fb06) SHA1(4d166bd79e19c7cae422673de3e095ad8101e013) )
ROM_LOAD( "mustache.a8", 0x18000, 0x8000, CRC(2e180ee4) SHA1(a5684a25c337aeb4effeda7982164d35bc190af9) )
ROM_REGION( 0x1300, "proms",0 ) /* proms */
ROM_LOAD( "mustache.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
ROM_LOAD( "mustache.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
ROM_LOAD( "mustache.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )
ROM_LOAD( "mustache.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END
ROM_START( mustachei )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "1.h18", 0x0000, 0x8000, CRC(22893fbc) SHA1(724ea50642aec9be10547bd86fae5e1ebfe54685) )
ROM_LOAD( "2.h16", 0x8000, 0x4000, CRC(ec70cfd3) SHA1(0476eab03b907778ea488c802b79da99bf376eb6) )
ROM_REGION( 0x8000, "t5182_z80", 0 ) /* Toshiba T5182 external ROM */
ROM_LOAD( "10.e5", 0x0000, 0x8000, CRC(efbb1943) SHA1(3320e9eaeb776d09ed63f7dedc79e720674e6718) )
ROM_REGION( 0x0c000, "gfx1",0) /* BG tiles */
ROM_LOAD( "5.a13", 0x0000, 0x4000, CRC(9baee4a7) SHA1(31bcec838789462e67e54ebe7256db9fc4e51b69) )
ROM_LOAD( "4.a15", 0x4000, 0x4000, CRC(8155387d) SHA1(5f0a394c7671442519a831b0eeeaba4eecd5a406) )
ROM_LOAD( "3.a16", 0x8000, 0x4000, CRC(4db4448d) SHA1(50a94fd65c263d95fd24b4009dbb87707929fdcb) )
ROM_REGION( 0x20000, "gfx2",0 ) /* sprites */
ROM_LOAD( "6.a4", 0x00000, 0x8000, CRC(4a95a89c) SHA1(b34ebbda9b0e591876988e42bd36fd505452f38c) )
ROM_LOAD( "8.a7", 0x08000, 0x8000, CRC(3e6be0fb) SHA1(319ea59107e37953c31f59f5f635fc520682b09f) )
ROM_LOAD( "7.a5", 0x10000, 0x8000, CRC(8ad38884) SHA1(e11f1e1db6d5d119afedbe6604d10a6fd6049f12) )
ROM_LOAD( "9.a8", 0x18000, 0x8000, CRC(3568c158) SHA1(c3a2120086befe396a112bd62f032638011cb47a) )
ROM_REGION( 0x1300, "proms",0 ) /* proms */
ROM_LOAD( "d.c3",0x0000, 0x0100, CRC(68575300) SHA1(bc93a38df91ad8c2f335f9bccc98b52376f9b483) )
ROM_LOAD( "c.c2",0x0100, 0x0100, CRC(eb008d62) SHA1(a370fbd1affaa489210ea36eb9e365263fb4e232) )
ROM_LOAD( "b.c1",0x0200, 0x0100, CRC(65da3604) SHA1(e4874d4152a57944d4e47306250833ea5cd0d89b) )
ROM_LOAD( "a.b6",0x0300, 0x1000, CRC(5f83fa35) SHA1(cb13e63577762d818e5dcbb52b8a53f66e284e8f) ) /* 63S281N near SEI0070BU */
ROM_END
DRIVER_INIT_MEMBER(mustache_state,mustache)
{
int i;
int G1 = memregion("gfx1")->bytes()/3;
int G2 = memregion("gfx2")->bytes()/2;
uint8_t *gfx1 = memregion("gfx1")->base();
uint8_t *gfx2 = memregion("gfx2")->base();
std::vector<uint8_t> buf(G2*2);
/* BG data lines */
for (i=0;i<G1; i++)
{
uint16_t w;
buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3);
w = (gfx1[i+G1] << 8) | gfx1[i+G1*2];
w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
buf[i+G1] = w >> 8;
buf[i+G1*2] = w & 0xff;
}
/* BG address lines */
for (i = 0; i < 3*G1; i++)
gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
/* SPR data lines */
for (i=0;i<G2; i++)
{
uint16_t w;
w = (gfx2[i] << 8) | gfx2[i+G2];
w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
buf[i] = w >> 8;
//.........这里部分代码省略.........
开发者ID:Robbbert,项目名称:store1,代码行数:101,代码来源:mustache.cpp
示例19: output
void chessmst_state::update_display()
{
for(int i=0; i<4; i++)
{
if (BIT(m_digit_matrix, i))
output().set_indexed_value("digit", i, BITSWAP16(m_digit, 3,5,12,10,14,1,2,13,8,6,11,15,7,9,4,0) | (m_digit_dot << 16));
}
}
开发者ID:Robbbert,项目名称:store1,代码行数:8,代码来源:chessmst.cpp
示例20: DRIVER_INIT_MEMBER
ROM_END
DRIVER_INIT_MEMBER(alesis_state,hr16)
{
int i;
UINT8 *ROM = memregion("maincpu")->base();
UINT8 *orig = memregion("user1")->base();
for (i = 0; i < 0x8000; i++)
{
ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
}
}
开发者ID:MisterTea,项目名称:MAMEHub,代码行数:13,代码来源:alesis.c
注:本文中的BITSWAP16函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论