Previous 199869 Revisions Next

r26060 Friday 8th November, 2013 at 16:15:22 UTC by David Haywood
part 4 (nw)
[src/mame/machine]igs025.c igs025.h pgmprot_igs025_igs012.c pgmprot_igs025_igs028.c

trunk/src/mame/machine/igs025.c
r26059r26060
196196         case 0x26:
197197         case 0x27:
198198            m_kb_ptr++;
199            olds_protection_calculate_hold(m_kb_cmd & 0x0f, data & 0xff);
199            killbld_protection_calculate_hold(m_kb_cmd & 0x0f, data & 0xff);
200200         break;
201201
202202      //  default:
r26059r26060
229229      case 0x26:
230230      case 0x27:
231231         m_kb_ptr++;
232         drgw2_protection_calculate_hold(m_kb_cmd & 0x0f, data & 0xff);
232         killbld_protection_calculate_hold(m_kb_cmd & 0x0f, data & 0xff);
233233      break;
234234
235235   //  case 0x08: // Used only on init..
r26059r26060
265265      case 0x01:
266266         return m_kb_reg & 0x7f;
267267
268      case 0x02:
269         return m_olds_bs | 0x80;
270
271      case 0x03:
272         return m_kb_cmd3;
273
268274      case 0x05:
269275      {
270276                switch (m_kb_ptr)
r26059r26060
285291                   return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
286292                }
287293
288                return 0;
294                return 0x3f00;
295                //return 0;
289296      }
290297
291298      case 0x40:
r26059r26060
294301
295302         //  default:
296303         //      logerror("%06X: ASIC25 R CMD %X\n", space.device().safe_pc(), m_kb_cmd);
297      }
298   }
299304
300   return 0;
301}
305         // drgw2 notes
306         //  case 0x13: // Read to $80eeb8
307         //  case 0x1f: // Read to $80eeb8
308         //  case 0xf4: // Read to $80eeb8
309         //  case 0xf6: // Read to $80eeb8
310         //  case 0xf8: // Read to $80eeb8
311         //      return 0;
302312
313         //  default:
314         //      logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_kb_cmd);
303315
304READ16_MEMBER(igs025_device::olds_r)
305{
306   if (offset)
307   {
308      switch (m_kb_cmd)
309      {
310      case 0x01:
311         return m_kb_reg & 0x7f;
312316
313      case 0x02:
314         return m_olds_bs | 0x80;
315
316      case 0x03:
317         return m_kb_cmd3;
318
319      case 0x05:
320      {
321                switch (m_kb_ptr)
322                {
323                case 1:
324                   return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
325
326                case 2:
327                   return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
328
329                case 3:
330                   return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
331
332                case 4:
333                   return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
334
335
336
337
338                case 5:
339                default: // >= 5
340                   return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);    // $817906
341                }
342317      }
343
344      case 0x40:
345         olds_protection_calculate_hilo();
346         return 0; // unused?
347      }
348318   }
349319
350320   return 0;
351321}
352322
353323
354READ16_MEMBER(igs025_device::drgw2_d80000_protection_r)
355{
356   switch (m_kb_cmd)
357   {
358   case 0x05:
359   {
360             switch (m_kb_ptr)
361             {
362             case 1:
363                return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
364
365             case 2:
366                return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
367
368             case 3:
369                return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
370
371             case 4:
372                return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
373
374             case 5:
375             default:
376                return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
377             }
378
379             return 0x3f00;
380   }
381
382   case 0x40:
383      drgw2_protection_calculate_hilo();
384      return 0;
385
386      //  case 0x13: // Read to $80eeb8
387      //  case 0x1f: // Read to $80eeb8
388      //  case 0xf4: // Read to $80eeb8
389      //  case 0xf6: // Read to $80eeb8
390      //  case 0xf8: // Read to $80eeb8
391      //      return 0;
392
393      //  default:
394      //      logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_kb_cmd);
395   }
396
397   return 0;
398}
399
400
401
402
403void igs025_device::drgw2_protection_calculate_hold(int y, int z)
404{
405   unsigned short old = m_kb_prot_hold;
406
407   m_kb_prot_hold = ((old << 1) | (old >> 15));
408
409   m_kb_prot_hold ^= 0x2bad;
410   m_kb_prot_hold ^= BIT(z, y);
411   m_kb_prot_hold ^= BIT(old, 7) << 0;
412   m_kb_prot_hold ^= BIT(~old, 13) << 4;
413   m_kb_prot_hold ^= BIT(old, 3) << 11;
414
415   m_kb_prot_hold ^= (m_kb_prot_hilo & ~0x0408) << 1;
416}
417
418
419void igs025_device::olds_protection_calculate_hold(int y, int z) // calculated in routine $12dbc2 in olds
420{
421   unsigned short old = m_kb_prot_hold;
422
423   m_kb_prot_hold = ((old << 1) | (old >> 15));
424
425   m_kb_prot_hold ^= 0x2bad;
426   m_kb_prot_hold ^= BIT(z, y);
427   m_kb_prot_hold ^= BIT(old, 7) << 0;
428   m_kb_prot_hold ^= BIT(~old, 13) << 4;
429   m_kb_prot_hold ^= BIT(old, 3) << 11;
430
431   m_kb_prot_hold ^= (m_kb_prot_hilo & ~0x0408) << 1; // $81790c
432}
433
434324void igs025_device::killbld_protection_calculate_hold(int y, int z)
435325{
436326   unsigned short old = m_kb_prot_hold;
r26059r26060
471361}
472362
473363
474void igs025_device::drgw2_protection_calculate_hilo()
475{
476   UINT8 source;
477364
478   m_kb_prot_hilo_select++;
479   if (m_kb_prot_hilo_select > 0xeb) {
480      m_kb_prot_hilo_select = 0;
481   }
482365
483   source = m_kb_source_data[m_kb_region][m_kb_prot_hilo_select];
484366
485   if (m_kb_prot_hilo_select & 1)
486   {
487      m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);
488   }
489   else
490   {
491      m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);
492   }
493}
494367
495void igs025_device::olds_protection_calculate_hilo() // calculated in routine $12dbc2 in olds
496{
497   UINT8 source;
498
499   m_kb_prot_hilo_select++;
500   if (m_kb_prot_hilo_select > 0xeb) {
501      m_kb_prot_hilo_select = 0;
502   }
503
504   source = m_kb_source_data[m_kb_region][m_kb_prot_hilo_select];
505
506   if (m_kb_prot_hilo_select & 1)    // $8178fa
507   {
508      m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);     // $8178d8
509   }
510   else
511   {
512      m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);     // $8178d8
513   }
514}
515
516
517
518
519368const device_type IGS025 = &device_creator<igs025_device>;
trunk/src/mame/machine/igs025.h
r26059r26060
1313public:
1414   igs025_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
1515
16   DECLARE_WRITE16_MEMBER( killbld_igs025_prot_w );
1716   DECLARE_READ16_MEMBER( killbld_igs025_prot_r );
1817   // use setters instead of making public?
1918   const UINT8 (*m_kb_source_data)[0xec];
r26059r26060
2423   igs025_execute_external m_execute_external;
2524   static void set_external_cb(device_t &device,igs025_execute_external newcb);
2625
27
28   DECLARE_READ16_MEMBER( olds_r );
2926   DECLARE_WRITE16_MEMBER( olds_w );
30   //const UINT8  *m_kb_prot_hilo_source2;
31
32   DECLARE_READ16_MEMBER( drgw2_d80000_protection_r );
3327   DECLARE_WRITE16_MEMBER( drgw2_d80000_protection_w );
34   
28   DECLARE_WRITE16_MEMBER( killbld_igs025_prot_w);
3529
30
3631protected:
3732   virtual void device_config_complete();
3833   virtual void device_validity_check(validity_checker &valid) const;
r26059r26060
5853   UINT16        m_olds_bs;
5954   UINT16        m_kb_cmd3;
6055
61
62   void olds_protection_calculate_hilo();
63   void olds_protection_calculate_hold(int y, int z);
64
65
66
67
68
69
70
71   void drgw2_protection_calculate_hilo();
72   void drgw2_protection_calculate_hold(int y, int z);
73
7456};
7557
7658
trunk/src/mame/machine/pgmprot_igs025_igs028.c
r26059r26060
163163{
164164   pgm_basic_init();
165165
166   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xdcb400, 0xdcb403, read16_delegate(FUNC(igs025_device::olds_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::olds_w), (igs025_device*)m_igs025));
166   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xdcb400, 0xdcb403, read16_delegate(FUNC(igs025_device::killbld_igs025_prot_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::olds_w), (igs025_device*)m_igs025));
167167   m_igs028->m_sharedprotram = m_sharedprotram;
168168   m_igs025->m_kb_source_data = m_olds_source_data;
169169
trunk/src/mame/machine/pgmprot_igs025_igs012.c
r26059r26060
112112
113113void pgm_012_025_state::drgw2_common_init()
114114{
115   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd80000, 0xd80003, read16_delegate(FUNC(igs025_device::drgw2_d80000_protection_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::drgw2_d80000_protection_w), (igs025_device*)m_igs025));
115   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd80000, 0xd80003, read16_delegate(FUNC(igs025_device::killbld_igs025_prot_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::drgw2_d80000_protection_w), (igs025_device*)m_igs025));
116116
117117
118118   m_igs025->m_kb_source_data = drgw2_source_data;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team