Previous 199869 Revisions Next

r28762 Thursday 20th March, 2014 at 17:52:18 UTC by Osso
Converted crt9021_device to devcb2 (nw)
[src/emu/video]crt9021.c crt9021.h
[src/mess/drivers]tandy2k.c

trunk/src/emu/video/crt9021.c
r28761r28762
8585
8686crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
8787   : device_t(mconfig, CRT9021, "SMC CRT9021", tag, owner, clock, "crt9021", __FILE__),
88      device_video_interface(mconfig, *this)
88      device_video_interface(mconfig, *this),
89      m_in_data_cb(*this),
90      m_in_attr_cb(*this),
91      m_in_atten_cb(*this)
8992{
9093}
9194
9295
9396//-------------------------------------------------
94//  device_config_complete - perform any
95//  operations now that the configuration is
96//  complete
97//-------------------------------------------------
98
99void crt9021_device::device_config_complete()
100{
101   // inherit a copy of the static data
102   const crt9021_interface *intf = reinterpret_cast<const crt9021_interface *>(static_config());
103   if (intf != NULL)
104      *static_cast<crt9021_interface *>(this) = *intf;
105
106   // or initialize to defaults if none provided
107   else
108   {
109      memset(&in_data_cb, 0, sizeof(in_data_cb));
110      memset(&in_attr_cb, 0, sizeof(in_attr_cb));
111      memset(&in_atten_cb, 0, sizeof(in_atten_cb));
112   }
113}
114
115
116//-------------------------------------------------
11797//  device_start - device-specific startup
11898//-------------------------------------------------
11999
r28761r28762
122102   // allocate timers
123103
124104   // resolve callbacks
125   m_in_data_func.resolve(in_data_cb, *this);
126   m_in_attr_func.resolve(in_attr_cb, *this);
127   m_in_atten_func.resolve(in_atten_cb, *this);
105   m_in_data_cb.resolve_safe(0);
106   m_in_attr_cb.resolve_safe(0);
107   m_in_atten_cb.resolve_safe(0);
128108
129109   // register for state saving
130110   save_item(NAME(m_slg));
trunk/src/emu/video/crt9021.h
r28761r28762
4646//  INTERFACE CONFIGURATION MACROS
4747//**************************************************************************
4848
49#define MCFG_CRT9021_ADD(_tag, _clock, _config) \
50   MCFG_DEVICE_ADD(_tag, CRT9021, _clock) \
51   MCFG_DEVICE_CONFIG(_config)
49#define MCFG_CRT9021_IN_DATA_CB(_devcb) \
50   devcb = &crt9021_device::set_in_data_callback(*device, DEVCB2_##_devcb);
5251
52#define MCFG_CRT9021_IN_ATTR_CB(_devcb) \
53   devcb = &crt9021_device::set_in_attr_callback(*device, DEVCB2_##_devcb);
5354
54#define CRT9021_INTERFACE(name) \
55   const crt9021_interface (name) =
55#define MCFG_CRT9021_IN_ATTEN_CB(_devcb) \
56   devcb = &crt9021_device::set_in_atten_callback(*device, DEVCB2_##_devcb);   
5657
57
58
5958//**************************************************************************
6059//  TYPE DEFINITIONS
6160//**************************************************************************
6261
63
64// ======================> crt9021_interface
65
66struct crt9021_interface
67{
68   devcb_read8             in_data_cb;
69   devcb_read8             in_attr_cb;
70
71   devcb_read_line         in_atten_cb;
72};
73
74
75
7662// ======================> crt9021_device
7763
7864class crt9021_device :  public device_t,
79                  public device_video_interface,
80                  public crt9021_interface
65                  public device_video_interface
8166{
8267public:
8368   // construction/destruction
8469   crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
70   
71   template<class _Object> static devcb2_base &set_in_data_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_data_cb.set_callback(object); }
72   template<class _Object> static devcb2_base &set_in_attr_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_attr_cb.set_callback(object); }
73   template<class _Object> static devcb2_base &set_in_atten_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_atten_cb.set_callback(object); }
8574
8675   DECLARE_WRITE_LINE_MEMBER( slg_w );
8776   DECLARE_WRITE_LINE_MEMBER( sld_w );
r28761r28762
9382
9483protected:
9584   // device-level overrides
96   virtual void device_config_complete();
9785   virtual void device_start();
9886   virtual void device_clock_changed();
9987   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
10088
10189private:
102   devcb_resolved_read8            m_in_data_func;
103   devcb_resolved_read8            m_in_attr_func;
104   devcb_resolved_read_line        m_in_atten_func;
90   devcb2_read8             m_in_data_cb;
91   devcb2_read8             m_in_attr_cb;
10592
93   devcb2_read_line         m_in_atten_cb;
94
10695   int m_slg;
10796   int m_sld;
10897   int m_cursor;
trunk/src/mess/drivers/tandy2k.c
r28761r28762
368368   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD
369369};
370370
371static CRT9021_INTERFACE( vac_intf )
372{
373   DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data
374   DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes
375   DEVCB_LINE_VCC // ATTEN
376};
377
378371// Intel 8251A Interface
379372
380373WRITE_LINE_MEMBER( tandy2k_state::rxrdy_w )
r28761r28762
653646   MCFG_CRT9212_IN_REN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, vlt_r)) // REN
654647   MCFG_CRT9212_IN_WEN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, wben_r)) // WEN
655648   MCFG_CRT9212_IN_WEN2_CB(VCC) // WEN2
656   MCFG_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16/8, vac_intf)
649   MCFG_DEVICE_ADD(CRT9021B_TAG, CRT9021, XTAL_16MHz*28/16/8)
650   MCFG_CRT9021_IN_DATA_CB(DEVREAD8(CRT9212_0_TAG, crt9212_device, read)) // data
651   MCFG_CRT9021_IN_ATTR_CB(DEVREAD8(CRT9212_1_TAG, crt9212_device, read)) // attributes
652   MCFG_CRT9021_IN_ATTEN_CB(VCC)
657653   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
658654
659655   // sound hardware

Previous 199869 Revisions Next


© 1997-2024 The MAME Team