DRIVER_INIT_MEMBER(chsuper_state,chmpnum) { UINT8 *buffer; UINT8 *rom = memregion("gfx1")->base(); int i; m_tilexor = 0x1800; buffer = auto_alloc_array(machine(), UINT8, 0x100000); for (i=0;i<0x100000;i++) { int j; j = i ^ (m_tilexor << 5); j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); j = BITSWAP24(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); buffer[j] = rom[i]; } memcpy(rom,buffer,0x100000); }
static DRIVER_INIT( chmpnum ) { chsuper_state *state = machine.driver_data<chsuper_state>(); UINT8 *buffer; UINT8 *rom = machine.region("gfx1")->base(); int i; state->m_tilexor = 0x1800; buffer = auto_alloc_array(machine, UINT8, 0x100000); for (i=0;i<0x100000;i++) { int j; j = i ^ (state->m_tilexor << 5); j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); j = BITSWAP24(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0); buffer[j] = rom[i]; } memcpy(rom,buffer,0x100000); }
DRIVER_INIT_MEMBER(darkmist_state,darkmist) { int i, len; uint8_t *ROM = memregion("maincpu")->base(); std::vector<uint8_t> buffer(0x10000); decrypt_gfx(); decrypt_snd(); for(i=0;i<0x8000;i++) { uint8_t p, d; p = d = ROM[i]; if(((i & 0x20) == 0x00) && ((i & 0x8) != 0)) p ^= 0x20; if(((i & 0x20) == 0x00) && ((i & 0xa) != 0)) d ^= 0x20; if(((i & 0x200) == 0x200) && ((i & 0x408) != 0)) p ^= 0x10; if((i & 0x220) != 0x200) { p = BITSWAP8(p, 7,6,5,2,3,4,1,0); d = BITSWAP8(d, 7,6,5,2,3,4,1,0); } ROM[i] = d; m_decrypted_opcodes[i] = p; } membank("bank1")->set_base(&ROM[0x010000]); /* adr line swaps */ ROM = memregion("bg_map")->base(); len = memregion("bg_map")->bytes(); memcpy( &buffer[0], ROM, len ); for(i=0;i<len;i++) { ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,7,6,5,4,3,15,14,13,12,9,8,2,1,11,10, 0)]; } ROM = memregion("fg_map")->base(); len = memregion("fg_map")->bytes(); memcpy( &buffer[0], ROM, len ); for(i=0;i<len;i++) { ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15 ,6,5,4,3,12,11,10,9,14,13,2,1,8,7 ,0 )]; } }
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)]; } }
// ROM_REGION( 0x80, "user1", 0 ) /* eeprom */ // ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) ) ROM_END /**********************************************************************************/ static void descramble_sound( running_machine &machine, const char *tag ) { UINT8 *rom = machine.root_device().memregion(tag)->base(); int length = machine.root_device().memregion(tag)->bytes(); UINT8 *buf1 = auto_alloc_array(machine, UINT8, length); UINT32 x; for (x = 0; x < length; x++) { UINT32 addr; addr = BITSWAP24 (x,23,22,21,0, 20, 19,18,17,16, 15,14,13,12, 11,10,9, 8, 7, 6, 5, 4, 3, 2, 1 ); buf1[addr] = rom[x]; } memcpy(rom,buf1,length); auto_free(machine, buf1); }
// the later PCM2 games have additional scrambling void pcm2_prot_device::swap(UINT8* ymrom, UINT32 ymsize, int value) { static const UINT32 addrs[7][2]={ {0x000000,0xa5000}, {0xffce20,0x01000}, {0xfe2cf6,0x4e001}, {0xffac28,0xc2000}, {0xfeb2c0,0x0a000}, {0xff14ea,0xa7001}, {0xffb440,0x02000}}; static const UINT8 xordata[7][8]={ {0xf9,0xe0,0x5d,0xf3,0xea,0x92,0xbe,0xef}, {0xc4,0x83,0xa8,0x5f,0x21,0x27,0x64,0xaf}, {0xc3,0xfd,0x81,0xac,0x6d,0xe7,0xbf,0x9e}, {0xc3,0xfd,0x81,0xac,0x6d,0xe7,0xbf,0x9e}, {0xcb,0x29,0x7d,0x43,0xd2,0x3a,0xc2,0xb4}, {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}, {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}}; dynamic_buffer buf(0x1000000); int j, d; UINT8* src = ymrom; memcpy(&buf[0], src, 0x1000000); for (int i = 0; i < 0x1000000; i++) { j = BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16); j ^= addrs[value][1]; d = ((i + addrs[value][0]) & 0xffffff); src[j] = buf[d] ^ xordata[value][j & 0x7]; } }
// ROM_REGION( 0x80, "user1", 0 ) /* eeprom */ // ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) ) ROM_END /**********************************************************************************/ void deco156_state::descramble_sound( const char *tag ) { UINT8 *rom = memregion(tag)->base(); int length = memregion(tag)->bytes(); dynamic_buffer buf1(length); UINT32 x; for (x = 0; x < length; x++) { UINT32 addr; addr = BITSWAP24 (x,23,22,21,0, 20, 19,18,17,16, 15,14,13,12, 11,10,9, 8, 7, 6, 5, 4, 3, 2, 1 ); buf1[addr] = rom[x]; } memcpy(rom,buf1,length); }
static void neo_pcm2_swap(int value) /* 0=kof2002, 1=matrim */ { static const unsigned int addrs[7][2]={ {0x000000,0xA5000}, {0xFFCE20,0x01000}, {0xFE2CF6,0x4E001}, {0xFFAC28,0xC2000}, {0xFEB2C0,0x0A000}, {0xFF14EA,0xA7001}, {0xFFB440,0x02000}}; static const UINT8 xordata[7][8]={ {0xF9,0xE0,0x5D,0xF3,0xEA,0x92,0xBE,0xEF}, {0xC4,0x83,0xA8,0x5F,0x21,0x27,0x64,0xAF}, {0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, {0xC3,0xFD,0x81,0xAC,0x6D,0xE7,0xBF,0x9E}, {0xCB,0x29,0x7D,0x43,0xD2,0x3A,0xC2,0xB4}, {0x4B,0xA4,0x63,0x46,0xF0,0x91,0xEA,0x62}, {0x4B,0xA4,0x63,0x46,0xF0,0x91,0xEA,0x62}}; UINT8 *src = (UINT8 *)memory_region(REGION_SOUND1); UINT8 *buf = (UINT8 *)malloc(0x1000000); int i, j, d; memcpy(buf,src,0x1000000); for (i=0;i<0x1000000;i++) { j=BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16); j=j^addrs[value][1]; d=((i+addrs[value][0])&0xffffff); src[j]=buf[d]^xordata[value][j&0x7]; } free(buf); }
ROM_END void darkmist_state::decrypt_fgbgtiles(uint8_t* rom, int size) { std::vector<uint8_t> buf(0x40000); /* data lines */ for (int 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 (int i = 0;i < size;i++) { rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13, 5,4,3,2, 12,11,10,9,8, 1,0, 7,6)]; } }
MACHINE_DRIVER_END /*************************************************************************** ROMs Loading ***************************************************************************/ /* Address lines scrambling */ static void decryptcode( int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12, int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 ) { int i; data8_t *RAM = memory_region( REGION_CPU1 ); size_t size = memory_region_length( REGION_CPU1 ); data8_t *buffer = osd_malloc( size ); if( buffer ) { memcpy( buffer, RAM, size ); for( i = 0; i < size; i++ ) { RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0 ) ]; } free( buffer ); } }
/* 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); }
/* 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); }
/* 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); }
static DRIVER_INIT(jujub) { /* Program ROMs are bitswapped */ { int i; UINT16 *prgrom = (UINT16*)machine.region("maincpu")->base(); for (i = 0; i < 0x60000/2; i++) { prgrom[i] = BITSWAP16(prgrom[i],15,12,13,14, 11,10, 9, 8, 7, 6, 5, 3, 4, 2, 1, 0); } } /* Decrypt data for z80 program */ { address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x20000); UINT8 *rom = machine.region("audiocpu")->base(); int i; memcpy(decrypt,rom,0x20000); space->set_decrypted_region(0x0000, 0x1fff, decrypt); for (i = 0;i < 0x2000;i++) { UINT8 src = decrypt[i]; rom[i] = src^0x55; } } { UINT8 *ROM = machine.region("oki")->base(); UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } auto_free(machine, buffer); } }
void pgm_decode_kovqhsgs_gfx_block(UINT8 *src) { INT32 i, j; UINT8 *dec = (UINT8*)BurnMalloc(0x800000); for (i = 0; i < 0x800000; i++) { j = BITSWAP24(i, 23, 10, 9, 22, 19, 18, 20, 21, 17, 16, 15, 14, 13, 12, 11, 8, 7, 6, 5, 4, 3, 2, 1, 0); dec[j] = src[i]; } memcpy (src, dec, 0x800000); BurnFree (dec); }
ROM_END DRIVER_INIT_MEMBER(toki_state,toki) { UINT8 *ROM = memregion("oki")->base(); dynamic_buffer buffer(0x20000); int i; memcpy(&buffer[0],ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } }
void pgm_decode_kovqhsgs_gfx_block(unsigned char *src) { int i, j; unsigned char *dec = (unsigned char*)malloc(0x800000); for (i = 0; i < 0x800000; i++) { j = BITSWAP24(i, 23, 10, 9, 22, 19, 18, 20, 21, 17, 16, 15, 14, 13, 12, 11, 8, 7, 6, 5, 4, 3, 2, 1, 0); dec[j] = src[i]; } memcpy (src, dec, 0x800000); free (dec); }
void pgm_decode_kovqhsgs_tile_data(unsigned char *source) { int i, j; unsigned short *src = (unsigned short*)source; unsigned short *dst = (unsigned short*)malloc(0x800000); for (i = 0; i < 0x800000 / 2; i++) { j = BITSWAP24(i, 23, 22, 9, 8, 21, 18, 0, 1, 2, 3, 16, 15, 14, 13, 12, 11, 10, 19, 20, 17, 7, 6, 5, 4); dst[j] = BITSWAP16(swapWord(src[i]), 1, 14, 8, 7, 0, 15, 6, 9, 13, 2, 5, 10, 12, 3, 4, 11); } memcpy (src, dst, 0x800000); free (dst); }
static void pgm_decode_kovlsqh2_program() { int i, j; unsigned short *src = (unsigned short*)PGM68KROM; unsigned short *dst = (unsigned short*)malloc(0x400000); for (i = 0; i < 0x400000 / 2; i++) { j = BITSWAP24(i, 23, 22, 21, 20, 19, 16, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 18, 17, 7); dst[j] = src[i]; } memcpy (src, dst, 0x400000); free (dst); }
static void pgm_decode_kovqhsgs_program() { int i, j; unsigned short *src = (unsigned short*)PGM68KROM; unsigned short *dst = (unsigned short*)malloc(0x400000); for (i = 0; i < 0x400000 / 2; i++) { j = BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 5, 4, 3, 2, 1, 0); dst[j] = BITSWAP16(swapWord(src[i]), 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0); } memcpy (src, dst, 0x400000); free (dst); }
static void pgm_decode_kovlsqh2_program() { INT32 i, j; UINT16 *src = (UINT16*)PGM68KROM; UINT16 *dst = (UINT16*)BurnMalloc(0x400000); for (i = 0; i < 0x400000 / 2; i++) { j = BITSWAP24(i, 23, 22, 21, 20, 19, 16, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 18, 17, 7); dst[j] = BURN_ENDIAN_SWAP_INT16(src[i]); } memcpy (src, dst, 0x400000); BurnFree (dst); }
void kof2k3bl_prot_device::pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) { std::vector<UINT16> tmp(0x100000/2); UINT16*rom16 = (UINT16*)cpurom; for (int i = 0; i < 0x700000/2; i += 0x100000/2) { memcpy(&tmp[0], &rom16[i], 0x100000); for (int j = 0; j < 0x100000/2; j++) rom16[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]; } /* patched by Altera protection chip on PCB */ rom16[0xf38ac/2] = 0x4e75; m_overlay = rom16[0x58196 / 2]; }
void pgm_decode_kovqhsgs_tile_data(UINT8 *source) { INT32 i, j; UINT16 *src = (UINT16*)source; UINT16 *dst = (UINT16*)BurnMalloc(0x800000); for (i = 0; i < 0x800000 / 2; i++) { j = BITSWAP24(i, 23, 22, 9, 8, 21, 18, 0, 1, 2, 3, 16, 15, 14, 13, 12, 11, 10, 19, 20, 17, 7, 6, 5, 4); dst[j] = BURN_ENDIAN_SWAP_INT16(BITSWAP16(BURN_ENDIAN_SWAP_INT16(src[i]), 1, 14, 8, 7, 0, 15, 6, 9, 13, 2, 5, 10, 12, 3, 4, 11)); } memcpy (src, dst, 0x800000); BurnFree (dst); }
/* 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; 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)]; }
void igs_m027_state::sdwx_gfx_decrypt() { int i; unsigned rom_size = 0x80000; UINT8 *src = (UINT8 *) (memregion("gfx1")->base()); dynamic_buffer result_data(rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)]; for (i=0; i<rom_size; i+=0x200) { memcpy(src+i+0x000,&result_data[i+0x000],0x80); memcpy(src+i+0x080,&result_data[i+0x100],0x80); memcpy(src+i+0x100,&result_data[i+0x080],0x80); memcpy(src+i+0x180,&result_data[i+0x180],0x80); } }
ROM_END DRIVER_INIT( coinmstr ) { UINT8 *rom = memory_region(REGION_USER1); int length = memory_region_length(REGION_USER1); UINT8 *buf = malloc_or_die(length); int i; memcpy(buf,rom,length); for(i = 0; i < length; i++) { int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4); rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7); } free(buf); }
static void sdwx_gfx_decrypt(running_machine &machine) { int i; unsigned rom_size = 0x80000; UINT8 *src = (UINT8 *) (machine.root_device().memregion("gfx1")->base()); UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size); for (i=0; i<rom_size; i++) result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)]; for (i=0; i<rom_size; i+=0x200) { memcpy(src+i+0x000,result_data+i+0x000,0x80); memcpy(src+i+0x080,result_data+i+0x100,0x80); memcpy(src+i+0x100,result_data+i+0x080,0x80); memcpy(src+i+0x180,result_data+i+0x180,0x80); } auto_free(machine, result_data); }
ROM_END static DRIVER_INIT( toki ) { UINT8 *ROM = machine.region("oki")->base(); UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000); int i; memcpy(buffer,ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } auto_free(machine, buffer); seibu_sound_decrypt(machine,"audiocpu",0x2000); }
ROM_END DRIVER_INIT_MEMBER(coinmstr_state,coinmstr) { UINT8 *rom = memregion("user1")->base(); int length = memregion("user1")->bytes(); UINT8 *buf = auto_alloc_array(machine(), UINT8, length); int i; memcpy(buf,rom,length); for(i = 0; i < length; i++) { int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4); rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7); } auto_free(machine(), buf); }
DRIVER_INIT_MEMBER(toki_state,jujuba) { /* Program ROMs are bitswapped */ { int i; UINT16 *prgrom = (UINT16*)memregion("maincpu")->base(); for (i = 0; i < 0x60000/2; i++) { prgrom[i] = BITSWAP16(prgrom[i],15,12,13,14, 11,10, 9, 8, 7, 6, 5, 3, 4, 2, 1, 0); } } /* Decrypt data for z80 program */ { UINT8 *decrypt = m_seibu_sound->get_custom_decrypt(); UINT8 *rom = memregion("audiocpu")->base(); memcpy(decrypt,rom,0x20000); for (int i = 0;i < 0x2000;i++) { UINT8 src = decrypt[i]; rom[i] = src^0x55; } } { UINT8 *ROM = memregion("oki")->base(); dynamic_buffer buffer(0x20000); int i; memcpy(&buffer[0],ROM,0x20000); for( i = 0; i < 0x20000; i++ ) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } } }