\r
\r
#include "PicoInt.h"\r
-#ifndef __GNUC__\r
-#pragma warning (disable:4706) // Disable assignment within conditional\r
-#endif\r
\r
int (*PicoScan)(unsigned int num, void *data)=NULL;\r
\r
-unsigned short DefOutBuff[320*2];\r
+#if OVERRIDE_HIGHCOL\r
+static unsigned char DefHighCol[8+320+8];\r
+unsigned char *HighCol=DefHighCol;\r
+#else\r
unsigned char HighCol[8+320+8];\r
+#endif\r
+unsigned short DefOutBuff[320*2];\r
+void *DrawLineDest=DefOutBuff; // pointer to dest buffer where to draw this line to\r
+\r
static int HighCacheA[41+1]; // caches for high layers\r
static int HighCacheB[41+1];\r
static int HighCacheS[80+1]; // and sprites\r
// lsb->msb: moved sprites, not all window tiles use same priority, accurate sprites (copied from PicoOpt), interlace\r
// dirty sprites, sonic mode, have layer with all hi prio tiles (mk3), layer sh/hi already processed\r
int rendstatus;\r
-void *DrawLineDest=DefOutBuff; // pointer to dest buffer where to draw this line to\r
int Scanline=0; // Scanline\r
\r
static int SpriteBlocks;\r
#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
#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
unsigned short *pal=HighPal;\r
int len, i, t, dirtyPal = Pico.m.dirtyPal;\r
\r
- if(dirtyPal) {\r
- unsigned short *ppal=Pico.cram;\r
- for(i = 0x3f; i >= 0; i--)\r
- pal[i] = (unsigned short) (((ppal[i]&0x00f)<<12)|((ppal[i]&0x0f0)<<3)|((ppal[i]&0xf00)>>7));\r
+ if (dirtyPal)\r
+ {\r
+ unsigned int *spal=(void *)Pico.cram;\r
+ unsigned int *dpal=(void *)HighPal;\r
+ for (i = 0x3f/2; i >= 0; i--)\r
+#ifdef USE_BGR555\r
+ dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);\r
+#else\r
+ dpal[i] = ((spal[i]&0x000f000f)<<12)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)>>7);\r
+#endif\r
Pico.m.dirtyPal = 0;\r
}\r
\r
- if (Pico.video.reg[12]&1) {\r
- len = 320;\r
- } else {\r
- if(!(PicoOpt&0x100)) pd+=32;\r
- len = 256;\r
- }\r
-\r
- if(sh) {\r
- if(dirtyPal) {\r
+ if (sh)\r
+ {\r
+ if (dirtyPal) {\r
// shadowed pixels\r
- for(i = 0x3f; i >= 0; i--)\r
+ for (i = 0x3f; i >= 0; i--)\r
pal[0x40|i] = pal[0xc0|i] = (unsigned short)((pal[i]>>1)&0x738e);\r
// hilighted pixels\r
- for(i = 0x3f; i >= 0; i--) {\r
+ for (i = 0x3f; i >= 0; i--) {\r
t=pal[i]&0xe71c;t+=0x4208;if(t&0x20)t|=0x1c;if(t&0x800)t|=0x700;if(t&0x10000)t|=0xe000;t&=0xe71c;\r
pal[0x80|i]=(unsigned short)t;\r
}\r
}\r
}\r
\r
- for(i = 0; i < len; i++)\r
+ if (Pico.video.reg[12]&1) {\r
+ len = 320;\r
+ } else {\r
+ if (!(PicoOpt&0x100)) pd+=32;\r
+ len = 256;\r
+ }\r
+\r
+#ifndef PSP\r
+ for (i = 0; i < len; i++)\r
pd[i] = pal[ps[i]];\r
+#else\r
+ {\r
+ extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);\r
+ amips_clut(pd, ps, pal, len);\r
+ }\r
+#endif\r
}\r
#endif\r
\r
}\r
}\r
\r
-void (*FinalizeLine)(int sh) = FinalizeLineBGR444;\r
+static void (*FinalizeLine)(int sh) = FinalizeLineBGR444;\r
\r
// --------------------------------------------\r
\r
if (Pico.video.reg[1]&0x40)\r
DrawDisplay(sh);\r
\r
- FinalizeLine(sh);\r
- //if (SpriteBlocks & (1<<(scan>>3))) for (sh=0; sh < 30; sh++) DrawLineDest[sh] = 0xf;\r
+ if (FinalizeLine != NULL)\r
+ FinalizeLine(sh);\r
\r
Skip=PicoScan(Scanline,DrawLineDest);\r
\r
\r
void PicoDrawSetColorFormat(int which)\r
{\r
- if (which == 2)\r
- FinalizeLine = FinalizeLine8bit;\r
- else if (which == 1)\r
- FinalizeLine = FinalizeLineRGB555;\r
- else FinalizeLine = FinalizeLineBGR444;\r
+ switch (which)\r
+ {\r
+ case 2: FinalizeLine = FinalizeLine8bit; break;\r
+ case 1: FinalizeLine = FinalizeLineRGB555; break;\r
+ case 0: FinalizeLine = FinalizeLineBGR444; break;\r
+ default:FinalizeLine = NULL; break;\r
+ }\r
+#if OVERRIDE_HIGHCOL\r
+ if (which) HighCol=DefHighCol;\r
+#endif\r
}\r
+\r