src/mess/video/vic6567.c
| r3255 | r3256 | |
| 213 | 213 | UINT16 c64_bitmap[2], bitmapmulti[4], mono[2], multi[4], ecmcolor[2], colors[4], spritemulti[4], spritemulti_buffer[4]; |
| 214 | 214 | |
| 215 | 215 | int lastline, rasterline, raster_mod; |
| 216 | | UINT64 rasterline_start_cpu_cycles; |
| 216 | UINT64 rasterline_start_cpu_cycles, totalcycles; |
| 217 | 217 | |
| 218 | 218 | /* background/foreground for sprite collision */ |
| 219 | 219 | UINT8 *screen[216], shift[216]; |
| r3255 | r3256 | |
| 271 | 271 | { |
| 272 | 272 | memset(&vic2, 0, sizeof(vic2)); |
| 273 | 273 | |
| 274 | vic2.totalcycles = 63; |
| 274 | 275 | vic2.pal = pal; |
| 275 | 276 | vic2.lines = VIC2_LINES; |
| 276 | 277 | |
| r3255 | r3256 | |
| 364 | 365 | WRITE8_HANDLER ( vic2_port_w ) |
| 365 | 366 | { |
| 366 | 367 | int startx, cycles; |
| 367 | | |
| 368 | // printf("vic write %04x %04x %04x\n", offset, data, vic2.rasterline); |
| 368 | 369 | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 369 | 370 | offset &= 0x3f; |
| 370 | 371 | switch (offset) |
| r3255 | r3256 | |
| 578 | 579 | cycles = (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles); |
| 579 | 580 | |
| 580 | 581 | if (cycles > VIC2_CYCLESPERLINE - 1) cycles = VIC2_CYCLESPERLINE; |
| 581 | | startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8; |
| 582 | startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8 * (63 / vic2.totalcycles); |
| 582 | 583 | if (startx >= VIC2_COLUMNS) startx -= VIC2_COLUMNS; |
| 583 | 584 | |
| 584 | 585 | // sprites chenges are active only from the next raster line |
| r3255 | r3256 | |
| 1217 | 1218 | line = end; |
| 1218 | 1219 | } |
| 1219 | 1220 | |
| 1220 | | if (LINES25) |
| 1221 | | { |
| 1222 | | vline = line - vic2.y_begin - YPOS; |
| 1223 | | } |
| 1224 | | else |
| 1225 | | { |
| 1226 | | vline = line - vic2.y_begin - YPOS + 8 - VERTICALPOS; |
| 1227 | | } |
| 1221 | vline = line - YPOS + 3 - VERTICALPOS; |
| 1222 | |
| 1228 | 1223 | if (first + 1 < vic2.y_end + YPOS) |
| 1229 | 1224 | end = first + 1; |
| 1230 | 1225 | else |
| r3255 | r3256 | |
| 1375 | 1370 | // int scanline = param; |
| 1376 | 1371 | |
| 1377 | 1372 | vic2.rasterline++; |
| 1373 | vic2.rasterline_start_cpu_cycles = activecpu_gettotalcycles(); |
| 1378 | 1374 | |
| 1379 | 1375 | // update sprites registers |
| 1380 | 1376 | for (i=0x00; i <= 0x10; i++) |
| r3255 | r3256 | |
| 1429 | 1425 | } |
| 1430 | 1426 | */ |
| 1431 | 1427 | /* |
| 1428 | if (((vic2.reg[0x11] & 7) == (vic2.reg[0x12] & 7)) && (vic2.rasterline >= 0x30) && (vic2.rasterline <= 0xf7)) // bad lines simulation |
| 1429 | { |
| 1430 | cpunum_set_clock(machine, 0, 0x57d0d); |
| 1431 | vic2.totalcycles = 63 - 40; |
| 1432 | } |
| 1433 | else |
| 1434 | { |
| 1435 | cpunum_set_clock(machine, 0, 0xf08a0); |
| 1436 | vic2.totalcycles = 63; |
| 1437 | } |
| 1438 | */ |
| 1439 | /* |
| 1432 | 1440 | if (input_code_pressed(KEYCODE_Q)) { cpunum_set_clock(machine, 0, 0x93203); } |
| 1433 | 1441 | if (input_code_pressed(KEYCODE_W)) { cpunum_set_clock(machine, 0, 0xf08a0); } |
| 1434 | 1442 | if (input_code_pressed(KEYCODE_E)) printf("%04x ",cpunum_get_clock(0)); |
| 1435 | 1443 | if (input_code_pressed(KEYCODE_R)) printf("%04x ", (int)(cpunum_get_clock(0)*63/103)); |
| 1436 | 1444 | vic2.raster_mod += 63 - (activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles); |
| 1437 | 1445 | if (input_code_pressed(KEYCODE_Q)) printf("%04x-%04x ",vic2.raster_mod, (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles)); |
| 1438 | | vic2.rasterline_start_cpu_cycles = activecpu_gettotalcycles(); |
| 1439 | 1446 | if (vic2.raster_mod > 63) |
| 1440 | 1447 | { |
| 1441 | 1448 | vic2.raster_mod -= 63; |
| r3255 | r3256 | |
| 1475 | 1482 | if (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES - vic2.lines) |
| 1476 | 1483 | vic2_drawlines (vic2.rasterline + vic2.lines - 1, vic2.rasterline + vic2.lines, VIC2_STARTVISIBLECOLUMNS, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1); |
| 1477 | 1484 | |
| 1485 | // if (vic2.rasterline == 0x80) |
| 1478 | 1486 | if (vic2.on) |
| 1479 | 1487 | if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES)) |
| 1480 | 1488 | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1); |