\r
\r
#define TileNormMaker(funcname,pix_func) \\r
-static int funcname(int sx,int addr,int pal) \\r
+static void funcname(int sx, unsigned int pack, int pal) \\r
{ \\r
- unsigned char *pd = Pico.est.HighCol+sx; \\r
- unsigned int pack=0; unsigned int t=0; \\r
+ unsigned char *pd = Pico.est.HighCol + sx; \\r
+ unsigned int t; \\r
\\r
- pack=*(unsigned int *)(Pico.vram+addr); /* Get 8 pixels */ \\r
- if (pack) \\r
- { \\r
- t=(pack&0x0000f000)>>12; pix_func(0); \\r
- t=(pack&0x00000f00)>> 8; pix_func(1); \\r
- t=(pack&0x000000f0)>> 4; pix_func(2); \\r
- t=(pack&0x0000000f) ; pix_func(3); \\r
- t=(pack&0xf0000000)>>28; pix_func(4); \\r
- t=(pack&0x0f000000)>>24; pix_func(5); \\r
- t=(pack&0x00f00000)>>20; pix_func(6); \\r
- t=(pack&0x000f0000)>>16; pix_func(7); \\r
- return 0; \\r
- } \\r
- \\r
- return 1; /* Tile blank */ \\r
+ t = (pack&0x0000f000)>>12; pix_func(0); \\r
+ t = (pack&0x00000f00)>> 8; pix_func(1); \\r
+ t = (pack&0x000000f0)>> 4; pix_func(2); \\r
+ t = (pack&0x0000000f) ; pix_func(3); \\r
+ t = (pack&0xf0000000)>>28; pix_func(4); \\r
+ t = (pack&0x0f000000)>>24; pix_func(5); \\r
+ t = (pack&0x00f00000)>>20; pix_func(6); \\r
+ t = (pack&0x000f0000)>>16; pix_func(7); \\r
}\r
\r
-\r
#define TileFlipMaker(funcname,pix_func) \\r
-static int funcname(int sx,int addr,int pal) \\r
+static void funcname(int sx, unsigned int pack, int pal) \\r
{ \\r
- unsigned char *pd = Pico.est.HighCol+sx; \\r
- unsigned int pack=0; unsigned int t=0; \\r
+ unsigned char *pd = Pico.est.HighCol + sx; \\r
+ unsigned int t; \\r
\\r
- pack=*(unsigned int *)(Pico.vram+addr); /* Get 8 pixels */ \\r
- if (pack) \\r
- { \\r
- t=(pack&0x000f0000)>>16; pix_func(0); \\r
- t=(pack&0x00f00000)>>20; pix_func(1); \\r
- t=(pack&0x0f000000)>>24; pix_func(2); \\r
- t=(pack&0xf0000000)>>28; pix_func(3); \\r
- t=(pack&0x0000000f) ; pix_func(4); \\r
- t=(pack&0x000000f0)>> 4; pix_func(5); \\r
- t=(pack&0x00000f00)>> 8; pix_func(6); \\r
- t=(pack&0x0000f000)>>12; pix_func(7); \\r
- return 0; \\r
- } \\r
- \\r
- return 1; /* Tile blank */ \\r
+ t = (pack&0x000f0000)>>16; pix_func(0); \\r
+ t = (pack&0x00f00000)>>20; pix_func(1); \\r
+ t = (pack&0x0f000000)>>24; pix_func(2); \\r
+ t = (pack&0xf0000000)>>28; pix_func(3); \\r
+ t = (pack&0x0000000f) ; pix_func(4); \\r
+ t = (pack&0x000000f0)>> 4; pix_func(5); \\r
+ t = (pack&0x00000f00)>> 8; pix_func(6); \\r
+ t = (pack&0x0000f000)>>12; pix_func(7); \\r
}\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
+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
\r
for (; cells > 0; dx+=8,tilex++,cells--)\r
{\r
- int zero=0;\r
+ unsigned int pack;\r
\r
code=Pico.vram[ts->nametab+(tilex&ts->xmask)];\r
if (code==blank) continue;\r
pal=((code>>9)&0x30)|sh;\r
}\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = code;\r
+ continue;\r
+ }\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
}\r
\r
// this is messy\r
-void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)\r
+static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)\r
{\r
int tilex,dx,code=0,addr=0,cell=0;\r
int oldcode=-1,blank=-1; // The tile we know is blank\r
\r
for (; cell < ts->cells; dx+=8,tilex++,cell++)\r
{\r
- int zero=0,nametabadd,ty;\r
+ int nametabadd, ty;\r
+ unsigned int pack;\r
\r
//if((cell&1)==0)\r
{\r
pal=((code>>9)&0x30)|((plane_sh<<5)&0x40);\r
}\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = code;\r
+ continue;\r
+ }\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
\r
for (; cells; dx+=8,tilex++,cells--)\r
{\r
- int zero=0;\r
+ unsigned int pack;\r
\r
code=Pico.vram[ts->nametab+(tilex&ts->xmask)];\r
if (code==blank) continue;\r
pal=((code>>9)&0x30);\r
}\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = code;\r
+ continue;\r
+ }\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
\r
// terminate the cache list\r
{\r
for (; tilex < tend; tilex++)\r
{\r
- int addr=0,zero=0;\r
+ unsigned int pack;\r
+ int dx, addr;\r
int pal;\r
\r
code=Pico.vram[nametab+tilex];\r
continue;\r
}\r
\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
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = code;\r
+ continue;\r
+ }\r
+\r
+ pal = ((code >> 9) & 0x30);\r
+ dx = 8 + (tilex << 3);\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
}\r
else\r
{\r
for (; tilex < tend; tilex++)\r
{\r
- int addr=0,zero=0;\r
+ unsigned int pack;\r
+ int dx, addr;\r
int pal;\r
\r
code=Pico.vram[nametab+tilex];\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
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = code;\r
+ continue;\r
+ }\r
+\r
+ dx = 8 + (tilex << 3);\r
\r
- if (zero) blank=code; // We know this tile is blank now\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
}\r
}\r
static void DrawTilesFromCache(int *hc, int sh, int rlim, struct PicoEState *est)\r
{\r
int code, addr, dx;\r
+ unsigned int pack;\r
int pal;\r
\r
// *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it\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
// 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
\r
- pal=((code>>9)&0x30);\r
- if (rlim-dx < 0) goto last_cut_tile;\r
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack) {\r
+ blank = (short)code;\r
+ continue;\r
+ }\r
\r
- if (code&0x0800) zero=TileFlip(dx,addr,pal);\r
- else zero=TileNorm(dx,addr,pal);\r
+ dx = (code >> 16) & 0x1ff;\r
+ pal = ((code >> 9) & 0x30);\r
+ if (rlim-dx < 0)\r
+ goto last_cut_tile;\r
\r
- if (zero) blank=(short)code;\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
}\r
else\r
{\r
while ((code=*hc++)) {\r
unsigned char *zb;\r
+\r
// Get tile address/2:\r
addr=(code&0x7ff)<<4;\r
addr+=(unsigned int)code>>25; // y offset into tile\r
*zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;\r
*zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf; *zb++ &= 0xbf;\r
\r
- pal=((code>>9)&0x30);\r
- if (rlim-dx < 0) goto last_cut_tile;\r
+ pack = *(unsigned int *)(Pico.vram + addr);\r
+ if (!pack)\r
+ continue;\r
+\r
+ pal = ((code >> 9) & 0x30);\r
+ if (rlim - dx < 0)\r
+ goto last_cut_tile;\r
\r
- if (code&0x0800) TileFlip(dx,addr,pal);\r
- else TileNorm(dx,addr,pal);\r
+ if (code & 0x0800) TileFlip(dx, pack, pal);\r
+ else TileNorm(dx, pack, pal);\r
}\r
}\r
return;\r
\r
last_cut_tile:\r
+ // for vertical window cutoff\r
{\r
- unsigned int t, pack=*(unsigned int *)(Pico.vram+addr); // Get 8 pixels\r
- unsigned char *pd = est->HighCol+dx;\r
- if (!pack) return;\r
+ unsigned char *pd = est->HighCol + dx;\r
+ unsigned int t;\r
+\r
if (code&0x0800)\r
{\r
switch (rlim-dx+8)\r
int pal;\r
int tile=0,delta=0;\r
int sx, sy;\r
- int (*fTileFunc)(int sx,int addr,int pal);\r
+ void (*fTileFunc)(int sx, unsigned int pack, int pal);\r
\r
// parse the sprite data\r
sy=sprite[0];\r
\r
for (; width; width--,sx+=8,tile+=delta)\r
{\r
+ unsigned int pack;\r
+\r
if(sx<=0) continue;\r
if(sx>=328) break; // Offscreen\r
\r
- tile&=0x7fff; // Clip tile address\r
- fTileFunc(sx,tile,pal);\r
+ pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+ fTileFunc(sx, pack, pal);\r
}\r
}\r
#endif\r
\r
for (; width; width--,sx+=8,tile+=delta)\r
{\r
+ unsigned int pack;\r
+\r
if(sx<=0) continue;\r
if(sx>=328) break; // Offscreen\r
\r
- tile&=0x7fff; // Clip tile address\r
- if (code&0x0800) TileFlip(sx,tile,pal);\r
- else TileNorm(sx,tile,pal);\r
+ pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+ if (code & 0x0800) TileFlip(sx, pack, pal);\r
+ else TileNorm(sx, pack, pal);\r
}\r
}\r
\r
*/\r
static void DrawSpritesSHi(unsigned char *sprited, const struct PicoEState *est)\r
{\r
- int (*fTileFunc)(int sx,int addr,int pal);\r
+ void (*fTileFunc)(int sx, unsigned int pack, int pal);\r
unsigned char *p;\r
int cnt;\r
\r
\r
for (; width; width--,sx+=8,tile+=delta)\r
{\r
+ unsigned int pack;\r
+\r
if(sx<=0) continue;\r
if(sx>=328) break; // Offscreen\r
\r
- tile&=0x7fff; // Clip tile address\r
- fTileFunc(sx,tile,pal);\r
+ pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+ fTileFunc(sx, pack, pal);\r
}\r
}\r
}\r
\r
static void DrawSpritesHiAS(unsigned char *sprited, int sh)\r
{\r
- int (*fTileFunc)(int sx,int addr,int pal);\r
+ void (*fTileFunc)(int sx, unsigned int pack, int pal);\r
unsigned char *p;\r
int entry, cnt, sh_cnt = 0;\r
\r
pal |= 0x80;\r
for (; width; width--,sx+=8,tile+=delta)\r
{\r
+ unsigned int pack;\r
+\r
if(sx<=0) continue;\r
if(sx>=328) break; // Offscreen\r
\r
- tile&=0x7fff; // Clip tile address\r
- fTileFunc(sx,tile,pal);\r
+ pack = *(unsigned int *)(Pico.vram + (tile & 0x7fff));\r
+ fTileFunc(sx, pack, pal);\r
}\r
}\r
\r