Previous 15994 Revisions Next

r3256 Sunday 14th September, 2008 at 07:51:00 UTC by Roberto Zandonà
[C64] fix smooth vertical scroll (see terra cresta or xevious)
[src/mess/drivers]c64.c
[src/mess/video]vic6567.c vic6567.h

src/mess/video/vic6567.c
r3255r3256
213213   UINT16 c64_bitmap[2], bitmapmulti[4], mono[2], multi[4], ecmcolor[2], colors[4], spritemulti[4], spritemulti_buffer[4];
214214
215215   int lastline, rasterline, raster_mod;
216   UINT64 rasterline_start_cpu_cycles;
216   UINT64 rasterline_start_cpu_cycles, totalcycles;
217217
218218   /* background/foreground for sprite collision */
219219   UINT8 *screen[216], shift[216];
r3255r3256
271271{
272272   memset(&vic2, 0, sizeof(vic2));
273273
274   vic2.totalcycles = 63;
274275   vic2.pal = pal;
275276   vic2.lines = VIC2_LINES;
276277
r3255r3256
364365WRITE8_HANDLER ( vic2_port_w )
365366{
366367   int startx, cycles;
367
368   // printf("vic write %04x %04x %04x\n", offset, data, vic2.rasterline);
368369   DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data));
369370   offset &= 0x3f;
370371   switch (offset)
r3255r3256
578579   cycles = (int)(activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles);
579580
580581   if (cycles > VIC2_CYCLESPERLINE - 1) cycles = VIC2_CYCLESPERLINE;
581   startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8;
582   startx = VIC2_FIRSTRASTERCOLUMNS + cycles * 8 * (63 / vic2.totalcycles);
582583   if (startx >= VIC2_COLUMNS) startx -= VIC2_COLUMNS;
583584
584585   // sprites chenges are active only from the next raster line
r3255r3256
12171218      line = end;
12181219   }
12191220
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
12281223   if (first + 1 < vic2.y_end + YPOS)
12291224      end = first + 1;
12301225   else
r3255r3256
13751370//   int scanline = param;
13761371
13771372   vic2.rasterline++;
1373   vic2.rasterline_start_cpu_cycles = activecpu_gettotalcycles();
13781374
13791375   // update sprites registers
13801376   for (i=0x00; i <= 0x10; i++)
r3255r3256
14291425   }
14301426*/
14311427/*
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/*
14321440   if (input_code_pressed(KEYCODE_Q)) { cpunum_set_clock(machine, 0, 0x93203); }
14331441   if (input_code_pressed(KEYCODE_W)) { cpunum_set_clock(machine, 0, 0xf08a0); }
14341442   if (input_code_pressed(KEYCODE_E)) printf("%04x    ",cpunum_get_clock(0));
14351443   if (input_code_pressed(KEYCODE_R)) printf("%04x    ", (int)(cpunum_get_clock(0)*63/103));
14361444   vic2.raster_mod += 63 - (activecpu_gettotalcycles() - vic2.rasterline_start_cpu_cycles);
14371445   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();
14391446   if (vic2.raster_mod > 63)
14401447   {
14411448      vic2.raster_mod -= 63;
r3255r3256
14751482      if (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES - vic2.lines)
14761483         vic2_drawlines (vic2.rasterline + vic2.lines - 1, vic2.rasterline + vic2.lines, VIC2_STARTVISIBLECOLUMNS, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1);
14771484
1485// if (vic2.rasterline == 0x80)
14781486   if (vic2.on)
14791487      if ((vic2.rasterline >= VIC2_FIRSTRASTERLINE) && (vic2.rasterline < VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES))
14801488         vic2_drawlines (vic2.rasterline - 1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS, VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS - 1);
src/mess/video/vic6567.h
r3255r3256
2424#define VIC2_HSIZE   320
2525#define VIC2_VSIZE   200
2626
27#define VIC6567_CYCLESPERLINE 65
27#define VIC6567_CYCLESPERLINE 63
2828#define VIC6569_CYCLESPERLINE 63
2929#define VIC2_CYCLESPERLINE (vic2.pal?VIC6569_CYCLESPERLINE:VIC6567_CYCLESPERLINE)
3030
src/mess/drivers/c64.c
r3255r3256
529529   MDRV_CPU_ADD( "main", M6510, VIC6569_CLOCK)
530530   MDRV_CPU_PROGRAM_MAP(c64_mem, 0)
531531   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
532   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
533532   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC6569_HRETRACERATE)
534533   MDRV_INTERLEAVE(1)
535534

Previous 15994 Revisions Next


© 1998-2018 The MESS Team