Previous 199869 Revisions Next

r20611 Wednesday 30th January, 2013 at 04:44:23 UTC by David Haywood
new clones
Knights of Valour: Yi Tong Zhong Yuan [XingXing]

also

Protection routines for aliencha [iq_132]
Implemented missing functions of lordgun's protection routines [iq_132]
[src/mame]mame.lst
[src/mame/drivers]lordgun.c pgm.c
[src/mame/includes]lordgun.h

trunk/src/mame/mame.lst
r20610r20611
92589258dmnfrntb      //
92599259dmnfrntpcb      //
92609260kovshp          // (c) 200? Knights of Valor Superheroes PLUS
9261kovytzy      // (c) 1999 Knights of Valour: Yi Tong Zhong Yuan
92619262kovshxas        // bootleg
92629263kovlsqh         // bootleg
92639264kovlsqh2        // bootleg
trunk/src/mame/includes/lordgun.h
r20610r20611
4040   UINT16 m_lordgun_protection_data;
4141   DECLARE_WRITE16_MEMBER(lordgun_protection_w);
4242   DECLARE_READ16_MEMBER(lordgun_protection_r);
43   DECLARE_WRITE16_MEMBER(aliencha_protection_w);
44   DECLARE_READ16_MEMBER(aliencha_protection_r);
4345
4446   DECLARE_WRITE16_MEMBER(lordgun_priority_w);
4547   DECLARE_READ16_MEMBER(lordgun_gun_0_x_r);
r20610r20611
6062   DECLARE_WRITE8_MEMBER(aliencha_dip_w);
6163   DECLARE_WRITE8_MEMBER(lordgun_okibank_w);
6264   DECLARE_DRIVER_INIT(lordgun);
63   DECLARE_DRIVER_INIT(aliencha);
64   DECLARE_DRIVER_INIT(alienchac);
6565   TILE_GET_INFO_MEMBER(get_tile_info_0);
6666   TILE_GET_INFO_MEMBER(get_tile_info_1);
6767   TILE_GET_INFO_MEMBER(get_tile_info_2);
trunk/src/mame/drivers/pgm.c
r20610r20611
31793179   ROM_LOAD( "m0600.rom",    0x400000, 0x400000, CRC(3ada4fd6) SHA1(4c87adb25d31cbd41f04fbffe31f7bc37173da76) )
31803180ROM_END
31813181
3182ROM_START( kovytzy )
3183   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3184   PGM_68K_BIOS
3185   ROM_LOAD16_WORD_SWAP( "ytzy_v201cn.rom",   0x100000, 0x400000, CRC(f3705ea0) SHA1(e31ad474d0c2364311d21a8ce37d49919c7b999c) )
31823186
3187   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3188   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3189
3190   ROM_REGION( 0xc00000, "tiles", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3191   PGM_VIDEO_BIOS
3192   ROM_LOAD( "t0600.rom",    0x180000, 0x800000, CRC(4acc1ad6) SHA1(0668dbd5e856c2406910c6b7382548b37c631780) )
3193
3194   ROM_REGION( 0x2000000, "sprcol", 0 ) /* Sprite Colour Data */
3195   ROM_LOAD( "a0600.rom",    0x0000000, 0x0800000, CRC(d8167834) SHA1(fa55a99629d03b2ea253392352f70d2c8639a991) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3196   ROM_LOAD( "a0601.rom",    0x0800000, 0x0800000, CRC(ff7a4373) SHA1(7def9fca7513ad5a117da230bebd2e3c78679041) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3197   ROM_LOAD( "a0602.rom",    0x1000000, 0x0800000, CRC(e7a32959) SHA1(3d0ed684dc5b269238890836b2ce7ef46aa5265b) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3198   ROM_LOAD( "a0540.rom",    0x1800000, 0x0800000, CRC(4fd3413e) SHA1(5e8f3e421342bf558c77e59635f9b5d713e825c2) )
3199
3200   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3201   ROM_LOAD( "b0600.rom",    0x0000000, 0x0800000, CRC(7d3cd059) SHA1(00cf994b63337e0e4ebe96453daf45f24192af1c) )
3202   ROM_LOAD( "b0540.rom",    0x0800000, 0x0800000, CRC(60999757) SHA1(118cf058e67858958bcb931e14f5d160c7de87cc) )
3203
3204   ROM_REGION( 0x800000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3205   PGM_AUDIO_BIOS
3206   ROM_LOAD( "m0600.rom",    0x400000, 0x400000, CRC(3ada4fd6) SHA1(4c87adb25d31cbd41f04fbffe31f7bc37173da76) )
3207ROM_END
3208
31833209ROM_START( kovshxas )
31843210   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
31853211   PGM_68K_BIOS
r20610r20611
39103936// if the internal ROM can't be extracted (likely case, execute only area and NO chance of custom code execution at all due to lack of external ROM) then a reference simulator should probably be written based on the actual
39113937// kovsh code, tweaked based on tests done with this specific board to catch any different behaviors.  These all seem to be for China only, they don't work as expected when set to other regions.
39123938GAME( 2004, kovshp,       pgm,       pgm_arm_type1,     kovsh, pgm_arm_type1_state,    kovshp,     ROT0,   "IGS", "Knights of Valour Super Heroes Plus / Sangoku Senki Super Heroes Plus (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
3939// Seems to be an earlier version, uses same PCB as kovsh.
3940GAME( 1999, kovytzy,      pgm,       pgm_arm_type1,     kovsh, pgm_arm_type1_state,    kovshp,     ROT0,   "IGS", "Knights of Valour: Yi Tong Zhong Yuan  / Sangoku Senki: Yi Tong Zhong Yuan (ver. 201, China)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
39133941// this bootleg is very close to kovshp
39143942GAME( 2004, kovshxas,     kovshp,    pgm_arm_type1,     kovsh, pgm_arm_type1_state, kovshxas,   ROT0,   "bootleg", "Knights of Valour: Aoshi Sanguo / Sangoku Senki: Aoshi Sanguo (ver. 202CN)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
39153943// these should be bootlegs of kovshp, but have further command changes in their ARMs and have a lot of code shuffled around, bootlegs of a different revision?
trunk/src/mame/drivers/lordgun.c
r20610r20611
2121
2222To do:
2323
24- Protection emulation instead of patching the roms
2524- lordgun: in the 3rd leg of the ship stage, sometimes part of a far jetboat is drawn above a nearer sub (both sprites).
2625  But this is correct considering both priorities and sprite list positions. Original game bug?
2726- lordgun: wrong colors for tilemap 0 in the 2nd leg of the last stage (where some sprite priority bugs happen too)
r20610r20611
5049
5150/***************************************************************************
5251
53    Code Decryption / Protection patches
52    Memory Maps - Main
5453
5554***************************************************************************/
5655
57DRIVER_INIT_MEMBER(lordgun_state,lordgun)
56WRITE16_MEMBER(lordgun_state::lordgun_protection_w)
5857{
59   int i;
60   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
58   switch (offset & 0x60)
59   {
60      case 0x00/2: // increment counter
61      {
62         m_lordgun_protection_data++;
63         m_lordgun_protection_data &= 0x1f;
6164
62   // Decryption
65         return;
66      }
6367
64   int rom_size = 0x100000;
65   for(i = 0; i < rom_size/2; i++)
66   {
67      UINT16 x = rom[i];
68      case 0xc0/2: // reset protection device
69      {
70         m_lordgun_protection_data = 0;
6871
69      if((i & 0x0120) == 0x0100 || (i & 0x0a00) == 0x0800)
70         x ^= 0x0010;
71
72      rom[i] = x;
72         return;
73      }
7374   }
7475}
7576
76
77// From XingXing:
78DRIVER_INIT_MEMBER(lordgun_state,aliencha)
77READ16_MEMBER(lordgun_state::lordgun_protection_r)
7978{
80   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
79   switch (offset & 0x60)
80   {
81      case 0x40/2: // bitswap and xor counter
82      {
83         UINT8 x = m_lordgun_protection_data;
8184
82   // Protection
85         m_lordgun_protection_data  = ((( x >> 0) | ( x >> 1)) & 1) << 4;
86         m_lordgun_protection_data |=  ((~x >> 2) & 1) << 3;
87         m_lordgun_protection_data |= (((~x >> 4) | ( x >> 0)) & 1) << 2;
88         m_lordgun_protection_data |=  (( x >> 3) & 1) << 1;
89         m_lordgun_protection_data |= (((~x >> 0) | ( x >> 2)) & 1) << 0;
8390
84   rom[0x0A558/2]  =   0x6012;     // 0A558  beq.s   $A56C
85   rom[0x0A8DC/2]  =   0x6012;     // 0A8DC  beq.s   $A8F0
86   rom[0x0AC92/2]  =   0x6012;     // 0AC92  beq.s   $ACA6
87   rom[0x124CC/2]  =   0x6012;     // 124CC  beq.s   $124E0
88   rom[0x12850/2]  =   0x6012;     // 12850  beq.s   $12864
89   rom[0x12C06/2]  =   0x6012;     // 12C06  beq.s   $12C1A
90   rom[0x1862A/2]  =   0x6012;     // 1862A  beq.s   $1863E
91   rom[0x189AE/2]  =   0x6012;     // 189AE  beq.s   $189C2
92   rom[0x18D64/2]  =   0x6012;     // 18D64  beq.s   $18D78
93   rom[0x230FC/2]  =   0x6012;     // 230FC  beq.s   $23110
94   rom[0x23480/2]  =   0x6012;     // 23480  beq.s   $23494
95   rom[0x23836/2]  =   0x6012;     // 23836  beq.s   $2384A
96   rom[0x2BD0E/2]  =   0x6012;     // 2BD0E  beq.s   $2BD22
97   rom[0x2C092/2]  =   0x6012;     // 2C092  beq.s   $2C0A6
98   rom[0x2C448/2]  =   0x6012;     // 2C448  beq.s   $2C45C
99}
91         return 0;
92      }
10093
94      case 0x80/2: // return value if conditions are met
95      {
96         if ((m_lordgun_protection_data & 0x11) == 0x01) return 0x10;
97         if ((m_lordgun_protection_data & 0x06) == 0x02) return 0x10;
98         if ((m_lordgun_protection_data & 0x09) == 0x08) return 0x10;
10199
102DRIVER_INIT_MEMBER(lordgun_state,alienchac)
103{
104   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
100         return 0;
101      }
102   }
105103
106   // Protection
107
108   rom[0x0A550/2]  =   0x6012;     // 0A558  beq.s   $A564
109   rom[0x0A8D4/2]  =   0x6012;     // 0A8D4  beq.s   $A8E8
110   rom[0x0AC8A/2]  =   0x6012;     // 0AC8A  beq.s   $AC9E
111   rom[0x124B8/2]  =   0x6012;     // 124B8  beq.s   $124CC
112   rom[0x1283C/2]  =   0x6012;     // 1283C  beq.s   $12850
113   rom[0x12BF2/2]  =   0x6012;     // 12BF2  beq.s   $12C06
114   rom[0x18616/2]  =   0x6012;     // 18616  beq.s   $1862A
115   rom[0x1899A/2]  =   0x6012;     // 1899A  beq.s   $189AE
116   rom[0x18D50/2]  =   0x6012;     // 18D50  beq.s   $18D64
117   rom[0x230E8/2]  =   0x6012;     // 230E8  beq.s   $230FC
118   rom[0x2346C/2]  =   0x6012;     // 2346C  beq.s   $23480
119   rom[0x23822/2]  =   0x6012;     // 23822  beq.s   $23822
120   rom[0x2BCFA/2]  =   0x6012;     // 2BCFA  beq.s   $2BD0E
121   rom[0x2C07E/2]  =   0x6012;     // 2C07E  beq.s   $2C092
122   rom[0x2C434/2]  =   0x6012;     // 2C434  beq.s   $2C448
104   return 0;
123105}
124106
125
126/***************************************************************************
127
128    Memory Maps - Main
129
130***************************************************************************/
131
132
133WRITE16_MEMBER(lordgun_state::lordgun_protection_w)
107WRITE16_MEMBER(lordgun_state::aliencha_protection_w)
134108{
135109   switch (offset & 0x60)
136110   {
137      // The data written to offsets 0 - 1f is offset * 2
138      // Use this write to increment the counter.
139      case 0x00:
140         m_lordgun_protection_data++;
141      return;
111      case 0xc0/2: // reset protection device
112      {
113         m_lordgun_protection_data = 0;
142114
143      case 0x20: // unused?
144      case 0x40: // protection results are read back from 40-5f.
145      return;
146
147      case 0x60: // reset / init
148         m_lordgun_protection_data = 0;
149      return;
115         return;
116      }
150117   }
151118}
152119
153READ16_MEMBER(lordgun_state::lordgun_protection_r)
120READ16_MEMBER(lordgun_state::aliencha_protection_r)
154121{
155   // Other offset ranges are not used?
156   if ((offset & 0x60) == 0x40)
122   switch (offset & 0x60)
157123   {
158      // Check to see if counter meets various conditions.
159      // The results may not be 0010, but this is the only bit
160      // that is checked by the 68k.
161      if ((m_lordgun_protection_data & 0x11) == 0x01)
162         return 0x0010;
124      case 0x00/2: // de-increment counter
125      {
126         m_lordgun_protection_data--;
127         m_lordgun_protection_data &= 0x1f;
163128
164      if ((m_lordgun_protection_data & 0x06) == 0x02)
165         return 0x0010;
129         return 0;
130      }
166131
167      if ((m_lordgun_protection_data & 0x09) == 0x08)
168         return 0x0010;
132      case 0x40/2: // bitswap and xor counter
133      {
134         UINT8 x = m_lordgun_protection_data;
169135
170      return 0;
136         m_lordgun_protection_data  = (((x >> 3) ^ (x >> 2)) & 1) << 4;
137         m_lordgun_protection_data |= (((x >> 2) ^ (x >> 1)) & 1) << 3;
138         m_lordgun_protection_data |= (((x >> 1) ^ (x >> 0)) & 1) << 2;
139         m_lordgun_protection_data |= (((x >> 4) ^ (x >> 0)) & 1) << 1;
140         m_lordgun_protection_data |= (((x >> 4) ^ (x >> 3)) & 1) << 0;
141
142         return 0;
143      }
144
145      case 0x80/2: // return value if conditions are met
146      {
147         if ((m_lordgun_protection_data & 0x11) == 0x00) return 0x20;
148         if ((m_lordgun_protection_data & 0x06) != 0x06) return 0x20;
149         if ((m_lordgun_protection_data & 0x18) == 0x00) return 0x20;
150
151         return 0;
152      }
171153   }
172154
173155   return 0;
r20610r20611
175157
176158WRITE8_MEMBER(lordgun_state::fake_w)
177159{
160//   popmessage("%02x",data);
178161}
162
179163WRITE8_MEMBER(lordgun_state::fake2_w)
180164{
181//  popmessage("%02x",data);
165//   popmessage("%02x",data);
182166}
183167
184168WRITE8_MEMBER(lordgun_state::lordgun_eeprom_w)
r20610r20611
188172
189173   if (data & ~0xfd)
190174   {
191//      popmessage("EE: %02x", data);
175//      popmessage("EE: %02x", data);
192176      logerror("%s: Unknown EEPROM bit written %02X\n",machine().describe_context(),data);
193177   }
194178
r20610r20611
219203
220204   if (~data & ~0xf8)
221205   {
222//      popmessage("EE: %02x", data);
206//      popmessage("EE: %02x", data);
223207      logerror("%s: Unknown EEPROM bit written %02X\n",machine().describe_context(),data);
224208   }
225209
r20610r20611
259243   m_aliencha_dip_sel = data;
260244}
261245
262
263246// Unknown, always equal to 7 in lordgun, aliencha.
264247WRITE16_MEMBER(lordgun_state::lordgun_priority_w)
265248{
266249   COMBINE_DATA(&m_priority);
267//  popmessage("PR: %04x", data);
268250}
269251
270252
r20610r20611
288270   return m_gun[1].hw_y;
289271}
290272
291
292273WRITE16_MEMBER(lordgun_state::lordgun_soundlatch_w)
293274{
294275   if (ACCESSING_BITS_0_7)     soundlatch_byte_w (space, 0, (data >> 0) & 0xff);
r20610r20611
353334   AM_RANGE(0x504000, 0x504001) AM_WRITE(lordgun_soundlatch_w)
354335   AM_RANGE(0x506000, 0x506007) AM_DEVREADWRITE8("ppi8255_0", i8255_device, read, write, 0x00ff)
355336   AM_RANGE(0x508000, 0x508007) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write, 0x00ff)
356   AM_RANGE(0x50b900, 0x50b9ff) AM_RAM // protection
337   AM_RANGE(0x50b900, 0x50b9ff) AM_READWRITE(aliencha_protection_r, aliencha_protection_w)
357338ADDRESS_MAP_END
358339
359340
r20610r20611
373354   device_t *device = machine().device("oki");
374355   downcast<okim6295_device *>(device)->set_bank_base((data & 2) ? 0x40000 : 0);
375356   if (data & ~3)  logerror("%s: unknown okibank bits %02x\n", machine().describe_context(), data);
376//  popmessage("OKI %x", data);
357//   popmessage("OKI %x", data);
377358}
378359
379360static ADDRESS_MAP_START( lordgun_soundio_map, AS_IO, 8, lordgun_state )
r20610r20611
584565   PORT_DIPSETTING(    0x01, "3" )
585566   PORT_DIPSETTING(    0x02, "4" )
586567   PORT_DIPSETTING(    0x03, "6" )
587//  PORT_DIPSETTING(    0x00, "6" )
568//   PORT_DIPSETTING(    0x00, "6" )
588569   PORT_DIPNAME( 0x04, 0x04, "Vs. Rounds" )        PORT_DIPLOCATION("SW3:3")
589570   PORT_DIPSETTING(    0x00, "3" )
590571   PORT_DIPSETTING(    0x04, "5" )
r20610r20611
717698   MCFG_GFXDECODE(lordgun)
718699   MCFG_PALETTE_LENGTH(0x800 * 8)  // 0x800 real colors, repeated per priority level
719700
720
721701   // sound hardware
722702   MCFG_SPEAKER_STANDARD_MONO("mono")
723703
r20610r20611
759739   MCFG_GFXDECODE(lordgun)
760740   MCFG_PALETTE_LENGTH(0x800 * 8)  // 0x800 real colors, repeated per priority level
761741
762
763742   // sound hardware
764743   MCFG_SPEAKER_STANDARD_MONO("mono")
765744
r20610r20611
10741053
10751054/***************************************************************************
10761055
1056    Code Decryption
1057
1058***************************************************************************/
1059
1060DRIVER_INIT_MEMBER(lordgun_state,lordgun)
1061{
1062   int i;
1063   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1064   int rom_size = 0x100000;
1065
1066   for(i = 0; i < rom_size/2; i++)
1067   {
1068      UINT16 x = rom[i];
1069
1070      if((i & 0x0120) == 0x0100 || (i & 0x0a00) == 0x0800)
1071         x ^= 0x0010;
1072
1073      rom[i] = x;
1074   }
1075}
1076
1077/***************************************************************************
1078
10771079    Game Drivers
10781080
10791081***************************************************************************/
10801082
1081GAME( 1994, lordgun,   0,        lordgun,  lordgun, lordgun_state,  lordgun,   ROT0, "IGS", "Lord of Gun (USA)",       GAME_IMPERFECT_GRAPHICS )
1082GAME( 1994, aliencha,  0,        aliencha, aliencha, lordgun_state, aliencha,  ROT0, "IGS", "Alien Challenge (World)", GAME_UNEMULATED_PROTECTION )
1083GAME( 1994, alienchac, aliencha, aliencha, aliencha, lordgun_state, alienchac, ROT0, "IGS", "Alien Challenge (China)", GAME_UNEMULATED_PROTECTION )
1083GAME( 1994, lordgun,   0,        lordgun,  lordgun,  lordgun_state, lordgun,  ROT0, "IGS", "Lord of Gun (USA)",       GAME_IMPERFECT_GRAPHICS )
1084GAME( 1994, aliencha,  0,        aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (World)", 0 )
1085GAME( 1994, alienchac, aliencha, aliencha, aliencha, driver_device, 0,        ROT0, "IGS", "Alien Challenge (China)", 0 )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team