trunk/src/mess/drivers/tb303.c
| r243592 | r243593 | |
| 13 | 13 | |
| 14 | 14 | #include "emu.h" |
| 15 | 15 | #include "cpu/ucom4/ucom4.h" |
| 16 | | #include "sound/speaker.h" |
| 17 | 16 | |
| 18 | 17 | #include "tb303.lh" |
| 19 | 18 | |
| r243592 | r243593 | |
| 23 | 22 | public: |
| 24 | 23 | tb303_state(const machine_config &mconfig, device_type type, const char *tag) |
| 25 | 24 | : driver_device(mconfig, type, tag), |
| 26 | | m_maincpu(*this, "maincpu") |
| 25 | m_maincpu(*this, "maincpu"), |
| 26 | m_t3_off_timer(*this, "t3_off") |
| 27 | 27 | { } |
| 28 | 28 | |
| 29 | 29 | required_device<cpu_device> m_maincpu; |
| 30 | required_device<timer_device> m_t3_off_timer; |
| 30 | 31 | |
| 32 | TIMER_DEVICE_CALLBACK_MEMBER(t3_clock); |
| 33 | TIMER_DEVICE_CALLBACK_MEMBER(t3_off); |
| 34 | |
| 31 | 35 | virtual void machine_start(); |
| 32 | 36 | }; |
| 33 | 37 | |
| 34 | 38 | |
| 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 | |
| 46 | TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_off) |
| 47 | { |
| 48 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 49 | } |
| 50 | |
| 51 | TIMER_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 | |
| 35 | 60 | static INPUT_PORTS_START( tb303 ) |
| 36 | 61 | INPUT_PORTS_END |
| 37 | 62 | |
| r243592 | r243593 | |
| 51 | 76 | static MACHINE_CONFIG_START( tb303, tb303_state ) |
| 52 | 77 | |
| 53 | 78 | /* 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) |
| 55 | 80 | |
| 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 | |
| 56 | 84 | MCFG_DEFAULT_LAYOUT(layout_tb303) |
| 57 | 85 | |
| 58 | 86 | /* no video! */ |