Previous 199869 Revisions Next

r44673 Thursday 4th February, 2016 at 19:35:06 UTC by hap
tb303/tr606: simplified interrupt timing
[src/mame/drivers]tb303.cpp tr606.cpp

trunk/src/mame/drivers/tb303.cpp
r253184r253185
2323{
2424public:
2525   tb303_state(const machine_config &mconfig, device_type type, const char *tag)
26      : hh_ucom4_state(mconfig, type, tag),
27      m_tp3_off_timer(*this, "tp3_off")
26      : hh_ucom4_state(mconfig, type, tag)
2827   { }
2928
30   required_device<timer_device> m_tp3_off_timer;
31
3229   UINT8 m_ram[0xc00];
3330   UINT16 m_ram_address;
3431   bool m_ram_ce;
r253184r253185
4340   DECLARE_READ8_MEMBER(input_r);
4441   void update_leds();
4542
46   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock);
47   TIMER_DEVICE_CALLBACK_MEMBER(tp3_off);
43   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock) { m_maincpu->set_input_line(0, ASSERT_LINE); }
44   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clear) { m_maincpu->set_input_line(0, CLEAR_LINE); }
4845
4946   virtual void machine_start() override;
5047};
5148
52
53/***************************************************************************
54
55  Timer/Interrupt
56
57***************************************************************************/
58
5949// TP2 to MCU CLK: LC circuit(TI S74230), stable sine wave, 2.2us interval
60#define TP2_CLOCK_HZ    454545 /* in hz */
50#define TP2_HZ      454545
6151
6252// TP3 to MCU _INT: square wave, 1.8ms interval, short duty cycle
63#define TP3_CLOCK       attotime::from_usec(1800)
64#define TP3_OFF         (TP3_CLOCK / 8)
53#define TP3_PERIOD  attotime::from_usec(1800)
54#define TP3_LOW     (TP3_PERIOD / 8)
6555
66TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::tp3_off)
67{
68   m_maincpu->set_input_line(0, CLEAR_LINE);
69}
7056
71TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::tp3_clock)
72{
73   m_maincpu->set_input_line(0, ASSERT_LINE);
74   m_tp3_off_timer->adjust(TP3_OFF);
75}
76
77
78
7957/***************************************************************************
8058
8159  I/O
r253184r253185
270248static MACHINE_CONFIG_START( tb303, tb303_state )
271249
272250   /* basic machine hardware */
273   MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ)
251   MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ)
274252   MCFG_UCOM4_READ_A_CB(READ8(tb303_state, input_r))
275253   MCFG_UCOM4_READ_B_CB(READ8(tb303_state, input_r))
276254   MCFG_UCOM4_READ_C_CB(READ8(tb303_state, ram_r))
r253184r253185
282260   MCFG_UCOM4_WRITE_H_CB(WRITE8(tb303_state, switch_w))
283261   MCFG_UCOM4_WRITE_I_CB(WRITE8(tb303_state, strobe_w))
284262
285   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tb303_state, tp3_clock, TP3_CLOCK)
286   MCFG_TIMER_START_DELAY(TP3_CLOCK)
287   MCFG_TIMER_DRIVER_ADD("tp3_off", tb303_state, tp3_off)
263   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tb303_state, tp3_clock, TP3_PERIOD)
264   MCFG_TIMER_START_DELAY(TP3_PERIOD - TP3_LOW)
265   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clear", tb303_state, tp3_clear, TP3_PERIOD)
288266
289267   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
290268   MCFG_DEFAULT_LAYOUT(layout_tb303)
trunk/src/mame/drivers/tr606.cpp
r253184r253185
2323{
2424public:
2525   tr606_state(const machine_config &mconfig, device_type type, const char *tag)
26      : hh_ucom4_state(mconfig, type, tag),
27      m_tp3_off_timer(*this, "tp3_off")
26      : hh_ucom4_state(mconfig, type, tag)
2827   { }
2928
30   required_device<timer_device> m_tp3_off_timer;
29   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock) { m_maincpu->set_input_line(0, ASSERT_LINE); }
30   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clear) { m_maincpu->set_input_line(0, CLEAR_LINE); }
3131
32   TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock);
33   TIMER_DEVICE_CALLBACK_MEMBER(tp3_off);
34
3532   virtual void machine_start() override;
3633};
3734
38
39/***************************************************************************
40
41  Timer/Interrupt
42
43***************************************************************************/
44
4535// TP2 to MCU CLK: LC circuit(TI S74230), stable sine wave, 2.2us interval
46#define TP2_CLOCK_HZ    454545 /* in hz */
36#define TP2_HZ      454545
4737
38// MCU interrupt timing is same as in TB303
4839// TP3 to MCU _INT: square wave, 1.8ms interval, short duty cycle
49#define TP3_CLOCK       attotime::from_usec(1800)
50#define TP3_OFF         (TP3_CLOCK / 8)
40#define TP3_PERIOD  attotime::from_usec(1800)
41#define TP3_LOW     (TP3_PERIOD / 8)
5142
52TIMER_DEVICE_CALLBACK_MEMBER(tr606_state::tp3_off)
53{
54   m_maincpu->set_input_line(0, CLEAR_LINE);
55}
5643
57TIMER_DEVICE_CALLBACK_MEMBER(tr606_state::tp3_clock)
58{
59   m_maincpu->set_input_line(0, ASSERT_LINE);
60   m_tp3_off_timer->adjust(TP3_OFF);
61}
62
63
64
6544/***************************************************************************
6645
6746  I/O
r253184r253185
10079static MACHINE_CONFIG_START( tr606, tr606_state )
10180
10281   /* basic machine hardware */
103   MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ)
82   MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ)
10483
105   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tr606_state, tp3_clock, TP3_CLOCK)
106   MCFG_TIMER_START_DELAY(TP3_CLOCK)
107   MCFG_TIMER_DRIVER_ADD("tp3_off", tr606_state, tp3_off)
84   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tr606_state, tp3_clock, TP3_PERIOD)
85   MCFG_TIMER_START_DELAY(TP3_PERIOD - TP3_LOW)
86   MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clear", tr606_state, tp3_clear, TP3_PERIOD)
10887
10988   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
11089   MCFG_DEFAULT_LAYOUT(layout_tr606)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team