src/mess/video/vic6567.c
| r3227 | r3228 | |
| 212 | 212 | |
| 213 | 213 | UINT16 c64_bitmap[2], bitmapmulti[4], mono[2], multi[4], ecmcolor[2], colors[4], spritemulti[4], spritemulti_buffer[4]; |
| 214 | 214 | |
| 215 | | int lastline, rasterline; |
| 215 | int lastline, rasterline, raster_mod; |
| 216 | 216 | UINT64 rasterline_start_cpu_cycles; |
| 217 | 217 | |
| 218 | 218 | /* background/foreground for sprite collision */ |
| r3227 | r3228 | |
| 571 | 571 | |
| 572 | 572 | cycles = (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles); |
| 573 | 573 | |
| 574 | | if (cycles > VIC2_CYCLESPERLINE - 1) cycles = VIC2_CYCLESPERLINE - 1; |
| 575 | | startx = VIC2_FIRSTRASTERCOLUMNS + (cycles) * 8; |
| 574 | if (cycles > VIC2_CYCLESPERLINE - 1) cycles = VIC2_CYCLESPERLINE; |
| 575 | startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8; |
| 576 | 576 | if (startx >= VIC2_COLUMNS) startx -= VIC2_COLUMNS; |
| 577 | 577 | |
| 578 | 578 | // sprites chenges are active only from the next raster line |
| 579 | | // FIX ME : c65 have different width, left border width is 8 pixel wrong ?! |
| 580 | | /* |
| 581 | | if (!strncmp(machine->gamedrv->name, "c64", 3)) |
| 582 | | { |
| 583 | | if (startx > VIC2_FIRSTRASTERCOLUMNS) |
| 584 | | { |
| 585 | | if (startx < VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS) |
| 579 | // FIX ME : left border width is 8 pixel wrong ?! |
| 580 | // printf("%04x-%04x %04x-%04x %04x-%04x\n",startx, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1, VIC2_STARTVISIBLECOLUMNS, VIC2_FIRSTRASTERCOLUMNS - 1, startx, VIC2_FIRSTRASTERCOLUMNS - 1); |
| 581 | if (vic2.on) |
| 582 | if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES)) |
| 583 | // if (!strncmp(machine->gamedrv->name, "c64", 3)) // |
| 584 | { |
| 585 | if (startx > VIC2_FIRSTRASTERCOLUMNS) |
| 586 | 586 | { |
| 587 | | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, startx, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1); |
| 587 | if (startx < VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS) |
| 588 | { |
| 589 | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, startx, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1); |
| 590 | } |
| 591 | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 588 | 592 | } |
| 589 | | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 590 | | } |
| 591 | | else |
| 592 | | { |
| 593 | | if (startx >= VIC2_STARTVISIBLECOLUMNS) |
| 594 | | { |
| 595 | | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, startx, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 593 | else |
| 594 | { |
| 595 | if (startx >= VIC2_STARTVISIBLECOLUMNS) |
| 596 | { |
| 597 | vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, startx, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 598 | } |
| 599 | } |
| 596 | 600 | } |
| 597 | | } |
| 598 | | } |
| 599 | | */ |
| 600 | 601 | } |
| 601 | 602 | |
| 602 | 603 | READ8_HANDLER ( vic2_port_r ) |
| r3227 | r3228 | |
| 1462 | 1463 | } |
| 1463 | 1464 | for (i=0; i < 5; i++) |
| 1464 | 1465 | vic2.spritemulti[i] = vic2.spritemulti_buffer[i]; |
| 1465 | | if (input_code_pressed(KEYCODE_Q)) { cpunum_set_clock(machine, 0, 0x93203); } |
| 1466 | | if (input_code_pressed(KEYCODE_W)) { cpunum_set_clock(machine, 0, 0xf08a0); } |
| 1466 | // if (input_code_pressed(KEYCODE_Q)) { cpunum_set_clock(machine, 0, 0x93203); } |
| 1467 | // if (input_code_pressed(KEYCODE_W)) { cpunum_set_clock(machine, 0, 0xf08a0); } |
| 1467 | 1468 | // if (input_code_pressed(KEYCODE_E)) printf("%04x ",cpunum_get_clock(0)); |
| 1468 | 1469 | // if (input_code_pressed(KEYCODE_R)) printf("%04x ", (int)(cpunum_get_clock(0)*63/103)); |
| 1470 | vic2.raster_mod += 63 - (activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles); |
| 1471 | // if (input_code_pressed(KEYCODE_Q)) printf("%04x-%04x ",vic2.raster_mod, (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles)); |
| 1469 | 1472 | vic2.rasterline_start_cpu_cycles = activecpu_gettotalcycles(); |
| 1473 | if (vic2.raster_mod > 63) |
| 1474 | { |
| 1475 | vic2.raster_mod -= 63; |
| 1476 | vic2.rasterline--; |
| 1477 | } |
| 1478 | if (vic2.raster_mod < -63) |
| 1479 | { |
| 1480 | vic2.raster_mod += 63; |
| 1481 | vic2.rasterline++; |
| 1482 | } |
| 1470 | 1483 | |
| 1471 | 1484 | if (vic2.rasterline == vic2.lines) |
| 1472 | 1485 | { |