src/mess/drivers/x1.c
| r5692 | r5693 | |
| 154 | 154 | #include "formats/fm7_dsk.h" |
| 155 | 155 | #include <ctype.h> |
| 156 | 156 | |
| 157 | | static UINT8 hres_320,io_switch,io_sys; |
| 157 | static UINT8 hres_320,io_switch,io_sys,vsync,vdisp; |
| 158 | 158 | static UINT8 io_bank_mode; |
| 159 | 159 | static UINT8 *gfx_bitmap_ram; |
| 160 | 160 | static UINT16 pcg_index[3]; |
| r5692 | r5693 | |
| 172 | 172 | UINT8 blackclip; // x1 turbo specific |
| 173 | 173 | }scrn_reg; |
| 174 | 174 | |
| 175 | static struct |
| 176 | { |
| 177 | UINT8 pal; |
| 178 | UINT8 gfx_pal; |
| 179 | UINT8 txt_pal; |
| 180 | UINT8 txt_disp; |
| 181 | }turbo_reg; |
| 182 | |
| 175 | 183 | static UINT8 pcg_write_addr; |
| 176 | 184 | |
| 177 | 185 | |
| r5692 | r5693 | |
| 886 | 894 | used_pcg_addr = pcg_write_addr*8; |
| 887 | 895 | pcg_offset = (pcg_index[addr-1]+used_pcg_addr) & 0x7ff; |
| 888 | 896 | pcg_offset+=((addr-1)*0x800); |
| 897 | printf("%04x\n",pcg_offset); |
| 889 | 898 | PCG_RAM[pcg_offset] = data; |
| 890 | 899 | |
| 891 | 900 | pcg_offset &= 0x7ff; |
| r5692 | r5693 | |
| 1004 | 1013 | scrn_reg.blackclip = data; |
| 1005 | 1014 | } |
| 1006 | 1015 | |
| 1016 | static READ8_HANDLER( x1turbo_pal_r ) { return turbo_reg.pal; } |
| 1017 | static READ8_HANDLER( x1turbo_txpal_r ) { return turbo_reg.txt_pal; } |
| 1018 | static READ8_HANDLER( x1turbo_txdisp_r ) { return turbo_reg.txt_disp; } |
| 1019 | static READ8_HANDLER( x1turbo_gfxpal_r ) { return turbo_reg.gfx_pal; } |
| 1020 | |
| 1007 | 1021 | static WRITE8_HANDLER( x1turbo_pal_w ) |
| 1008 | 1022 | { |
| 1009 | 1023 | printf("TURBO PAL %02x\n",data); |
| 1024 | turbo_reg.pal = data; |
| 1010 | 1025 | } |
| 1011 | 1026 | |
| 1012 | 1027 | static WRITE8_HANDLER( x1turbo_txpal_w ) |
| 1013 | 1028 | { |
| 1014 | 1029 | printf("TURBO TEXT PAL %02x\n",data); |
| 1030 | turbo_reg.txt_pal = data; |
| 1015 | 1031 | } |
| 1016 | 1032 | |
| 1017 | 1033 | static WRITE8_HANDLER( x1turbo_txdisp_w ) |
| 1018 | 1034 | { |
| 1019 | 1035 | printf("TURBO TEXT DISPLAY %02x\n",data); |
| 1036 | turbo_reg.txt_disp = data; |
| 1020 | 1037 | } |
| 1021 | 1038 | |
| 1022 | 1039 | static WRITE8_HANDLER( x1turbo_gfxpal_w ) |
| 1023 | 1040 | { |
| 1024 | 1041 | printf("TURBO GFX PAL %02x\n",data); |
| 1042 | turbo_reg.gfx_pal = data; |
| 1025 | 1043 | } |
| 1026 | 1044 | |
| 1027 | 1045 | /************************************* |
| r5692 | r5693 | |
| 1115 | 1133 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } |
| 1116 | 1134 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } |
| 1117 | 1135 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); } |
| 1136 | else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } |
| 1137 | else if(offset >= 0x1fb9 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb9); } |
| 1138 | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } |
| 1139 | else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } |
| 1118 | 1140 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } |
| 1119 | 1141 | else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1120 | 1142 | else if(offset >= 0x2000 && offset <= 0x2fff) { return colorram[offset-0x2000]; } |
| r5692 | r5693 | |
| 1212 | 1234 | ---- ---x "cmt test" (active low) |
| 1213 | 1235 | */ |
| 1214 | 1236 | UINT8 dat = 0; |
| 1215 | | dat = (input_port_read(device->machine, "SYSTEM") & ~0x6e) | sub_obf; |
| 1237 | vdisp = (video_screen_get_vpos(device->machine->primary_screen) < 200) ? 0x80 : 0x00; |
| 1238 | dat = (input_port_read(device->machine, "SYSTEM") & 0x11) | sub_obf | vsync | vdisp; |
| 1216 | 1239 | |
| 1217 | | if((dat & 0x80) == 0) |
| 1218 | | dat |= 0x04; // VSync (todo: proper implementation of vsync) |
| 1219 | | |
| 1220 | 1240 | if(cassette_input(devtag_get_device(device->machine,"cass")) > 0.03) |
| 1221 | 1241 | dat |= 0x02; |
| 1222 | 1242 | |
| r5692 | r5693 | |
| 1277 | 1297 | DEVCB_HANDLER(x1_portc_w) /* Port C write */ |
| 1278 | 1298 | }; |
| 1279 | 1299 | |
| 1300 | static WRITE_LINE_DEVICE_HANDLER(vsync_changed) |
| 1301 | { |
| 1302 | vsync = (state & 1) ? 0x04 : 0x00; |
| 1303 | //printf("%d %02x\n",video_screen_get_vpos(device->machine->primary_screen),vsync); |
| 1304 | } |
| 1305 | |
| 1280 | 1306 | static const mc6845_interface mc6845_intf = |
| 1281 | 1307 | { |
| 1282 | 1308 | "screen", /* screen we are acting on */ |
| r5692 | r5693 | |
| 1287 | 1313 | DEVCB_NULL, /* callback for display state changes */ |
| 1288 | 1314 | DEVCB_NULL, /* callback for cursor state changes */ |
| 1289 | 1315 | DEVCB_NULL, /* HSYNC callback */ |
| 1290 | | DEVCB_NULL, /* VSYNC callback */ |
| 1316 | DEVCB_LINE(vsync_changed), /* VSYNC callback */ |
| 1291 | 1317 | NULL /* update address callback */ |
| 1292 | 1318 | }; |
| 1293 | 1319 | |