From dbb5aac8e48715275c4e864666622e69794f8e09 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 3 Aug 2013 17:51:55 +0000 Subject: [PATCH] tidy up some no longer needed pgm / puzzli2 bits / notes (nw) --- src/mame/drivers/pgm.c | 16 +++-- src/mame/includes/pgm.h | 6 ++ src/mame/machine/pgmprot_igs027a_type1.c | 88 ++++-------------------- src/mame/machine/pgmprot_igs027a_type2.c | 21 ++++-- 4 files changed, 47 insertions(+), 84 deletions(-) diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c index dfd3c6e7cf1..46df2da7e52 100644 --- a/src/mame/drivers/pgm.c +++ b/src/mame/drivers/pgm.c @@ -4012,10 +4012,14 @@ GAME( 2000, kov2102, kov2, pgm_arm_type2, kov2, pgm_arm_type2_state GAME( 2000, kov2101, kov2, pgm_arm_type2, kov2, pgm_arm_type2_state, kov2, ROT0, "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 101, 101, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 11/29/00 11:03:08 V100 (Ext. Arm V100, Int. Arm V100HK) GAME( 2000, kov2100, kov2, pgm_arm_type2, kov2, pgm_arm_type2_state, kov2, ROT0, "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 100, 100, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 11/29/00 11:03:08 V100 (Ext. Arm V100, Int. Arm V100HK) -// region provided by internal ARM rom (we only have a China internal ROM and it doesn't seem to write the region code at all even if the 68k reads it, maybe this was only released in China?) -GAME( 2001, kov2p, pgm, pgm_arm_type2, pgm, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M205XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 2001, kov2p204, kov2p, pgm_arm_type2, pgm, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M204XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 2001, kov2p202, kov2p, pgm_arm_type2, pgm, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M202XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +// region provided by internal ARM rom (we only have a China internal ROM) +GAME( 2001, kov2p, pgm, pgm_arm_type2, kov2, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M205XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 04/25/02 17:48:27 M205XX +GAME( 2001, kov2p204, kov2p, pgm_arm_type2, kov2, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M204XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 08/28/01 09:11:49 M204XX +GAME( 2001, kov2p202, kov2p, pgm_arm_type2, kov2, pgm_arm_type2_state, kov2p, ROT0, "IGS", "Knights of Valour 2 Plus - Nine Dragons / Sangoku Senki 2 Plus - Nine Dragons (ver. M202XX, 200, 100CN)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 07/09/01 11:03:50 M202XX + + + + // region provided by internal ARM rom GAME( 2001, martmast, pgm, pgm_arm_type2, martmast, pgm_arm_type2_state, martmast, ROT0, "IGS", "Martial Masters (ver. 104, 102, 102US)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 68k V104, Ext Arm 102, Int Arm 102US @@ -4112,8 +4116,8 @@ GAME( 1999, puzlstar, pgm, pgm_arm_type1_sim, pstar, pgm_arm_type1_ GAME( 2001, py2k2, pgm, pgm_arm_type1_sim, py2k2, pgm_arm_type1_state, py2k2, ROT0, "IGS", "Photo Y2K 2", GAME_NOT_WORKING ) /* need internal rom of IGS027A */ GAME( 2004, pgm3in1, pgm, pgm_arm_type1_sim, py2k2, pgm_arm_type1_state, pgm3in1, ROT0, "IGS", "Photo Y2K 2 (Flash 3-in-1)", GAME_NOT_WORKING ) /* need internal rom of IGS027A */ -GAME( 1999, puzzli2, pgm, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // ROM label is V100 -GAME( 2001, puzzli2s, puzzli2, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 Super (ver. 200)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) +GAME( 1999, puzzli2, pgm, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // ROM label is V100 ( V0001, 11/22/99 09:27:58 in program ROM ) +GAME( 2001, puzzli2s, puzzli2, pgm_arm_type1_sim, puzzli2, pgm_arm_type1_state, puzzli2, ROT0, "IGS", "Puzzli 2 Super (ver. 200)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // ( V200, 12/28/01 12:53:34 in program ROM ) /* Games below this point are known to have an 'execute only' internal ROM area covering an area at the start of the internal ROM. This can't be read when running code from either internal or external ROM space. */ diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h index f1be6e50d6a..fa78567c538 100644 --- a/src/mame/includes/pgm.h +++ b/src/mame/includes/pgm.h @@ -268,6 +268,11 @@ public: 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; UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure @@ -318,6 +323,7 @@ public: 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 ); }; diff --git a/src/mame/machine/pgmprot_igs027a_type1.c b/src/mame/machine/pgmprot_igs027a_type1.c index 68d78e4f1cb..45d34de44c6 100644 --- a/src/mame/machine/pgmprot_igs027a_type1.c +++ b/src/mame/machine/pgmprot_igs027a_type1.c @@ -6,8 +6,9 @@ Knights of Valor (kov) + bootlegs Knights of Valor Plus (kovplus) - Puzzli 2 Super (puzzli2) + Puzzli 2 / Puzzli 2 Super (puzzli2s) Photo Y2k2 (py2k2) + Photo Y2k2 - Flash 3-in-1 (pgm3in1) Puzzle Star (puzlstar) These are implemented in 55857E type chips @@ -43,6 +44,9 @@ None of these games have an external ARM rom, although it appears the program code does check for the possibility of one existing. + The 68k ROM gets checksummed by the ARM, the code doesn't even + get decrytped if it fails. + 68k code is encrypted on these, decryption table is uploaded to ARM space. @@ -564,7 +568,7 @@ void pgm_arm_type1_state::command_handler_ddp3(int pc) /* preliminary */ -// not accurate, low bits (0x03 mask) are certainly wrong, possibly others, 0/1 below each shows if i've attempted to automatically verify the value +// fairly accurate now, although could still do with finding a way to verify on hw UINT8 puzzli2_level_decode[256] = { // 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , a , b , c , d , e , f , 0x32, 0x3e, 0xb2, 0x37, 0x31, 0x22, 0xd6, 0x0d, 0x35, 0x5c, 0x8d, 0x3c, 0x7a, 0x5f, 0xd7, 0xac, // 0x0 @@ -602,45 +606,6 @@ UINT8 puzzli2_level_decode[256] = { }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static int hackcount = 0; -static int hackcount2 = 0; -static int hack_47_value = 0; -static int hack_31_table_offset = 0; -static int hack_31_table_offset2 = 0; void pgm_arm_type1_state::command_handler_puzzli2(int pc) { @@ -2181,19 +2146,23 @@ int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue) DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2) { pgm_basic_init(); + + pgm_puzzli2_decrypt(machine()); arm_sim_handler = &pgm_arm_type1_state::command_handler_puzzli2; m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x500000, 0x500005, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_r),this), write16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_w),this)); m_maincpu->space(AS_PROGRAM).install_read_handler(0x4f0000, 0x4f003f, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_protram_r),this)); - m_irq4_disabled = 1; // // doesn't like this irq?? + m_irq4_disabled = 1; // // doesn't like this irq?? - seems to be RTC related + + hackcount = 0; + hackcount2 = 0; + hack_47_value = 0; + hack_31_table_offset = 0; + hack_31_table_offset = 0; //#define PUZZLI2_LEVEL_STRUCTURE_LOG #ifdef PUZZLI2_LEVEL_STRUCTURE_LOG UINT8 *src2 = (UINT8 *) (machine().root_device().memregion("maincpu")->base()); -// UINT8 new_puzzli2_level_decode[256]; - -// for (int i=0;i<256;i++) -// new_puzzli2_level_decode[i] = puzzli2_level_decode[i]; int offset; int limit; @@ -2270,34 +2239,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2) } - /* - int c=0; - for (int i=0;i<256;i++) - { - printf(" %d , ",coverage[i]); - c++; - if (c==16) - { - printf("\n"); - c = 0; - } - } - printf("\n"); - c=0; - - for (int i=0;i<256;i++) - { - printf("0x%02x, ", new_puzzli2_level_decode[i]); - - c++; - if (c==16) - { - printf("\n"); - c = 0; - } - } - */ #endif diff --git a/src/mame/machine/pgmprot_igs027a_type2.c b/src/mame/machine/pgmprot_igs027a_type2.c index e5e62bfd646..1c12555f20d 100644 --- a/src/mame/machine/pgmprot_igs027a_type2.c +++ b/src/mame/machine/pgmprot_igs027a_type2.c @@ -6,16 +6,15 @@ used by Knights of Valor 2 (kov2) - Knights of Valor 2 Nine Dragons (kov2p) * + Knights of Valor 2 Nine Dragons (kov2p) DoDonPachi 2 - Bee Storm (ddp2) Martial Masters (martmast) Dragon World 2001 (dw2001) Dragon World Pretty Chance (dwpc) (verified to be the same internal rom as dw2001) - * using a hacked kov2 internal ROM ---- - These games use a larger region of shared RAM than the 55857E + These games use a larger region of shared RAM than the earlier type and have a communication based on interrupts ---- @@ -25,6 +24,8 @@ The external ARM roms are encrypted, the internal ARM rom uploads the decryption tables. + The external ARM rom is checksummed + Game Region is supplied by internal ARM rom. ***********************************************************************/ @@ -160,6 +161,16 @@ WRITE32_MEMBER(pgm_arm_type2_state::kov2_arm_region_w ) COMBINE_DATA(&m_arm7_shareram[0x138/4]); } +WRITE32_MEMBER(pgm_arm_type2_state::kov2p_arm_region_w ) +{ + int pc = space.device().safe_pc(); + int regionhack = ioport("RegionHack")->read(); +// printf("%08x\n", pc); + if (pc==0x1b0 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0); + COMBINE_DATA(&m_arm7_shareram[0x138/4]); +} + + DRIVER_INIT_MEMBER(pgm_arm_type2_state,kov2) { pgm_basic_init(); @@ -181,7 +192,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type2_state,kov2p) kov2_latch_init(); // we only have a China internal ROM dumped for now, allow us to override that for debugging purposes. -// machine().device("prot")->memory().space(AS_PROGRAM).install_write_handler(0x48000138, 0x4800013b, write32_delegate(FUNC(pgm_arm_type2_state::kov2_arm_region_w),this)); + machine().device("prot")->memory().space(AS_PROGRAM).install_write_handler(0x48000138, 0x4800013b, write32_delegate(FUNC(pgm_arm_type2_state::kov2p_arm_region_w),this)); } WRITE32_MEMBER(pgm_arm_type2_state::martmast_arm_region_w ) @@ -273,7 +284,7 @@ INPUT_PORTS_START( kov2 ) PORT_CONFNAME( 0x00ff, 0x00ff, DEF_STR( Region ) ) PORT_CONFSETTING( 0x0000, DEF_STR( China ) ) PORT_CONFSETTING( 0x0001, DEF_STR( Taiwan ) ) - PORT_CONFSETTING( 0x0002, "Japan (Cave license)" ) + PORT_CONFSETTING( 0x0002, "Japan (Alta license)" ) // 'Busyou Souha' title for kov2p Japan PORT_CONFSETTING( 0x0003, DEF_STR( Korea ) ) PORT_CONFSETTING( 0x0004, DEF_STR( Hong_Kong ) ) PORT_CONFSETTING( 0x0005, DEF_STR( World ) )