\r
void VL_LoadPalFile(const char *filename, byte *palette)\r
{\r
- int fd;\r
-\r
- fd = open(filename,O_RDONLY|O_BINARY);\r
- if (fd >= 0) {\r
- word i;\r
-\r
- read(fd,palette, PAL_SIZE);\r
- close(fd);\r
-\r
- vga_palette_lseek(0);\r
- for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
- }\r
+ VL_LoadPalFilewithoffset(filename, palette, 0);\r
}\r
\r
void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)\r
read(fd,palette, PAL_SIZE);\r
close(fd);\r
\r
- vga_palette_lseek(o);\r
- for (i=o;i < 256-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
+ vga_palette_lseek(1+o);\r
+ for (i=o;i < 255-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
}\r
}\r
\r
modexPalSave(pal);\r
CHKCOLDBGOUT1\r
//check palette for dups\r
- for(; (*z)<PAL_SIZE; (*z)+=3)\r
+ for(; (*z)<PAL_SIZE-3; (*z)+=3)\r
{\r
CHKCOLDBGOUT2\r
//if((*z)%3==0)\r
word w=0;\r
word q=0;\r
word qq=0;\r
- static word a[PAL_SIZE]; //palette array of change values!\r
+ static word a[PAL_SIZE-3]; //palette array of change values!\r
word z=0, aq=0, aa=0, pp=0;\r
\r
//modexWaitBorder();\r
if((*i)==0)\r
{\r
memset(a, -1, sizeof(a));\r
- outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */\r
+ outp(PAL_WRITE_REG, 1); /* start at the beginning of palette */\r
}\r
else if(qp==0)\r
{\r
printf("qq: %02d\n", (qq));//\r
printf(" (*i)-q=%02d\n", (*i)-q);//\r
#endif\r
- outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */\r
+ outp(PAL_WRITE_REG, qq);\r
}\r
- if((*i)<PAL_SIZE && w==0)\r
+ if((*i)<PAL_SIZE-3 && w==0)\r
{\r
- for(; (*i)<PAL_SIZE; (*i)++)\r
+ for(; (*i)<PAL_SIZE-3; (*i)++)\r
{\r
//if(i%3==0 && (p[i+5]==p[i+4] && p[i+4]==p[i+3] && p[i+3]==p[i+2] && p[i+2]==p[i+1] && p[i+1]==p[i] && p[i+5]==p[i]))\r
//____ if((qp>0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else\r