src/mess/video/crt9021.c
| r9662 | r9663 | |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - attributes |
| 15 | - reverse video |
| 16 | - character blank |
| 17 | - character blink |
| 18 | - underline |
| 19 | - full/half intensity |
| 20 | - operation modes |
| 21 | - wide graphics |
| 22 | - thin graphics |
| 23 | - character mode w/o underline |
| 24 | - character mode w/underline |
| 25 | - double height characters |
| 26 | - double width characters |
| 27 | - parallel scan line |
| 28 | - serial scan line |
| 29 | - cursor |
| 30 | - underline |
| 31 | - blinking underline |
| 32 | - reverse video |
| 33 | - blinking reverse video |
| 34 | - programmable character blink rate (75/25 duty) |
| 35 | - programmable cursor blink rate (50/50 duty) |
| 36 | - data/attribute latches |
| 37 | |
| 38 | */ |
| 39 | |
| 10 | 40 | #include "emu.h" |
| 11 | 41 | #include "crt9021.h" |
| 12 | 42 | |
| r9662 | r9663 | |
| 19 | 49 | #define LOG 1 |
| 20 | 50 | |
| 21 | 51 | |
| 52 | // attributes |
| 53 | static const int ATTRIBUTE_REVID = 0x80; |
| 54 | static const int ATTRIBUTE_INT = 0x40; |
| 55 | static const int ATTRIBUTE_BLINK = 0x20; |
| 56 | static const int ATTRIBUTE_MS1 = 0x10; |
| 57 | static const int ATTRIBUTE_MS0 = 0x08; |
| 58 | static const int ATTRIBUTE_CHABL = 0x04; |
| 59 | static const int ATTRIBUTE_BKC = 0x02; |
| 60 | static const int ATTRIBUTE_BLC = 0x01; |
| 22 | 61 | |
| 62 | |
| 63 | |
| 23 | 64 | //************************************************************************** |
| 24 | 65 | // GLOBAL VARIABLES |
| 25 | 66 | //************************************************************************** |
| r9662 | r9663 | |
| 80 | 121 | // or initialize to defaults if none provided |
| 81 | 122 | else |
| 82 | 123 | { |
| 83 | | memset(&out_ld_sh_func, 0, sizeof(out_ld_sh_func)); |
| 84 | 124 | memset(&in_data_func, 0, sizeof(in_data_func)); |
| 85 | 125 | memset(&in_attr_func, 0, sizeof(in_attr_func)); |
| 86 | 126 | memset(&in_atten_func, 0, sizeof(in_atten_func)); |
| r9662 | r9663 | |
| 119 | 159 | // allocate timers |
| 120 | 160 | |
| 121 | 161 | // resolve callbacks |
| 122 | | devcb_resolve_write_line(&m_out_ld_sh_func, &m_config.out_ld_sh_func, this); |
| 123 | 162 | devcb_resolve_read8(&m_in_data_func, &m_config.in_data_func, this); |
| 124 | 163 | devcb_resolve_read8(&m_in_attr_func, &m_config.in_attr_func, this); |
| 125 | 164 | devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this); |
| r9662 | r9663 | |
| 129 | 168 | assert(m_screen != NULL); |
| 130 | 169 | |
| 131 | 170 | // register for state saving |
| 132 | | state_save_register_device_item(this, 0, m_sl); |
| 171 | state_save_register_device_item(this, 0, m_slg); |
| 172 | state_save_register_device_item(this, 0, m_sld); |
| 173 | state_save_register_device_item(this, 0, m_cursor); |
| 174 | state_save_register_device_item(this, 0, m_retbl); |
| 175 | state_save_register_device_item(this, 0, m_vsync); |
| 133 | 176 | } |
| 134 | 177 | |
| 135 | 178 | |
| r9662 | r9663 | |
| 152 | 195 | |
| 153 | 196 | |
| 154 | 197 | //------------------------------------------------- |
| 155 | | // slg_w - |
| 198 | // slg_w - scan line gate |
| 156 | 199 | //------------------------------------------------- |
| 157 | 200 | |
| 158 | 201 | WRITE_LINE_MEMBER( crt9021_device::slg_w ) |
| 159 | 202 | { |
| 203 | if (LOG) logerror("CRT9021 '%s' SLG: %u\n", tag(), state); |
| 204 | |
| 205 | m_slg = state; |
| 160 | 206 | } |
| 161 | 207 | |
| 162 | 208 | |
| 163 | 209 | //------------------------------------------------- |
| 164 | | // sld_w - |
| 210 | // sld_w - scan line data |
| 165 | 211 | //------------------------------------------------- |
| 166 | 212 | |
| 167 | 213 | WRITE_LINE_MEMBER( crt9021_device::sld_w ) |
| 168 | 214 | { |
| 215 | if (LOG) logerror("CRT9021 '%s' SLG: %u\n", tag(), state); |
| 216 | |
| 217 | if (!m_slg) |
| 218 | { |
| 219 | m_sld <<= 1; |
| 220 | m_sld |= state; |
| 221 | } |
| 169 | 222 | } |
| 170 | 223 | |
| 171 | 224 | |
| 172 | 225 | //------------------------------------------------- |
| 173 | | // cursor_w - |
| 226 | // cursor_w - cursor |
| 174 | 227 | //------------------------------------------------- |
| 175 | 228 | |
| 176 | 229 | WRITE_LINE_MEMBER( crt9021_device::cursor_w ) |
| 177 | 230 | { |
| 231 | if (LOG) logerror("CRT9021 '%s' CURSOR: %u\n", tag(), state); |
| 232 | |
| 233 | m_cursor = state; |
| 178 | 234 | } |
| 179 | 235 | |
| 180 | 236 | |
| 181 | 237 | //------------------------------------------------- |
| 182 | | // retbl_w - |
| 238 | // retbl_w - retrace blank |
| 183 | 239 | //------------------------------------------------- |
| 184 | 240 | |
| 185 | 241 | WRITE_LINE_MEMBER( crt9021_device::retbl_w ) |
| 186 | 242 | { |
| 243 | if (LOG) logerror("CRT9021 '%s' RETBL: %u\n", tag(), state); |
| 244 | |
| 245 | m_retbl = state; |
| 187 | 246 | } |
| 188 | 247 | |
| 189 | 248 | |
| 190 | 249 | //------------------------------------------------- |
| 191 | | // vsync_w - |
| 250 | // vsync_w - vertical sync |
| 192 | 251 | //------------------------------------------------- |
| 193 | 252 | |
| 194 | 253 | WRITE_LINE_MEMBER( crt9021_device::vsync_w ) |
| 195 | 254 | { |
| 255 | if (LOG) logerror("CRT9021 '%s' VSYNC: %u\n", tag(), state); |
| 256 | |
| 257 | m_vsync = state; |
| 196 | 258 | } |
| 197 | 259 | |
| 198 | 260 | |
src/mess/drivers/tandy2k.c
| r9662 | r9663 | |
| 204 | 204 | /* video access */ |
| 205 | 205 | m_vram_base = data & 0x1f; |
| 206 | 206 | |
| 207 | | /* video clock speed */ |
| 208 | | if (m_clkspd != BIT(data, 5)) |
| 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); |
| 212 | | m_clkspd = BIT(data, 5); |
| 213 | | } |
| 214 | | |
| 215 | 207 | /* dots per char */ |
| 208 | int character_width = BIT(data, 6) ? 8 : 10; |
| 209 | |
| 216 | 210 | if (m_clkcnt != BIT(data, 6)) |
| 217 | 211 | { |
| 218 | | m_vpac->set_hpixels_per_column(BIT(data, 6) ? 8 : 10); |
| 212 | m_vpac->set_hpixels_per_column(character_width); |
| 219 | 213 | m_clkcnt = BIT(data, 6); |
| 220 | 214 | } |
| 221 | 215 | |
| 216 | /* video clock speed */ |
| 217 | if (m_clkspd != BIT(data, 5)) |
| 218 | { |
| 219 | float pixel_clock = BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20; |
| 220 | float character_clock = pixel_clock / character_width; |
| 221 | |
| 222 | m_vpac->set_unscaled_clock(pixel_clock); |
| 223 | m_vac->set_unscaled_clock(character_clock); |
| 224 | m_clkspd = BIT(data, 5); |
| 225 | } |
| 226 | |
| 222 | 227 | /* video source select */ |
| 223 | 228 | m_vidouts = BIT(data, 7); |
| 224 | 229 | |
| r9662 | r9663 | |
| 555 | 560 | DEVCB_LINE_VCC // WEN2 |
| 556 | 561 | }; |
| 557 | 562 | |
| 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 | 563 | static CRT9021_INTERFACE( vac_intf ) |
| 570 | 564 | { |
| 571 | 565 | SCREEN_TAG, |
| 572 | | DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vac_ld_ht_w), // _LD/HT |
| 573 | 566 | DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data |
| 574 | 567 | DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes |
| 575 | 568 | DEVCB_LINE_VCC // ATTEN |
| r9662 | r9663 | |
| 872 | 865 | MDRV_CRT9007_ADD(CRT9007_TAG, XTAL_16MHz*28/16, vpac_intf, vpac_mem) |
| 873 | 866 | MDRV_CRT9212_ADD(CRT9212_0_TAG, drb0_intf) |
| 874 | 867 | MDRV_CRT9212_ADD(CRT9212_1_TAG, drb1_intf) |
| 875 | | MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16, vac_intf) |
| 868 | MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16/8, vac_intf) |
| 876 | 869 | |
| 877 | 870 | /* sound hardware */ |
| 878 | 871 | MDRV_SPEAKER_STANDARD_MONO("mono") |