Previous 199869 Revisions Next

r35081 Monday 16th February, 2015 at 22:52:44 UTC by hap
added interrupt timer
[src/mess/drivers]tb303.c

trunk/src/mess/drivers/tb303.c
r243592r243593
1313
1414#include "emu.h"
1515#include "cpu/ucom4/ucom4.h"
16#include "sound/speaker.h"
1716
1817#include "tb303.lh"
1918
r243592r243593
2322public:
2423   tb303_state(const machine_config &mconfig, device_type type, const char *tag)
2524      : driver_device(mconfig, type, tag),
26      m_maincpu(*this, "maincpu")
25      m_maincpu(*this, "maincpu"),
26      m_t3_off_timer(*this, "t3_off")
2727   { }
2828
2929   required_device<cpu_device> m_maincpu;
30   required_device<timer_device> m_t3_off_timer;
3031
32   TIMER_DEVICE_CALLBACK_MEMBER(t3_clock);
33   TIMER_DEVICE_CALLBACK_MEMBER(t3_off);
34
3135   virtual void machine_start();
3236};
3337
3438
39// T2 to MCU CLK: LC circuit, stable sine wave, 2.2us interval
40#define TB303_T2_CLOCK_HZ   454545 /* in hz */
41
42// T3 to MCU _INT: square wave, 1.8ms interval, short duty cycle
43#define TB303_T3_CLOCK      attotime::from_usec(1800)
44#define TB303_T3_OFF        (TB303_T3_CLOCK / 8)
45
46TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_off)
47{
48   m_maincpu->set_input_line(0, CLEAR_LINE);
49}
50
51TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_clock)
52{
53   m_maincpu->set_input_line(0, ASSERT_LINE);
54   m_t3_off_timer->adjust(TB303_T3_OFF);
55}
56
57
58
59
3560static INPUT_PORTS_START( tb303 )
3661INPUT_PORTS_END
3762
r243592r243593
5176static MACHINE_CONFIG_START( tb303, tb303_state )
5277
5378   /* basic machine hardware */
54   MCFG_CPU_ADD("maincpu", NEC_D650, 454545) // LC circuit, 2.2us pulse interval
79   MCFG_CPU_ADD("maincpu", NEC_D650, TB303_T2_CLOCK_HZ)
5580
81   MCFG_TIMER_DRIVER_ADD_PERIODIC("t3_clock", tb303_state, t3_clock, TB303_T3_CLOCK)
82   MCFG_TIMER_DRIVER_ADD("t3_off", tb303_state, t3_off)
83
5684   MCFG_DEFAULT_LAYOUT(layout_tb303)
5785
5886   /* no video! */


Previous 199869 Revisions Next


© 1997-2024 The MAME Team