src/mess/video/pc_vga.c
| r2291 | r2292 | |
| 528 | 528 | static WRITE64_HANDLER( vga_text64_w ) { write64be_with_write8_handler(vga_text_w, machine, offset, data, mem_mask); } |
| 529 | 529 | static WRITE64_HANDLER( vga_vga64_w ) { write64be_with_write8_handler(vga_vga_w, machine, offset, data, mem_mask); } |
| 530 | 530 | |
| 531 | | static void vga_cpu_interface(void) |
| 531 | static void vga_cpu_interface(running_machine *machine) |
| 532 | 532 | { |
| 533 | 533 | static int sequencer, gc; |
| 534 | 534 | read8_machine_func read_handler; |
| r2291 | r2292 | |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | | buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 603 | buswidth = cputype_databus_width(machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 604 | 604 | switch(buswidth) |
| 605 | 605 | { |
| 606 | 606 | case 8: |
| r2291 | r2292 | |
| 939 | 939 | if (vga.sequencer.index < vga.svga_intf.seq_regcount) |
| 940 | 940 | { |
| 941 | 941 | vga.sequencer.data[vga.sequencer.index] = data; |
| 942 | | vga_cpu_interface(); |
| 942 | vga_cpu_interface(machine); |
| 943 | 943 | |
| 944 | 944 | if (vga.sequencer.index == 0) |
| 945 | 945 | vga.monitor.start_time = timer_get_time(); |
| r2291 | r2292 | |
| 1004 | 1004 | if (vga.gc.index < vga.svga_intf.gc_regcount) |
| 1005 | 1005 | { |
| 1006 | 1006 | vga.gc.data[vga.gc.index] = data; |
| 1007 | | vga_cpu_interface(); |
| 1007 | vga_cpu_interface(machine); |
| 1008 | 1008 | } |
| 1009 | 1009 | break; |
| 1010 | 1010 | } |
| r2291 | r2292 | |
| 1040 | 1040 | |
| 1041 | 1041 | |
| 1042 | 1042 | |
| 1043 | | void pc_vga_reset(void) |
| 1043 | void pc_vga_reset(running_machine *machine) |
| 1044 | 1044 | { |
| 1045 | 1045 | /* clear out the VGA structure */ |
| 1046 | 1046 | memset(vga.pens, 0, sizeof(vga.pens)); |
| r2291 | r2292 | |
| 1065 | 1065 | the video memory area, |
| 1066 | 1066 | so I introduced the reset to switch to b8000 area */ |
| 1067 | 1067 | vga.sequencer.data[4] = 0; |
| 1068 | | vga_cpu_interface(); |
| 1068 | vga_cpu_interface(machine); |
| 1069 | 1069 | |
| 1070 | 1070 | vga.line_compare = 0x3ff; |
| 1071 | 1071 | // set CRTC register to match the line compare value |
| r2291 | r2292 | |
| 1088 | 1088 | |
| 1089 | 1089 | |
| 1090 | 1090 | |
| 1091 | | void pc_vga_init(const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf) |
| 1091 | void pc_vga_init(running_machine *machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf) |
| 1092 | 1092 | { |
| 1093 | 1093 | int i, j, k, mask, buswidth; |
| 1094 | 1094 | |
| r2291 | r2292 | |
| 1135 | 1135 | memset(vga.crtc.data, '\0', vga.svga_intf.crtc_regcount); |
| 1136 | 1136 | memset(vga.gc.data, '\0', vga.svga_intf.gc_regcount); |
| 1137 | 1137 | |
| 1138 | | buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 1138 | buswidth = cputype_databus_width(machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 1139 | 1139 | switch(buswidth) |
| 1140 | 1140 | { |
| 1141 | 1141 | case 8: |
| r2291 | r2292 | |
| 1159 | 1159 | break; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | | pc_vga_reset(); |
| 1162 | pc_vga_reset(machine); |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | static TIMER_CALLBACK(vga_timer) |
| r2291 | r2292 | |
| 1175 | 1175 | vga.monitor.get_sync_lines = vga_get_crtc_sync_lines; |
| 1176 | 1176 | vga.monitor.get_sync_columns = vga_get_crtc_sync_columns; |
| 1177 | 1177 | timer_pulse(ATTOTIME_IN_HZ(60), NULL, 0, vga_timer); |
| 1178 | | pc_video_start(NULL, pc_ega_choosevideomode, 0); |
| 1178 | pc_video_start(machine, NULL, pc_ega_choosevideomode, 0); |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | static VIDEO_RESET( ega ) |
| r2291 | r2292 | |
| 1190 | 1190 | vga.monitor.get_sync_lines=vga_get_crtc_sync_lines; |
| 1191 | 1191 | vga.monitor.get_sync_columns=vga_get_crtc_sync_columns; |
| 1192 | 1192 | timer_pulse(ATTOTIME_IN_HZ(60), NULL, 0, vga_timer); |
| 1193 | | pc_video_start(NULL, pc_vga_choosevideomode, 0); |
| 1193 | pc_video_start(machine, NULL, pc_vga_choosevideomode, 0); |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | static VIDEO_RESET( vga ) |
| 1197 | 1197 | { |
| 1198 | | pc_vga_reset(); |
| 1198 | pc_vga_reset(machine); |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | static void vga_vh_text(bitmap_t *bitmap, struct mscrtc6845 *crtc) |
src/mess/machine/pc.c
| r2291 | r2292 | |
| 358 | 358 | |
| 359 | 359 | DRIVER_INIT( pc1640 ) |
| 360 | 360 | { |
| 361 | | pc_vga_init(&vga_interface, NULL); |
| 361 | pc_vga_init(machine, &vga_interface, NULL); |
| 362 | 362 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xaffff, 0, 0, SMH_BANK1 ); |
| 363 | 363 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb7fff, 0, 0, SMH_BANK2 ); |
| 364 | 364 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb8000, 0xbffff, 0, 0, SMH_BANK3 ); |
| r2291 | r2292 | |
| 388 | 388 | mess_init_pc_common(PCCOMMON_KEYBOARD_PC | PCCOMMON_DMA8237_PC | PCCOMMON_NEC765_RDY_NC); |
| 389 | 389 | ppi8255_init(&pc_ppi8255_interface); |
| 390 | 390 | |
| 391 | | pc_vga_init(&vga_interface, NULL); |
| 391 | pc_vga_init(machine, &vga_interface, NULL); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | static int pc_irq_callback(int irqline) |