let it build on msvc
[picodrive.git] / pico / draw.c
index a649e8c..83010a4 100644 (file)
@@ -46,6 +46,10 @@ static int  HighCacheA[41+1];   // caches for high layers
 static int  HighCacheB[41+1];\r
 static int  HighPreSpr[80*2+1]; // slightly preprocessed sprites\r
 \r
+#define LF_PLANE_1 (1 << 0)\r
+#define LF_SH      (1 << 1) // must be = 2\r
+#define LF_FORCE   (1 << 2)\r
+\r
 #define SPRL_HAVE_HI     0x80 // have hi priority sprites\r
 #define SPRL_HAVE_LO     0x40 // *lo*\r
 #define SPRL_MAY_HAVE_OP 0x20 // may have operator sprites on the line\r
@@ -54,12 +58,9 @@ unsigned char HighLnSpr[240][3 + MAX_LINE_SPRITES]; // sprite_count, ^flags, til
 \r
 int rendstatus_old;\r
 int rendlines;\r
-int PicoDrawMask = -1;\r
 \r
 static int skip_next_line=0;\r
 \r
-//unsigned short ppt[] = { 0x0f11, 0x0ff1, 0x01f1, 0x011f, 0x01ff, 0x0f1f, 0x0f0e, 0x0e7c };\r
-\r
 struct TileStrip\r
 {\r
   int nametab; // Position in VRAM of name table (for this tile line)\r
@@ -128,19 +129,12 @@ static void funcname(int sx, unsigned int pack, int pal)     \
 }\r
 \r
 \r
-#ifdef _ASM_DRAW_C_AMIPS\r
-int TileNorm(int sx, unsigned int pack, int pal);\r
-int TileFlip(int sx, unsigned int pack, int pal);\r
-#else\r
-\r
 #define pix_just_write(x) \\r
   if (t) pd[x]=pal|t\r
 \r
 TileNormMaker(TileNorm,pix_just_write)\r
 TileFlipMaker(TileFlip,pix_just_write)\r
 \r
-#endif\r
-\r
 #ifndef _ASM_DRAW_C\r
 \r
 // draw a sprite pixel, process operator colors\r
@@ -192,18 +186,24 @@ TileFlipMaker(TileFlipAS_noop, pix_sh_as_noop)
 TileNormMaker(TileNormAS_onlymark, pix_sh_as_onlymark)\r
 TileFlipMaker(TileFlipAS_onlymark, pix_sh_as_onlymark)\r
 \r
+// mark pixel as sprite pixel (AS)\r
+#define pix_and(x) \\r
+  pd[x] = (pd[x] & 0xc0) | (pd[x] & (pal | t))\r
+\r
+TileNormMaker(TileNorm_and, pix_and)\r
+TileFlipMaker(TileFlip_and, pix_and)\r
 \r
 // --------------------------------------------\r
 \r
 #ifndef _ASM_DRAW_C\r
-static void DrawStrip(struct TileStrip *ts, int plane_sh, int cellskip)\r
+static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)\r
 {\r
   int tilex,dx,ty,code=0,addr=0,cells;\r
   int oldcode=-1,blank=-1; // The tile we know is blank\r
   int pal=0,sh;\r
 \r
   // Draw tiles across screen:\r
-  sh=(plane_sh<<5)&0x40;\r
+  sh = (lflags & LF_SH) << 5; // 0x40\r
   tilex=((-ts->hscroll)>>3)+cellskip;\r
   ty=(ts->line&7)<<1; // Y-Offset into tile\r
   dx=((ts->hscroll-1)&7)+1;\r
@@ -211,13 +211,14 @@ static void DrawStrip(struct TileStrip *ts, int plane_sh, int cellskip)
   if(dx != 8) cells++; // have hscroll, need to draw 1 cell more\r
   dx+=cellskip<<3;\r
 \r
-  for (; cells > 0; dx+=8,tilex++,cells--)\r
+  for (; cells > 0; dx+=8, tilex++, cells--)\r
   {\r
     unsigned int pack;\r
 \r
-    code=Pico.vram[ts->nametab+(tilex&ts->xmask)];\r
-    if (code==blank) continue;\r
-    if (code>>15) { // high priority tile\r
+    code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
+    if (code == blank)\r
+      continue;\r
+    if ((code >> 15) | (lflags & LF_FORCE)) { // high priority tile\r
       int cval = code | (dx<<16) | (ty<<25);\r
       if(code&0x1000) cval^=7<<26;\r
       *ts->hc++ = cval; // cache it\r
@@ -234,7 +235,7 @@ static void DrawStrip(struct TileStrip *ts, int plane_sh, int cellskip)
       pal=((code>>9)&0x30)|sh;\r
     }\r
 \r
-    pack = *(unsigned int *)(Pico.vram + addr);\r
+    pack = *(unsigned int *)(PicoMem.vram + addr);\r
     if (!pack) {\r
       blank = code;\r
       continue;\r
@@ -260,7 +261,11 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
   // Draw tiles across screen:\r
   tilex=(-ts->hscroll)>>3;\r
   dx=((ts->hscroll-1)&7)+1;\r
-  if(dx != 8) cell--; // have hscroll, start with negative cell\r
+  if (ts->hscroll & 0x0f) {\r
+    int adj = ((ts->hscroll ^ dx) >> 3) & 1;\r
+    cell -= adj + 1;\r
+    ts->cells -= adj;\r
+  }\r
   cell+=cellskip;\r
   tilex+=cellskip;\r
   dx+=cellskip<<3;\r
@@ -273,7 +278,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
     //if((cell&1)==0)\r
     {\r
       int line,vscroll;\r
-      vscroll=Pico.vsram[(plane_sh&1)+(cell&~1)];\r
+      vscroll=PicoMem.vsram[(plane_sh&1)+(cell&~1)];\r
 \r
       // Find the line in the name table\r
       line=(vscroll+scan)&ts->line&0xffff; // ts->line is really ymask ..\r
@@ -281,7 +286,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
       ty=(line&7)<<1; // Y-Offset into tile\r
     }\r
 \r
-    code=Pico.vram[ts->nametab+nametabadd+(tilex&ts->xmask)];\r
+    code=PicoMem.vram[ts->nametab+nametabadd+(tilex&ts->xmask)];\r
     if (code==blank) continue;\r
     if (code>>15) { // high priority tile\r
       int cval = code | (dx<<16) | (ty<<25);\r
@@ -299,7 +304,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
       pal=((code>>9)&0x30)|((plane_sh<<5)&0x40);\r
     }\r
 \r
-    pack = *(unsigned int *)(Pico.vram + addr);\r
+    pack = *(unsigned int *)(PicoMem.vram + addr);\r
     if (!pack) {\r
       blank = code;\r
       continue;\r
@@ -335,7 +340,7 @@ void DrawStripInterlace(struct TileStrip *ts)
   {\r
     unsigned int pack;\r
 \r
-    code=Pico.vram[ts->nametab+(tilex&ts->xmask)];\r
+    code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];\r
     if (code==blank) continue;\r
     if (code>>15) { // high priority tile\r
       int cval = (code&0xfc00) | (dx<<16) | (ty<<25);\r
@@ -355,7 +360,7 @@ void DrawStripInterlace(struct TileStrip *ts)
       pal=((code>>9)&0x30);\r
     }\r
 \r
-    pack = *(unsigned int *)(Pico.vram + addr);\r
+    pack = *(unsigned int *)(PicoMem.vram + addr);\r
     if (!pack) {\r
       blank = code;\r
       continue;\r
@@ -408,11 +413,11 @@ static void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells,
   htab+=plane_sh&1; // A or B\r
 \r
   // Get horizontal scroll value, will be masked later\r
-  ts.hscroll=Pico.vram[htab&0x7fff];\r
+  ts.hscroll = PicoMem.vram[htab & 0x7fff];\r
 \r
   if((pvid->reg[12]&6) == 6) {\r
     // interlace mode 2\r
-    vscroll=Pico.vsram[plane_sh&1]; // Get vertical scroll value\r
+    vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value\r
 \r
     // Find the line in the name table\r
     ts.line=(vscroll+(est->DrawScanline<<1))&((ymask<<1)|1);\r
@@ -425,7 +430,7 @@ static void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells,
     ts.line=ymask|(shift[width]<<24); // save some stuff instead of line\r
     DrawStripVSRam(&ts, plane_sh, cellskip);\r
   } else {\r
-    vscroll=Pico.vsram[plane_sh&1]; // Get vertical scroll value\r
+    vscroll = PicoMem.vsram[plane_sh & 1]; // Get vertical scroll value\r
 \r
     // Find the line in the name table\r
     ts.line=(vscroll+est->DrawScanline)&ymask;\r
@@ -462,7 +467,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
 \r
   if (!(est->rendstatus & PDRAW_WND_DIFF_PRIO)) {\r
     // check the first tile code\r
-    code=Pico.vram[nametab+tilex];\r
+    code = PicoMem.vram[nametab + tilex];\r
     // if the whole window uses same priority (what is often the case), we may be able to skip this field\r
     if ((code>>15) != prio) return;\r
   }\r
@@ -479,7 +484,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
       int dx, addr;\r
       int pal;\r
 \r
-      code=Pico.vram[nametab+tilex];\r
+      code = PicoMem.vram[nametab + tilex];\r
       if (code==blank) continue;\r
       if ((code>>15) != prio) {\r
         est->rendstatus |= PDRAW_WND_DIFF_PRIO;\r
@@ -490,7 +495,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
       addr=(code&0x7ff)<<4;\r
       if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
 \r
-      pack = *(unsigned int *)(Pico.vram + addr);\r
+      pack = *(unsigned int *)(PicoMem.vram + addr);\r
       if (!pack) {\r
         blank = code;\r
         continue;\r
@@ -511,7 +516,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
       int dx, addr;\r
       int pal;\r
 \r
-      code=Pico.vram[nametab+tilex];\r
+      code = PicoMem.vram[nametab + tilex];\r
       if(code==blank) continue;\r
       if((code>>15) != prio) {\r
         est->rendstatus |= PDRAW_WND_DIFF_PRIO;\r
@@ -532,7 +537,7 @@ static void DrawWindow(int tstart, int tend, int prio, int sh,
       addr=(code&0x7ff)<<4;\r
       if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
 \r
-      pack = *(unsigned int *)(Pico.vram + addr);\r
+      pack = *(unsigned int *)(PicoMem.vram + addr);\r
       if (!pack) {\r
         blank = code;\r
         continue;\r
@@ -580,12 +585,13 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est
   {\r
     short blank=-1; // The tile we know is blank\r
     while ((code=*hc++)) {\r
-      if((short)code == blank) continue;\r
+      if (!(code & 0x8000) || (short)code == blank)\r
+        continue;\r
       // Get tile address/2:\r
-      addr=(code&0x7ff)<<4;\r
-      addr+=(unsigned int)code>>25; // y offset into tile\r
+      addr = (code & 0x7ff) << 4;\r
+      addr += code >> 25; // y offset into tile\r
 \r
-      pack = *(unsigned int *)(Pico.vram + addr);\r
+      pack = *(unsigned int *)(PicoMem.vram + addr);\r
       if (!pack) {\r
         blank = (short)code;\r
         continue;\r
@@ -613,7 +619,7 @@ static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est
       *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;\r
       *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;\r
 \r
-      pack = *(unsigned int *)(Pico.vram + addr);\r
+      pack = *(unsigned int *)(PicoMem.vram + addr);\r
       if (!pack)\r
         continue;\r
 \r
@@ -715,12 +721,33 @@ static void DrawSprite(int *sprite, int sh)
     if(sx<=0)   continue;\r
     if(sx>=328) break; // Offscreen\r
 \r
-    pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+    pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));\r
     fTileFunc(sx, pack, pal);\r
   }\r
 }\r
 #endif\r
 \r
+static NOINLINE void DrawTilesFromCacheForced(const int *hc)\r
+{\r
+  int code, addr, dx;\r
+  unsigned int pack;\r
+  int pal;\r
+\r
+  // *ts->hc++ = code | (dx<<16) | (ty<<25);\r
+  while ((code = *hc++)) {\r
+    // Get tile address/2:\r
+    addr = (code & 0x7ff) << 4;\r
+    addr += (code >> 25) & 0x0e; // y offset into tile\r
+\r
+    dx = (code >> 16) & 0x1ff;\r
+    pal = ((code >> 9) & 0x30);\r
+    pack = *(unsigned int *)(PicoMem.vram + addr);\r
+\r
+    if (code & 0x0800) TileFlip_and(dx, pack, pal);\r
+    else               TileNorm_and(dx, pack, pal);\r
+  }\r
+}\r
+\r
 static void DrawSpriteInterlace(unsigned int *sprite)\r
 {\r
   int width=0,height=0;\r
@@ -760,14 +787,14 @@ static void DrawSpriteInterlace(unsigned int *sprite)
     if(sx<=0)   continue;\r
     if(sx>=328) break; // Offscreen\r
 \r
-    pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+    pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));\r
     if (code & 0x0800) TileFlip(sx, pack, pal);\r
     else               TileNorm(sx, pack, pal);\r
   }\r
 }\r
 \r
 \r
-static void DrawAllSpritesInterlace(int pri, int sh)\r
+static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)\r
 {\r
   struct PicoVideo *pvid=&Pico.video;\r
   int i,u,table,link=0,sline=Pico.est.DrawScanline<<1;\r
@@ -782,7 +809,7 @@ static void DrawAllSpritesInterlace(int pri, int sh)
     unsigned int *sprite;\r
     int code, sx, sy, height;\r
 \r
-    sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
+    sprite=(unsigned int *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
 \r
     // get sprite info\r
     code = sprite[0];\r
@@ -885,7 +912,7 @@ static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)
       if(sx<=0)   continue;\r
       if(sx>=328) break; // Offscreen\r
 \r
-      pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+      pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));\r
       fTileFunc(sx, pack, pal);\r
     }\r
   }\r
@@ -959,7 +986,7 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
       if(sx<=0)   continue;\r
       if(sx>=328) break; // Offscreen\r
 \r
-      pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+      pack = *(unsigned int *)(PicoMem.vram + (tile & 0x7fff));\r
       fTileFunc(sx, pack, pal);\r
     }\r
   }\r
@@ -1019,7 +1046,7 @@ static NOINLINE void PrepareSprites(int full)
       unsigned int *sprite;\r
       int code2, sx, sy, height;\r
 \r
-      sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
+      sprite=(unsigned int *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
 \r
       // parse sprite info\r
       code2 = sprite[1];\r
@@ -1072,7 +1099,7 @@ found:;
       unsigned int *sprite;\r
       int code, code2, sx, sy, hv, height, width;\r
 \r
-      sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
+      sprite=(unsigned int *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
 \r
       // parse sprite info\r
       code = sprite[0];\r
@@ -1196,7 +1223,7 @@ void PicoDoHighPal555(int sh, int line, struct PicoEState *est)
 \r
   Pico.m.dirtyPal = 0;\r
 \r
-  spal = (void *)Pico.cram;\r
+  spal = (void *)PicoMem.cram;\r
   dpal = (void *)est->HighPal;\r
 \r
   for (i = 0; i < 0x40 / 2; i++) {\r
@@ -1278,9 +1305,9 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
     rs |= PDRAW_SONIC_MODE;\r
     est->rendstatus = rs;\r
     if (dirty_count == 3) {\r
-      blockcpy(est->HighPal, Pico.cram, 0x40*2);\r
+      blockcpy(est->HighPal, PicoMem.cram, 0x40*2);\r
     } else if (dirty_count == 11) {\r
-      blockcpy(est->HighPal+0x40, Pico.cram, 0x40*2);\r
+      blockcpy(est->HighPal+0x40, PicoMem.cram, 0x40*2);\r
     }\r
   }\r
 \r
@@ -1312,8 +1339,8 @@ static int DrawDisplay(int sh)
   struct PicoEState *est=&Pico.est;\r
   unsigned char *sprited = &HighLnSpr[est->DrawScanline][0];\r
   struct PicoVideo *pvid=&Pico.video;\r
-  int win=0,edge=0,hvwind=0;\r
-  int maxw,maxcells;\r
+  int win=0, edge=0, hvwind=0, lflags;\r
+  int maxw, maxcells;\r
 \r
   if (est->rendstatus & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {\r
     // elprintf(EL_STATUS, "PrepareSprites(%i)", (est->rendstatus>>4)&1);\r
@@ -1351,29 +1378,40 @@ static int DrawDisplay(int sh)
   }\r
 \r
   /* - layer B low - */\r
-  if (PicoDrawMask & PDRAW_LAYERB_ON)\r
-    DrawLayer(1|(sh<<1), HighCacheB, 0, maxcells, est);\r
+  if (!(pvid->debug_p & PVD_KILL_B)) {\r
+    lflags = LF_PLANE_1 | (sh << 1);\r
+    if (pvid->debug_p & PVD_FORCE_B)\r
+      lflags |= LF_FORCE;\r
+    DrawLayer(lflags, HighCacheB, 0, maxcells, est);\r
+  }\r
   /* - layer A low - */\r
-  if (!(PicoDrawMask & PDRAW_LAYERA_ON));\r
+  lflags = 0 | (sh << 1);\r
+  if (pvid->debug_p & PVD_FORCE_A)\r
+    lflags |= LF_FORCE;\r
+  if (pvid->debug_p & PVD_KILL_A)\r
+    ;\r
   else if (hvwind == 1)\r
     DrawWindow(0, maxcells>>1, 0, sh, est);\r
   else if (hvwind == 2) {\r
-    DrawLayer(0|(sh<<1), HighCacheA, (win&0x80) ?    0 : edge<<1, (win&0x80) ?     edge<<1 : maxcells, est);\r
-    DrawWindow(                      (win&0x80) ? edge :       0, (win&0x80) ? maxcells>>1 : edge, 0, sh, est);\r
-  } else\r
-    DrawLayer(0|(sh<<1), HighCacheA, 0, maxcells, est);\r
+    DrawLayer(lflags, HighCacheA, (win&0x80) ?    0 : edge<<1, (win&0x80) ?     edge<<1 : maxcells, est);\r
+    DrawWindow(                   (win&0x80) ? edge :       0, (win&0x80) ? maxcells>>1 : edge, 0, sh, est);\r
+  }\r
+  else\r
+    DrawLayer(lflags, HighCacheA, 0, maxcells, est);\r
   /* - sprites low - */\r
-  if (!(PicoDrawMask & PDRAW_SPRITES_LOW_ON));\r
+  if (pvid->debug_p & PVD_KILL_S_LO)\r
+    ;\r
   else if (est->rendstatus & PDRAW_INTERLACE)\r
     DrawAllSpritesInterlace(0, sh);\r
   else if (sprited[1] & SPRL_HAVE_LO)\r
     DrawAllSprites(sprited, 0, sh, est);\r
 \r
   /* - layer B hi - */\r
-  if ((PicoDrawMask & PDRAW_LAYERB_ON) && HighCacheB[0])\r
+  if (!(pvid->debug_p & PVD_KILL_B) && HighCacheB[0])\r
     DrawTilesFromCache(HighCacheB, sh, maxw, est);\r
   /* - layer A hi - */\r
-  if (!(PicoDrawMask & PDRAW_LAYERA_ON));\r
+  if (pvid->debug_p & PVD_KILL_A)\r
+    ;\r
   else if (hvwind == 1)\r
     DrawWindow(0, maxcells>>1, 1, sh, est);\r
   else if (hvwind == 2) {\r
@@ -1384,7 +1422,8 @@ static int DrawDisplay(int sh)
     if (HighCacheA[0])\r
       DrawTilesFromCache(HighCacheA, sh, maxw, est);\r
   /* - sprites hi - */\r
-  if (!(PicoDrawMask & PDRAW_SPRITES_HI_ON));\r
+  if (pvid->debug_p & PVD_KILL_S_HI)\r
+    ;\r
   else if (est->rendstatus & PDRAW_INTERLACE)\r
     DrawAllSpritesInterlace(1, sh);\r
   // have sprites without layer pri bit ontop of sprites with that bit\r
@@ -1395,6 +1434,11 @@ static int DrawDisplay(int sh)
   else if (sprited[1] & SPRL_HAVE_HI)\r
     DrawAllSprites(sprited, 1, 0, est);\r
 \r
+  if (pvid->debug_p & PVD_FORCE_B)\r
+    DrawTilesFromCacheForced(HighCacheB);\r
+  else if (pvid->debug_p & PVD_FORCE_A)\r
+    DrawTilesFromCacheForced(HighCacheA);\r
+\r
 #if 0\r
   {\r
     int *c, a, b;\r
@@ -1480,6 +1524,9 @@ static void PicoLine(int line, int offs, int sh, int bgc)
     return;\r
   }\r
 \r
+  if (Pico.video.debug_p & (PVD_FORCE_A | PVD_FORCE_B))\r
+    bgc = 0x3f;\r
+\r
   // Draw screen:\r
   BackFill(bgc, sh, &Pico.est);\r
   if (Pico.video.reg[1]&0x40)\r
@@ -1503,13 +1550,14 @@ void PicoDrawSync(int to, int blank_last_line)
 \r
   pprof_start(draw);\r
 \r
-  if (rendlines != 240)\r
+  if (rendlines != 240) {\r
     offs = 8;\r
+    if (to > 223)\r
+      to = 223;\r
+  }\r
 \r
   for (line = Pico.est.DrawScanline; line < to; line++)\r
-  {\r
     PicoLine(line, offs, sh, bgc);\r
-  }\r
 \r
   // last line\r
   if (line <= to)\r
@@ -1569,7 +1617,7 @@ void PicoDrawSetOutBuf(void *dest, int increment)
 {\r
   DrawLineDestBase = dest;\r
   DrawLineDestIncrement = increment;\r
-  Pico.est.DrawLineDest = DrawLineDestBase + Pico.est.DrawScanline * increment;\r
+  Pico.est.DrawLineDest = (char *)DrawLineDestBase + Pico.est.DrawScanline * increment;\r
 }\r
 \r
 void PicoDrawSetInternalBuf(void *dest, int increment)\r