trunk/src/mess/machine/e05a03.c
| r28717 | r28718 | |
| 19 | 19 | |
| 20 | 20 | e05a03_device::e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 21 | 21 | : device_t(mconfig, E05A03, "E05A03", tag, owner, clock, "e05a03", __FILE__), |
| 22 | m_write_nlq_lp(*this), |
| 23 | m_write_pe_lp(*this), |
| 24 | m_write_reso(*this), |
| 25 | m_write_pe(*this), |
| 26 | m_read_data(*this), |
| 22 | 27 | m_shift(0), |
| 23 | 28 | m_busy_leading(0), |
| 24 | 29 | m_busy_software(0), |
| r28717 | r28718 | |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | //------------------------------------------------- |
| 38 | | // device_config_complete - perform any |
| 39 | | // operations now that the configuration is |
| 40 | | // complete |
| 41 | | //------------------------------------------------- |
| 42 | | |
| 43 | | void e05a03_device::device_config_complete() |
| 44 | | { |
| 45 | | // inherit a copy of the static data |
| 46 | | const e05a03_interface *intf = reinterpret_cast<const e05a03_interface *>(static_config()); |
| 47 | | if (intf != NULL) |
| 48 | | *static_cast<e05a03_interface *>(this) = *intf; |
| 49 | | |
| 50 | | // or initialize to defaults if none provided |
| 51 | | else |
| 52 | | { |
| 53 | | memset(&m_in_data_cb, 0 , sizeof(m_in_data_cb)); |
| 54 | | memset(&m_out_nlq_lp_cb, 0 , sizeof(m_out_nlq_lp_cb)); |
| 55 | | memset(&m_out_pe_lp_cb, 0 , sizeof(m_out_pe_lp_cb)); |
| 56 | | memset(&m_out_pe_cb, 0 , sizeof(m_out_pe_cb)); |
| 57 | | memset(&m_out_reso_cb, 0 , sizeof(m_out_reso_cb)); |
| 58 | | } |
| 59 | | } |
| 60 | | |
| 61 | | //------------------------------------------------- |
| 62 | 43 | // device_start - device-specific startup |
| 63 | 44 | //------------------------------------------------- |
| 64 | 45 | |
| 65 | 46 | void e05a03_device::device_start() |
| 66 | 47 | { |
| 67 | 48 | /* resolve callbacks */ |
| 68 | | m_out_nlq_lp_func.resolve(m_out_nlq_lp_cb, *this); |
| 69 | | m_out_pe_lp_func.resolve(m_out_pe_lp_cb, *this); |
| 70 | | m_out_reso_func.resolve(m_out_reso_cb, *this); |
| 71 | | m_out_pe_func.resolve(m_out_pe_cb, *this); |
| 72 | | m_in_data_func.resolve(m_in_data_cb, *this); |
| 49 | m_write_nlq_lp.resolve_safe(); |
| 50 | m_write_pe_lp.resolve_safe(); |
| 51 | m_write_reso.resolve_safe(); |
| 52 | m_write_pe.resolve_safe(); |
| 53 | m_read_data.resolve_safe(0); |
| 73 | 54 | |
| 74 | 55 | /* register for state saving */ |
| 75 | 56 | save_item(NAME(m_shift)); |
| r28717 | r28718 | |
| 96 | 77 | m_pf_motor = 0x00; |
| 97 | 78 | m_cr_motor = 0x0f; |
| 98 | 79 | |
| 99 | | m_out_pe_func(0); |
| 100 | | m_out_pe_lp_func(1); |
| 80 | m_write_pe(0); |
| 81 | m_write_pe_lp(1); |
| 101 | 82 | |
| 102 | 83 | m_busy_software = 1; |
| 103 | 84 | m_nlqlp = 1; |
| r28717 | r28718 | |
| 127 | 108 | m_nlqlp = BIT(data, 4); |
| 128 | 109 | m_cndlp = BIT(data, 3); |
| 129 | 110 | |
| 130 | | m_out_pe_func(BIT(data, 2)); |
| 131 | | m_out_pe_lp_func(!BIT(data, 2)); |
| 111 | m_write_pe(BIT(data, 2)); |
| 112 | m_write_pe_lp(!BIT(data, 2)); |
| 132 | 113 | |
| 133 | 114 | #if 0 |
| 134 | 115 | m_pe = BIT(data, 2); |
| r28717 | r28718 | |
| 162 | 143 | break; |
| 163 | 144 | |
| 164 | 145 | case 0x02: |
| 165 | | result = m_in_data_func(0); |
| 146 | result = m_read_data(0); |
| 166 | 147 | break; |
| 167 | 148 | |
| 168 | 149 | case 0x03: |
| r28717 | r28718 | |
| 198 | 179 | if (!state) |
| 199 | 180 | { |
| 200 | 181 | device_reset(); |
| 201 | | m_out_reso_func(1); |
| 182 | m_write_reso(1); |
| 202 | 183 | } |
| 203 | 184 | } |
| 204 | 185 | |
trunk/src/mess/machine/e05a03.h
| r28717 | r28718 | |
| 10 | 10 | #ifndef __E05A03_H__ |
| 11 | 11 | #define __E05A03_H__ |
| 12 | 12 | |
| 13 | | |
| 14 | 13 | /*************************************************************************** |
| 15 | | TYPE DEFINITIONS |
| 14 | DEVICE CONFIGURATION MACROS |
| 16 | 15 | ***************************************************************************/ |
| 17 | 16 | |
| 18 | | struct e05a03_interface |
| 19 | | { |
| 20 | | devcb_read8 m_in_data_cb; |
| 17 | #define MCFG_E05A03_NLQ_LP_CALLBACK(_write) \ |
| 18 | devcb = &e05a03_device::set_nlq_lp_wr_callback(*device, DEVCB2_##_write); |
| 21 | 19 | |
| 22 | | devcb_write_line m_out_nlq_lp_cb; |
| 23 | | devcb_write_line m_out_pe_lp_cb; |
| 24 | | devcb_write_line m_out_pe_cb; |
| 25 | | devcb_write_line m_out_reso_cb; |
| 26 | | }; |
| 20 | #define MCFG_E05A03_PE_LP_CALLBACK(_write) \ |
| 21 | devcb = &e05a03_device::set_pe_lp_wr_callback(*device, DEVCB2_##_write); |
| 27 | 22 | |
| 23 | #define MCFG_E05A03_RESO_CALLBACK(_write) \ |
| 24 | devcb = &e05a03_device::set_reso_wr_callback(*device, DEVCB2_##_write); |
| 28 | 25 | |
| 26 | #define MCFG_E05A03_PE_CALLBACK(_write) \ |
| 27 | devcb = &e05a03_device::set_pe_wr_callback(*device, DEVCB2_##_write); |
| 28 | |
| 29 | #define MCFG_E05A03_DATA_CALLBACK(_read) \ |
| 30 | devcb = &e05a03_device::set_data_rd_callback(*device, DEVCB2_##_read); |
| 31 | |
| 32 | |
| 29 | 33 | /*************************************************************************** |
| 30 | | DEVICE CONFIGURATION MACROS |
| 34 | TYPE DEFINITIONS |
| 31 | 35 | ***************************************************************************/ |
| 32 | 36 | |
| 33 | | class e05a03_device : public device_t, |
| 34 | | public e05a03_interface |
| 37 | class e05a03_device : public device_t |
| 35 | 38 | { |
| 36 | 39 | public: |
| 37 | 40 | e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 38 | 41 | ~e05a03_device() {} |
| 39 | 42 | |
| 43 | template<class _Object> static devcb2_base &set_nlq_lp_wr_callback(device_t &device, _Object object) { return downcast<e05a03_device &>(device).m_write_nlq_lp.set_callback(object); } |
| 44 | template<class _Object> static devcb2_base &set_pe_lp_wr_callback(device_t &device, _Object object) { return downcast<e05a03_device &>(device).m_write_pe_lp.set_callback(object); } |
| 45 | template<class _Object> static devcb2_base &set_reso_wr_callback(device_t &device, _Object object) { return downcast<e05a03_device &>(device).m_write_reso.set_callback(object); } |
| 46 | template<class _Object> static devcb2_base &set_pe_wr_callback(device_t &device, _Object object) { return downcast<e05a03_device &>(device).m_write_pe.set_callback(object); } |
| 47 | template<class _Object> static devcb2_base &set_data_rd_callback(device_t &device, _Object object) { return downcast<e05a03_device &>(device).m_read_data.set_callback(object); } |
| 48 | |
| 40 | 49 | DECLARE_WRITE8_MEMBER( write ); |
| 41 | 50 | DECLARE_READ8_MEMBER( read ); |
| 42 | 51 | |
| r28717 | r28718 | |
| 49 | 58 | |
| 50 | 59 | protected: |
| 51 | 60 | // device-level overrides |
| 52 | | virtual void device_config_complete(); |
| 53 | 61 | virtual void device_start(); |
| 54 | 62 | virtual void device_reset(); |
| 55 | 63 | |
| 56 | 64 | private: |
| 57 | 65 | // internal state |
| 66 | /* callbacks */ |
| 67 | devcb2_write_line m_write_nlq_lp; /* pin 2, nlq lamp output */ |
| 68 | devcb2_write_line m_write_pe_lp; /* pin 3, paper empty lamp output */ |
| 69 | devcb2_write_line m_write_reso; /* pin 25, reset output */ |
| 70 | devcb2_write_line m_write_pe; /* pin 35, centronics pe output */ |
| 71 | devcb2_read8 m_read_data; /* pin 47-54, centronics data input */ |
| 58 | 72 | |
| 59 | 73 | /* 24-bit shift register, port 0x00, 0x01 and 0x02 */ |
| 60 | 74 | UINT32 m_shift; |
| r28717 | r28718 | |
| 78 | 92 | |
| 79 | 93 | /* port 0x07 (4-bit) */ |
| 80 | 94 | UINT8 m_cr_motor; |
| 81 | | |
| 82 | | /* callbacks */ |
| 83 | | devcb_resolved_write_line m_out_nlq_lp_func; /* pin 2, nlq lamp output */ |
| 84 | | devcb_resolved_write_line m_out_pe_lp_func; /* pin 3, paper empty lamp output */ |
| 85 | | devcb_resolved_write_line m_out_reso_func; /* pin 25, reset output */ |
| 86 | | devcb_resolved_write_line m_out_pe_func; /* pin 35, centronics pe output */ |
| 87 | | devcb_resolved_read8 m_in_data_func; /* pin 47-54, centronics data input */ |
| 88 | 95 | }; |
| 89 | 96 | |
| 90 | 97 | extern const device_type E05A03; |
| 91 | 98 | |
| 92 | 99 | |
| 93 | | #define MCFG_E05A03_ADD(_tag, _intf) \ |
| 94 | | MCFG_DEVICE_ADD(_tag, E05A03, 0) \ |
| 95 | | MCFG_DEVICE_CONFIG(_intf) |
| 96 | | |
| 97 | | |
| 98 | 100 | #endif /* __E05A03_H__ */ |
trunk/src/mess/drivers/lx800.c
| r28717 | r28718 | |
| 244 | 244 | MACHINE DRIVERS |
| 245 | 245 | ***************************************************************************/ |
| 246 | 246 | |
| 247 | | static const e05a03_interface lx800_e05a03_intf = |
| 248 | | { |
| 249 | | DEVCB_DRIVER_MEMBER(lx800_state, lx800_centronics_data_r), |
| 250 | | DEVCB_NULL, |
| 251 | | DEVCB_DRIVER_LINE_MEMBER(lx800_state, lx800_paperempty_led_w), |
| 252 | | DEVCB_DRIVER_LINE_MEMBER(lx800_state, lx800_centronics_pe_w), |
| 253 | | DEVCB_DRIVER_LINE_MEMBER(lx800_state, lx800_reset_w) |
| 254 | | }; |
| 255 | | |
| 256 | 247 | static MACHINE_CONFIG_START( lx800, lx800_state ) |
| 257 | 248 | /* basic machine hardware */ |
| 258 | 249 | MCFG_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz) |
| 259 | 250 | MCFG_CPU_PROGRAM_MAP(lx800_mem) |
| 260 | 251 | MCFG_CPU_IO_MAP(lx800_io) |
| 261 | 252 | |
| 262 | | |
| 263 | 253 | MCFG_DEFAULT_LAYOUT(layout_lx800) |
| 264 | 254 | |
| 265 | 255 | /* audio hardware */ |
| r28717 | r28718 | |
| 268 | 258 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 269 | 259 | |
| 270 | 260 | /* gate array */ |
| 271 | | MCFG_E05A03_ADD("ic3b", lx800_e05a03_intf) |
| 261 | MCFG_DEVICE_ADD("ic3b", E05A03, 0) |
| 262 | MCFG_E05A03_PE_LP_CALLBACK(WRITELINE(lx800_state, lx800_paperempty_led_w)) |
| 263 | MCFG_E05A03_RESO_CALLBACK(WRITELINE(lx800_state, lx800_reset_w)) |
| 264 | MCFG_E05A03_PE_CALLBACK(WRITELINE(lx800_state, lx800_centronics_pe_w)) |
| 265 | MCFG_E05A03_DATA_CALLBACK(READ8(lx800_state, lx800_centronics_data_r)) |
| 272 | 266 | MACHINE_CONFIG_END |
| 273 | 267 | |
| 274 | 268 | |