}\r
\r
void\r
-modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) {\r
+modexClearRegion(page_t *page, int x, int y, int w, int h, byte color)\r
+{\r
word pageOff = (word) page->data;\r
- word xoff=x/4; /* xoffset that begins each row */\r
- word scanCount=w/4; /* number of iterations per row (excluding right clip)*/\r
- word poffset = pageOff + y*(page->stridew) + xoff; /* starting offset */\r
- word nextRow = page->stridew-scanCount-1; /* loc of next row */\r
- byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
+ word xoff=(x>>2); // xoffset that begins each row\r
+ word poffset = pageOff + y*(page->stridew) + xoff; // starting offset\r
+ word scanCount=w>>2; // number of iterations per row (excluding right clip)\r
+ word nextRow = page->stridew-scanCount-1; // loc of next row\r
+ byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; // clips for rectangles not on 4s\r
byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
byte left = lclip[x&0x03];\r
byte right = rclip[(x+w)&0x03];\r
\r
- /* handle the case which requires an extra group */\r
+ // handle the case which requires an extra group\r
if((x & 0x03) && !((x+w) & 0x03)) {\r
- right=0x0f;\r
+ right=0x0f;\r
}\r
\r
//printf("modexClearRegion(x=%u, y=%u, w=%u, h=%u, left=%u, right=%u)\n", x, y, w, h, left, right);\r
word dx, word dy,\r
word width, word height)\r
{\r
- word doffset = (word)dest->data + dy*(dest->stridew) + dx/4;\r
- word soffset = (word)src->data + sy*(src->stridew) + sx/4;\r
- word scans = vga_state.vga_stride; //++++0000 the quick and dirty fix of the major issue with p16 video display wwww\r
+ word doffset = (word)dest->data + dy*(dest->stridew) + (dx>>2);\r
+ word soffset = (word)src->data + sy*(src->stridew) + (sx>>2);\r
+ word scans = vga_state.vga_stride+8; //++++0000 the quick and dirty fix of the major issue with p16 video display wwww\r
word nextSrcRow = src->stridew - scans - 1;\r
word nextDestRow = dest->stridew - scans - 1;\r
- byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */\r
+ byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; // clips for rectangles not on 4s\r
byte rclip[] = {0x00, 0x01, 0x03, 0x07};\r
byte left = lclip[sx&0x03];\r
byte right = rclip[(sx+width)&0x03];\r
\r
- /* handle the case which requires an extra group */\r
+ // handle the case which requires an extra group\r
if((sx & 0x03) && !((sx+width) & 0x03)) {\r
right=0x0f;\r
}\r
}\r
\r
\r
-byte *\r
+/*byte *\r
modexNewPal() {\r
byte *ptr;\r
- ptr = malloc(PAL_SIZE);\r
+ ptr = m a l l o c(PAL_SIZE);\r
\r
- /* handle errors */\r
+ // handle errors\r
if(!ptr) {\r
printf("Could not allocate palette.\n");\r
}\r
\r
return ptr;\r
-}\r
+}*/\r
\r
\r
void\r
-modexLoadPalFile(byte *filename, byte **palette) {\r
+modexLoadPalFile(byte *filename, byte *palette) {\r
FILE *file;\r
byte *ptr;\r
\r
- /* free the palette if it exists */\r
- if(*palette) {\r
- free(*palette);\r
- }\r
+ // free the palette if it exists\r
+ //if(*palette) { free(*palette); }\r
\r
- /* allocate the new palette */\r
- *palette = modexNewPal();\r
+ // allocate the new palette\r
+ //*palette = modexNewPal();\r
\r
- /* open the file */\r
+ // open the file\r
file = fopen(filename, "rb");\r
if(!file) {\r
- printf("Could not open palette file: %s\n", filename);\r
+ printf("Could not open palette file: %s\n", filename);\r
}\r
\r
/* read the file */\r
- ptr = *palette;\r
+ ptr = palette;\r
while(!feof(file)) {\r
*ptr++ = fgetc(file);\r
}\r
\r
\r
void VL_LoadPalFile(const char *filename, byte *palette)\r
+{\r
+ VL_LoadPalFilewithoffset(filename, palette, 0);\r
+}\r
+\r
+void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)\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
+ VL_UpdatePaletteWrite(palette, o);\r
}\r
}\r
\r
+void VL_UpdatePaletteWrite(byte *palette, word o)\r
+{\r
+ word i;\r
+ vga_palette_lseek(/*1+*/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
+}\r
\r
void\r
modexSavePalFile(char *filename, byte *pal) {\r
}\r
}\r
\r
-void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
+void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, const byte *str)\r
{\r
word s, o, w;\r
- word x_draw = x;\r
+ word x_draw;\r
//word addr = (word) romFontsData.l;\r
- word addrq = (page->stridew) * y + (x / 4) + ((word)page->data);\r
- word addrr = addrq;\r
+ word addrq;\r
+ word addrr;\r
byte c;\r
\r
+ if(tlsw){ x-=page->tlx; y-=page->tly; }\r
+ x_draw = x/4;\r
+ addrq = (page->stridew) * y + (word)(x_draw) +\r
+ ((word)page->data);\r
+ addrr = addrq;\r
s=romFonts[t].seg;\r
o=romFonts[t].off;\r
w=romFonts[t].charSize;\r
\r
for(; *str != '\0'; str++)\r
{\r
- c = (*str);\r
- if(c=='\n')\r
- {\r
- x = x_draw;\r
- romFontsData.chw = 0;\r
- addrq += (page->stridew) * 8;\r
- addrr = addrq;\r
- y += 8;\r
- continue;\r
- }\r
+ c = (*str);\r
+ if(c=='\n')\r
+ {\r
+ x = x_draw;\r
+ romFontsData.chw = 0;\r
+ addrq += (page->stridew) * 8;\r
+ addrr = addrq;\r
+ y += 8;\r
+ continue;\r
+ }\r
\r
// load the character into romFontsData.l\r
// no need for inline assembly!\r
x_draw += 8; /* track X for edge of screen */\r
addrr += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */\r
}\r
+ //printf("print xy:%dx%d tlxy:%dx%d\n", x, y, page->tlx, page->tly);\r
}\r
\r
void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
int palq=(mult)*TILEWH;\r
int palcol=0;\r
int palx, paly;\r
- for(paly=0; paly<palq; paly+=mult){\r
- for(palx=0; palx<palq; palx+=mult){\r
+ for(paly=TILEWH*8; paly<palq+TILEWH*8; paly+=mult){\r
+ for(palx=TILEWH*12; palx<palq+TILEWH*12; palx+=mult){\r
modexClearRegion(pee, palx+TILEWH, paly+TILEWH, mult, mult, palcol);\r
palcol++;\r
}\r