*\r
*/\r
\r
-#include <dos.h>\r
-#include <string.h>\r
-#include <mem.h>\r
#include <conio.h>\r
#include <stdio.h>\r
#include <stdlib.h>\r
byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */\r
\r
static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette);\r
-static byte tmppal[PAL_SIZE];\r
+static byte tmppal[PAL_SIZE];
+int old_mode;\r
+
+/////////////////////////////////////////////////////////////////////////////
+// //
+// setvideo() - This function Manages the video modes //
+// //
+/////////////////////////////////////////////////////////////////////////////
+void VGAmodeX(sword vq)
+{
+ union REGS in, out;
+
+ if(!vq)
+ { // deinit the video
+ // change to the video mode we were in before we switched to mode 13h
+ modexLeave();
+ //in.h.ah = 0x00;
+ //in.h.al = old_mode;
+ //int86(0x10, &in, &out);
+
+ }
+ else if(vq==1)
+ { // init the video
+ // get old video mode
+ //in.h.ah = 0xf;
+ //int86(0x10, &in, &out);
+ //old_mode = out.h.al;
+ // enter mode
+ modexEnter();
+ }
+}
\r
static void\r
vgaSetMode(byte mode)\r
}\r
\r
\r
-/* utility */\r
+/* utility */
void\r
modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)\r
{\r
free(pal);\r
}\r
\r
-void modexputPixel(int x, int y, byte color)\r
-{\r
+void modexputPixel(page_t *page, int x, int y, byte color)\r
+{
+ word pageOff = (word) page->data;\r
/* Each address accesses four neighboring pixels, so set\r
Write Plane Enable according to which pixel we want\r
to modify. The plane is determined by the two least\r
- significant bits of the x-coordinate: */\r
+ significant bits of the x-coordinate: */
+ //modexSelectPlane(PLANE(x));\r
outp(SC_INDEX, 0x02);\r
outp(SC_DATA, 0x01 << (x & 3));\r
\r
offset = (width * y + x) / 4, and write the given\r
color to the plane we selected above. Heed the active\r
page start selection. */\r
- VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + 0] = color;\r
+ VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff] = color;\r
\r
}\r
\r
-byte modexgetPixel(int x, int y)\r
-{\r
+byte modexgetPixel(page_t *page, int x, int y)\r
+{
+ word pageOff = (word) page->data;\r
/* Select the plane from which we must read the pixel color: */\r
outpw(GC_INDEX, 0x04);\r
outpw(GC_INDEX+1, x & 3);\r
\r
- return VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + 0];\r
+ return VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff];\r
\r
+}
+
+void modexhlin(page_t *page, word xl, word xh, word y, word color)
+{
+ word x;
+ word yy=0;
+
+ for(x=0;x<xh*4;x+=4)
+ {
+ if(x+4>=SCREEN_WIDTH-1){ x=0; yy+=4; }
+ modexClearRegion(page, x+xl, y+yy, 4, 4, color);
+ }
+ //modexputPixel(page, x+xl, y, color);
}\r
\r
void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
for(; *str != '\0'; str++)\r
{
c = (*str);
- if(c=='\n' || c=="\
-" || chw>=page->width-1)
+ if((c=='\n'/* || c=="\
+"*/) || chw
+>=page->width)
+ {
+ chw=0;
+ y+=w;
+ continue;
+ }
+ //load the letter 'A'\r
+ __asm {\r
+ MOV DI, addr\r
+ MOV SI, o\r
+ MOV ES, s\r
+ SUB AH, AH\r
+ MOV AL, c ; the letter\r
+ MOV CX, w\r
+ MUL CX\r
+ ADD SI, AX ;the address of charcter\r
+ L1: MOV AX, ES:SI\r
+ MOV DS:DI, AX\r
+ INC SI\r
+ INC DI\r
+ DEC CX\r
+ JNZ L1\r
+ }
+\r
+ for(i=0; i<w; i++)
+ {\r
+ j=1<<8;
+ xp=0;\r
+ while(j)
+ {
+ modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);
+ xp++;
+ j>>=1;
+ }
+ }\r
+ chw += xp;\r
+ }\r
+}
+
+void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
+{
+ word i, s, o, w, j, xp;
+ byte l[1024];\r
+ word addr = (word) l;
+ word chw=0;
+ byte c;
+
+ switch(t)\r
+ {\r
+ case 0:
+ w=14;\r
+ break;\r
+ case 1:
+ w=8;\r
+ break;\r
+ case 2:
+ w=8;\r
+ break;\r
+ case 3:
+ w=16;\r
+ break;\r
+ default:
+ t=3;\r
+ w=16;\r
+ break;\r
+ }
+\r
+ s=romFonts[t].seg;\r
+ o=romFonts[t].off;
+\r
+ for(; *str != '\0'; str++)\r
+ {
+ c = (*str);
+ if((c=='\n'/* || c=="\
+"*/)/* || chw>=page->width*/)
{
chw=0;
y+=w;
xp=0;\r
while(j)
{
- modexputPixel(x+xp+chw, y+i, l[i] & j ? col:bgcol);
+ //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);
+ modexClearRegion(page, (x+xp+chw)*8, (y+i)*8, 8, 8, l[i] & j ? col:bgcol);
xp++;
j>>=1;
}
}\r
- chw += xp-1;\r
+ chw += xp;\r
}\r
}\r
\r