Previous 199869 Revisions Next

r28761 Thursday 20th March, 2014 at 17:47:52 UTC by Osso
Converted crt9212_device to devcb2 (nw)
[src/emu/video]crt9212.c crt9212.h
[src/mess/drivers]tandy2k.c

trunk/src/emu/video/crt9212.c
r28760r28761
2222
2323
2424#define REN \
25   m_in_ren_func()
25   m_in_ren_cb()
2626
2727#define WEN \
28   m_in_wen_func()
28   m_in_wen_cb()
2929
3030#define WEN2 \
31   m_in_wen2_func()
31   m_in_wen2_cb()
3232
3333#define ROF(_state) \
34   m_out_rof_func(_state);
34   m_out_rof_cb(_state);
3535
3636#define WOF(_state) \
37   m_out_wof_func(_state);
37   m_out_wof_cb(_state);
3838
3939
4040
r28760r28761
5555//-------------------------------------------------
5656
5757crt9212_device::crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
58   : device_t(mconfig, CRT9212, "SMC CRT9212", tag, owner, clock, "crt9212", __FILE__)
58   : device_t(mconfig, CRT9212, "SMC CRT9212", tag, owner, clock, "crt9212", __FILE__),
59      m_out_rof_cb(*this),
60      m_out_wof_cb(*this),
61      m_in_ren_cb(*this),
62      m_in_wen_cb(*this),
63      m_in_wen2_cb(*this)
5964{
6065}
6166
62
6367//-------------------------------------------------
64//  device_config_complete - perform any
65//  operations now that the configuration is
66//  complete
67//-------------------------------------------------
68
69void crt9212_device::device_config_complete()
70{
71   // inherit a copy of the static data
72   const crt9212_interface *intf = reinterpret_cast<const crt9212_interface *>(static_config());
73   if (intf != NULL)
74      *static_cast<crt9212_interface *>(this) = *intf;
75
76   // or initialize to defaults if none provided
77   else
78   {
79      memset(&m_out_rof_cb, 0, sizeof(m_out_rof_cb));
80      memset(&m_out_wof_cb, 0, sizeof(m_out_wof_cb));
81      memset(&m_in_ren_cb, 0, sizeof(m_in_ren_cb));
82      memset(&m_in_wen_cb, 0, sizeof(m_in_wen_cb));
83      memset(&m_in_wen2_cb, 0, sizeof(m_in_wen2_cb));
84   }
85}
86
87
88//-------------------------------------------------
8968//  device_start - device-specific startup
9069//-------------------------------------------------
9170
9271void crt9212_device::device_start()
9372{
9473   // resolve callbacks
95   m_out_rof_func.resolve(m_out_rof_cb, *this);
96   m_out_wof_func.resolve(m_out_wof_cb, *this);
97   m_in_ren_func.resolve(m_in_ren_cb, *this);
98   m_in_wen_func.resolve(m_in_wen_cb, *this);
99   m_in_wen2_func.resolve(m_in_wen2_cb, *this);
74   m_out_rof_cb.resolve_safe();
75   m_out_wof_cb.resolve_safe();
76   m_in_ren_cb.resolve_safe(0);
77   m_in_wen_cb.resolve_safe(0);
78   m_in_wen2_cb.resolve_safe(0);
10079
10180   // register for state saving
10281   save_item(NAME(m_input));
trunk/src/emu/video/crt9212.h
r28760r28761
4747//  INTERFACE CONFIGURATION MACROS
4848//**************************************************************************
4949
50#define MCFG_CRT9212_ADD(_tag, _config) \
51   MCFG_DEVICE_ADD(_tag, CRT9212, 0) \
52   MCFG_DEVICE_CONFIG(_config)
50#define MCFG_CRT9212_OUT_ROF_CB(_devcb) \
51   devcb = &crt9212_device::set_out_rof_callback(*device, DEVCB2_##_devcb);
5352
53#define MCFG_CRT9212_OUT_WOF_CB(_devcb) \
54   devcb = &crt9212_device::set_out_wof_callback(*device, DEVCB2_##_devcb);
55   
56#define MCFG_CRT9212_IN_REN_CB(_devcb) \
57   devcb = &crt9212_device::set_in_ren_callback(*device, DEVCB2_##_devcb);
5458
55#define CRT9212_INTERFACE(name) \
56   const crt9212_interface (name) =
59#define MCFG_CRT9212_IN_WEN_CB(_devcb) \
60   devcb = &crt9212_device::set_in_wen_callback(*device, DEVCB2_##_devcb);
5761
62#define MCFG_CRT9212_IN_WEN2_CB(_devcb) \
63   devcb = &crt9212_device::set_in_wen2_callback(*device, DEVCB2_##_devcb);
5864
5965
6066//**************************************************************************
6167//  TYPE DEFINITIONS
6268//**************************************************************************
6369
64
65// ======================> crt9212_interface
66
67struct crt9212_interface
68{
69   devcb_write_line        m_out_rof_cb;
70   devcb_write_line        m_out_wof_cb;
71   devcb_read_line         m_in_ren_cb;
72   devcb_read_line         m_in_wen_cb;
73   devcb_read_line         m_in_wen2_cb;
74};
75
76
77
7870// ======================> crt9212_device
7971
80class crt9212_device :  public device_t,
81                  public crt9212_interface
72class crt9212_device :  public device_t
8273{
8374public:
8475   // construction/destruction
8576   crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
77   
78   template<class _Object> static devcb2_base &set_out_rof_callback(device_t &device, _Object object) { return downcast<crt9212_device &>(device).m_out_rof_cb.set_callback(object); }
79   template<class _Object> static devcb2_base &set_out_wof_callback(device_t &device, _Object object) { return downcast<crt9212_device &>(device).m_out_wof_cb.set_callback(object); }
80   template<class _Object> static devcb2_base &set_in_ren_callback(device_t &device, _Object object) { return downcast<crt9212_device &>(device).m_in_ren_cb.set_callback(object); }
81   template<class _Object> static devcb2_base &set_in_wen_callback(device_t &device, _Object object) { return downcast<crt9212_device &>(device).m_in_wen_cb.set_callback(object); }
82   template<class _Object> static devcb2_base &set_in_wen2_callback(device_t &device, _Object object) { return downcast<crt9212_device &>(device).m_in_wen2_cb.set_callback(object); }
8683
8784   DECLARE_READ8_MEMBER( read );
8885   DECLARE_WRITE8_MEMBER( write );
r28760r28761
9390
9491protected:
9592   // device-level overrides
96   virtual void device_config_complete();
9793   virtual void device_start();
9894
9995private:
100   devcb_resolved_write_line   m_out_rof_func;
101   devcb_resolved_write_line   m_out_wof_func;
102   devcb_resolved_read_line    m_in_ren_func;
103   devcb_resolved_read_line    m_in_wen_func;
104   devcb_resolved_read_line    m_in_wen2_func;
96   devcb2_write_line        m_out_rof_cb;
97   devcb2_write_line        m_out_wof_cb;
98   devcb2_read_line         m_in_ren_cb;
99   devcb2_read_line         m_in_wen_cb;
100   devcb2_read_line         m_in_wen2_cb;
105101
106102   UINT8 m_ram[CRT9212_RAM_SIZE][2];
107103
trunk/src/mess/drivers/tandy2k.c
r28760r28761
368368   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD
369369};
370370
371static CRT9212_INTERFACE( drb0_intf )
372{
373   DEVCB_NULL, // ROF
374   DEVCB_NULL, // WOF
375   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN
376   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN
377   DEVCB_LINE_VCC // WEN2
378};
379
380static CRT9212_INTERFACE( drb1_intf )
381{
382   DEVCB_NULL, // ROF
383   DEVCB_NULL, // WOF
384   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN
385   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN
386   DEVCB_LINE_VCC // WEN2
387};
388
389371static CRT9021_INTERFACE( vac_intf )
390372{
391373   DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data
r28760r28761
659641
660642   MCFG_CRT9007_ADD(CRT9007_TAG, XTAL_16MHz*28/16, vpac_intf, vpac_mem)
661643   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
662   MCFG_CRT9212_ADD(CRT9212_0_TAG, drb0_intf)
663   MCFG_CRT9212_ADD(CRT9212_1_TAG, drb1_intf)
644   MCFG_DEVICE_ADD(CRT9212_0_TAG, CRT9212, 0)
645   // ROF
646   // WOF
647   MCFG_CRT9212_IN_REN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, vlt_r)) // REN
648   MCFG_CRT9212_IN_WEN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, wben_r)) // WEN
649   MCFG_CRT9212_IN_WEN2_CB(VCC) // WEN2
650   MCFG_DEVICE_ADD(CRT9212_1_TAG, CRT9212, 0)
651   // ROF
652   // WOF
653   MCFG_CRT9212_IN_REN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, vlt_r)) // REN
654   MCFG_CRT9212_IN_WEN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, wben_r)) // WEN
655   MCFG_CRT9212_IN_WEN2_CB(VCC) // WEN2
664656   MCFG_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16/8, vac_intf)
665657   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
666658

Previous 199869 Revisions Next


© 1997-2024 The MAME Team