Previous 15994 Revisions Next

r5417 Thursday 13th August, 2009 at 06:37:04 UTC by Roberto Zandonà
c64: fixed horizontal raster effect
[src/mess/video]vic6567.c vic6567.h

src/mess/video/vic6567.c
r5416r5417
363363WRITE8_HANDLER ( vic2_port_w )
364364{
365365   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;
368367   DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data));
369368   offset &= 0x3f;
370369   switch (offset)
r5416r5417
568567
569568   cycles = (int)(cpu_get_total_cycles(space->cpu) - vic2.rasterline_start_cpu_cycles);
570569
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;
574572
575573   // 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
578575   if (vic2.on)
579576      if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES))
580         // if (!strncmp(machine->gamedrv->name, "c64", 3)) //
581577         {
582            if (startx > VIC2_FIRSTRASTERCOLUMNS)
578            if ((realx >= 0) && (realx <= (VIC2_LAST_VISIBLE_X - VIC2_FIRST_VISIBLE_X)))
583579            {
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);
589581            }
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            }
597582         }
583
598584}
599585
600586READ8_HANDLER ( vic2_port_r )
r5416r5417
14041390
14051391#include "vic4567.c"
14061392
1407// TIMER_CALLBACK( vic2_scanline_interrupt )
14081393INTERRUPT_GEN( vic2_raster_irq )
14091394{
14101395   int i,j;
1411//   int scanline = param;
1396
14121397   running_machine *machine = device->machine;   
14131398
14141399   vic2.rasterline++;
r5416r5417
14301415   for (i=0; i < 4; i++)
14311416      vic2.spritemulti[i] = vic2.spritemulti_buffer[i];
14321417/*
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
14421418   if ((vic2.rasterline % 8) == 0x02)
14431419   {
14441420      vic2.reg[0x11] = vic2.reg_buffer[0x11];
r5416r5417
14791455      }
14801456*/
14811457/*
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));
14861458   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));
14881459   if (vic2.raster_mod > 63)
14891460   {
14901461      vic2.raster_mod -= 63;
r5416r5417
15281499   if (vic2.on)
15291500      if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES))
15301501         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);
15331502}
15341503
15351504VIDEO_UPDATE( vic2 )
src/mess/video/vic6567.h
r5416r5417
8080#define VIC6569_FIRSTRASTERCOLUMNS 404
8181#define VIC2_FIRSTRASTERCOLUMNS (vic2.pal?VIC6569_FIRSTRASTERCOLUMNS:VIC6567_FIRSTRASTERCOLUMNS)
8282
83#define VIC6569_FIRST_X 0x194
84#define VIC2_FIRST_X VIC6569_FIRST_X
8385
86#define VIC6569_FIRST_VISIBLE_X 0x1e0
87#define VIC2_FIRST_VISIBLE_X VIC6569_FIRST_VISIBLE_X
88
89#define VIC6569_MAX_X 0x1f7
90#define VIC2_MAX_X VIC6569_MAX_X
91
92#define VIC6569_LAST_VISIBLE_X 0x17c
93#define VIC2_LAST_VISIBLE_X VIC6569_LAST_VISIBLE_X
94
95#define VIC6569_LAST_X 0x193
96#define VIC2_LAST_X VIC6569_LAST_X
97
98
8499/*----------- defined in video/vic6567.c -----------*/
85100
86101/* call to init videodriver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team