src/mess/video/crt9021.c
| r0 | r9647 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | SMC CRT9021 Video Attributes Controller (VAC) emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "crt9021.h" |
| 12 | |
| 13 | |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // MACROS / CONSTANTS |
| 17 | //************************************************************************** |
| 18 | |
| 19 | #define LOG 1 |
| 20 | |
| 21 | |
| 22 | |
| 23 | //************************************************************************** |
| 24 | // GLOBAL VARIABLES |
| 25 | //************************************************************************** |
| 26 | |
| 27 | // devices |
| 28 | const device_type CRT9021 = crt9021_device_config::static_alloc_device_config; |
| 29 | |
| 30 | |
| 31 | |
| 32 | //************************************************************************** |
| 33 | // DEVICE CONFIGURATION |
| 34 | //************************************************************************** |
| 35 | |
| 36 | //------------------------------------------------- |
| 37 | // crt9021_device_config - constructor |
| 38 | //------------------------------------------------- |
| 39 | |
| 40 | crt9021_device_config::crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 41 | : device_config(mconfig, static_alloc_device_config, "SMC CRT9021", tag, owner, clock) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | |
| 46 | //------------------------------------------------- |
| 47 | // static_alloc_device_config - allocate a new |
| 48 | // configuration object |
| 49 | //------------------------------------------------- |
| 50 | |
| 51 | device_config *crt9021_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 52 | { |
| 53 | return global_alloc(crt9021_device_config(mconfig, tag, owner, clock)); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | //------------------------------------------------- |
| 58 | // alloc_device - allocate a new device object |
| 59 | //------------------------------------------------- |
| 60 | |
| 61 | device_t *crt9021_device_config::alloc_device(running_machine &machine) const |
| 62 | { |
| 63 | return auto_alloc(&machine, crt9021_device(machine, *this)); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | //------------------------------------------------- |
| 68 | // device_config_complete - perform any |
| 69 | // operations now that the configuration is |
| 70 | // complete |
| 71 | //------------------------------------------------- |
| 72 | |
| 73 | void crt9021_device_config::device_config_complete() |
| 74 | { |
| 75 | // inherit a copy of the static data |
| 76 | const crt9021_interface *intf = reinterpret_cast<const crt9021_interface *>(static_config()); |
| 77 | if (intf != NULL) |
| 78 | *static_cast<crt9021_interface *>(this) = *intf; |
| 79 | |
| 80 | // or initialize to defaults if none provided |
| 81 | else |
| 82 | { |
| 83 | memset(&out_ld_sh_func, 0, sizeof(out_ld_sh_func)); |
| 84 | memset(&in_data_func, 0, sizeof(in_data_func)); |
| 85 | memset(&in_attr_func, 0, sizeof(in_attr_func)); |
| 86 | memset(&in_atten_func, 0, sizeof(in_atten_func)); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | |
| 91 | |
| 92 | //************************************************************************** |
| 93 | // INLINE HELPERS |
| 94 | //************************************************************************** |
| 95 | |
| 96 | |
| 97 | |
| 98 | //************************************************************************** |
| 99 | // LIVE DEVICE |
| 100 | //************************************************************************** |
| 101 | |
| 102 | //------------------------------------------------- |
| 103 | // crt9021_device - constructor |
| 104 | //------------------------------------------------- |
| 105 | |
| 106 | crt9021_device::crt9021_device(running_machine &_machine, const crt9021_device_config &config) |
| 107 | : device_t(_machine, config), |
| 108 | m_config(config) |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | |
| 113 | //------------------------------------------------- |
| 114 | // device_start - device-specific startup |
| 115 | //------------------------------------------------- |
| 116 | |
| 117 | void crt9021_device::device_start() |
| 118 | { |
| 119 | // allocate timers |
| 120 | |
| 121 | // resolve callbacks |
| 122 | devcb_resolve_write_line(&m_out_ld_sh_func, &m_config.out_ld_sh_func, this); |
| 123 | devcb_resolve_read8(&m_in_data_func, &m_config.in_data_func, this); |
| 124 | devcb_resolve_read8(&m_in_attr_func, &m_config.in_attr_func, this); |
| 125 | devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this); |
| 126 | |
| 127 | // get the screen device |
| 128 | m_screen = machine->device<screen_device>(m_config.screen_tag); |
| 129 | assert(m_screen != NULL); |
| 130 | |
| 131 | // register for state saving |
| 132 | state_save_register_device_item(this, 0, m_sl); |
| 133 | } |
| 134 | |
| 135 | |
| 136 | //------------------------------------------------- |
| 137 | // device_clock_changed - handle clock change |
| 138 | //------------------------------------------------- |
| 139 | |
| 140 | void crt9021_device::device_clock_changed() |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | |
| 145 | //------------------------------------------------- |
| 146 | // device_timer - handle timer events |
| 147 | //------------------------------------------------- |
| 148 | |
| 149 | void crt9021_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | |
| 154 | //------------------------------------------------- |
| 155 | // slg_w - |
| 156 | //------------------------------------------------- |
| 157 | |
| 158 | WRITE_LINE_MEMBER( crt9021_device::slg_w ) |
| 159 | { |
| 160 | } |
| 161 | |
| 162 | |
| 163 | //------------------------------------------------- |
| 164 | // sld_w - |
| 165 | //------------------------------------------------- |
| 166 | |
| 167 | WRITE_LINE_MEMBER( crt9021_device::sld_w ) |
| 168 | { |
| 169 | } |
| 170 | |
| 171 | |
| 172 | //------------------------------------------------- |
| 173 | // cursor_w - |
| 174 | //------------------------------------------------- |
| 175 | |
| 176 | WRITE_LINE_MEMBER( crt9021_device::cursor_w ) |
| 177 | { |
| 178 | } |
| 179 | |
| 180 | |
| 181 | //------------------------------------------------- |
| 182 | // retbl_w - |
| 183 | //------------------------------------------------- |
| 184 | |
| 185 | WRITE_LINE_MEMBER( crt9021_device::retbl_w ) |
| 186 | { |
| 187 | } |
| 188 | |
| 189 | |
| 190 | //------------------------------------------------- |
| 191 | // vsync_w - |
| 192 | //------------------------------------------------- |
| 193 | |
| 194 | WRITE_LINE_MEMBER( crt9021_device::vsync_w ) |
| 195 | { |
| 196 | } |
| 197 | |
| 198 | |
| 199 | //------------------------------------------------- |
| 200 | // update_screen - update screen |
| 201 | //------------------------------------------------- |
| 202 | |
| 203 | void crt9021_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) |
| 204 | { |
| 205 | } |
src/mess/video/crt9021.h
| r0 | r9647 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | SMC CRT9021 Video Attributes Controller (VAC) emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | ********************************************************************** |
| 9 | _____ _____ |
| 10 | D0 1 |* \_/ | 28 D1 |
| 11 | MS0 2 | | 27 D2 |
| 12 | MS1 3 | | 26 D3 |
| 13 | REVID 4 | | 25 D4 |
| 14 | CHABL 5 | | 24 D5 |
| 15 | BLINK 6 | | 23 D6 |
| 16 | INTIN 7 | CRT9021 | 22 D7 |
| 17 | Vcc 8 | | 21 _VSYNC |
| 18 | ATTEN 9 | | 20 GND |
| 19 | INTOUT 10 | | 19 SL0/SLD |
| 20 | CURSOR 11 | | 18 SL1/_SLG |
| 21 | RETBL 12 | | 17 SL2/BLC |
| 22 | _LD/SH 13 | | 16 SL3/BKC |
| 23 | VIDEO 14 |_____________| 15 VDC |
| 24 | |
| 25 | **********************************************************************/ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #ifndef __CRT9021__ |
| 30 | #define __CRT9021__ |
| 31 | |
| 32 | #include "emu.h" |
| 33 | |
| 34 | |
| 35 | |
| 36 | //************************************************************************** |
| 37 | // MACROS / CONSTANTS |
| 38 | //************************************************************************** |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | //************************************************************************** |
| 44 | // INTERFACE CONFIGURATION MACROS |
| 45 | //************************************************************************** |
| 46 | |
| 47 | #define MDRV_CRT9021_ADD(_tag, _clock, _config) \ |
| 48 | MDRV_DEVICE_ADD(_tag, CRT9021, _clock) \ |
| 49 | MDRV_DEVICE_CONFIG(_config) |
| 50 | |
| 51 | |
| 52 | #define CRT9021_INTERFACE(name) \ |
| 53 | const crt9021_interface (name) = |
| 54 | |
| 55 | |
| 56 | |
| 57 | //************************************************************************** |
| 58 | // TYPE DEFINITIONS |
| 59 | //************************************************************************** |
| 60 | |
| 61 | |
| 62 | // ======================> crt9021_interface |
| 63 | |
| 64 | struct crt9021_interface |
| 65 | { |
| 66 | const char *screen_tag; /* screen we are acting on */ |
| 67 | |
| 68 | devcb_write_line out_ld_sh_func; |
| 69 | |
| 70 | devcb_read8 in_data_func; |
| 71 | devcb_read8 in_attr_func; |
| 72 | |
| 73 | devcb_read_line in_atten_func; |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | |
| 78 | // ======================> crt9021_device_config |
| 79 | |
| 80 | class crt9021_device_config : public device_config, |
| 81 | public crt9021_interface |
| 82 | { |
| 83 | friend class crt9021_device; |
| 84 | |
| 85 | // construction/destruction |
| 86 | crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 87 | |
| 88 | public: |
| 89 | // allocators |
| 90 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 91 | virtual device_t *alloc_device(running_machine &machine) const; |
| 92 | |
| 93 | protected: |
| 94 | // device_config overrides |
| 95 | virtual void device_config_complete(); |
| 96 | }; |
| 97 | |
| 98 | |
| 99 | |
| 100 | // ======================> crt9021_device |
| 101 | |
| 102 | class crt9021_device : public device_t |
| 103 | { |
| 104 | friend class crt9021_device_config; |
| 105 | |
| 106 | // construction/destruction |
| 107 | crt9021_device(running_machine &_machine, const crt9021_device_config &_config); |
| 108 | |
| 109 | public: |
| 110 | DECLARE_WRITE_LINE_MEMBER( slg_w ); |
| 111 | DECLARE_WRITE_LINE_MEMBER( sld_w ); |
| 112 | DECLARE_WRITE_LINE_MEMBER( cursor_w ); |
| 113 | DECLARE_WRITE_LINE_MEMBER( retbl_w ); |
| 114 | DECLARE_WRITE_LINE_MEMBER( vsync_w ); |
| 115 | |
| 116 | void update_screen(bitmap_t *bitmap, const rectangle *cliprect); |
| 117 | |
| 118 | protected: |
| 119 | // device-level overrides |
| 120 | virtual void device_start(); |
| 121 | virtual void device_clock_changed(); |
| 122 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 123 | |
| 124 | private: |
| 125 | devcb_resolved_write_line m_out_ld_sh_func; |
| 126 | devcb_resolved_read8 m_in_data_func; |
| 127 | devcb_resolved_read8 m_in_attr_func; |
| 128 | devcb_resolved_read_line m_in_atten_func; |
| 129 | |
| 130 | screen_device *m_screen; |
| 131 | |
| 132 | int m_sl; |
| 133 | |
| 134 | const crt9021_device_config &m_config; |
| 135 | }; |
| 136 | |
| 137 | |
| 138 | // device type definition |
| 139 | extern const device_type CRT9021; |
| 140 | |
| 141 | |
| 142 | |
| 143 | #endif |
src/mess/includes/tandy2k.h
| r9646 | r9647 | |
| 29 | 29 | m_fdc(*this, I8272A_TAG), |
| 30 | 30 | m_pic0(*this, I8259A_0_TAG), |
| 31 | 31 | m_pic1(*this, I8259A_1_TAG), |
| 32 | m_vpac(*this, CRT9007_TAG), |
| 32 | 33 | m_drb0(*this, CRT9212_0_TAG), |
| 33 | 34 | m_drb1(*this, CRT9212_1_TAG), |
| 34 | | m_vpac(*this, CRT9007_TAG), |
| 35 | m_vac(*this, CRT9021B_TAG), |
| 35 | 36 | m_centronics(*this, CENTRONICS_TAG), |
| 36 | 37 | m_speaker(*this, SPEAKER_TAG), |
| 37 | 38 | m_ram(*this, "messram"), |
| r9646 | r9647 | |
| 48 | 49 | required_device<crt9007_device> m_vpac; |
| 49 | 50 | required_device<crt9212_device> m_drb0; |
| 50 | 51 | required_device<crt9212_device> m_drb1; |
| 51 | | // required_device<crt9201_device> m_vag; |
| 52 | required_device<crt9021_device> m_vac; |
| 52 | 53 | required_device<running_device> m_centronics; |
| 53 | 54 | required_device<running_device> m_speaker; |
| 54 | 55 | required_device<running_device> m_ram; |
| r9646 | r9647 | |
| 76 | 77 | DECLARE_WRITE_LINE_MEMBER( rfrqpulse_w ); |
| 77 | 78 | DECLARE_READ8_MEMBER( ppi_pb_r ); |
| 78 | 79 | DECLARE_WRITE8_MEMBER( ppi_pc_w ); |
| 80 | DECLARE_WRITE_LINE_MEMBER( vpac_vlt_w ); |
| 81 | DECLARE_WRITE_LINE_MEMBER( vpac_drb_w ); |
| 82 | DECLARE_WRITE_LINE_MEMBER( vac_ld_ht_w ); |
| 79 | 83 | |
| 80 | 84 | /* DMA state */ |
| 81 | 85 | UINT8 m_dma_mux; |
src/mess/drivers/tandy2k.c
| r9646 | r9647 | |
| 39 | 39 | #include "machine/upd765.h" |
| 40 | 40 | #include "sound/speaker.h" |
| 41 | 41 | #include "video/crt9007.h" |
| 42 | #include "video/crt9021.h" |
| 42 | 43 | #include "video/crt9212.h" |
| 43 | 44 | #include "includes/tandy2k.h" |
| 44 | 45 | |
| r9646 | r9647 | |
| 207 | 208 | if (m_clkspd != BIT(data, 5)) |
| 208 | 209 | { |
| 209 | 210 | m_vpac->set_unscaled_clock(BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20); |
| 211 | m_vac->set_unscaled_clock(BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20); |
| 210 | 212 | m_clkspd = BIT(data, 5); |
| 211 | 213 | } |
| 212 | 214 | |
| r9646 | r9647 | |
| 477 | 479 | { |
| 478 | 480 | if (m_vidouts) |
| 479 | 481 | { |
| 480 | | //m_vag->update_screen(&bitmap, &cliprect); |
| 482 | m_vac->update_screen(&bitmap, &cliprect); |
| 481 | 483 | } |
| 482 | 484 | |
| 483 | 485 | return 0; |
| r9646 | r9647 | |
| 507 | 509 | } |
| 508 | 510 | } |
| 509 | 511 | */ |
| 512 | |
| 513 | WRITE_LINE_MEMBER( tandy2k_state::vpac_vlt_w ) |
| 514 | { |
| 515 | m_drb0->clrcnt_w(state); |
| 516 | m_drb1->clrcnt_w(state); |
| 517 | } |
| 518 | |
| 519 | WRITE_LINE_MEMBER( tandy2k_state::vpac_drb_w ) |
| 520 | { |
| 521 | m_drb0->tog_w(state); |
| 522 | m_drb1->tog_w(state); |
| 523 | } |
| 524 | |
| 510 | 525 | static CRT9007_INTERFACE( vpac_intf ) |
| 511 | 526 | { |
| 512 | 527 | SCREEN_TAG, |
| 513 | 528 | 10, |
| 514 | 529 | DEVCB_DEVICE_LINE(I8259A_1_TAG, pic8259_ir1_w), |
| 515 | 530 | DEVCB_NULL, // DMAR 80186 HOLD |
| 516 | | DEVCB_NULL, // VS CRT9021B U14 VSYNC |
| 531 | DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, vsync_w), // VS |
| 517 | 532 | DEVCB_NULL, // HS |
| 518 | | DEVCB_NULL, // VLT CRT9212 U55/U15 _CLRCNT |
| 519 | | DEVCB_NULL, // CURS CRT9021B U14 CURSOR |
| 520 | | DEVCB_NULL, // DRB CRT9212 U55/U15 TOG |
| 521 | | DEVCB_NULL, // SLG CRT9021B U14 _SLG |
| 522 | | DEVCB_NULL // SLD CRT9021B U14 SLD |
| 533 | DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vpac_vlt_w), // VLT |
| 534 | DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, cursor_w), // CURS |
| 535 | DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vpac_drb_w), // DRB |
| 536 | DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, slg_w), // SLG |
| 537 | DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD |
| 523 | 538 | }; |
| 524 | 539 | |
| 525 | 540 | static CRT9212_INTERFACE( drb0_intf ) |
| 526 | 541 | { |
| 527 | 542 | DEVCB_NULL, // ROF |
| 528 | 543 | DEVCB_NULL, // WOF |
| 529 | | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), |
| 530 | | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), |
| 531 | | DEVCB_LINE_VCC |
| 544 | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN |
| 545 | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN |
| 546 | DEVCB_LINE_VCC // WEN2 |
| 532 | 547 | }; |
| 533 | 548 | |
| 534 | 549 | static CRT9212_INTERFACE( drb1_intf ) |
| 535 | 550 | { |
| 536 | 551 | DEVCB_NULL, // ROF |
| 537 | 552 | DEVCB_NULL, // WOF |
| 538 | | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), |
| 539 | | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), |
| 540 | | DEVCB_LINE_VCC |
| 553 | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN |
| 554 | DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN |
| 555 | DEVCB_LINE_VCC // WEN2 |
| 541 | 556 | }; |
| 542 | 557 | |
| 558 | WRITE_LINE_MEMBER( tandy2k_state::vac_ld_ht_w ) |
| 559 | { |
| 560 | for (int state = 0; state < 2; state++) |
| 561 | { |
| 562 | m_drb0->rclk_w(state); |
| 563 | m_drb0->wclk_w(state); |
| 564 | m_drb1->rclk_w(state); |
| 565 | m_drb1->wclk_w(state); |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | static CRT9021_INTERFACE( vac_intf ) |
| 570 | { |
| 571 | SCREEN_TAG, |
| 572 | DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vac_ld_ht_w), // _LD/HT |
| 573 | DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data |
| 574 | DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes |
| 575 | DEVCB_LINE_VCC // ATTEN |
| 576 | }; |
| 577 | |
| 543 | 578 | /* Intel 8251A Interface */ |
| 544 | 579 | |
| 545 | 580 | static WRITE_LINE_DEVICE_HANDLER( rxrdy_w ) |
| r9646 | r9647 | |
| 837 | 872 | MDRV_CRT9007_ADD(CRT9007_TAG, XTAL_16MHz*28/16, vpac_intf, vpac_mem) |
| 838 | 873 | MDRV_CRT9212_ADD(CRT9212_0_TAG, drb0_intf) |
| 839 | 874 | MDRV_CRT9212_ADD(CRT9212_1_TAG, drb1_intf) |
| 875 | MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16, vac_intf) |
| 840 | 876 | |
| 841 | 877 | /* sound hardware */ |
| 842 | 878 | MDRV_SPEAKER_STANDARD_MONO("mono") |