trunk/src/mame/drivers/tb303.cpp
r253184 | r253185 | |
23 | 23 | { |
24 | 24 | public: |
25 | 25 | 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) |
28 | 27 | { } |
29 | 28 | |
30 | | required_device<timer_device> m_tp3_off_timer; |
31 | | |
32 | 29 | UINT8 m_ram[0xc00]; |
33 | 30 | UINT16 m_ram_address; |
34 | 31 | bool m_ram_ce; |
r253184 | r253185 | |
43 | 40 | DECLARE_READ8_MEMBER(input_r); |
44 | 41 | void update_leds(); |
45 | 42 | |
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); } |
48 | 45 | |
49 | 46 | virtual void machine_start() override; |
50 | 47 | }; |
51 | 48 | |
52 | | |
53 | | /*************************************************************************** |
54 | | |
55 | | Timer/Interrupt |
56 | | |
57 | | ***************************************************************************/ |
58 | | |
59 | 49 | // 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 |
61 | 51 | |
62 | 52 | // 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) |
65 | 55 | |
66 | | TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::tp3_off) |
67 | | { |
68 | | m_maincpu->set_input_line(0, CLEAR_LINE); |
69 | | } |
70 | 56 | |
71 | | TIMER_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 | | |
79 | 57 | /*************************************************************************** |
80 | 58 | |
81 | 59 | I/O |
r253184 | r253185 | |
270 | 248 | static MACHINE_CONFIG_START( tb303, tb303_state ) |
271 | 249 | |
272 | 250 | /* basic machine hardware */ |
273 | | MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ) |
| 251 | MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ) |
274 | 252 | MCFG_UCOM4_READ_A_CB(READ8(tb303_state, input_r)) |
275 | 253 | MCFG_UCOM4_READ_B_CB(READ8(tb303_state, input_r)) |
276 | 254 | MCFG_UCOM4_READ_C_CB(READ8(tb303_state, ram_r)) |
r253184 | r253185 | |
282 | 260 | MCFG_UCOM4_WRITE_H_CB(WRITE8(tb303_state, switch_w)) |
283 | 261 | MCFG_UCOM4_WRITE_I_CB(WRITE8(tb303_state, strobe_w)) |
284 | 262 | |
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) |
288 | 266 | |
289 | 267 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) |
290 | 268 | MCFG_DEFAULT_LAYOUT(layout_tb303) |
trunk/src/mame/drivers/tr606.cpp
r253184 | r253185 | |
23 | 23 | { |
24 | 24 | public: |
25 | 25 | 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) |
28 | 27 | { } |
29 | 28 | |
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); } |
31 | 31 | |
32 | | TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock); |
33 | | TIMER_DEVICE_CALLBACK_MEMBER(tp3_off); |
34 | | |
35 | 32 | virtual void machine_start() override; |
36 | 33 | }; |
37 | 34 | |
38 | | |
39 | | /*************************************************************************** |
40 | | |
41 | | Timer/Interrupt |
42 | | |
43 | | ***************************************************************************/ |
44 | | |
45 | 35 | // 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 |
47 | 37 | |
| 38 | // MCU interrupt timing is same as in TB303 |
48 | 39 | // 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) |
51 | 42 | |
52 | | TIMER_DEVICE_CALLBACK_MEMBER(tr606_state::tp3_off) |
53 | | { |
54 | | m_maincpu->set_input_line(0, CLEAR_LINE); |
55 | | } |
56 | 43 | |
57 | | TIMER_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 | | |
65 | 44 | /*************************************************************************** |
66 | 45 | |
67 | 46 | I/O |
r253184 | r253185 | |
100 | 79 | static MACHINE_CONFIG_START( tr606, tr606_state ) |
101 | 80 | |
102 | 81 | /* basic machine hardware */ |
103 | | MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ) |
| 82 | MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ) |
104 | 83 | |
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) |
108 | 87 | |
109 | 88 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) |
110 | 89 | MCFG_DEFAULT_LAYOUT(layout_tr606) |