trunk/src/emu/video/crt9021.c
| r28761 | r28762 | |
| 85 | 85 | |
| 86 | 86 | crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 87 | 87 | : 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) |
| 89 | 92 | { |
| 90 | 93 | } |
| 91 | 94 | |
| 92 | 95 | |
| 93 | 96 | //------------------------------------------------- |
| 94 | | // device_config_complete - perform any |
| 95 | | // operations now that the configuration is |
| 96 | | // complete |
| 97 | | //------------------------------------------------- |
| 98 | | |
| 99 | | void 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 | | //------------------------------------------------- |
| 117 | 97 | // device_start - device-specific startup |
| 118 | 98 | //------------------------------------------------- |
| 119 | 99 | |
| r28761 | r28762 | |
| 122 | 102 | // allocate timers |
| 123 | 103 | |
| 124 | 104 | // 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); |
| 128 | 108 | |
| 129 | 109 | // register for state saving |
| 130 | 110 | save_item(NAME(m_slg)); |
trunk/src/emu/video/crt9021.h
| r28761 | r28762 | |
| 46 | 46 | // INTERFACE CONFIGURATION MACROS |
| 47 | 47 | //************************************************************************** |
| 48 | 48 | |
| 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); |
| 52 | 51 | |
| 52 | #define MCFG_CRT9021_IN_ATTR_CB(_devcb) \ |
| 53 | devcb = &crt9021_device::set_in_attr_callback(*device, DEVCB2_##_devcb); |
| 53 | 54 | |
| 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); |
| 56 | 57 | |
| 57 | | |
| 58 | | |
| 59 | 58 | //************************************************************************** |
| 60 | 59 | // TYPE DEFINITIONS |
| 61 | 60 | //************************************************************************** |
| 62 | 61 | |
| 63 | | |
| 64 | | // ======================> crt9021_interface |
| 65 | | |
| 66 | | struct 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 | | |
| 76 | 62 | // ======================> crt9021_device |
| 77 | 63 | |
| 78 | 64 | class crt9021_device : public device_t, |
| 79 | | public device_video_interface, |
| 80 | | public crt9021_interface |
| 65 | public device_video_interface |
| 81 | 66 | { |
| 82 | 67 | public: |
| 83 | 68 | // construction/destruction |
| 84 | 69 | 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); } |
| 85 | 74 | |
| 86 | 75 | DECLARE_WRITE_LINE_MEMBER( slg_w ); |
| 87 | 76 | DECLARE_WRITE_LINE_MEMBER( sld_w ); |
| r28761 | r28762 | |
| 93 | 82 | |
| 94 | 83 | protected: |
| 95 | 84 | // device-level overrides |
| 96 | | virtual void device_config_complete(); |
| 97 | 85 | virtual void device_start(); |
| 98 | 86 | virtual void device_clock_changed(); |
| 99 | 87 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 100 | 88 | |
| 101 | 89 | private: |
| 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; |
| 105 | 92 | |
| 93 | devcb2_read_line m_in_atten_cb; |
| 94 | |
| 106 | 95 | int m_slg; |
| 107 | 96 | int m_sld; |
| 108 | 97 | int m_cursor; |
trunk/src/mess/drivers/tandy2k.c
| r28761 | r28762 | |
| 368 | 368 | DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD |
| 369 | 369 | }; |
| 370 | 370 | |
| 371 | | static 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 | | |
| 378 | 371 | // Intel 8251A Interface |
| 379 | 372 | |
| 380 | 373 | WRITE_LINE_MEMBER( tandy2k_state::rxrdy_w ) |
| r28761 | r28762 | |
| 653 | 646 | MCFG_CRT9212_IN_REN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, vlt_r)) // REN |
| 654 | 647 | MCFG_CRT9212_IN_WEN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, wben_r)) // WEN |
| 655 | 648 | 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) |
| 657 | 653 | MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) |
| 658 | 654 | |
| 659 | 655 | // sound hardware |