trunk/src/emu/diserial.c
| r26766 | r26767 | |
| 470 | 470 | /* let a know the state of b */ |
| 471 | 471 | other_connection->serial_connection_out(); |
| 472 | 472 | } |
| 473 | | |
| 474 | | |
| 475 | | |
| 476 | | const device_type SERIAL_SOURCE = &device_creator<serial_source_device>; |
| 477 | | |
| 478 | | //------------------------------------------------- |
| 479 | | // serial_source_device - constructor |
| 480 | | //------------------------------------------------- |
| 481 | | |
| 482 | | serial_source_device::serial_source_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 483 | | : device_t(mconfig, SERIAL_SOURCE, "Serial source", tag, owner, clock, "serial_source", __FILE__), |
| 484 | | device_serial_interface(mconfig, *this) |
| 485 | | { |
| 486 | | } |
| 487 | | |
| 488 | | void serial_source_device::device_start() |
| 489 | | { |
| 490 | | } |
| 491 | | |
| 492 | | void serial_source_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 493 | | { |
| 494 | | device_serial_interface::device_timer(timer, id, param, ptr); |
| 495 | | } |
| 496 | | |
| 497 | | void serial_source_device::input_callback(UINT8 state) |
| 498 | | { |
| 499 | | m_input_state = state; |
| 500 | | } |
| 501 | | |
| 502 | | void serial_source_device::send_bit(UINT8 data) |
| 503 | | { |
| 504 | | set_out_data_bit(data); |
| 505 | | serial_connection_out(); |
| 506 | | } |
trunk/src/emu/diserial.h
| r26766 | r26767 | |
| 157 | 157 | void rcv_edge(); |
| 158 | 158 | }; |
| 159 | 159 | |
| 160 | | |
| 161 | | class serial_source_device : public device_t, |
| 162 | | public device_serial_interface |
| 163 | | { |
| 164 | | public: |
| 165 | | // construction/destruction |
| 166 | | serial_source_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 167 | | |
| 168 | | virtual void input_callback(UINT8 state); |
| 169 | | void send_bit(UINT8 data); |
| 170 | | protected: |
| 171 | | // device-level overrides |
| 172 | | virtual void device_start(); |
| 173 | | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 174 | | }; |
| 175 | | |
| 176 | | extern const device_type SERIAL_SOURCE; |
| 177 | | |
| 178 | | #define MCFG_SERIAL_SOURCE_ADD(_tag) \ |
| 179 | | MCFG_DEVICE_ADD((_tag), SERIAL_SOURCE, 0) |
| 180 | | |
| 181 | 160 | #endif /* __DISERIAL_H__ */ |