Previous 15994 Revisions Next

r3228 Thursday 11th September, 2008 at 18:13:01 UTC by Roberto Zandonà
[C64] update the raster changing in the middle of a line
[src/mess/video]vic6567.c vic6567.h

src/mess/video/vic6567.c
r3227r3228
212212
213213   UINT16 c64_bitmap[2], bitmapmulti[4], mono[2], multi[4], ecmcolor[2], colors[4], spritemulti[4], spritemulti_buffer[4];
214214
215   int lastline, rasterline;
215   int lastline, rasterline, raster_mod;
216216   UINT64 rasterline_start_cpu_cycles;
217217
218218   /* background/foreground for sprite collision */
r3227r3228
571571
572572   cycles = (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles);
573573
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;
576576   if (startx >= VIC2_COLUMNS) startx -= VIC2_COLUMNS;
577577
578578   // 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)
586586            {
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);
588592            }
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            }
596600         }
597      }
598   }
599*/
600601}
601602
602603READ8_HANDLER ( vic2_port_r )
r3227r3228
14621463   }
14631464   for (i=0; i < 5; i++)
14641465      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); }
14671468   // if (input_code_pressed(KEYCODE_E)) printf("%04x    ",cpunum_get_clock(0));
14681469   // 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));
14691472   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   }
14701483
14711484   if (vic2.rasterline == vic2.lines)
14721485   {
src/mess/video/vic6567.h
r3227r3228
4444#define VIC2_CLOCK ((vic2.pal?VIC6569_CLOCK:VIC6567_CLOCK))
4545
4646#define VIC6567_HRETRACERATE (VIC6567_CLOCK / 65)
47#define VIC6569_HRETRACERATE (VIC6569_CLOCK / 63)
47#define VIC6569_HRETRACERATE (VIC6569_CLOCK / VIC6569_CLOCK )
4848
49#define VIC2_HRETRACERATE (vic2.pal?VIC6569_VRETRACERATE:VIC6567_VRETRACERATE)
49#define VIC2_HRETRACERATE (vic2.pal?VIC6569_HRETRACERATE:VIC6567_HRETRACERATE)
5050
5151/* pal 50 Hz vertical screen refresh, screen consists of 312 lines
5252 * ntsc 60 Hz vertical screen refresh, screen consists of 262 lines */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team