#endif\r
\r
\r
+#ifdef _ASM_DRAW_C_AMIPS\r
+int TileNorm(int sx,int addr,int pal);\r
+int TileFlip(int sx,int addr,int pal);\r
+#else\r
static int TileNorm(int sx,int addr,int pal)\r
{\r
unsigned char *pd = HighCol+sx;\r
}\r
return 1; // Tile blank\r
}\r
-\r
+#endif\r
\r
// tile renderers for hacky operator sprite support\r
#define sh_pix(x) \\r
}\r
\r
// Draw tiles across screen:\r
- for (; tilex < tend; tilex++)\r
+ if (!sh)\r
{\r
- int addr=0,zero=0;\r
- int pal;\r
+ for (; tilex < tend; tilex++)\r
+ {\r
+ int addr=0,zero=0;\r
+ int pal;\r
+\r
+ code=Pico.vram[nametab+tilex];\r
+ if(code==blank) continue;\r
+ if((code>>15) != prio) {\r
+ rendstatus|=2;\r
+ continue;\r
+ }\r
\r
- code=Pico.vram[nametab+tilex];\r
- if(code==blank) continue;\r
- if((code>>15) != prio) {\r
- rendstatus|=2;\r
- continue;\r
+ pal=((code>>9)&0x30);\r
+\r
+ // Get tile address/2:\r
+ addr=(code&0x7ff)<<4;\r
+ if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
+\r
+ if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
+ else zero=TileNorm(8+(tilex<<3),addr,pal);\r
+\r
+ if (zero) blank=code; // We know this tile is blank now\r
}\r
+ }\r
+ else\r
+ {\r
+ for (; tilex < tend; tilex++)\r
+ {\r
+ int addr=0,zero=0;\r
+ int pal, tmp, *zb;\r
+\r
+ code=Pico.vram[nametab+tilex];\r
+ if(code==blank) continue;\r
+ if((code>>15) != prio) {\r
+ rendstatus|=2;\r
+ continue;\r
+ }\r
\r
- pal=((code>>9)&0x30);\r
+ pal=((code>>9)&0x30);\r
\r
- if(sh) {\r
- int tmp, *zb = (int *)(HighCol+8+(tilex<<3));\r
+ zb = (int *)(HighCol+8+(tilex<<3));\r
if(prio) {\r
tmp = *zb;\r
if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
} else {\r
pal |= 0x40;\r
}\r
- }\r
\r
- // Get tile address/2:\r
- addr=(code&0x7ff)<<4;\r
- if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
+ // Get tile address/2:\r
+ addr=(code&0x7ff)<<4;\r
+ if (code&0x1000) addr+=14-ty; else addr+=ty; // Y-flip\r
\r
- if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
- else zero=TileNorm(8+(tilex<<3),addr,pal);\r
+ if (code&0x0800) zero=TileFlip(8+(tilex<<3),addr,pal);\r
+ else zero=TileNorm(8+(tilex<<3),addr,pal);\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (zero) blank=code; // We know this tile is blank now\r
+ }\r
}\r
-\r
- // terminate the cache list\r
- //*hcache = 0;\r
}\r
\r
// --------------------------------------------\r
\r
+static void DrawTilesFromCacheShPrep(void)\r
+{\r
+ if (!(rendstatus&0x80))\r
+ {\r
+ // as some layer has covered whole line with hi priority tiles,\r
+ // we can process whole line and then act as if sh/hi mode was off.\r
+ int c = 320/4, *zb = (int *)(HighCol+8);\r
+ rendstatus|=0x80;\r
+ while (c--)\r
+ {\r
+ int tmp = *zb;\r
+ if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;\r
+ else {\r
+ if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
+ if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;\r
+ *zb=tmp;\r
+ }\r
+ zb++;\r
+ }\r
+ }\r
+}\r
+\r
static void DrawTilesFromCache(int *hc, int sh, int rlim)\r
{\r
int code, addr, dx;\r
\r
if (sh && (rendstatus&0xc0))\r
{\r
- if (!(rendstatus&0x80))\r
- {\r
- // as some layer has covered whole line with hi priority tiles,\r
- // we can process whole line and then act as if sh/hi mode was off.\r
- rendstatus|=0x80;\r
- int c = 320/4, *zb = (int *)(HighCol+8);\r
- while (c--)\r
- {\r
- int tmp = *zb;\r
- if (!(tmp & 0x80808080)) *zb=tmp&0x3f3f3f3f;\r
- else {\r
- if(!(tmp&0x00000080)) tmp&=~0x000000c0; if(!(tmp&0x00008000)) tmp&=~0x0000c000;\r
- if(!(tmp&0x00800000)) tmp&=~0x00c00000; if(!(tmp&0x80000000)) tmp&=~0xc0000000;\r
- *zb=tmp;\r
- }\r
- zb++;\r
- }\r
- }\r
+ DrawTilesFromCacheShPrep();\r
sh = 0;\r
}\r
\r
- if (sh)\r
+ if (!sh)\r
{\r
+ short blank=-1; // The tile we know is blank\r
while ((code=*hc++)) {\r
- unsigned char *zb;\r
+ int zero;\r
+ if((short)code == blank) continue;\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
addr+=(unsigned int)code>>25; // y offset into tile\r
dx=(code>>16)&0x1ff;\r
- zb = HighCol+dx;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
- if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
\r
pal=((code>>9)&0x30);\r
if (rlim-dx < 0) goto last_cut_tile;\r
\r
- if (code&0x0800) TileFlip(dx,addr,pal);\r
- else TileNorm(dx,addr,pal);\r
+ if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
+ else zero=TileNorm(dx,addr,pal);\r
+\r
+ if (zero) blank=(short)code;\r
}\r
}\r
else\r
{\r
- short blank=-1; // The tile we know is blank\r
while ((code=*hc++)) {\r
- int zero;\r
- if((short)code == blank) continue;\r
+ unsigned char *zb;\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
addr+=(unsigned int)code>>25; // y offset into tile\r
dx=(code>>16)&0x1ff;\r
+ zb = HighCol+dx;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
+ if(!(*zb&0x80)) *zb&=0x3f; zb++; if(!(*zb&0x80)) *zb&=0x3f; zb++;\r
\r
pal=((code>>9)&0x30);\r
if (rlim-dx < 0) goto last_cut_tile;\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
-\r
- if (zero) blank=(short)code;\r
+ if (code&0x0800) TileFlip(dx,addr,pal);\r
+ else TileNorm(dx,addr,pal);\r
}\r
}\r
return;\r
#ifndef _ASM_DRAW_C\r
static void BackFill(int reg7, int sh)\r
{\r
- unsigned int back=0;\r
- unsigned int *pd=NULL,*end=NULL;\r
+ unsigned int back;\r
\r
// Start with a blank scanline (background colour):\r
back=reg7&0x3f;\r
back|=back<<8;\r
back|=back<<16;\r
\r
- pd= (unsigned int *)(HighCol+8);\r
- end=(unsigned int *)(HighCol+8+320);\r
-\r
- do { pd[0]=pd[1]=pd[2]=pd[3]=back; pd+=4; } while (pd<end);\r
+ memset32((int *)(HighCol+8), back, 320/4);\r
}\r
#endif\r
\r