Previous 199869 Revisions Next

r18563 Tuesday 16th October, 2012 at 20:36:49 UTC by Wilbert Pol
(MESS) ngp.c: Some small cleanups (nw)
[src/mess/drivers]ngp.c

trunk/src/mess/drivers/ngp.c
r18562r18563
122122{
123123public:
124124   ngp_state(const machine_config &mconfig, device_type type, const char *tag)
125      : driver_device(mconfig, type, tag) { }
125      : driver_device(mconfig, type, tag)
126      , m_tlcs900( *this, "maincpu" )
127      , m_z80( *this, "soundcpu" )
128      , m_dac_l( *this, "dac_l" )
129      , m_dac_r( *this, "dac_r" )
130      { }
126131
127132   virtual void machine_start();
128133   virtual void machine_reset();
r18562r18563
141146      UINT8   command[2];
142147   } m_flash_chip[2];
143148
144   device_t *m_tlcs900;
145   device_t *m_z80;
149   required_device<cpu_device> m_tlcs900;
150   required_device<cpu_device> m_z80;
146151   device_t *m_t6w28;
147   dac_device *m_dac_l;
148   dac_device *m_dac_r;
152   required_device<dac_device> m_dac_l;
153   required_device<dac_device> m_dac_r;
149154   device_t *m_k1ge;
150155
151156   DECLARE_READ8_MEMBER( ngp_io_r );
r18562r18563
260265      switch( data )
261266      {
262267      case 0x55:      /* Enable Z80 */
263         m_z80->execute().resume(SUSPEND_REASON_HALT );
268         m_z80->resume(SUSPEND_REASON_HALT );
264269         m_z80->reset();
265         m_z80->execute().set_input_line(0, CLEAR_LINE );
270         m_z80->set_input_line(0, CLEAR_LINE );
266271         break;
267272      case 0xAA:      /* Disable Z80 */
268         m_z80->execute().suspend(SUSPEND_REASON_HALT, 1 );
273         m_z80->suspend(SUSPEND_REASON_HALT, 1 );
269274         break;
270275      }
271276      break;
272277
273278   case 0x3a:   /* Trigger Z80 NMI */
274      m_z80->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE );
279      m_z80->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
275280      break;
276281   }
277282   m_io_reg[offset] = data;
r18562r18563
527532
528533WRITE8_MEMBER( ngp_state::ngp_z80_signal_main_w )
529534{
530   m_tlcs900->execute().set_input_line(TLCS900_INT5, ASSERT_LINE );
535   m_tlcs900->set_input_line(TLCS900_INT5, ASSERT_LINE );
531536}
532537
533538
r18562r18563
541546
542547WRITE8_MEMBER( ngp_state::ngp_z80_clear_irq )
543548{
544   m_z80->execute().set_input_line(0, CLEAR_LINE );
549   m_z80->set_input_line(0, CLEAR_LINE );
545550
546551   /* I am not exactly sure what causes the maincpu INT5 signal to be cleared. This will do for now. */
547   m_tlcs900->execute().set_input_line(TLCS900_INT5, CLEAR_LINE );
552   m_tlcs900->set_input_line(TLCS900_INT5, CLEAR_LINE );
548553}
549554
550555
r18562r18563
558563
559564   if ( m_io_reg[0x33] & 0x04 )
560565   {
561      m_tlcs900->execute().set_input_line(TLCS900_NMI,
562         (machine().root_device().ioport("Power")->read() & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
566      m_tlcs900->set_input_line(TLCS900_NMI, (machine().root_device().ioport("Power")->read() & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
563567   }
564568}
565569
r18562r18563
582586
583587WRITE8_MEMBER( ngp_state::ngp_vblank_pin_w )
584588{
585   m_tlcs900->execute().set_input_line(TLCS900_INT4, data ? ASSERT_LINE : CLEAR_LINE );
589   m_tlcs900->set_input_line(TLCS900_INT4, data ? ASSERT_LINE : CLEAR_LINE );
586590}
587591
588592
589593WRITE8_MEMBER( ngp_state::ngp_hblank_pin_w )
590594{
591   m_tlcs900->execute().set_input_line(TLCS900_TIO, data ? ASSERT_LINE : CLEAR_LINE );
595   m_tlcs900->set_input_line(TLCS900_TIO, data ? ASSERT_LINE : CLEAR_LINE );
592596}
593597
594598
595599WRITE8_MEMBER( ngp_state::ngp_tlcs900_to3 )
596600{
597601   if ( data && ! m_old_to3 )
598      m_z80->execute().set_input_line(0, ASSERT_LINE );
602      m_z80->set_input_line(0, ASSERT_LINE );
599603
600604   m_old_to3 = data;
601605}
r18562r18563
611615void ngp_state::machine_reset()
612616{
613617   m_old_to3 = 0;
614   m_tlcs900 = machine().device( "maincpu" );
615   m_z80 = machine().device( "soundcpu" );
616618   m_t6w28 = machine().device( "t6w28" );
617   m_dac_l = machine().device<dac_device>( "dac_l" );
618   m_dac_r = machine().device<dac_device>( "dac_r" );
619619   m_k1ge = machine().device( "k1ge" );
620620
621   m_z80->execute().suspend(SUSPEND_REASON_HALT, 1 );
622   m_z80->execute().set_input_line(0, CLEAR_LINE );
621   m_z80->suspend(SUSPEND_REASON_HALT, 1 );
622   m_z80->set_input_line(0, CLEAR_LINE );
623623}
624624
625625

Previous 199869 Revisions Next


© 1997-2024 The MAME Team