Previous 199869 Revisions Next

r28718 Wednesday 19th March, 2014 at 13:25:12 UTC by Curt Coder
(MESS) e05a03: devcb2. (nw)
[src/mess/drivers]lx800.c
[src/mess/machine]e05a03.c e05a03.h

trunk/src/mess/machine/e05a03.c
r28717r28718
1919
2020e05a03_device::e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2121   : 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),
2227   m_shift(0),
2328   m_busy_leading(0),
2429   m_busy_software(0),
r28717r28718
3540}
3641
3742//-------------------------------------------------
38//  device_config_complete - perform any
39//  operations now that the configuration is
40//  complete
41//-------------------------------------------------
42
43void 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//-------------------------------------------------
6243//  device_start - device-specific startup
6344//-------------------------------------------------
6445
6546void e05a03_device::device_start()
6647{
6748   /* 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);
7354
7455   /* register for state saving */
7556   save_item(NAME(m_shift));
r28717r28718
9677   m_pf_motor = 0x00;
9778   m_cr_motor = 0x0f;
9879
99   m_out_pe_func(0);
100   m_out_pe_lp_func(1);
80   m_write_pe(0);
81   m_write_pe_lp(1);
10182
10283   m_busy_software = 1;
10384   m_nlqlp = 1;
r28717r28718
127108      m_nlqlp = BIT(data, 4);
128109      m_cndlp = BIT(data, 3);
129110
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));
132113
133114#if 0
134115      m_pe = BIT(data, 2);
r28717r28718
162143      break;
163144
164145   case 0x02:
165      result = m_in_data_func(0);
146      result = m_read_data(0);
166147      break;
167148
168149   case 0x03:
r28717r28718
198179   if (!state)
199180   {
200181      device_reset();
201      m_out_reso_func(1);
182      m_write_reso(1);
202183   }
203184}
204185
trunk/src/mess/machine/e05a03.h
r28717r28718
1010#ifndef __E05A03_H__
1111#define __E05A03_H__
1212
13
1413/***************************************************************************
15    TYPE DEFINITIONS
14    DEVICE CONFIGURATION MACROS
1615***************************************************************************/
1716
18struct 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);
2119
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);
2722
23#define MCFG_E05A03_RESO_CALLBACK(_write) \
24   devcb = &e05a03_device::set_reso_wr_callback(*device, DEVCB2_##_write);
2825
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
2933/***************************************************************************
30    DEVICE CONFIGURATION MACROS
34    TYPE DEFINITIONS
3135***************************************************************************/
3236
33class e05a03_device : public device_t,
34                        public e05a03_interface
37class e05a03_device : public device_t
3538{
3639public:
3740   e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3841   ~e05a03_device() {}
3942
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
4049   DECLARE_WRITE8_MEMBER( write );
4150   DECLARE_READ8_MEMBER( read );
4251
r28717r28718
4958
5059protected:
5160   // device-level overrides
52   virtual void device_config_complete();
5361   virtual void device_start();
5462   virtual void device_reset();
5563
5664private:
5765   // 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 */
5872
5973   /* 24-bit shift register, port 0x00, 0x01 and 0x02 */
6074   UINT32 m_shift;
r28717r28718
7892
7993   /* port 0x07 (4-bit) */
8094   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 */
8895};
8996
9097extern const device_type E05A03;
9198
9299
93#define MCFG_E05A03_ADD(_tag, _intf) \
94   MCFG_DEVICE_ADD(_tag, E05A03, 0) \
95   MCFG_DEVICE_CONFIG(_intf)
96
97
98100#endif /* __E05A03_H__ */
trunk/src/mess/drivers/lx800.c
r28717r28718
244244    MACHINE DRIVERS
245245***************************************************************************/
246246
247static 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
256247static MACHINE_CONFIG_START( lx800, lx800_state )
257248   /* basic machine hardware */
258249   MCFG_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)
259250   MCFG_CPU_PROGRAM_MAP(lx800_mem)
260251   MCFG_CPU_IO_MAP(lx800_io)
261252
262
263253   MCFG_DEFAULT_LAYOUT(layout_lx800)
264254
265255   /* audio hardware */
r28717r28718
268258   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
269259
270260   /* 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))
272266MACHINE_CONFIG_END
273267
274268

Previous 199869 Revisions Next


© 1997-2024 The MAME Team