diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 44455690819..60a1fe1bd52 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1843,12 +1843,19 @@ files { MAME_DIR .. "src/mame/includes/pgm.h", MAME_DIR .. "src/mame/video/pgm.cpp", MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type1.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type1.h", MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type2.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type2.h", MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type3.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs027a_type3.h", MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs012.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs012.h", MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs022.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs022.h", MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs028.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_igs025_igs028.h", MAME_DIR .. "src/mame/machine/pgmprot_orlegend.cpp", + MAME_DIR .. "src/mame/machine/pgmprot_orlegend.h", MAME_DIR .. "src/mame/drivers/pgm2.cpp", MAME_DIR .. "src/mame/drivers/spoker.cpp", MAME_DIR .. "src/mame/machine/igs036crypt.cpp", diff --git a/src/mame/drivers/pgm.cpp b/src/mame/drivers/pgm.cpp index 4dde7e27485..d26b8392863 100644 --- a/src/mame/drivers/pgm.cpp +++ b/src/mame/drivers/pgm.cpp @@ -191,7 +191,13 @@ Notes: #include "emu.h" #include "includes/pgm.h" - +#include "machine/pgmprot_igs025_igs012.h" +#include "machine/pgmprot_igs025_igs022.h" +#include "machine/pgmprot_igs025_igs028.h" +#include "machine/pgmprot_igs027a_type1.h" +#include "machine/pgmprot_igs027a_type2.h" +#include "machine/pgmprot_igs027a_type3.h" +#include "machine/pgmprot_orlegend.h" READ16_MEMBER(pgm_state::pgm_videoram_r) { diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h index 23f43937ff3..f4cb1634e85 100644 --- a/src/mame/includes/pgm.h +++ b/src/mame/includes/pgm.h @@ -111,342 +111,6 @@ public: }; -/* for machine/pgmprot_orlegend.c type games */ -class pgm_asic3_state : public pgm_state -{ -public: - pgm_asic3_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag) { - } - - // ASIC 3 (oriental legends protection) - UINT8 m_asic3_reg; - UINT8 m_asic3_latch[3]; - UINT8 m_asic3_x; - UINT16 m_asic3_hilo; - UINT16 m_asic3_hold; - - DECLARE_DRIVER_INIT(orlegend); - void asic3_compute_hold(int,int); - DECLARE_READ16_MEMBER( pgm_asic3_r ); - DECLARE_WRITE16_MEMBER( pgm_asic3_w ); -}; - - -/* for machine/pgmprot1.c type games */ -class pgm_arm_type1_state : public pgm_state -{ -public: - pgm_arm_type1_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_arm7_shareram(*this, "arm7_shareram"), - m_prot(*this, "prot") { - m_curslots = 0; - m_puzzli_54_trigger = 0; - } - - /////////////// simulations - UINT16 m_value0; - UINT16 m_value1; - UINT16 m_valuekey; - UINT16 m_ddp3lastcommand; - UINT32 m_valueresponse; - int m_curslots; - UINT32 m_slots[0x100]; - - // pstars / oldsplus / kov - UINT16 m_pstar_e7_value; - UINT16 m_pstar_b1_value; - UINT16 m_pstar_ce_value; - UINT16 m_kov_c0_value; - UINT16 m_kov_cb_value; - UINT16 m_kov_fe_value; - UINT16 m_extra_ram[0x100]; - // puzzli2 - INT32 m_puzzli_54_trigger; - - typedef void (pgm_arm_type1_state::*pgm_arm_sim_command_handler)(int pc); - - pgm_arm_sim_command_handler arm_sim_handler; - - /////////////// emulation - UINT16 m_pgm_arm_type1_highlatch_arm_w; - UINT16 m_pgm_arm_type1_lowlatch_arm_w; - UINT16 m_pgm_arm_type1_highlatch_68k_w; - UINT16 m_pgm_arm_type1_lowlatch_68k_w; - UINT32 m_pgm_arm_type1_counter; - optional_shared_ptr m_arm7_shareram; - - optional_device m_prot; - - DECLARE_DRIVER_INIT(photoy2k); - DECLARE_DRIVER_INIT(kovsh); - DECLARE_DRIVER_INIT(kovshp); - DECLARE_DRIVER_INIT(kovshxas); - DECLARE_DRIVER_INIT(kovlsqh2); - DECLARE_DRIVER_INIT(kovqhsgs); - DECLARE_DRIVER_INIT(ddp3); - DECLARE_DRIVER_INIT(ket); - DECLARE_DRIVER_INIT(espgal); - DECLARE_DRIVER_INIT(puzzli2); - DECLARE_DRIVER_INIT(py2k2); - DECLARE_DRIVER_INIT(pgm3in1); - DECLARE_DRIVER_INIT(pstar); - DECLARE_DRIVER_INIT(kov); - DECLARE_DRIVER_INIT(kovboot); - DECLARE_DRIVER_INIT(oldsplus); - DECLARE_MACHINE_START(pgm_arm_type1); - - DECLARE_READ32_MEMBER( pgm_arm7_type1_protlatch_r ); - DECLARE_WRITE32_MEMBER( pgm_arm7_type1_protlatch_w ); - DECLARE_READ16_MEMBER( pgm_arm7_type1_68k_protlatch_r ); - DECLARE_WRITE16_MEMBER( pgm_arm7_type1_68k_protlatch_w ); - DECLARE_READ16_MEMBER( pgm_arm7_type1_ram_r ); - DECLARE_WRITE16_MEMBER( pgm_arm7_type1_ram_w ); - DECLARE_READ32_MEMBER( pgm_arm7_type1_unk_r ); - DECLARE_READ32_MEMBER( pgm_arm7_type1_exrom_r ); - DECLARE_READ32_MEMBER( pgm_arm7_type1_shareram_r ); - DECLARE_WRITE32_MEMBER( pgm_arm7_type1_shareram_w ); - void pgm_arm7_type1_latch_init(); - DECLARE_READ16_MEMBER( kovsh_fake_region_r ); - DECLARE_WRITE16_MEMBER( kovshp_asic27a_write_word ); - void pgm_decode_kovlsqh2_tiles(); - void pgm_decode_kovlsqh2_sprites(UINT8 *src ); - void pgm_decode_kovlsqh2_samples(); - void pgm_decode_kovqhsgs_program(); - void pgm_decode_kovqhsgs2_program(); - DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_r ); - void command_handler_ddp3(int pc); - void command_handler_puzzli2(int pc); - void command_handler_py2k2(int pc); - void command_handler_pstars(int pc); - void command_handler_kov(int pc); - void command_handler_oldsplus(int pc); - DECLARE_WRITE16_MEMBER( pgm_arm7_type1_sim_w ); - DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_protram_r ); - DECLARE_READ16_MEMBER( pstars_arm7_type1_sim_protram_r ); - int m_simregion; - - /* puzzli2 protection internal state stuff */ - int stage; - int tableoffs; - int tableoffs2; - int entries_left; - int currentcolumn; - int currentrow; - int num_entries; - int full_entry; - int prev_tablloc; - int numbercolumns; - int depth; - UINT16 m_row_bitmask; - int hackcount; - int hackcount2; - int hack_47_value; - int hack_31_table_offset; - int hack_31_table_offset2; - int p2_31_retcounter; - - UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure - - int command_31_write_type; - - - // the maximum level size returned or read by the device appears to be this size - UINT16 level_structure[8][10]; - - - int puzzli2_take_leveldata_value(UINT8 datvalue); -}; - -/* for machine/pgmprot2.c type games */ -class pgm_arm_type2_state : public pgm_state -{ -public: - pgm_arm_type2_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_arm_ram(*this, "arm_ram"), - m_arm7_shareram(*this, "arm7_shareram"), - m_prot(*this, "prot") { - } - // kov2 - UINT32 m_kov2_latchdata_68k_w; - UINT32 m_kov2_latchdata_arm_w; - - required_shared_ptr m_arm_ram; - required_shared_ptr m_arm7_shareram; - - optional_device m_prot; - - DECLARE_DRIVER_INIT(kov2); - DECLARE_DRIVER_INIT(kov2p); - DECLARE_DRIVER_INIT(martmast); - DECLARE_DRIVER_INIT(ddp2); - DECLARE_DRIVER_INIT(dw2001); - DECLARE_DRIVER_INIT(dwpc); - DECLARE_MACHINE_START(pgm_arm_type2); - DECLARE_READ32_MEMBER( arm7_latch_arm_r ); - DECLARE_WRITE32_MEMBER( arm7_latch_arm_w ); - DECLARE_READ32_MEMBER( arm7_shareram_r ); - DECLARE_WRITE32_MEMBER( arm7_shareram_w ); - DECLARE_READ16_MEMBER( arm7_latch_68k_r ); - DECLARE_WRITE16_MEMBER( arm7_latch_68k_w ); - DECLARE_READ16_MEMBER( arm7_ram_r ); - DECLARE_WRITE16_MEMBER( arm7_ram_w ); - void kov2_latch_init(); - DECLARE_WRITE32_MEMBER( martmast_arm_region_w ); - DECLARE_WRITE32_MEMBER( kov2_arm_region_w ); - DECLARE_WRITE32_MEMBER( kov2p_arm_region_w ); - DECLARE_READ32_MEMBER( ddp2_speedup_r ); - DECLARE_READ16_MEMBER( ddp2_main_speedup_r ); -}; - - - -/* for machine/pgmprot3.c type games */ -class pgm_arm_type3_state : public pgm_state -{ -public: - pgm_arm_type3_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_arm_ram(*this, "arm_ram"), - m_arm_ram2(*this, "arm_ram2"), - m_prot(*this, "prot") { - } - // svg - int m_svg_ram_sel; - std::unique_ptr m_svg_shareram[2]; //for 5585G MACHINE - - UINT32 m_svg_latchdata_68k_w; - UINT32 m_svg_latchdata_arm_w; - required_shared_ptr m_arm_ram; - required_shared_ptr m_arm_ram2; - - UINT32* m_armrom; - - optional_device m_prot; - - DECLARE_DRIVER_INIT(theglad); - DECLARE_DRIVER_INIT(theglada); - DECLARE_DRIVER_INIT(svg); - DECLARE_DRIVER_INIT(svgpcb); - DECLARE_DRIVER_INIT(killbldp); - DECLARE_DRIVER_INIT(dmnfrnt); - DECLARE_DRIVER_INIT(happy6); - DECLARE_MACHINE_START(pgm_arm_type3); - DECLARE_WRITE32_MEMBER( svg_arm7_ram_sel_w ); - DECLARE_READ32_MEMBER( svg_arm7_shareram_r ); - DECLARE_WRITE32_MEMBER( svg_arm7_shareram_w ); - DECLARE_READ16_MEMBER( svg_m68k_ram_r ); - DECLARE_WRITE16_MEMBER( svg_m68k_ram_w ); - DECLARE_READ16_MEMBER( svg_68k_nmi_r ); - DECLARE_WRITE16_MEMBER( svg_68k_nmi_w ); - DECLARE_WRITE16_MEMBER( svg_latch_68k_w ); - DECLARE_READ16_MEMBER( svg_latch_68k_r ); - DECLARE_READ32_MEMBER( svg_latch_arm_r ); - DECLARE_WRITE32_MEMBER( svg_latch_arm_w ); - void svg_basic_init(); - void pgm_create_dummy_internal_arm_region(int size); - void pgm_patch_external_arm_rom_jumptable_theglada(int base); - void pgm_create_dummy_internal_arm_region_theglad(int is_svg); - void pgm_descramble_happy6(UINT8* src); - void pgm_descramble_happy6_2(UINT8* src); - void svg_latch_init(); - DECLARE_READ32_MEMBER( dmnfrnt_speedup_r ); - DECLARE_READ16_MEMBER( dmnfrnt_main_speedup_r ); - DECLARE_READ32_MEMBER( killbldp_speedup_r ); - DECLARE_READ32_MEMBER( theglad_speedup_r ); - DECLARE_READ32_MEMBER( happy6_speedup_r ); - DECLARE_READ32_MEMBER( svg_speedup_r ); - DECLARE_READ32_MEMBER( svgpcb_speedup_r ); - DECLARE_MACHINE_RESET(pgm_arm_type3_reset); -}; - - -/* for machine/pgmprot4.c type games */ -class pgm_022_025_state : public pgm_state -{ -public: - pgm_022_025_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_sharedprotram(*this, "sharedprotram"), - m_igs025(*this,"igs025"), - m_igs022(*this,"igs022") - - { } - - void pgm_dw3_decrypt(); - void pgm_killbld_decrypt(); - - required_shared_ptr m_sharedprotram; - - DECLARE_DRIVER_INIT(killbld); - DECLARE_DRIVER_INIT(drgw3); - DECLARE_MACHINE_RESET(killbld); - DECLARE_MACHINE_RESET(dw3); - - void igs025_to_igs022_callback( void ); - - required_device m_igs025; - required_device m_igs022; -}; - -/* for machine/pgmprot5.c type games */ -class pgm_012_025_state : public pgm_state -{ -public: - pgm_012_025_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_igs025(*this,"igs025") - { - } - - - required_device m_igs025; - - void pgm_drgw2_decrypt(); - void drgw2_common_init(); - - DECLARE_DRIVER_INIT(drgw2); - DECLARE_DRIVER_INIT(dw2v100x); - DECLARE_DRIVER_INIT(drgw2c); - DECLARE_DRIVER_INIT(drgw2j); - DECLARE_DRIVER_INIT(drgw2hk); - - DECLARE_MACHINE_RESET(drgw2); - - -}; - -/* for machine/pgmprot6.c type games */ -class pgm_028_025_state : public pgm_state -{ -public: - pgm_028_025_state(const machine_config &mconfig, device_type type, const char *tag) - : pgm_state(mconfig, type, tag), - m_sharedprotram(*this, "sharedprotram"), - m_igs025(*this,"igs025"), - m_igs028(*this,"igs028") - - { - } - - - - required_shared_ptr m_sharedprotram; - required_device m_igs025; - required_device m_igs028; - - void igs025_to_igs028_callback( void ); - - DECLARE_DRIVER_INIT(olds); - DECLARE_MACHINE_RESET(olds); - - -}; - - - /*----------- defined in drivers/pgm.c -----------*/ @@ -464,72 +128,3 @@ void pgm_sound_irq( device_t *device, int level ); ADDRESS_MAP_EXTERN( pgm_mem, 16 ); ADDRESS_MAP_EXTERN( pgm_basic_mem, 16 ); ADDRESS_MAP_EXTERN( pgm_base_mem, 16 ); - - - - -/*----------- defined in machine/pgmprot.c -----------*/ - - -INPUT_PORTS_EXTERN( orlegend ); -INPUT_PORTS_EXTERN( orlegendt ); -INPUT_PORTS_EXTERN( orlegendk ); - - -MACHINE_CONFIG_EXTERN( pgm_asic3 ); - -/*----------- defined in machine/pgmprot1.c -----------*/ - -/* emulations */ - -/* simulations */ - -MACHINE_CONFIG_EXTERN( pgm_arm_type1 ); -MACHINE_CONFIG_EXTERN( pgm_arm_type1_sim ); -MACHINE_CONFIG_EXTERN( pgm_arm_type1_cave ); - -INPUT_PORTS_EXTERN( sango ); -INPUT_PORTS_EXTERN( sango_ch ); -INPUT_PORTS_EXTERN( photoy2k ); -INPUT_PORTS_EXTERN( oldsplus ); -INPUT_PORTS_EXTERN( pstar ); -INPUT_PORTS_EXTERN( py2k2 ); -INPUT_PORTS_EXTERN( puzzli2 ); -INPUT_PORTS_EXTERN( kovsh ); - -/*----------- defined in machine/pgmprot2.c -----------*/ - -/* emulations */ -MACHINE_CONFIG_EXTERN( pgm_arm_type2 ); - -/* simulations (or missing) */ -INPUT_PORTS_EXTERN( ddp2 ); -INPUT_PORTS_EXTERN( kov2 ); -INPUT_PORTS_EXTERN( martmast ); -INPUT_PORTS_EXTERN( dw2001 ); - -/*----------- defined in machine/pgmprot3.c -----------*/ - -MACHINE_CONFIG_EXTERN( pgm_arm_type3 ); -INPUT_PORTS_EXTERN(theglad); -INPUT_PORTS_EXTERN(happy6); -INPUT_PORTS_EXTERN(svg); -INPUT_PORTS_EXTERN(svgtw); - -/*----------- defined in machine/pgmprot4.c -----------*/ - -MACHINE_CONFIG_EXTERN(pgm_022_025_dw3); -MACHINE_CONFIG_EXTERN(pgm_022_025_killbld); - -INPUT_PORTS_EXTERN( killbld ); -INPUT_PORTS_EXTERN( dw3 ); -INPUT_PORTS_EXTERN( dw3j ); - -/*----------- defined in machine/pgmprot5.c -----------*/ - -MACHINE_CONFIG_EXTERN( pgm_012_025_drgw2 ); - -/*----------- defined in machine/pgmprot6.c -----------*/ - -MACHINE_CONFIG_EXTERN( pgm_028_025_ol ); -INPUT_PORTS_EXTERN( olds ); diff --git a/src/mame/machine/pgmprot_igs025_igs012.cpp b/src/mame/machine/pgmprot_igs025_igs012.cpp index aa5de549047..99da2483f62 100644 --- a/src/mame/machine/pgmprot_igs025_igs012.cpp +++ b/src/mame/machine/pgmprot_igs025_igs012.cpp @@ -19,6 +19,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_igs025_igs012.h" /* Dragon World 2 */ diff --git a/src/mame/machine/pgmprot_igs025_igs012.h b/src/mame/machine/pgmprot_igs025_igs012.h new file mode 100644 index 00000000000..1a100809356 --- /dev/null +++ b/src/mame/machine/pgmprot_igs025_igs012.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, ElSemi + +class pgm_012_025_state : public pgm_state +{ +public: + pgm_012_025_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_igs025(*this,"igs025") + { + } + + + required_device m_igs025; + + void pgm_drgw2_decrypt(); + void drgw2_common_init(); + + DECLARE_DRIVER_INIT(drgw2); + DECLARE_DRIVER_INIT(dw2v100x); + DECLARE_DRIVER_INIT(drgw2c); + DECLARE_DRIVER_INIT(drgw2j); + DECLARE_DRIVER_INIT(drgw2hk); + + DECLARE_MACHINE_RESET(drgw2); +}; + +MACHINE_CONFIG_EXTERN( pgm_012_025_drgw2 ); diff --git a/src/mame/machine/pgmprot_igs025_igs022.cpp b/src/mame/machine/pgmprot_igs025_igs022.cpp index e55d8aad943..7c31b2358c3 100644 --- a/src/mame/machine/pgmprot_igs025_igs022.cpp +++ b/src/mame/machine/pgmprot_igs025_igs022.cpp @@ -20,6 +20,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_igs025_igs022.h" /* The IGS022 is an MCU which performs encrypted DMA used by - The Killing Blade diff --git a/src/mame/machine/pgmprot_igs025_igs022.h b/src/mame/machine/pgmprot_igs025_igs022.h new file mode 100644 index 00000000000..b434454dd91 --- /dev/null +++ b/src/mame/machine/pgmprot_igs025_igs022.h @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, ElSemi + +class pgm_022_025_state : public pgm_state +{ +public: + pgm_022_025_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_sharedprotram(*this, "sharedprotram"), + m_igs025(*this,"igs025"), + m_igs022(*this,"igs022") + + { } + + void pgm_dw3_decrypt(); + void pgm_killbld_decrypt(); + + required_shared_ptr m_sharedprotram; + + DECLARE_DRIVER_INIT(killbld); + DECLARE_DRIVER_INIT(drgw3); + DECLARE_MACHINE_RESET(killbld); + DECLARE_MACHINE_RESET(dw3); + + void igs025_to_igs022_callback( void ); + + required_device m_igs025; + required_device m_igs022; +}; + +MACHINE_CONFIG_EXTERN(pgm_022_025_dw3); +MACHINE_CONFIG_EXTERN(pgm_022_025_killbld); + +INPUT_PORTS_EXTERN( killbld ); +INPUT_PORTS_EXTERN( dw3 ); +INPUT_PORTS_EXTERN( dw3j ); diff --git a/src/mame/machine/pgmprot_igs025_igs028.cpp b/src/mame/machine/pgmprot_igs025_igs028.cpp index e1242a7326d..ea8c77acb39 100644 --- a/src/mame/machine/pgmprot_igs025_igs028.cpp +++ b/src/mame/machine/pgmprot_igs025_igs028.cpp @@ -22,6 +22,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_igs025_igs028.h" // tables are xored by table at $1998dc // tables are the same as drgw3 and drgw2 diff --git a/src/mame/machine/pgmprot_igs025_igs028.h b/src/mame/machine/pgmprot_igs025_igs028.h new file mode 100644 index 00000000000..1d6ef718c22 --- /dev/null +++ b/src/mame/machine/pgmprot_igs025_igs028.h @@ -0,0 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, ElSemi + +class pgm_028_025_state : public pgm_state +{ +public: + pgm_028_025_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_sharedprotram(*this, "sharedprotram"), + m_igs025(*this,"igs025"), + m_igs028(*this,"igs028") + + { + } + + required_shared_ptr m_sharedprotram; + required_device m_igs025; + required_device m_igs028; + + void igs025_to_igs028_callback( void ); + + DECLARE_DRIVER_INIT(olds); + DECLARE_MACHINE_RESET(olds); +}; + +MACHINE_CONFIG_EXTERN( pgm_028_025_ol ); +INPUT_PORTS_EXTERN( olds ); diff --git a/src/mame/machine/pgmprot_igs027a_type1.cpp b/src/mame/machine/pgmprot_igs027a_type1.cpp index 84b7bfc5de6..4d5b1f93638 100644 --- a/src/mame/machine/pgmprot_igs027a_type1.cpp +++ b/src/mame/machine/pgmprot_igs027a_type1.cpp @@ -59,6 +59,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_igs027a_type1.h" /**************************** EMULATION *******************************/ /* used by photoy2k, kovsh */ diff --git a/src/mame/machine/pgmprot_igs027a_type1.h b/src/mame/machine/pgmprot_igs027a_type1.h new file mode 100644 index 00000000000..988926c1d65 --- /dev/null +++ b/src/mame/machine/pgmprot_igs027a_type1.h @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, ElSemi, Xing Xing + +class pgm_arm_type1_state : public pgm_state +{ +public: + pgm_arm_type1_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_arm7_shareram(*this, "arm7_shareram"), + m_prot(*this, "prot") { + m_curslots = 0; + m_puzzli_54_trigger = 0; + } + + /////////////// simulations + UINT16 m_value0; + UINT16 m_value1; + UINT16 m_valuekey; + UINT16 m_ddp3lastcommand; + UINT32 m_valueresponse; + int m_curslots; + UINT32 m_slots[0x100]; + + // pstars / oldsplus / kov + UINT16 m_pstar_e7_value; + UINT16 m_pstar_b1_value; + UINT16 m_pstar_ce_value; + UINT16 m_kov_c0_value; + UINT16 m_kov_cb_value; + UINT16 m_kov_fe_value; + UINT16 m_extra_ram[0x100]; + // puzzli2 + INT32 m_puzzli_54_trigger; + + typedef void (pgm_arm_type1_state::*pgm_arm_sim_command_handler)(int pc); + + pgm_arm_sim_command_handler arm_sim_handler; + + /////////////// emulation + UINT16 m_pgm_arm_type1_highlatch_arm_w; + UINT16 m_pgm_arm_type1_lowlatch_arm_w; + UINT16 m_pgm_arm_type1_highlatch_68k_w; + UINT16 m_pgm_arm_type1_lowlatch_68k_w; + UINT32 m_pgm_arm_type1_counter; + optional_shared_ptr m_arm7_shareram; + + optional_device m_prot; + + DECLARE_DRIVER_INIT(photoy2k); + DECLARE_DRIVER_INIT(kovsh); + DECLARE_DRIVER_INIT(kovshp); + DECLARE_DRIVER_INIT(kovshxas); + DECLARE_DRIVER_INIT(kovlsqh2); + DECLARE_DRIVER_INIT(kovqhsgs); + DECLARE_DRIVER_INIT(ddp3); + DECLARE_DRIVER_INIT(ket); + DECLARE_DRIVER_INIT(espgal); + DECLARE_DRIVER_INIT(puzzli2); + DECLARE_DRIVER_INIT(py2k2); + DECLARE_DRIVER_INIT(pgm3in1); + DECLARE_DRIVER_INIT(pstar); + DECLARE_DRIVER_INIT(kov); + DECLARE_DRIVER_INIT(kovboot); + DECLARE_DRIVER_INIT(oldsplus); + DECLARE_MACHINE_START(pgm_arm_type1); + + DECLARE_READ32_MEMBER( pgm_arm7_type1_protlatch_r ); + DECLARE_WRITE32_MEMBER( pgm_arm7_type1_protlatch_w ); + DECLARE_READ16_MEMBER( pgm_arm7_type1_68k_protlatch_r ); + DECLARE_WRITE16_MEMBER( pgm_arm7_type1_68k_protlatch_w ); + DECLARE_READ16_MEMBER( pgm_arm7_type1_ram_r ); + DECLARE_WRITE16_MEMBER( pgm_arm7_type1_ram_w ); + DECLARE_READ32_MEMBER( pgm_arm7_type1_unk_r ); + DECLARE_READ32_MEMBER( pgm_arm7_type1_exrom_r ); + DECLARE_READ32_MEMBER( pgm_arm7_type1_shareram_r ); + DECLARE_WRITE32_MEMBER( pgm_arm7_type1_shareram_w ); + void pgm_arm7_type1_latch_init(); + DECLARE_READ16_MEMBER( kovsh_fake_region_r ); + DECLARE_WRITE16_MEMBER( kovshp_asic27a_write_word ); + void pgm_decode_kovlsqh2_tiles(); + void pgm_decode_kovlsqh2_sprites(UINT8 *src ); + void pgm_decode_kovlsqh2_samples(); + void pgm_decode_kovqhsgs_program(); + void pgm_decode_kovqhsgs2_program(); + DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_r ); + void command_handler_ddp3(int pc); + void command_handler_puzzli2(int pc); + void command_handler_py2k2(int pc); + void command_handler_pstars(int pc); + void command_handler_kov(int pc); + void command_handler_oldsplus(int pc); + DECLARE_WRITE16_MEMBER( pgm_arm7_type1_sim_w ); + DECLARE_READ16_MEMBER( pgm_arm7_type1_sim_protram_r ); + DECLARE_READ16_MEMBER( pstars_arm7_type1_sim_protram_r ); + int m_simregion; + + /* puzzli2 protection internal state stuff */ + int stage; + int tableoffs; + int tableoffs2; + int entries_left; + int currentcolumn; + int currentrow; + int num_entries; + int full_entry; + int prev_tablloc; + int numbercolumns; + int depth; + UINT16 m_row_bitmask; + int hackcount; + int hackcount2; + int hack_47_value; + int hack_31_table_offset; + int hack_31_table_offset2; + int p2_31_retcounter; + + UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure + + int command_31_write_type; + + + // the maximum level size returned or read by the device appears to be this size + UINT16 level_structure[8][10]; + + + int puzzli2_take_leveldata_value(UINT8 datvalue); +}; + +MACHINE_CONFIG_EXTERN( pgm_arm_type1 ); +MACHINE_CONFIG_EXTERN( pgm_arm_type1_sim ); +MACHINE_CONFIG_EXTERN( pgm_arm_type1_cave ); + +INPUT_PORTS_EXTERN( sango ); +INPUT_PORTS_EXTERN( sango_ch ); +INPUT_PORTS_EXTERN( photoy2k ); +INPUT_PORTS_EXTERN( oldsplus ); +INPUT_PORTS_EXTERN( pstar ); +INPUT_PORTS_EXTERN( py2k2 ); +INPUT_PORTS_EXTERN( puzzli2 ); +INPUT_PORTS_EXTERN( kovsh ); diff --git a/src/mame/machine/pgmprot_igs027a_type2.cpp b/src/mame/machine/pgmprot_igs027a_type2.cpp index 83eb15bd96b..cad9702edc8 100644 --- a/src/mame/machine/pgmprot_igs027a_type2.cpp +++ b/src/mame/machine/pgmprot_igs027a_type2.cpp @@ -34,7 +34,7 @@ #include "emu.h" #include "includes/pgm.h" - +#include "machine/pgmprot_igs027a_type2.h" READ32_MEMBER(pgm_arm_type2_state::arm7_latch_arm_r ) { diff --git a/src/mame/machine/pgmprot_igs027a_type2.h b/src/mame/machine/pgmprot_igs027a_type2.h new file mode 100644 index 00000000000..994ffb63443 --- /dev/null +++ b/src/mame/machine/pgmprot_igs027a_type2.h @@ -0,0 +1,52 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, ElSemi, Xing Xing + +class pgm_arm_type2_state : public pgm_state +{ +public: + pgm_arm_type2_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_arm_ram(*this, "arm_ram"), + m_arm7_shareram(*this, "arm7_shareram"), + m_prot(*this, "prot") { + } + // kov2 + UINT32 m_kov2_latchdata_68k_w; + UINT32 m_kov2_latchdata_arm_w; + + required_shared_ptr m_arm_ram; + required_shared_ptr m_arm7_shareram; + + optional_device m_prot; + + DECLARE_DRIVER_INIT(kov2); + DECLARE_DRIVER_INIT(kov2p); + DECLARE_DRIVER_INIT(martmast); + DECLARE_DRIVER_INIT(ddp2); + DECLARE_DRIVER_INIT(dw2001); + DECLARE_DRIVER_INIT(dwpc); + DECLARE_MACHINE_START(pgm_arm_type2); + DECLARE_READ32_MEMBER( arm7_latch_arm_r ); + DECLARE_WRITE32_MEMBER( arm7_latch_arm_w ); + DECLARE_READ32_MEMBER( arm7_shareram_r ); + DECLARE_WRITE32_MEMBER( arm7_shareram_w ); + DECLARE_READ16_MEMBER( arm7_latch_68k_r ); + DECLARE_WRITE16_MEMBER( arm7_latch_68k_w ); + DECLARE_READ16_MEMBER( arm7_ram_r ); + DECLARE_WRITE16_MEMBER( arm7_ram_w ); + void kov2_latch_init(); + DECLARE_WRITE32_MEMBER( martmast_arm_region_w ); + DECLARE_WRITE32_MEMBER( kov2_arm_region_w ); + DECLARE_WRITE32_MEMBER( kov2p_arm_region_w ); + DECLARE_READ32_MEMBER( ddp2_speedup_r ); + DECLARE_READ16_MEMBER( ddp2_main_speedup_r ); +}; + +/* emulations */ +MACHINE_CONFIG_EXTERN( pgm_arm_type2 ); + +/* simulations (or missing) */ +INPUT_PORTS_EXTERN( ddp2 ); +INPUT_PORTS_EXTERN( kov2 ); +INPUT_PORTS_EXTERN( martmast ); +INPUT_PORTS_EXTERN( dw2001 ); diff --git a/src/mame/machine/pgmprot_igs027a_type3.cpp b/src/mame/machine/pgmprot_igs027a_type3.cpp index 429e7b2d170..5ed8e9f41e7 100644 --- a/src/mame/machine/pgmprot_igs027a_type3.cpp +++ b/src/mame/machine/pgmprot_igs027a_type3.cpp @@ -45,6 +45,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_igs027a_type3.h" WRITE32_MEMBER(pgm_arm_type3_state::svg_arm7_ram_sel_w ) { diff --git a/src/mame/machine/pgmprot_igs027a_type3.h b/src/mame/machine/pgmprot_igs027a_type3.h new file mode 100644 index 00000000000..2586b9fb248 --- /dev/null +++ b/src/mame/machine/pgmprot_igs027a_type3.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood, Xing Xing + +class pgm_arm_type3_state : public pgm_state +{ +public: + pgm_arm_type3_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag), + m_arm_ram(*this, "arm_ram"), + m_arm_ram2(*this, "arm_ram2"), + m_prot(*this, "prot") { + } + // svg + int m_svg_ram_sel; + std::unique_ptr m_svg_shareram[2]; //for 5585G MACHINE + + UINT32 m_svg_latchdata_68k_w; + UINT32 m_svg_latchdata_arm_w; + required_shared_ptr m_arm_ram; + required_shared_ptr m_arm_ram2; + + UINT32* m_armrom; + + optional_device m_prot; + + DECLARE_DRIVER_INIT(theglad); + DECLARE_DRIVER_INIT(theglada); + DECLARE_DRIVER_INIT(svg); + DECLARE_DRIVER_INIT(svgpcb); + DECLARE_DRIVER_INIT(killbldp); + DECLARE_DRIVER_INIT(dmnfrnt); + DECLARE_DRIVER_INIT(happy6); + DECLARE_MACHINE_START(pgm_arm_type3); + DECLARE_WRITE32_MEMBER( svg_arm7_ram_sel_w ); + DECLARE_READ32_MEMBER( svg_arm7_shareram_r ); + DECLARE_WRITE32_MEMBER( svg_arm7_shareram_w ); + DECLARE_READ16_MEMBER( svg_m68k_ram_r ); + DECLARE_WRITE16_MEMBER( svg_m68k_ram_w ); + DECLARE_READ16_MEMBER( svg_68k_nmi_r ); + DECLARE_WRITE16_MEMBER( svg_68k_nmi_w ); + DECLARE_WRITE16_MEMBER( svg_latch_68k_w ); + DECLARE_READ16_MEMBER( svg_latch_68k_r ); + DECLARE_READ32_MEMBER( svg_latch_arm_r ); + DECLARE_WRITE32_MEMBER( svg_latch_arm_w ); + void svg_basic_init(); + void pgm_create_dummy_internal_arm_region(int size); + void pgm_patch_external_arm_rom_jumptable_theglada(int base); + void pgm_create_dummy_internal_arm_region_theglad(int is_svg); + void pgm_descramble_happy6(UINT8* src); + void pgm_descramble_happy6_2(UINT8* src); + void svg_latch_init(); + DECLARE_READ32_MEMBER( dmnfrnt_speedup_r ); + DECLARE_READ16_MEMBER( dmnfrnt_main_speedup_r ); + DECLARE_READ32_MEMBER( killbldp_speedup_r ); + DECLARE_READ32_MEMBER( theglad_speedup_r ); + DECLARE_READ32_MEMBER( happy6_speedup_r ); + DECLARE_READ32_MEMBER( svg_speedup_r ); + DECLARE_READ32_MEMBER( svgpcb_speedup_r ); + DECLARE_MACHINE_RESET(pgm_arm_type3_reset); +}; + +MACHINE_CONFIG_EXTERN( pgm_arm_type3 ); +INPUT_PORTS_EXTERN(theglad); +INPUT_PORTS_EXTERN(happy6); +INPUT_PORTS_EXTERN(svg); +INPUT_PORTS_EXTERN(svgtw); diff --git a/src/mame/machine/pgmprot_orlegend.cpp b/src/mame/machine/pgmprot_orlegend.cpp index 0303dcad442..13efe757335 100644 --- a/src/mame/machine/pgmprot_orlegend.cpp +++ b/src/mame/machine/pgmprot_orlegend.cpp @@ -14,6 +14,7 @@ #include "emu.h" #include "includes/pgm.h" +#include "machine/pgmprot_orlegend.h" void pgm_asic3_state::asic3_compute_hold(int y, int z) { diff --git a/src/mame/machine/pgmprot_orlegend.h b/src/mame/machine/pgmprot_orlegend.h new file mode 100644 index 00000000000..9c9f945fdaf --- /dev/null +++ b/src/mame/machine/pgmprot_orlegend.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, iq_132 +/* for machine/pgmprot_orlegend.c type games */ + +class pgm_asic3_state : public pgm_state +{ +public: + pgm_asic3_state(const machine_config &mconfig, device_type type, const char *tag) + : pgm_state(mconfig, type, tag) { + } + + // ASIC 3 (oriental legends protection) + UINT8 m_asic3_reg; + UINT8 m_asic3_latch[3]; + UINT8 m_asic3_x; + UINT16 m_asic3_hilo; + UINT16 m_asic3_hold; + + DECLARE_DRIVER_INIT(orlegend); + void asic3_compute_hold(int,int); + DECLARE_READ16_MEMBER( pgm_asic3_r ); + DECLARE_WRITE16_MEMBER( pgm_asic3_w ); +}; + +INPUT_PORTS_EXTERN( orlegend ); +INPUT_PORTS_EXTERN( orlegendt ); +INPUT_PORTS_EXTERN( orlegendk ); +MACHINE_CONFIG_EXTERN( pgm_asic3 );