src/mess/video/crt9007.c
| r7454 | r7455 | |
| 23 | 23 | typedef struct _crt9007_t crt9007_t;
|
| 24 | 24 | struct _crt9007_t
|
| 25 | 25 | {
|
| 26 | | devcb_resolved_read8 in_vd_func;
|
| 27 | 26 | devcb_resolved_write_line out_int_func;
|
| 27 | devcb_resolved_write_line out_dmar_func;
|
| 28 | 28 | devcb_resolved_write_line out_hs_func;
|
| 29 | 29 | devcb_resolved_write_line out_vs_func;
|
| 30 | devcb_resolved_read8 in_vd_func;
|
| 31 | |
| 32 | UINT8 reg[64];
|
| 30 | 33 | };
|
| 31 | 34 | |
| 32 | 35 | /***************************************************************************
|
| r7454 | r7455 | |
| 56 | 59 | |
| 57 | 60 | READ8_DEVICE_HANDLER( crt9007_r )
|
| 58 | 61 | {
|
| 59 | | // crt9007_t *crt9007 = get_safe_token(device);
|
| 62 | crt9007_t *crt9007 = get_safe_token(device);
|
| 60 | 63 | |
| 61 | 64 | UINT8 data = 0;
|
| 62 | 65 | |
| 66 | swítch (offset)
|
| 67 | {
|
| 68 | case 0x15:
|
| 69 | if (LOG) logerror("CRT9007 '%s' Start\n", device->tag.cstr());
|
| 70 | break;
|
| 71 | |
| 72 | case 0x16:
|
| 73 | if (LOG) logerror("CRT9007 '%s' Reset\n", device->tag.cstr());
|
| 74 | break;
|
| 75 | |
| 76 | case 0x38:
|
| 77 | data = crt9007->reg[0x18];
|
| 78 | break;
|
| 79 | |
| 80 | case 0x39:
|
| 81 | data = crt9007->reg[0x19];
|
| 82 | break;
|
| 83 | |
| 84 | case 0x3a:
|
| 85 | break;
|
| 86 | |
| 87 | case 0x3b:
|
| 88 | break;
|
| 89 | |
| 90 | case 0x3c:
|
| 91 | break;
|
| 92 | |
| 93 | default:
|
| 94 | logerror("CRT9007 '%s' Read from Invalid Register: %02x!\n", device->tag.cstr(), offset);
|
| 95 | }
|
| 96 | |
| 63 | 97 | return data;
|
| 64 | 98 | }
|
| 65 | 99 | |
| r7454 | r7455 | |
| 69 | 103 | |
| 70 | 104 | WRITE8_DEVICE_HANDLER( crt9007_w )
|
| 71 | 105 | {
|
| 72 | | // crt9007_t *crt9007 = get_safe_token(device);
|
| 106 | crt9007_t *crt9007 = get_safe_token(device);
|
| 107 | |
| 108 | crt9007->reg[offset] = data;
|
| 109 | |
| 110 | switch (offset)
|
| 111 | {
|
| 112 | case 0x00:
|
| 113 | if (LOG) logerror("CRT9007 '%s' Characters per Horizontal Period: %u\n", device->tag.cstr(), data);
|
| 114 | break;
|
| 115 |
|
| 116 | case 0x01:
|
| 117 | if (LOG) logerror("CRT9007 '%s' Characters per Data Row: %u\n", device->tag.cstr(), data + 1);
|
| 118 | break;
|
| 119 | |
| 120 | case 0x02:
|
| 121 | if (LOG) logerror("CRT9007 '%s' Horizontal Delay: %u\n", device->tag.cstr(), data);
|
| 122 | break;
|
| 123 | |
| 124 | case 0x03:
|
| 125 | if (LOG) logerror("CRT9007 '%s' Horizontal Sync Width: %u\n", device->tag.cstr(), data);
|
| 126 | break;
|
| 127 | |
| 128 | case 0x04:
|
| 129 | if (LOG) logerror("CRT9007 '%s' Vertical Sync Width: %u\n", device->tag.cstr(), data);
|
| 130 | break;
|
| 131 | |
| 132 | case 0x05:
|
| 133 | if (LOG) logerror("CRT9007 '%s' Vertical Delay: %u\n", device->tag.cstr(), data - 1);
|
| 134 | break;
|
| 135 | |
| 136 | case 0x06:
|
| 137 | if (LOG) |
| 138 | {
|
| 139 | logerror("CRT9007 '%s' Pin Configuration: %u\n", device->tag.cstr(), data >> 6);
|
| 140 | logerror("CRT9007 '%s' Cursor Skew: %u\n", device->tag.cstr(), (data >> 3) & 0x07);
|
| 141 | logerror("CRT9007 '%s' Blank Skew: %u\n", device->tag.cstr(), data & 0x07);
|
| 142 | }
|
| 143 | break;
|
| 144 | |
| 145 | case 0x07:
|
| 146 | if (LOG) logerror("CRT9007 '%s' Visible Data Rows per Frame: %u\n", device->tag.cstr(), data + 1);
|
| 147 | break;
|
| 148 | |
| 149 | case 0x08:
|
| 150 | if (LOG) logerror("CRT9007 '%s' Scan Lines per Data Row: %u\n", device->tag.cstr(), (data & 0x1f) + 1);
|
| 151 | break;
|
| 152 | |
| 153 | case 0x09:
|
| 154 | if (LOG) logerror("CRT9007 '%s' Scan Lines per Frame: %u\n", device->tag.cstr(), ((crt9007->reg[0x08] << 3) & 0xff00) | data);
|
| 155 | break;
|
| 156 | |
| 157 | case 0x0a:
|
| 158 | if (LOG)
|
| 159 | {
|
| 160 | logerror("CRT9007 '%s' DMA Burst Count: %u\n", device->tag.cstr(), (data & 0x0f) + 1);
|
| 161 | logerror("CRT9007 '%s' DMA Burst Delay: %u\n", device->tag.cstr(), (data >> 4) & 0x07);
|
| 162 | logerror("CRT9007 '%s' DMA Disable: %u\n", device->tag.cstr(), BIT(data, 7));
|
| 163 | }
|
| 164 | break;
|
| 165 | |
| 166 | case 0x0b:
|
| 167 | if (LOG)
|
| 168 | {
|
| 169 | logerror("CRT9007 '%s' %s Height Cursor\n", device->tag.cstr(), BIT(data, 0) ? "Single" : "Double");
|
| 170 | logerror("CRT9007 '%s' Operation Mode: %u\n", device->tag.cstr(), (data >> 1) & 0x07);
|
| 171 | logerror("CRT9007 '%s' Interlace Mode: %u\n", device->tag.cstr(), (data >> 4) & 0x03);
|
| 172 | logerror("CRT9007 '%s' %s Mechanism\n", device->tag.cstr(), BIT(data, 6) ? "Page Blank" : "Smooth Scroll");
|
| 173 | }
|
| 174 | break;
|
| 175 | |
| 176 | case 0x0c:
|
| 177 | break;
|
| 178 | |
| 179 | case 0x0d:
|
| 180 | if (LOG)
|
| 181 | {
|
| 182 | logerror("CRT9007 '%s' Table Start Register: %04x\n", device->tag.cstr(), ((data << 8) & 0x3f00) | crt9007->reg[0x0c]);
|
| 183 | logerror("CRT9007 '%s' Address Mode: %u\n", device->tag.cstr(), (data >> 6) & 0x03);
|
| 184 | }
|
| 185 | break;
|
| 186 | |
| 187 | case 0x0e:
|
| 188 | break;
|
| 189 | |
| 190 | case 0x0f:
|
| 191 | if (LOG)
|
| 192 | {
|
| 193 | logerror("CRT9007 '%s' Auxialiary Address Register 1: %04x\n", device->tag.cstr(), ((data << 8) & 0x3f00) | crt9007->reg[0x0e]);
|
| 194 | logerror("CRT9007 '%s' Row Attributes: %u\n", device->tag.cstr(), (data >> 6) & 0x03);
|
| 195 | }
|
| 196 | break;
|
| 197 | |
| 198 | case 0x10:
|
| 199 | if (LOG) logerror("CRT9007 '%s' Sequential Break Register 1: %u\n", device->tag.cstr(), data);
|
| 200 | break;
|
| 201 | |
| 202 | case 0x11:
|
| 203 | if (LOG) logerror("CRT9007 '%s' Data Row Start Register: %u\n", device->tag.cstr(), data);
|
| 204 | break;
|
| 205 | |
| 206 | case 0x12:
|
| 207 | if (LOG) logerror("CRT9007 '%s' Data Row End/Sequential Break Register 2: %u\n", device->tag.cstr(), data);
|
| 208 | break;
|
| 209 | |
| 210 | case 0x13:
|
| 211 | break;
|
| 212 | |
| 213 | case 0x14:
|
| 214 | if (LOG)
|
| 215 | {
|
| 216 | logerror("CRT9007 '%s' Auxiliary Address Register 2: %04x\n", device->tag.cstr(), ((data << 8) & 0x3f00) | crt9007->reg[0x13]);
|
| 217 | logerror("CRT9007 '%s' Row Attributes: %u\n", device->tag.cstr(), (data >> 6) & 0x03);
|
| 218 | }
|
| 219 | break;
|
| 220 | |
| 221 | case 0x15:
|
| 222 | if (LOG) logerror("CRT9007 '%s' Start\n", device->tag.cstr());
|
| 223 | break;
|
| 224 | |
| 225 | case 0x16:
|
| 226 | if (LOG) logerror("CRT9007 '%s' Reset\n", device->tag.cstr());
|
| 227 | break;
|
| 228 | |
| 229 | case 0x17:
|
| 230 | if (LOG)
|
| 231 | {
|
| 232 | logerror("CRT9007 '%s' Smooth Scroll Offset: %u\n", device->tag.cstr(), (data >> 1) & 0x3f);
|
| 233 | logerror("CRT9007 '%s' Smooth Scroll Offset Overflow: %u\n", device->tag.cstr(), BIT(data, 7));
|
| 234 | }
|
| 235 | break;
|
| 236 | |
| 237 | case 0x18:
|
| 238 | if (LOG) logerror("CRT9007 '%s' Vertical Cursor Register: %u\n", device->tag.cstr(), data);
|
| 239 | break;
|
| 240 | |
| 241 | case 0x19:
|
| 242 | if (LOG) logerror("CRT9007 '%s' Horizontal Cursor Register: %u\n", device->tag.cstr(), data);
|
| 243 | break;
|
| 244 | |
| 245 | case 0x1a:
|
| 246 | if (LOG)
|
| 247 | {
|
| 248 | logerror("CRT9007 '%s' Frame Timer: %u\n", device->tag.cstr(), BIT(data, 0));
|
| 249 | logerror("CRT9007 '%s' Light Pen Interrupt: %u\n", device->tag.cstr(), BIT(data, 5));
|
| 250 | logerror("CRT9007 '%s' Vertical Retrace Interrupt: %u\n", device->tag.cstr(), BIT(data, 6));
|
| 251 | }
|
| 252 | break;
|
| 253 | |
| 254 | default:
|
| 255 | logerror("CRT9007 '%s' Write to Invalid Register: %02x!\n", device->tag.cstr(), offset);
|
| 256 | }
|
| 73 | 257 | }
|
| 74 | 258 | |
| 75 | 259 | /*-------------------------------------------------
|
| r7454 | r7455 | |
| 90 | 274 | const crt9007_interface *intf = get_interface(device);
|
| 91 | 275 | |
| 92 | 276 | /* resolve callbacks */
|
| 93 | | devcb_resolve_read8(&crt9007->in_vd_func, &intf->in_vd_func, device);
|
| 94 | 277 | devcb_resolve_write_line(&crt9007->out_int_func, &intf->out_int_func, device);
|
| 278 | devcb_resolve_write_line(&crt9007->out_dmar_func, &intf->out_dmar_func, device);
|
| 95 | 279 | devcb_resolve_write_line(&crt9007->out_hs_func, &intf->out_hs_func, device);
|
| 96 | 280 | devcb_resolve_write_line(&crt9007->out_vs_func, &intf->out_vs_func, device);
|
| 281 | devcb_resolve_read8(&crt9007->in_vd_func, &intf->in_vd_func, device);
|
| 97 | 282 | |
| 98 | 283 | /* register for state saving */
|
| 99 | 284 | // state_save_register_device_item(device, 0, crt9007->);
|
src/mess/drivers/tandy2k.c
| r7454 | r7455 | |
| 10 | 10 |
|
| 11 | 11 | TODO:
|
| 12 | 12 | |
| 13 | - port FFFE?
|
| 14 | |
| 15 | 'u76' (FFF07): unmapped I/O memory word write to FFFE = 00FF & FFFF
|
| 16 | 'u76' (FFF0F): unmapped I/O memory word read from FFFE & FFFF
|
| 17 | |
| 18 | - CRT9007
|
| 19 | - video
|
| 13 | 20 | - 80186
|
| 14 | 21 | - keyboard ROM
|
| 15 | | - CRT9007
|
| 16 | | - video
|
| 17 | 22 | - hires graphics board
|
| 18 | 23 | - floppy 720K DSQD
|
| 19 | 24 | - DMA
|
| r7454 | r7455 | |
| 148 | 153 | {
|
| 149 | 154 | /*
|
| 150 | 155 | |
| 151 | | bit description
|
| 156 | bit signal description
|
| 152 | 157 | |
| 153 | | 8 A15 of video access
|
| 154 | | 9 A16 of video access
|
| 155 | | 10 A17 of video access
|
| 156 | | 11 A18 of video access
|
| 157 | | 12 A19 of video access
|
| 158 | | 13 clock speed (0 = 22.4 MHz, 1 = 28 MHz)
|
| 159 | | 14 dots/char (0 = 10 [800x400], 1 = 8 [640x400])
|
| 160 | | 15 vidout-sel, selects the video source for display on monochrome monitor
|
| 158 | 8 A15 A15 of video access
|
| 159 | 9 A16 A16 of video access
|
| 160 | 10 A17 A17 of video access
|
| 161 | 11 A18 A18 of video access
|
| 162 | 12 A19 A19 of video access
|
| 163 | 13 CLKSPD clock speed (0 = 22.4 MHz, 1 = 28 MHz)
|
| 164 | 14 CLKCNT dots/char (0 = 10 [800x400], 1 = 8 [640x400])
|
| 165 | 15 VIDOUTS selects the video source for display on monochrome monitor
|
| 161 | 166 | |
| 162 | 167 | */
|
| 163 | 168 | }
|
| r7454 | r7455 | |
| 249 | 254 | |
| 250 | 255 | static ADDRESS_MAP_START( tandy2k_mem, ADDRESS_SPACE_PROGRAM, 16 )
|
| 251 | 256 | ADDRESS_MAP_UNMAP_HIGH
|
| 252 | | AM_RANGE(0x00000, 0x1ffff) AM_RAM
|
| 253 | | // AM_RANGE(0x20000, 0xdffff) AM_RAM // expanded RAM
|
| 257 | // AM_RANGE(0x00000, 0xdffff) AM_RAM
|
| 254 | 258 | // AM_RANGE(0xe0000, 0xf7fff) AM_RAM // hires graphics
|
| 255 | | AM_RANGE(0xf8000, 0xfbfff) AM_RAM // character generator
|
| 259 | AM_RANGE(0xf8000, 0xfbfff) AM_RAM AM_BASE_MEMBER(tandy2k_state, char_ram)
|
| 256 | 260 | AM_RANGE(0xfc000, 0xfdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION(I80186_TAG, 0)
|
| 257 | 261 | ADDRESS_MAP_END
|
| 258 | 262 | |
| 259 | 263 | static ADDRESS_MAP_START( tandy2k_io, ADDRESS_SPACE_IO, 16 )
|
| 260 | 264 | ADDRESS_MAP_UNMAP_HIGH
|
| 261 | | AM_RANGE(0x00000, 0x00001) AM_READWRITE8(enable_r, enable_w, 0xff00)
|
| 262 | | AM_RANGE(0x00002, 0x00003) AM_WRITE8(dma_mux_w, 0xff00)
|
| 263 | | AM_RANGE(0x00004, 0x00005) AM_DEVREADWRITE8(I8272A_TAG, fldtc_r, fldtc_w, 0xff00)
|
| 264 | | AM_RANGE(0x00010, 0x00013) AM_DEVREADWRITE8(I8251A_TAG, msm8251_data_r, msm8251_data_w, 0xff00)
|
| 265 | | AM_RANGE(0x00030, 0x00031) AM_DEVREAD8(I8272A_TAG, upd765_status_r, 0xff00)
|
| 266 | | AM_RANGE(0x00032, 0x00033) AM_DEVREADWRITE8(I8272A_TAG, upd765_data_r, upd765_data_w, 0xff00)
|
| 267 | | AM_RANGE(0x00040, 0x00047) AM_DEVREADWRITE8(I8253_TAG, pit8253_r, pit8253_w, 0xff00)
|
| 268 | | AM_RANGE(0x00050, 0x00057) AM_DEVREADWRITE8(I8255A_TAG, i8255a_r, i8255a_w, 0xff00)
|
| 269 | | AM_RANGE(0x00060, 0x00063) AM_DEVREADWRITE8(I8259A_0_TAG, pic8259_r, pic8259_w, 0xff00)
|
| 270 | | AM_RANGE(0x00070, 0x00073) AM_DEVREADWRITE8(I8259A_1_TAG, pic8259_r, pic8259_w, 0xff00)
|
| 271 | | AM_RANGE(0x00080, 0x00081) AM_DEVREADWRITE8(I8272A_TAG, upd765_dack_r, upd765_dack_w, 0xff00)
|
| 272 | | AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_r, crt9007_w, 0xff00)
|
| 273 | | AM_RANGE(0x00100, 0x0017f) AM_WRITE8(addr_ctrl_w, 0x00ff)
|
| 265 | AM_RANGE(0x00000, 0x00001) AM_READWRITE8(enable_r, enable_w, 0x00ff)
|
| 266 | AM_RANGE(0x00002, 0x00003) AM_WRITE8(dma_mux_w, 0x00ff)
|
| 267 | AM_RANGE(0x00004, 0x00005) AM_DEVREADWRITE8(I8272A_TAG, fldtc_r, fldtc_w, 0x00ff)
|
| 268 | AM_RANGE(0x00010, 0x00013) AM_DEVREADWRITE8(I8251A_TAG, msm8251_data_r, msm8251_data_w, 0x00ff)
|
| 269 | AM_RANGE(0x00030, 0x00031) AM_DEVREAD8(I8272A_TAG, upd765_status_r, 0x00ff)
|
| 270 | AM_RANGE(0x00032, 0x00033) AM_DEVREADWRITE8(I8272A_TAG, upd765_data_r, upd765_data_w, 0x00ff)
|
| 271 | AM_RANGE(0x00040, 0x00047) AM_DEVREADWRITE8(I8253_TAG, pit8253_r, pit8253_w, 0x00ff)
|
| 272 | AM_RANGE(0x00050, 0x00057) AM_DEVREADWRITE8(I8255A_TAG, i8255a_r, i8255a_w, 0x00ff)
|
| 273 | AM_RANGE(0x00060, 0x00063) AM_DEVREADWRITE8(I8259A_0_TAG, pic8259_r, pic8259_w, 0x00ff)
|
| 274 | AM_RANGE(0x00070, 0x00073) AM_DEVREADWRITE8(I8259A_1_TAG, pic8259_r, pic8259_w, 0x00ff)
|
| 275 | AM_RANGE(0x00080, 0x00081) AM_DEVREADWRITE8(I8272A_TAG, upd765_dack_r, upd765_dack_w, 0x00ff)
|
| 276 | AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_r, crt9007_w, 0x00ff)
|
| 277 | AM_RANGE(0x00100, 0x0017f) AM_WRITE8(addr_ctrl_w, 0xff00)
|
| 274 | 278 | // AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff)
|
| 275 | 279 | // AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w)
|
| 276 | 280 | // AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff)
|
| r7454 | r7455 | |
| 278 | 282 | |
| 279 | 283 | static ADDRESS_MAP_START( tandy2k_hd_io, ADDRESS_SPACE_IO, 16 )
|
| 280 | 284 | AM_IMPORT_FROM(tandy2k_io)
|
| 281 | | // AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0xff00)
|
| 282 | | // AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, hdc_reset_r, hdc_reset_w, 0xff00)
|
| 283 | | // AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_r, wd1010_w, 0xff00)
|
| 285 | // AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0x00ff)
|
| 286 | // AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, hdc_reset_r, hdc_reset_w, 0x00ff)
|
| 287 | // AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_r, wd1010_w, 0x00ff)
|
| 284 | 288 | ADDRESS_MAP_END
|
| 285 | 289 | |
| 286 | 290 | static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
|
| r7454 | r7455 | |
| 444 | 448 | DEVCB_LINE(vidint11_w),
|
| 445 | 449 | DEVCB_NULL,
|
| 446 | 450 | DEVCB_NULL,
|
| 451 | DEVCB_NULL,
|
| 447 | 452 | DEVCB_MEMORY_HANDLER(I80186_TAG, PROGRAM, memory_read_byte_16le)
|
| 448 | 453 | };
|
| 449 | 454 | |
| r7454 | r7455 | |
| 724 | 729 | state->speaker = devtag_get_device(machine, SPEAKER_TAG);
|
| 725 | 730 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
|
| 726 | 731 | |
| 732 | /* memory banking */
|
| 733 | const address_space *program = cputag_get_address_space(machine, I80186_TAG, ADDRESS_SPACE_PROGRAM);
|
| 734 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram"));
|
| 735 | int ram_size = messram_get_size(devtag_get_device(machine, "messram"));
|
| 736 | |
| 737 | memory_install_ram(program, 0x00000, ram_size - 1, 0, 0, ram);
|
| 738 | |
| 727 | 739 | /* register for state saving */
|
| 728 | 740 | // state_save_register_global(machine, state->);
|
| 729 | 741 | }
|