diff options
author | 2016-04-12 00:10:54 +0100 | |
---|---|---|
committer | 2016-04-12 00:10:54 +0100 | |
commit | 0cfa1925336ecc84f33640c0e65be5ddce8e50fb (patch) | |
tree | 33e9d2afacfcfd7aa561e436260848fadf2f75b2 | |
parent | b09ae03b65762ebdef7b1c274b857082f20665fd (diff) |
segacrp2 is now a device, kill off a whole bunch of duplicated decryption code across several drivers (nw)
-rw-r--r-- | scripts/target/mame/arcade.lua | 4 | ||||
-rw-r--r-- | src/mame/drivers/angelkds.cpp | 20 | ||||
-rw-r--r-- | src/mame/drivers/appoooh.cpp | 54 | ||||
-rw-r--r-- | src/mame/drivers/calorie.cpp | 18 | ||||
-rw-r--r-- | src/mame/drivers/segae.cpp | 67 | ||||
-rw-r--r-- | src/mame/drivers/segas16a.cpp | 66 | ||||
-rw-r--r-- | src/mame/drivers/system1.cpp | 389 | ||||
-rw-r--r-- | src/mame/includes/angelkds.h | 1 | ||||
-rw-r--r-- | src/mame/includes/appoooh.h | 1 | ||||
-rw-r--r-- | src/mame/includes/system1.h | 9 | ||||
-rw-r--r-- | src/mame/machine/segacrp2.cpp | 124 | ||||
-rw-r--r-- | src/mame/machine/segacrp2.h | 7 | ||||
-rw-r--r-- | src/mame/machine/segacrp2_device.cpp | 371 | ||||
-rw-r--r-- | src/mame/machine/segacrp2_device.h | 123 |
14 files changed, 685 insertions, 569 deletions
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 3fa206f4947..f4cfb929b41 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -805,8 +805,6 @@ files { MAME_DIR .. "src/mame/machine/pcshare.h", MAME_DIR .. "src/mame/machine/segacrpt.cpp", MAME_DIR .. "src/mame/machine/segacrpt.h", - MAME_DIR .. "src/mame/machine/segacrp2.cpp", - MAME_DIR .. "src/mame/machine/segacrp2.h", MAME_DIR .. "src/mame/machine/ticket.cpp", MAME_DIR .. "src/mame/machine/ticket.h", MAME_DIR .. "src/mame/video/avgdvg.cpp", @@ -3129,6 +3127,8 @@ files { MAME_DIR .. "src/mame/video/suprloco.cpp", MAME_DIR .. "src/mame/drivers/system1.cpp", MAME_DIR .. "src/mame/includes/system1.h", + MAME_DIR .. "src/mame/machine/segacrp2_device.cpp", + MAME_DIR .. "src/mame/machine/segacrp2_device.h", MAME_DIR .. "src/mame/video/system1.cpp", MAME_DIR .. "src/mame/drivers/system16.cpp", MAME_DIR .. "src/mame/includes/system16.h", diff --git a/src/mame/drivers/angelkds.cpp b/src/mame/drivers/angelkds.cpp index aa6d996010b..53175d2cadd 100644 --- a/src/mame/drivers/angelkds.cpp +++ b/src/mame/drivers/angelkds.cpp @@ -125,7 +125,7 @@ Dumped by Chackn #include "emu.h" #include "cpu/z80/z80.h" -#include "machine/segacrp2.h" +#include "machine/segacrp2_device.h" #include "sound/2203intf.h" #include "includes/angelkds.h" #include "machine/i8255.h" @@ -570,8 +570,13 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( spcpostn, angelkds ) /* encryption */ - MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_REPLACE("maincpu", SEGA_317_0005, XTAL_6MHz) + MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_IO_MAP(main_portmap) + MCFG_CPU_VBLANK_INT_DRIVER("screen", angelkds_state, irq0_line_hold) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") + MACHINE_CONFIG_END /*** Rom Loading @@ -678,16 +683,7 @@ DRIVER_INIT_MEMBER(angelkds_state,angelkds) membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000); } -DRIVER_INIT_MEMBER(angelkds_state,spcpostn) -{ - UINT8 *RAM = memregion("user1")->base(); - - // 317-0005 - sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 1); - - membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000); -} GAME( 1988, angelkds, 0, angelkds, angelkds, angelkds_state, angelkds, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , MACHINE_SUPPORTS_SAVE) /* Nasco not displayed but 'Exa Planning' is */ -GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) /* encrypted */ +GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, angelkds, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) /* encrypted */ diff --git a/src/mame/drivers/appoooh.cpp b/src/mame/drivers/appoooh.cpp index c860ccc7ccc..8ffff3e27fe 100644 --- a/src/mame/drivers/appoooh.cpp +++ b/src/mame/drivers/appoooh.cpp @@ -166,7 +166,7 @@ Language #include "emu.h" #include "cpu/z80/z80.h" #include "includes/appoooh.h" -#include "machine/segacrp2.h" +#include "machine/segacrp2_device.h" #include "sound/sn76496.h" @@ -481,6 +481,16 @@ static MACHINE_CONFIG_DERIVED( robowres, appoooh_common ) MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( robowrese, robowres ) + + MCFG_CPU_REPLACE("maincpu", SEGA_315_5179,18432000/6) /* ??? the main xtal is 18.432 MHz */ + MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_IO_MAP(main_portmap) + MCFG_CPU_VBLANK_INT_DRIVER("screen", appoooh_state, vblank_irq) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") +MACHINE_CONFIG_END + /************************************* * * ROM definition(s) @@ -585,46 +595,6 @@ ROM_END * *************************************/ -DRIVER_INIT_MEMBER(appoooh_state,robowres) -{ - static const UINT8 xor_table[128] = - { - 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04, - 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04, - 0x00,0x45,0x41,0x14,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, - 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04, - 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04, - 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41, - }; - - static const int swap_table[128] = - { - 8, 9,11,13,15, 0, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 3, 4, 6, - 8, - 7, 1, 2, 4, 6, 0, 1, 3, 5, - 7, 1, 2, 4, 6, 0, 1, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 3, 4, 6, 0, 2, 3, 5, - 7, 1, 3, 4, 6, 0, 2, 4, 5, - 7, - }; - - sega_decode_2(memregion("maincpu")->base(), m_decrypted_opcodes, xor_table, swap_table); -} DRIVER_INIT_MEMBER(appoooh_state,robowresb) { @@ -639,5 +609,5 @@ DRIVER_INIT_MEMBER(appoooh_state,robowresb) *************************************/ GAME( 1984, appoooh, 0, appoooh, appoooh, driver_device, 0, ROT0, "Sanritsu / Sega", "Appoooh", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, robowres, 0, robowres, robowres, appoooh_state, robowres, ROT0, "Sanritsu / Sega", "Robo Wres 2001", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, robowres, 0, robowrese,robowres, driver_device, 0, ROT0, "Sanritsu / Sega", "Robo Wres 2001", MACHINE_SUPPORTS_SAVE ) GAME( 1986, robowresb, robowres, robowres, robowres, appoooh_state, robowresb,ROT0, "bootleg", "Robo Wres 2001 (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/calorie.cpp b/src/mame/drivers/calorie.cpp index a4602d37189..1faa6b62bb8 100644 --- a/src/mame/drivers/calorie.cpp +++ b/src/mame/drivers/calorie.cpp @@ -81,7 +81,7 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" -#include "machine/segacrp2.h" +#include "machine/segacrp2_device.h" #include "sound/ay8910.h" @@ -110,7 +110,6 @@ public: DECLARE_WRITE8_MEMBER(calorie_flipscreen_w); DECLARE_READ8_MEMBER(calorie_soundlatch_r); DECLARE_WRITE8_MEMBER(bogus_w); - DECLARE_DRIVER_INIT(calorie); DECLARE_DRIVER_INIT(calorieb); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); @@ -488,6 +487,13 @@ static MACHINE_CONFIG_START( calorie, calorie_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.8) /* YM2149 really */ MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( caloriee, calorie ) + MCFG_CPU_REPLACE("maincpu", SEGA_317_0004,4000000) /* 4 MHz */ + MCFG_CPU_PROGRAM_MAP(calorie_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", calorie_state, irq0_line_hold) + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") +MACHINE_CONFIG_END /************************************* * @@ -560,11 +566,7 @@ ROM_END * *************************************/ -DRIVER_INIT_MEMBER(calorie_state,calorie) -{ - // 317-0004 - sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 0); -} + DRIVER_INIT_MEMBER(calorie_state,calorieb) { @@ -579,5 +581,5 @@ DRIVER_INIT_MEMBER(calorie_state,calorieb) *************************************/ /* Note: the bootleg is identical to the original once decrypted */ -GAME( 1986, calorie, 0, calorie, calorie, calorie_state, calorie, ROT0, "Sega", "Calorie Kun vs Moguranian", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, calorie, 0, caloriee,calorie, driver_device, 0, ROT0, "Sega", "Calorie Kun vs Moguranian", MACHINE_SUPPORTS_SAVE ) GAME( 1986, calorieb, calorie, calorie, calorie, calorie_state, calorieb, ROT0, "bootleg", "Calorie Kun vs Moguranian (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 77874a36fe5..9e26251263d 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -296,7 +296,7 @@ GND 8A 8B GND #include "cpu/z80/z80.h" #include "sound/sn76496.h" #include "machine/mc8123.h" -#include "machine/segacrp2.h" +#include "machine/segacrp2_device.h" #include "video/315_5124.h" #include "includes/segaipt.h" @@ -1018,6 +1018,14 @@ static MACHINE_CONFIG_DERIVED( systemex, systeme ) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( systemex_315_5177, systeme ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, XTAL_10_738635MHz/2) /* Z80B @ 5.3693Mhz */ + MCFG_CPU_PROGRAM_MAP(systeme_map) + MCFG_CPU_IO_MAP(io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( systemeb, systeme ) MCFG_DEVICE_MODIFY("maincpu") MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map) @@ -1030,61 +1038,6 @@ DRIVER_INIT_MEMBER(systeme_state, hangonjr) } -DRIVER_INIT_MEMBER(systeme_state, astrofl) -{ - // 315-5177 - static const UINT8 xor_table[128] = - { - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - }; - - static const int swap_table[128] = - { - 0,0,0,0, - 1,1,1,1,1, - 2,2,2,2,2, - 3,3,3,3, - 4,4,4,4,4, - 5,5,5,5,5, - 6,6,6,6,6, - 7,7,7,7,7, - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11,11, - 12,12,12,12,12, - 13,13, - - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11, - 12,12,12,12,12, - 13,13,13,13,13, - 14,14,14,14,14, - 15,15,15,15,15, - 16,16,16,16, - 17,17,17,17,17, - 18,18,18,18,18, - 19,19,19,19,19, - 20,20,20,20,20, - 21,21, - }; - - sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); -} DRIVER_INIT_MEMBER(systeme_state, ridleofp) @@ -1113,7 +1066,7 @@ DRIVER_INIT_MEMBER(systeme_state, fantzn2) // YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS GAME( 1985, hangonjr, 0, systeme, hangonjr, systeme_state, hangonjr, ROT0, "Sega", "Hang-On Jr.", MACHINE_SUPPORTS_SAVE ) GAME( 1986, transfrm, 0, systeme, transfrm, driver_device, 0, ROT0, "Sega", "Transformer", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, astrofl, transfrm, systemex, transfrm, systeme_state, astrofl, ROT0, "Sega", "Astro Flash (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, astrofl, transfrm, systemex_315_5177, transfrm, driver_device, 0, ROT0, "Sega", "Astro Flash (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, ridleofp, 0, systeme, ridleofp, systeme_state, ridleofp, ROT90, "Sega / Nasco", "Riddle of Pythagoras (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, opaopa, 0, systemeb, opaopa, systeme_state, opaopa, ROT0, "Sega", "Opa Opa (MC-8123, 317-0042)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, fantzn2, 0, systemex, fantzn2, systeme_state, fantzn2, ROT0, "Sega", "Fantasy Zone II - The Tears of Opa-Opa (MC-8123, 317-0057)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp index b87aee5f734..9240b10d3bf 100644 --- a/src/mame/drivers/segas16a.cpp +++ b/src/mame/drivers/segas16a.cpp @@ -148,7 +148,7 @@ Tetris - - - - EPR12169 EPR12170 - #include "emu.h" #include "includes/segas16a.h" -#include "machine/segacrp2.h" +#include "machine/segacrp2_device.h" #include "machine/fd1089.h" #include "machine/nvram.h" #include "sound/dac.h" @@ -1982,8 +1982,11 @@ static MACHINE_CONFIG_DERIVED( system16a_no7751, system16a ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system16a_no7751p, system16a_no7751 ) - MCFG_DEVICE_MODIFY("soundcpu") + MCFG_CPU_REPLACE("soundcpu", SEGA_315_5177, 4000000) + MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_CPU_IO_MAP(sound_no7751_portmap) MCFG_CPU_DECRYPTED_OPCODES_MAP(sound_decrypted_opcodes_map) + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":sound_decrypted_opcodes") MACHINE_CONFIG_END /* @@ -3674,63 +3677,6 @@ DRIVER_INIT_MEMBER(segas16a_state,quartet) m_i8751_vblank_hook = i8751_sim_delegate(FUNC(segas16a_state::quartet_i8751_sim), this); } -DRIVER_INIT_MEMBER(segas16a_state,fantzonep) -{ - DRIVER_INIT_CALL(generic); - - // 315-5177 - static const UINT8 xor_table[128] = - { - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - }; - - static const int swap_table[128] = - { - 0,0,0,0, - 1,1,1,1,1, - 2,2,2,2,2, - 3,3,3,3, - 4,4,4,4,4, - 5,5,5,5,5, - 6,6,6,6,6, - 7,7,7,7,7, - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11,11, - 12,12,12,12,12, - 13,13, - - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11, - 12,12,12,12,12, - 13,13,13,13,13, - 14,14,14,14,14, - 15,15,15,15,15, - 16,16,16,16, - 17,17,17,17,17, - 18,18,18,18,18, - 19,19,19,19,19, - 20,20,20,20,20, - 21,21, - }; - - sega_decode_2(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, xor_table, swap_table); -} DRIVER_INIT_MEMBER(segas16a_state,sdi) { @@ -3778,7 +3724,7 @@ GAME( 1986, alexkidd1, alexkidd, system16a_fd1089a, alexkidd, segas16a GAME( 1986, fantzone, 0, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (Rev A, unprotected)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, fantzone1, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (unprotected)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, fantzonep, fantzone, system16a_no7751p, fantzone, segas16a_state,fantzonep, ROT0, "Sega", "Fantasy Zone (317-5000)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, fantzonep, fantzone, system16a_no7751p, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (317-5000)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, fantzonepr, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // bad / missing gfx roms GAME( 1988, passsht16a, passsht, system16a_fd1094, passsht16a, segas16a_state,passsht16a, ROT270, "Sega", "Passing Shot (Japan, 4 Players, System 16A) (FD1094 317-0071)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/system1.cpp b/src/mame/drivers/system1.cpp index 17ad4b0ad75..00365817449 100644 --- a/src/mame/drivers/system1.cpp +++ b/src/mame/drivers/system1.cpp @@ -223,7 +223,6 @@ seem to have access to. #include "machine/z80pio.h" #include "machine/i8255.h" #include "machine/segacrpt.h" -#include "machine/segacrp2.h" #include "machine/mc8123.h" #include "sound/sn76496.h" #include "includes/system1.h" @@ -2191,6 +2190,7 @@ static MACHINE_CONFIG_DERIVED( sys1ppix, sys1ppi ) MACHINE_CONFIG_END + /* reduced visible area for scrolling games */ static MACHINE_CONFIG_DERIVED( sys1ppis, sys1ppi ) @@ -2223,6 +2223,42 @@ static MACHINE_CONFIG_DERIVED( sys1piox, sys1pio ) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MACHINE_CONFIG_END +#define ENCRYPTED_SYS1PPI_MAPS \ + MCFG_CPU_PROGRAM_MAP(system1_map) \ + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) \ + MCFG_CPU_IO_MAP(system1_ppi_io_map) \ + MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) \ + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") + +#define ENCRYPTED_SYS1PIO_MAPS \ + MCFG_CPU_PROGRAM_MAP(system1_map) \ + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) \ + MCFG_CPU_IO_MAP(system1_pio_io_map) \ + MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) \ + MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes") + + +static MACHINE_CONFIG_DERIVED( sys1ppix_315_5178, sys1ppi ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5178, MASTER_CLOCK) + ENCRYPTED_SYS1PPI_MAPS +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( sys1piox_315_5177, sys1pio ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, MASTER_CLOCK) + ENCRYPTED_SYS1PIO_MAPS +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys1piox_315_5162, sys1pio ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5162, MASTER_CLOCK) + ENCRYPTED_SYS1PIO_MAPS +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys1piox_317_0006, sys1pio ) + MCFG_CPU_REPLACE("maincpu", SEGA_317_0006, MASTER_CLOCK) + ENCRYPTED_SYS1PIO_MAPS +MACHINE_CONFIG_END + /* reduced visible area for scrolling games */ static MACHINE_CONFIG_DERIVED( sys1pios, sys1pio ) @@ -2286,6 +2322,27 @@ static MACHINE_CONFIG_DERIVED( sys2x, sys2 ) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys2_315_5177, sys2 ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, MASTER_CLOCK) + ENCRYPTED_SYS1PPI_MAPS +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys2_315_5176, sys2 ) + MCFG_CPU_REPLACE("maincpu", SEGA_315_5176, MASTER_CLOCK) + ENCRYPTED_SYS1PPI_MAPS +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys2_317_0006, sys2 ) + MCFG_CPU_REPLACE("maincpu", SEGA_317_0006, MASTER_CLOCK) + ENCRYPTED_SYS1PPI_MAPS +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys2_317_0007, sys2 ) + MCFG_CPU_REPLACE("maincpu", SEGA_317_0007, MASTER_CLOCK) + ENCRYPTED_SYS1PPI_MAPS +MACHINE_CONFIG_END + + static MACHINE_CONFIG_DERIVED( sys2xb, sys2 ) MCFG_DEVICE_MODIFY("maincpu") MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map) @@ -5442,162 +5499,10 @@ DRIVER_INIT_MEMBER(system1_state,myherok) DRIVER_INIT_CALL(sega315_5132); } -DRIVER_INIT_MEMBER(system1_state,sega315_5162) -{ - // 315-5162 - static const UINT8 xor_table[128] = - { - 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00, - }; - static const int swap_table[128] = - { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 12, - }; - DRIVER_INIT_CALL(bank00); - sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); -} -DRIVER_INIT_MEMBER(system1_state,sega315_5177) -{ - // 315-5177 - static const UINT8 xor_table[128] = - { - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - }; - static const int swap_table[128] = - { - 0,0,0,0, - 1,1,1,1,1, - 2,2,2,2,2, - 3,3,3,3, - 4,4,4,4,4, - 5,5,5,5,5, - 6,6,6,6,6, - 7,7,7,7,7, - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11,11, - 12,12,12,12,12, - 13,13, - - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11, - 12,12,12,12,12, - 13,13,13,13,13, - 14,14,14,14,14, - 15,15,15,15,15, - 16,16,16,16, - 17,17,17,17,17, - 18,18,18,18,18, - 19,19,19,19,19, - 20,20,20,20,20, - 21,21, - }; - - DRIVER_INIT_CALL(bank00); - sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); -} - -DRIVER_INIT_MEMBER(system1_state,sega315_5177_s2) -{ - DRIVER_INIT_CALL(sega315_5177); - DRIVER_INIT_CALL(bank0c); -} - -DRIVER_INIT_MEMBER(system1_state, sega315_5176) -{ - // todo -} - -DRIVER_INIT_MEMBER(system1_state,sega315_5176_s2) -{ - DRIVER_INIT_CALL(sega315_5176); - DRIVER_INIT_CALL(bank0c); -} - - - - -DRIVER_INIT_MEMBER(system1_state,sega315_5178) -{ - // 315-5178 - static const UINT8 xor_table[128] = - { - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, - 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, - 0x40,0x55,0x15,0x05,0x51,0x11, - 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, - 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, - 0x41,0x54,0x14,0x04,0x50,0x10, - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, - - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, - 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, - 0x40,0x55,0x15,0x05,0x51,0x11, - 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, - 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, - 0x41,0x54,0x14,0x04,0x50,0x10, - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, - }; - - static const int swap_table[128] = - { - 2, - 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, - 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4, - 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, - 4, 6, 0, 2, 4, 6, 0, 2, 4, 6, - 8, - 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, - 6, 0, 2, 4, 6, 0, 2, - - 10, - 11,13,15, 9,11,13,15, 9,11,13,15, - 8,10,12,14, 8,10,12,14, 8,10,12, - 13,15, 9,11,13,15, 9,11,13,15, 9,11, - 12,14, 8,10,12,14, 8,10,12,14, - 16, - 9,11,13,15, 9,11,13,15, 9,11,13, - 14, 8,10,12,14, 8,10, - }; - - DRIVER_INIT_CALL(bank00); - sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); -} DRIVER_INIT_MEMBER(system1_state,sega315_5135) { @@ -5661,19 +5566,9 @@ DRIVER_INIT_MEMBER(system1_state,sega315_3135) sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); } -DRIVER_INIT_MEMBER(system1_state,gardia) -{ - // 317-0006 - DRIVER_INIT_CALL(bank44); - sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 2); -} -DRIVER_INIT_MEMBER(system1_state,gardiab) -{ - // 317-0007 - DRIVER_INIT_CALL(bank44); - sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 3); -} + + DRIVER_INIT_MEMBER(system1_state,wbml) { @@ -5807,91 +5702,91 @@ DRIVER_INIT_MEMBER(system1_state,shtngmst) *************************************/ /* PPI-based System 1 */ -GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, upndown, 0, sys1ppix, upndown, system1_state, sega315_5098, ROT270, "Sega", "Up'n Down (315-5030)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, regulus, 0, sys1ppix, regulus, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033, Rev A.)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, reguluso, regulus, sys1ppix, reguluso, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, mrviking, 0, sys1ppisx, mrviking, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, mrvikingj, mrviking, sys1ppisx, mrvikingj, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041, Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, swat, 0, sys1ppix, swat, system1_state, sega315_5048, ROT270, "Coreland / Sega", "SWAT (315-5048)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, flickyo, flicky, sys1ppix, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, flickys1, flicky, sys1ppix, flickys1, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, wmatch, 0, sys1ppisx, wmatch, system1_state, sega315_5064, ROT270, "Sega", "Water Match (315-5064)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, bullfgt, 0, sys1ppix, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "Bullfight (315-5065)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, nprinces, seganinj, sys1ppix, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboy2, wboy, sys1ppix, wboy, system1_state, sega315_5178, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, upndown, 0, sys1ppix, upndown, system1_state, sega315_5098, ROT270, "Sega", "Up'n Down (315-5030)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, regulus, 0, sys1ppix, regulus, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033, Rev A.)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, reguluso, regulus, sys1ppix, reguluso, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, mrviking, 0, sys1ppisx, mrviking, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, mrvikingj, mrviking, sys1ppisx, mrvikingj, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041, Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, swat, 0, sys1ppix, swat, system1_state, sega315_5048, ROT270, "Coreland / Sega", "SWAT (315-5048)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, flickyo, flicky, sys1ppix, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, flickys1, flicky, sys1ppix, flickys1, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, wmatch, 0, sys1ppisx, wmatch, system1_state, sega315_5064, ROT270, "Sega", "Water Match (315-5064)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, bullfgt, 0, sys1ppix, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "Bullfight (315-5065)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, nprinces, seganinj, sys1ppix, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboy2, wboy, sys1ppix_315_5178, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", MACHINE_SUPPORTS_SAVE ) /* PIO-based System 1 */ -GAME( 1984, flicky, 0, sys1piox, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, thetogyu, bullfgt, sys1piox, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, spatter, 0, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Spatter (315-xxxx)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, spattera, spatter, sys1piosx, spatter, system1_state, sega315_5099, ROT0, "Sega", "Spatter (315-5099)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, ssanchan, spatter, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Sanrin San Chan (Japan, 315-xxxx)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, pitfall2, 0, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, pitfall2a, pitfall2, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, seganinj, 0, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Sega Ninja (315-5102)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, seganinja, seganinj, sys1piox, seganinj, system1_state, sega315_5133, ROT0, "Sega", "Sega Ninja (315-5113)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // needs decrypting -GAME( 1985, ninja, seganinj, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Ninja (315-5102)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, nprinceso, seganinj, sys1piox, seganinj, system1_state, sega315_5098, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, nprincesb, seganinj, sys1piox, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, imsorry, 0, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, imsorryj, imsorry, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, teddybb, 0, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, teddybbo, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, teddybbobl, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, sscandal, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, myherobl, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "bootleg", "My Hero (bootleg, 315-5132 encryption)", MACHINE_SUPPORTS_SAVE ) // cloned 315-5132 encryption? might be a direct copy of an undumped original set -GAME( 1985, myherok, myhero, sys1piox, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", MACHINE_SUPPORTS_SAVE ) // possible bootleg, has extra encryption -GAME( 1985, 4dwarrio, 0, sys1piox, 4dwarrio, system1_state, sega315_5162, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, raflesia, 0, sys1piox, raflesia, system1_state, sega315_5162, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboy, 0, sys1piox, wboy, system1_state, sega315_5177, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboyo, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5135)", MACHINE_SUPPORTS_SAVE ) // aka 317-0003 -GAME( 1986, wboy3, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboy4, wboy, sys1piox, wboy, system1_state, sega315_5162, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", MACHINE_SUPPORTS_SAVE ) // appears to be a very early / unfinished version. -GAME( 1986, wboy5, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboyub, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (US bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1987, blockgal, 0, sys1piox, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", MACHINE_SUPPORTS_SAVE) +GAME( 1984, flicky, 0, sys1piox, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, thetogyu, bullfgt, sys1piox, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, spatter, 0, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Spatter (315-xxxx)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, spattera, spatter, sys1piosx, spatter, system1_state, sega315_5099, ROT0, "Sega", "Spatter (315-5099)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, ssanchan, spatter, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Sanrin San Chan (Japan, 315-xxxx)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, pitfall2, 0, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, pitfall2a, pitfall2, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, seganinj, 0, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Sega Ninja (315-5102)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, seganinja, seganinj, sys1piox, seganinj, system1_state, sega315_5133, ROT0, "Sega", "Sega Ninja (315-5113)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // needs decrypting +GAME( 1985, ninja, seganinj, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Ninja (315-5102)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, nprinceso, seganinj, sys1piox, seganinj, system1_state, sega315_5098, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, nprincesb, seganinj, sys1piox, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, imsorry, 0, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, imsorryj, imsorry, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, teddybb, 0, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, teddybbo, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, teddybbobl, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, sscandal, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, myherobl, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "bootleg", "My Hero (bootleg, 315-5132 encryption)", MACHINE_SUPPORTS_SAVE ) // cloned 315-5132 encryption? might be a direct copy of an undumped original set +GAME( 1985, myherok, myhero, sys1piox, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", MACHINE_SUPPORTS_SAVE ) // possible bootleg, has extra encryption +GAME( 1985, 4dwarrio, 0, sys1piox_315_5162, 4dwarrio, system1_state, bank00, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, raflesia, 0, sys1piox_315_5162, raflesia, system1_state, bank00, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboy, 0, sys1piox_315_5177, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboyo, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5135)", MACHINE_SUPPORTS_SAVE ) // aka 317-0003 +GAME( 1986, wboy3, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboy4, wboy, sys1piox_315_5162, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", MACHINE_SUPPORTS_SAVE ) // appears to be a very early / unfinished version. +GAME( 1986, wboy5, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboyub, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (US bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +GAME( 1987, blockgal, 0, sys1piox, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", MACHINE_SUPPORTS_SAVE) /* PIO-based System 1 with ROM banking */ -GAME( 1985, hvymetal, 0, sys1piox, hvymetal, system1_state, sega315_3135, ROT0, "Sega", "Heavy Metal (315-5135)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, gardia, 0, sys1piox, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (317-0006)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE) -GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, hvymetal, 0, sys1piox, hvymetal, system1_state, sega315_3135, ROT0, "Sega", "Heavy Metal (315-5135)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, gardia, 0, sys1piox_317_0006, gardia, system1_state, bank44, ROT270, "Coreland / Sega", "Gardia (317-0006)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE) +GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", MACHINE_SUPPORTS_SAVE ) /* System 2 */ -GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, gardiab, gardia, sys2x, gardia, system1_state, gardiab, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, gardiaj, gardia, sys2x, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (Japan, 317-0006)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboysys2, wboy, sys2x, wboysys2, system1_state, sega315_5177_s2, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 1, 315-5177)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, wboysys2a, wboy, sys2x, wboysys2, system1_state, sega315_5176_s2, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 2, 315-5176)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbml, 0, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbmljo, wbml, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbmljb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbmlb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", MACHINE_SUPPORTS_SAVE) -GAME( 1987, wbmlbg, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbmlbge, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 2009, wbmlvc, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", MACHINE_SUPPORTS_SAVE ) -GAME( 2009, wbmlvcd, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of English, Virtual Console release)", MACHINE_SUPPORTS_SAVE ) // fully decrypted version -GAME( 1987, wbmld, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wbmljod, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, dakkochn, 0, sys2xb, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, blockgalb, blockgal, sys2x, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, ufosensi, 0, sys2rowxb, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, ufosensib, ufosensi, sys2rowxb, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, gardiab, gardia, sys2_317_0007, gardia, system1_state, bank44, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, gardiaj, gardia, sys2_317_0006, gardia, system1_state, bank44, ROT270, "Coreland / Sega", "Gardia (Japan, 317-0006)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboysys2, wboy, sys2_315_5177, wboysys2, system1_state, bank0c, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 1, 315-5177)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, wboysys2a, wboy, sys2_315_5176, wboysys2, system1_state, bank0c, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 2, 315-5176)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbml, 0, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbmljo, wbml, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbmljb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbmlb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", MACHINE_SUPPORTS_SAVE) +GAME( 1987, wbmlbg, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbmlbge, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 2009, wbmlvc, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", MACHINE_SUPPORTS_SAVE ) +GAME( 2009, wbmlvcd, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of English, Virtual Console release)", MACHINE_SUPPORTS_SAVE ) // fully decrypted version +GAME( 1987, wbmld, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wbmljod, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, dakkochn, 0, sys2xb, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, blockgalb, blockgal, sys2x, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, ufosensi, 0, sys2rowxb, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, ufosensib, ufosensi, sys2rowxb, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/angelkds.h b/src/mame/includes/angelkds.h index 1617fc2579a..22ebca1505e 100644 --- a/src/mame/includes/angelkds.h +++ b/src/mame/includes/angelkds.h @@ -55,7 +55,6 @@ public: DECLARE_WRITE8_MEMBER(angelkds_bgbotscroll_write); DECLARE_WRITE8_MEMBER(angelkds_layer_ctrl_write); DECLARE_DRIVER_INIT(angelkds); - DECLARE_DRIVER_INIT(spcpostn); TILE_GET_INFO_MEMBER(get_tx_tile_info); TILE_GET_INFO_MEMBER(get_bgtop_tile_info); TILE_GET_INFO_MEMBER(get_bgbot_tile_info); diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h index 34e49e02c8b..94cbae0b9fb 100644 --- a/src/mame/includes/appoooh.h +++ b/src/mame/includes/appoooh.h @@ -52,7 +52,6 @@ public: DECLARE_WRITE8_MEMBER(bg_videoram_w); DECLARE_WRITE8_MEMBER(bg_colorram_w); DECLARE_WRITE8_MEMBER(out_w); - DECLARE_DRIVER_INIT(robowres); DECLARE_DRIVER_INIT(robowresb); TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info); diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h index 0c97c03d5ed..f67f81d636d 100644 --- a/src/mame/includes/system1.h +++ b/src/mame/includes/system1.h @@ -2,6 +2,7 @@ // copyright-holders:Jarek Parchanski, Nicola Salmoria, Mirko Buffoni #include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/segacrp2_device.h" class system1_state : public driver_device { @@ -86,7 +87,6 @@ public: DECLARE_WRITE8_MEMBER(sound_control_w); DECLARE_DRIVER_INIT(nobb); - DECLARE_DRIVER_INIT(sega315_5178); DECLARE_DRIVER_INIT(sega315_5110); DECLARE_DRIVER_INIT(sega315_5093); DECLARE_DRIVER_INIT(dakkochn); @@ -113,18 +113,11 @@ public: DECLARE_DRIVER_INIT(bootsys2); DECLARE_DRIVER_INIT(bootsys2d); DECLARE_DRIVER_INIT(sega315_5065); - DECLARE_DRIVER_INIT(sega315_5177); - DECLARE_DRIVER_INIT(sega315_5177_s2); - DECLARE_DRIVER_INIT(sega315_5176); - DECLARE_DRIVER_INIT(sega315_5176_s2); DECLARE_DRIVER_INIT(sega315_3135); - DECLARE_DRIVER_INIT(gardiab); - DECLARE_DRIVER_INIT(sega315_5162); DECLARE_DRIVER_INIT(choplift); DECLARE_DRIVER_INIT(sega315_5102); DECLARE_DRIVER_INIT(sega315_5133); - DECLARE_DRIVER_INIT(gardia); DECLARE_DRIVER_INIT(sega315_spat); DECLARE_DRIVER_INIT(sega315_5099); TILE_GET_INFO_MEMBER(tile_get_info); diff --git a/src/mame/machine/segacrp2.cpp b/src/mame/machine/segacrp2.cpp deleted file mode 100644 index 8c326441755..00000000000 --- a/src/mame/machine/segacrp2.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/****************************************************************************** - - Sega encryption emulation by Nicola Salmoria - - - This encryption is an evolution of the one implemented in segacrpt.c. - It works on more data and address bits but apart from that it's essentially - the same. - - The encryption affects D0, D2, D4, and D6, and depends on M1, A0, A3, A6, A9, - A12, and A14. - - The encryption consists of a permutation of the four data bits, which can also - be inverted. Therefore there are 4! * 2^4 = 384 different possible encryptions. - - An interesting peculiarity is that four games in the list below use an almost - identical key, just offset by one or more bytes. This leads to believe that - keys were generated using a PRNG like in other Sega encryptions (MC8123 etc.) - and the CPU part# used to skip the first N bytes. - - - List of encrypted games currently known: - - CPU Part # Game Comments - 315-5162 4D Warriors & used I'm Sorry for k.p.a. - Rafflesia & - Wonder Boy (set 4) - 315-5177 Astro Flash & - Wonder Boy (set 1) - 315-5178 Wonder Boy (set 2) unencrypted version available - 315-5179 Robo-Wrestle 2001 - 317-5000 Fantasy Zone (Sound CPU) same key as 315-5177 - - The following games seem to use the same algorithm as the above ones, but - using a key which almost doesn't change - - 317-0004 Calorie Kun unencrypted bootleg available - 317-0005 Space Position - 317-0006 Gardia (set 1) - 317-0007 Gardia (set 2) - -******************************************************************************/ - -#include "emu.h" -#include "segacrp2.h" - - -void sega_decode_2(UINT8 *rom, UINT8 *decrypted, - const UINT8 xor_table[128],const int swap_table[128]) -{ - static const UINT8 swaptable[24][4] = - { - { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, - { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, - { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, - { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, - { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, - { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, - }; - - - for (int A = 0x0000;A < 0x8000;A++) - { - int row; - UINT8 src; - const UINT8 *tbl; - - - src = rom[A]; - - /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ - row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) - + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); - - /* decode the opcodes */ - tbl = swaptable[swap_table[2*row]]; - decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row]; - - /* decode the data */ - tbl = swaptable[swap_table[2*row+1]]; - rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1]; - } -} - - -/****************************************************************************** - - These games (all 317-000x CPUs) use the same algorithm, but the key doesn't - change much - just a shift in the table. - -******************************************************************************/ - -void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift) -{ - static const UINT8 xor_table[128+3] = - { - 0x04,0x54,0x44,0x14,0x15,0x15,0x51,0x41,0x41,0x14,0x10,0x50,0x15,0x55,0x54,0x05, - 0x04,0x41,0x51,0x01,0x05,0x10,0x55,0x51,0x05,0x05,0x54,0x11,0x45,0x05,0x04,0x14, - 0x10,0x55,0x01,0x41,0x51,0x05,0x55,0x04,0x45,0x41,0x55,0x14,0x45,0x10,0x04,0x45, - 0x55,0x50,0x40,0x00,0x11,0x45,0x15,0x00,0x01,0x00,0x40,0x00,0x01,0x45,0x11,0x00, - 0x45,0x00,0x44,0x54,0x40,0x04,0x05,0x15,0x15,0x10,0x15,0x04,0x01,0x05,0x50,0x11, - 0x00,0x44,0x44,0x04,0x04,0x01,0x50,0x05,0x51,0x00,0x45,0x44,0x50,0x15,0x54,0x40, - 0x41,0x45,0x40,0x10,0x14,0x15,0x40,0x51,0x50,0x50,0x45,0x00,0x10,0x15,0x05,0x51, - 0x50,0x44,0x01,0x15,0x40,0x04,0x01,0x44,0x50,0x44,0x50,0x50,0x50,0x10,0x44,0x04, - 0x40,0x04,0x10, - }; - - static const int swap_table[128+3] = - { - 7, 7,12, 1,18,11, 8,23,21,17, 0,23,22, 0,21,15, - 13,19,21,20,20,12,13,10,20, 0,14,18, 6,18, 3, 5, - 5,20,20,13, 8, 0,20,18, 4,14, 8, 5,17, 6,22,10, - 0,21, 0, 1, 6,11,17, 9,17, 3, 9,21, 0, 4,16, 1, - 13,17,21, 5, 3, 7, 2,16,18,13, 6,19,11,23, 3,20, - 3, 2,18,10,18,23,19,23, 3,15, 0,10, 5,12, 0, 0, - 11,22, 8,14, 8, 6, 1,15, 7,11, 2,17,10,15, 8,21, - 10, 0, 2, 6, 1, 1, 3, 1,12,18,16, 5, 0,15,17,15, - 10,20, 1, - }; - - sega_decode_2(rom, decrypted, xor_table + shift, swap_table + shift); -} diff --git a/src/mame/machine/segacrp2.h b/src/mame/machine/segacrp2.h deleted file mode 100644 index 3c30b8771ae..00000000000 --- a/src/mame/machine/segacrp2.h +++ /dev/null @@ -1,7 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria - -void sega_decode_2(UINT8 *rom, UINT8 *decrypted, - const UINT8 xor_table[128],const int swap_table[128]); - -void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift); diff --git a/src/mame/machine/segacrp2_device.cpp b/src/mame/machine/segacrp2_device.cpp new file mode 100644 index 00000000000..5682da2411f --- /dev/null +++ b/src/mame/machine/segacrp2_device.cpp @@ -0,0 +1,371 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, David Haywood +/****************************************************************************** + + Sega encryption emulation by Nicola Salmoria + + + This encryption is an evolution of the one implemented in segacrpt.c. + It works on more data and address bits but apart from that it's essentially + the same. + + The encryption affects D0, D2, D4, and D6, and depends on M1, A0, A3, A6, A9, + A12, and A14. + + The encryption consists of a permutation of the four data bits, which can also + be inverted. Therefore there are 4! * 2^4 = 384 different possible encryptions. + + An interesting peculiarity is that four games in the list below use an almost + identical key, just offset by one or more bytes. This leads to believe that + keys were generated using a PRNG like in other Sega encryptions (MC8123 etc.) + and the CPU part# used to skip the first N bytes. + + + List of encrypted games currently known: + + CPU Part # Game Comments + 315-5162 4D Warriors & used I'm Sorry for k.p.a. + Rafflesia & + Wonder Boy (set 4) + 315-5176 Wonder Boy (system 2 hardware, set 2) NOT DECRYPTED + 315-5177 Astro Flash & + Wonder Boy (set 1) + 315-5178 Wonder Boy (set 2) unencrypted version available + 315-5179 Robo-Wrestle 2001 + 317-5000 Fantasy Zone (Sound CPU) same key as 315-5177 + + The following games seem to use the same algorithm as the above ones, but + using a key which almost doesn't change + + 317-0004 Calorie Kun unencrypted bootleg available + 317-0005 Space Position + 317-0006 Gardia (set 1) + 317-0007 Gardia (set 2) + +******************************************************************************/ + +#include "emu.h" +#include "segacrp2_device.h" + +static void decode(UINT8 *rom, UINT8 *decrypted, + const UINT8 xor_table[128],const int swap_table[128]) +{ + static const UINT8 swaptable[24][4] = + { + { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, + { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 }, + { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 }, + { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 }, + { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 }, + { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 }, + }; + + + for (int A = 0x0000;A < 0x8000;A++) + { + int row; + UINT8 src; + const UINT8 *tbl; + + + src = rom[A]; + + /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */ + row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2) + + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5); + + /* decode the opcodes */ + tbl = swaptable[swap_table[2*row]]; + decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row]; + + /* decode the data */ + tbl = swaptable[swap_table[2*row+1]]; + rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1]; + } +} + + +const device_type SEGACRP2_Z80 = &device_creator<segacrp2_z80_device>; + +const device_type SEGA_315_5179 = &device_creator<sega_315_5179_device>; +const device_type SEGA_315_5178 = &device_creator<sega_315_5178_device>; +const device_type SEGA_315_5177 = &device_creator<sega_315_5177_device>; // also seen as 317-5000 +const device_type SEGA_315_5176 = &device_creator<sega_315_5176_device>; // TODO! +const device_type SEGA_315_5162 = &device_creator<sega_315_5162_device>; + +const device_type SEGA_317_0004 = &device_creator<sega_317_0004_device>; +const device_type SEGA_317_0005 = &device_creator<sega_317_0005_device>; +const device_type SEGA_317_0006 = &device_creator<sega_317_0006_device>; +const device_type SEGA_317_0007 = &device_creator<sega_317_0007_device>; + + + +segacrp2_z80_device::segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : z80_device(mconfig, SEGACRP2_Z80, "Z80", tag, owner, clock, "z80_sega2", __FILE__) {} +void segacrp2_z80_device::device_start() { z80_device::device_start(); decrypt(); } +void segacrp2_z80_device::device_reset() { z80_device::device_reset(); } +void segacrp2_z80_device::decrypt() { } + +void segacrp2_z80_device::set_decrypted_tag(device_t &device, const char* decrypted_tag) +{ + segacrp2_z80_device &dev = downcast<segacrp2_z80_device &>(device); + dev.m_decrypted_tag = decrypted_tag; +} + + +sega_315_5177_device::sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_315_5177_device::decrypt() +{ + // 315-5177 + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const int swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table); +} + + +sega_315_5176_device::sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_315_5176_device::decrypt() +{ + // 315-5176 + // TODO! +} + + +sega_315_5162_device::sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_315_5162_device::decrypt() +{ + // 315-5162 + static const UINT8 xor_table[128] = + { + 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00, + }; + + static const int swap_table[128] = + { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 12, + }; + + decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table); +} + + + + +sega_315_5178_device::sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_315_5178_device::decrypt() +{ // 315-5178 + static const UINT8 xor_table[128] = + { + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, + 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, + 0x40,0x55,0x15,0x05,0x51,0x11, + 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, + 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, + 0x41,0x54,0x14,0x04,0x50,0x10, + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, + + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, + 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, + 0x40,0x55,0x15,0x05,0x51,0x11, + 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, + 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, + 0x41,0x54,0x14,0x04,0x50,0x10, + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, + }; + + static const int swap_table[128] = + { + 2, + 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, + 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4, + 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, + 4, 6, 0, 2, 4, 6, 0, 2, 4, 6, + 8, + 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, + 6, 0, 2, 4, 6, 0, 2, + + 10, + 11,13,15, 9,11,13,15, 9,11,13,15, + 8,10,12,14, 8,10,12,14, 8,10,12, + 13,15, 9,11,13,15, 9,11,13,15, 9,11, + 12,14, 8,10,12,14, 8,10,12,14, + 16, + 9,11,13,15, 9,11,13,15, 9,11,13, + 14, 8,10,12,14, 8,10, + }; + + decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table); +} + + + +sega_315_5179_device::sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_315_5179_device::decrypt() +{ // 315-5179 + static const UINT8 xor_table[128] = + { + 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04, + 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04, + 0x00,0x45,0x41,0x14,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, + 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04, + 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04, + 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41, + }; + + static const int swap_table[128] = + { + 8, 9,11,13,15, 0, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 3, 4, 6, + 8, + 7, 1, 2, 4, 6, 0, 1, 3, 5, + 7, 1, 2, 4, 6, 0, 1, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 3, 4, 6, 0, 2, 3, 5, + 7, 1, 3, 4, 6, 0, 2, 4, 5, + 7, + }; + + decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table); +} + + +/****************************************************************************** + + These games (all 317-000x CPUs) use the same algorithm, but the key doesn't + change much - just a shift in the table. + +******************************************************************************/ + +void _sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift) +{ + static const UINT8 xor_table[128+3] = + { + 0x04,0x54,0x44,0x14,0x15,0x15,0x51,0x41,0x41,0x14,0x10,0x50,0x15,0x55,0x54,0x05, + 0x04,0x41,0x51,0x01,0x05,0x10,0x55,0x51,0x05,0x05,0x54,0x11,0x45,0x05,0x04,0x14, + 0x10,0x55,0x01,0x41,0x51,0x05,0x55,0x04,0x45,0x41,0x55,0x14,0x45,0x10,0x04,0x45, + 0x55,0x50,0x40,0x00,0x11,0x45,0x15,0x00,0x01,0x00,0x40,0x00,0x01,0x45,0x11,0x00, + 0x45,0x00,0x44,0x54,0x40,0x04,0x05,0x15,0x15,0x10,0x15,0x04,0x01,0x05,0x50,0x11, + 0x00,0x44,0x44,0x04,0x04,0x01,0x50,0x05,0x51,0x00,0x45,0x44,0x50,0x15,0x54,0x40, + 0x41,0x45,0x40,0x10,0x14,0x15,0x40,0x51,0x50,0x50,0x45,0x00,0x10,0x15,0x05,0x51, + 0x50,0x44,0x01,0x15,0x40,0x04,0x01,0x44,0x50,0x44,0x50,0x50,0x50,0x10,0x44,0x04, + 0x40,0x04,0x10, + }; + + static const int swap_table[128+3] = + { + 7, 7,12, 1,18,11, 8,23,21,17, 0,23,22, 0,21,15, + 13,19,21,20,20,12,13,10,20, 0,14,18, 6,18, 3, 5, + 5,20,20,13, 8, 0,20,18, 4,14, 8, 5,17, 6,22,10, + 0,21, 0, 1, 6,11,17, 9,17, 3, 9,21, 0, 4,16, 1, + 13,17,21, 5, 3, 7, 2,16,18,13, 6,19,11,23, 3,20, + 3, 2,18,10,18,23,19,23, 3,15, 0,10, 5,12, 0, 0, + 11,22, 8,14, 8, 6, 1,15, 7,11, 2,17,10,15, 8,21, + 10, 0, 2, 6, 1, 1, 3, 1,12,18,16, 5, 0,15,17,15, + 10,20, 1, + }; + + decode(rom, decrypted, xor_table + shift, swap_table + shift); +} + + +sega_317_0004_device::sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_317_0004_device::decrypt() +{ // 317-0004 + _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 0); +} + + + +sega_317_0005_device::sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_317_0005_device::decrypt() +{ // 317-0005 + _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 1); +} + + +sega_317_0006_device::sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_317_0006_device::decrypt() +{ // 317-0006 + _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 2); +} + +sega_317_0007_device::sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} +void sega_317_0007_device::decrypt() +{ // 317-0006 + _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 3); +}
\ No newline at end of file diff --git a/src/mame/machine/segacrp2_device.h b/src/mame/machine/segacrp2_device.h new file mode 100644 index 00000000000..f6e90820209 --- /dev/null +++ b/src/mame/machine/segacrp2_device.h @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#pragma once + +#ifndef __SEGACRP2_Z80__ +#define __SEGACRP2_Z80__ + + +#define MCFG_SEGAZ80_SET_DECRYPTED_TAG(_tag) \ + segacrp2_z80_device::set_decrypted_tag(*device, _tag); + +#include "emu.h" +#include "cpu/z80/z80.h" + +// base class +class segacrp2_z80_device : public z80_device +{ +public: + segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); + + static void set_decrypted_tag(device_t &device, const char* decrypted_tag); + const char* m_decrypted_tag; +protected: + virtual void device_start() override; + virtual void device_reset() override; + virtual void decrypt(); +}; + + + +// actual encrypted CPUs +class sega_315_5179_device : public segacrp2_z80_device +{ +public: + sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + + +class sega_315_5178_device : public segacrp2_z80_device +{ +public: + sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + +class sega_315_5177_device : public segacrp2_z80_device +{ +public: + sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + +class sega_315_5176_device : public segacrp2_z80_device +{ +public: + sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + +class sega_315_5162_device : public segacrp2_z80_device +{ +public: + sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + +class sega_317_0004_device : public segacrp2_z80_device +{ +public: + sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + + +class sega_317_0005_device : public segacrp2_z80_device +{ +public: + sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + + +class sega_317_0006_device : public segacrp2_z80_device +{ +public: + sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + +class sega_317_0007_device : public segacrp2_z80_device +{ +public: + sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); +protected: + virtual void decrypt() override; +}; + + +extern const device_type SEGACRP2_Z80; +extern const device_type SEGA_315_5179; +extern const device_type SEGA_315_5178; +extern const device_type SEGA_315_5177; +extern const device_type SEGA_315_5176; +extern const device_type SEGA_315_5162; + +extern const device_type SEGA_317_0004; +extern const device_type SEGA_317_0005; +extern const device_type SEGA_317_0006; +extern const device_type SEGA_317_0007; + + +#endif /// __SEGACRP2_Z80__ + |