src/mess/video/vic6567.c
| r5416 | r5417 | |
| 363 | 363 | WRITE8_HANDLER ( vic2_port_w ) |
| 364 | 364 | { |
| 365 | 365 | running_machine *machine = space->machine; |
| 366 | | int startx, cycles; |
| 367 | | // printf("vic write %04x %04x %04x\n", offset, data, vic2.rasterline); |
| 366 | int cycles, realx; |
| 368 | 367 | DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data)); |
| 369 | 368 | offset &= 0x3f; |
| 370 | 369 | switch (offset) |
| r5416 | r5417 | |
| 568 | 567 | |
| 569 | 568 | cycles = (int)(cpu_get_total_cycles(space->cpu) - vic2.rasterline_start_cpu_cycles); |
| 570 | 569 | |
| 571 | | if (cycles > VIC2_CYCLESPERLINE - 1) cycles = VIC2_CYCLESPERLINE; |
| 572 | | startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8 * (63 / vic2.totalcycles); |
| 573 | | if (startx >= VIC2_COLUMNS) startx -= VIC2_COLUMNS; |
| 570 | realx = VIC2_FIRST_X + cycles * 8 * (VIC2_CYCLESPERLINE / vic2.totalcycles); |
| 571 | if (realx > VIC2_MAX_X) realx -= VIC2_MAX_X; |
| 574 | 572 | |
| 575 | 573 | // sprites chenges are active only from the next raster line |
| 576 | | // FIX ME : left border width is 8 pixel wrong ?! |
| 577 | | // printf("%04x-%04x %04x-%04x %04x-%04x\n",startx, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1, VIC2_STARTVISIBLECOLUMNS, VIC2_FIRSTRASTERCOLUMNS - 1, startx, VIC2_FIRSTRASTERCOLUMNS - 1); |
| 574 | |
| 578 | 575 | if (vic2.on) |
| 579 | 576 | if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES)) |
| 580 | | // if (!strncmp(machine->gamedrv->name, "c64", 3)) // |
| 581 | 577 | { |
| 582 | | if (startx > VIC2_FIRSTRASTERCOLUMNS) |
| 578 | if ((realx >= 0) && (realx <= (VIC2_LAST_VISIBLE_X - VIC2_FIRST_VISIBLE_X))) |
| 583 | 579 | { |
| 584 | | if (startx < VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS) |
| 585 | | { |
| 586 | | vic2_drawlines (machine, vic2.rasterline - 1, vic2.rasterline, startx, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1); |
| 587 | | } |
| 588 | | vic2_drawlines (machine, vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 580 | vic2_drawlines (machine, vic2.rasterline - 1, vic2.rasterline, realx, VIC2_LAST_VISIBLE_X - VIC2_FIRST_VISIBLE_X); |
| 589 | 581 | } |
| 590 | | else |
| 591 | | { |
| 592 | | if (startx >= VIC2_STARTVISIBLECOLUMNS) |
| 593 | | { |
| 594 | | vic2_drawlines (machine, vic2.rasterline - 1, vic2.rasterline, startx, VIC2_FIRSTRASTERCOLUMNS + 8 - 1); |
| 595 | | } |
| 596 | | } |
| 597 | 582 | } |
| 583 | |
| 598 | 584 | } |
| 599 | 585 | |
| 600 | 586 | READ8_HANDLER ( vic2_port_r ) |
| r5416 | r5417 | |
| 1404 | 1390 | |
| 1405 | 1391 | #include "vic4567.c" |
| 1406 | 1392 | |
| 1407 | | // TIMER_CALLBACK( vic2_scanline_interrupt ) |
| 1408 | 1393 | INTERRUPT_GEN( vic2_raster_irq ) |
| 1409 | 1394 | { |
| 1410 | 1395 | int i,j; |
| 1411 | | // int scanline = param; |
| 1396 | |
| 1412 | 1397 | running_machine *machine = device->machine; |
| 1413 | 1398 | |
| 1414 | 1399 | vic2.rasterline++; |
| r5416 | r5417 | |
| 1430 | 1415 | for (i=0; i < 4; i++) |
| 1431 | 1416 | vic2.spritemulti[i] = vic2.spritemulti_buffer[i]; |
| 1432 | 1417 | /* |
| 1433 | | i=0; |
| 1434 | | if (input_code_pressed(KEYCODE_Q)) i = 1; |
| 1435 | | if (input_code_pressed(KEYCODE_W)) i = 2; |
| 1436 | | if (input_code_pressed(KEYCODE_E)) i = 3; |
| 1437 | | if (input_code_pressed(KEYCODE_R)) i = 4; |
| 1438 | | if (input_code_pressed(KEYCODE_T)) i = 5; |
| 1439 | | if (input_code_pressed(KEYCODE_Y)) i = 6; |
| 1440 | | if (input_code_pressed(KEYCODE_U)) i = 7; |
| 1441 | | |
| 1442 | 1418 | if ((vic2.rasterline % 8) == 0x02) |
| 1443 | 1419 | { |
| 1444 | 1420 | vic2.reg[0x11] = vic2.reg_buffer[0x11]; |
| r5416 | r5417 | |
| 1479 | 1455 | } |
| 1480 | 1456 | */ |
| 1481 | 1457 | /* |
| 1482 | | if (input_code_pressed(KEYCODE_Q)) { cpunum_set_clock(machine, 0, 0x93203); } |
| 1483 | | if (input_code_pressed(KEYCODE_W)) { cpunum_set_clock(machine, 0, 0xf08a0); } |
| 1484 | | if (input_code_pressed(KEYCODE_E)) printf("%04x ",cpunum_get_clock(0)); |
| 1485 | | if (input_code_pressed(KEYCODE_R)) printf("%04x ", (int)(cpunum_get_clock(0)*63/103)); |
| 1486 | 1458 | vic2.raster_mod += 63 - (activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles); |
| 1487 | | if (input_code_pressed(KEYCODE_Q)) printf("%04x-%04x ",vic2.raster_mod, (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles)); |
| 1488 | 1459 | if (vic2.raster_mod > 63) |
| 1489 | 1460 | { |
| 1490 | 1461 | vic2.raster_mod -= 63; |
| r5416 | r5417 | |
| 1528 | 1499 | if (vic2.on) |
| 1529 | 1500 | if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES)) |
| 1530 | 1501 | vic2_drawlines (machine, vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS); |
| 1531 | | |
| 1532 | | // timer_adjust_oneshot(vicii_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); |
| 1533 | 1502 | } |
| 1534 | 1503 | |
| 1535 | 1504 | VIDEO_UPDATE( vic2 ) |