src/emu/video/pc_vga.c
| r13778 | r13779 | |
| 16 | 16 | ega/vga |
| 17 | 17 | 64k (early ega 16k) words of 32 bit memory |
| 18 | 18 | |
| 19 | TODO: |
| 20 | - modernize |
| 21 | - convert to a device. |
| 22 | - fix pixel clock |
| 23 | - add emulated mc6845 hook-up |
| 24 | - fix resolution change |
| 25 | - fix video update. |
| 26 | - (and many more ...) |
| 19 | 27 | |
| 20 | 28 | ROM declarations: |
| 21 | 29 | |
| r13778 | r13779 | |
| 525 | 533 | case 0xa: |
| 526 | 534 | vga.attribute.state = 0; |
| 527 | 535 | data = 0;/*4; */ |
| 528 | | #if 0 /* slow */ |
| 529 | | { |
| 530 | | int clock=vga.monitor.get_clock(); |
| 531 | | int lines=vga.monitor.get_lines(); |
| 532 | | int columns=vga.monitor.get_columns(); |
| 533 | | int diff = (((space->machine().time() - vga.monitor.start_time) * clock).seconds) |
| 534 | | %(lines*columns); |
| 535 | | if (diff<columns*vga.monitor.get_sync_lines()) data|=8; |
| 536 | | diff=diff/lines; |
| 537 | | if (diff%columns<vga.monitor.get_sync_columns()) data|=1; |
| 538 | | } |
| 539 | | #elif 1 |
| 540 | | if (vga.monitor.retrace) |
| 541 | | { |
| 542 | | data |= 1; |
| 543 | | if ((space->machine().time() - vga.monitor.start_time) > attotime::from_usec(300)) |
| 544 | | { |
| 545 | | data |= 8; |
| 546 | | vga.monitor.retrace=0; |
| 547 | | } |
| 548 | | } |
| 549 | | else |
| 550 | | { |
| 551 | | if ((space->machine().time() - vga.monitor.start_time) > attotime::from_msec(15)) |
| 552 | | vga.monitor.retrace=1; |
| 553 | | vga.monitor.start_time=space->machine().time(); |
| 554 | | } |
| 555 | | #else |
| 556 | | // not working with ps2m30 |
| 557 | | if (vga.monitor.retrace) data|=9; |
| 558 | | vga.monitor.retrace=0; |
| 559 | | #endif |
| 536 | data |= (space->machine().primary_screen->hblank() & 1) << 0; |
| 537 | data |= (space->machine().primary_screen->vblank() & 1) << 3; |
| 560 | 538 | /* ega diagnostic readback enough for oak bios */ |
| 561 | 539 | switch (vga.attribute.data[0x12]&0x30) { |
| 562 | 540 | case 0: |
| r13778 | r13779 | |
| 998 | 976 | pc_vga_reset(machine); |
| 999 | 977 | } |
| 1000 | 978 | |
| 1001 | | static TIMER_CALLBACK(vga_timer) |
| 1002 | | { |
| 1003 | | vga.monitor.retrace=1; |
| 1004 | | } |
| 1005 | | |
| 1006 | 979 | static VIDEO_START( vga ) |
| 1007 | 980 | { |
| 1008 | 981 | vga.monitor.get_clock=vga_get_clock; |
| r13778 | r13779 | |
| 1010 | 983 | vga.monitor.get_columns=vga_get_crtc_columns; |
| 1011 | 984 | vga.monitor.get_sync_lines=vga_get_crtc_sync_lines; |
| 1012 | 985 | vga.monitor.get_sync_columns=vga_get_crtc_sync_columns; |
| 1013 | | machine.scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); |
| 1014 | 986 | pc_video_start(machine, pc_vga_choosevideomode); |
| 1015 | 987 | } |
| 1016 | 988 | |
| r13778 | r13779 | |
| 1269 | 1241 | MACHINE_CONFIG_FRAGMENT( pcvideo_vga ) |
| 1270 | 1242 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1271 | 1243 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1272 | | MCFG_SCREEN_SIZE(720, 480) |
| 1273 | | MCFG_SCREEN_VISIBLE_AREA(0,720-1, 0,480-1) |
| 1244 | MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,800,0,640,525,0,480) |
| 1274 | 1245 | MCFG_SCREEN_UPDATE(pc_video) |
| 1275 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 1276 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1277 | 1246 | |
| 1278 | 1247 | MCFG_PALETTE_LENGTH(0x100) |
| 1279 | 1248 | MCFG_PALETTE_INIT(vga) |