Previous 199869 Revisions Next

r31335 Sunday 20th July, 2014 at 14:27:28 UTC by hap
fix irqline problem
[src/emu/cpu/tms7000]tms7000.c tms7000.h

trunk/src/emu/cpu/tms7000/tms7000.c
r31334r31335
318318//  interrupts
319319//-------------------------------------------------
320320
321void tms7000_device::execute_set_input(int irqline, int state)
321void tms7000_device::execute_set_input(int extline, int state)
322322{
323   assert(irqline == TMS7000_INT1_LINE || irqline == TMS7000_INT3_LINE);
323   if (extline != TMS7000_INT1_LINE && extline != TMS7000_INT3_LINE)
324      return;
325
324326   bool irqstate = (state == CLEAR_LINE) ? false : true;
325327
326328   // reverse polarity (70cx2-only)
327   if (m_io_control[2] & (0x01 << (4 * irqline)))
329   if (m_io_control[2] & (0x01 << (4 * extline)))
328330      irqstate = !irqstate;
329331
330   if (m_irq_state[irqline] != irqstate)
332   if (m_irq_state[extline] != irqstate)
331333   {
332      m_irq_state[irqline] = irqstate;
334      m_irq_state[extline] = irqstate;
333335     
334336      // set/clear internal irq flag
335      flag_ext_interrupt(irqline);
337      flag_ext_interrupt(extline);
336338     
337      if (m_irq_state[irqline])
339      if (m_irq_state[extline])
338340      {
339341         // latch timer 1 on INT3
340         if (irqline == TMS7000_INT3_LINE)
342         if (extline == TMS7000_INT3_LINE)
341343            m_timer_capture_latch[0] = m_timer_decrementer[0];
342344
343345         // on 70cx2, latch timer 2 on INT1
344         if (irqline == TMS7000_INT1_LINE && chip_is_family_70cx2())
346         if (extline == TMS7000_INT1_LINE && chip_is_family_70cx2())
345347            m_timer_capture_latch[1] = m_timer_decrementer[1];
346348         
347349         // clear external if it's edge-triggered (70cx2-only)
348         if (m_io_control[2] & (0x02 << (4 * irqline)))
349            m_irq_state[irqline] = false;
350         if (m_io_control[2] & (0x02 << (4 * extline)))
351            m_irq_state[extline] = false;
350352
351353         check_interrupts();
352354      }
353355   }
354356}
355357
356void tms7000_device::flag_ext_interrupt(int irqline)
358void tms7000_device::flag_ext_interrupt(int extline)
357359{
358   if (irqline != TMS7000_INT1_LINE && irqline != TMS7000_INT3_LINE)
360   if (extline != TMS7000_INT1_LINE && extline != TMS7000_INT3_LINE)
359361      return;
360362
361363   // set/clear for pending external interrupt
362   if (m_irq_state[irqline])
363      m_io_control[0] |= (0x02 << (4 * irqline));
364   if (m_irq_state[extline])
365      m_io_control[0] |= (0x02 << (4 * extline));
364366   else
365      m_io_control[0] &= ~(0x02 << (4 * irqline));
367      m_io_control[0] &= ~(0x02 << (4 * extline));
366368}
367369
368370void tms7000_device::check_interrupts()
r31334r31335
381383      {
382384         // ack
383385         m_io_control[irqline > 2] &= ~(0x02 << shift);
384         
385         flag_ext_interrupt(irqline);
386         if (irqline == 0 || irqline == 2)
387            flag_ext_interrupt(irqline / 2);
388
386389         do_interrupt(irqline);
387390         return;
388391      }
r31334r31335
509512         return m_port_ddr[offset / 2 - 2];
510513
511514      default:
512         logerror("%s: tms7000_pf_r @ $%04x\n", tag(), offset);
515         logerror("'%s' (%04X): tms7000_pf_r @ $%04x\n", tag(), m_pc, offset);
513516         break;
514517   }
515518
r31334r31335
593596         break;
594597
595598      default:
596         logerror("%s: tms7000_pf_w @ $%04x = $%02x\n", tag(), offset, data);
599         logerror("'%s' (%04X): tms7000_pf_w @ $%04x = $%02x\n", tag(), m_pc, offset, data);
597600         break;
598601   }
599602}
trunk/src/emu/cpu/tms7000/tms7000.h
r31334r31335
5757   tms7000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5858   tms7000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal, UINT32 info_flags, const char *shortname, const char *source);
5959
60   DECLARE_READ8_MEMBER(tms7000_unmapped_rf_r) { logerror("%s: unmapped_rf_r @ $%04x\n", tag(), offset + 0x80); return 0; };
61   DECLARE_WRITE8_MEMBER(tms7000_unmapped_rf_w) { logerror("%s: unmapped_rf_w @ $%04x = $%02x\n", tag(), offset + 0x80, data); };
60   DECLARE_READ8_MEMBER(tms7000_unmapped_rf_r) { logerror("'%s' (%04X): unmapped_rf_r @ $%04x\n", tag(), m_pc, offset + 0x80); return 0; };
61   DECLARE_WRITE8_MEMBER(tms7000_unmapped_rf_w) { logerror("'%s' (%04X): unmapped_rf_w @ $%04x = $%02x\n", tag(), m_pc, offset + 0x80, data); };
6262
6363   DECLARE_READ8_MEMBER(tms7000_pf_r);
6464   DECLARE_WRITE8_MEMBER(tms7000_pf_w);
r31334r31335
8383   virtual UINT32 execute_max_cycles() const { return 49; }
8484   virtual UINT32 execute_input_lines() const { return 2; }
8585   virtual void execute_run();
86   virtual void execute_set_input(int irqline, int state);
86   virtual void execute_set_input(int extline, int state);
8787
8888   // device_memory_interface overrides
8989   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); }
r31334r31335
128128   UINT8 m_port_latch[4];
129129   UINT8 m_port_ddr[4];
130130   
131   void flag_ext_interrupt(int irqline);
131   void flag_ext_interrupt(int extline);
132132   void check_interrupts();
133133   void do_interrupt(int irqline);
134134   

Previous 199869 Revisions Next


© 1997-2024 The MAME Team