]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/modex16.c
ok! wwww
[16.git] / src / lib / modex16.c
index e5550b4c130f4a969a514d6df63c9f2393d35988..b1e6d51f79ef370366d443ed08c7330a6a048226 100644 (file)
 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];
+static byte tmppal[PAL_SIZE];\r
 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
+/////////////////////////////////////////////////////////////////////////////\r
+//                                                                                                                                                                                                                                             //\r
+// setvideo() - This function Manages the video modes                                                                                          //\r
+//                                                                                                                                                                                                                                             //\r
+/////////////////////////////////////////////////////////////////////////////\r
+void VGAmodeX(sword vq)\r
+{\r
+       union REGS in, out;\r
+\r
+       if(!vq)\r
+       { // deinit the video\r
+               // change to the video mode we were in before we switched to mode 13h\r
+               modexLeave();\r
+               in.h.ah = 0x00;\r
+               in.h.al = old_mode;\r
+               int86(0x10, &in, &out);\r
+\r
+       }\r
+       else if(vq==1)\r
+       { // init the video\r
+               // get old video mode\r
+               in.h.ah = 0xf;\r
+               int86(0x10, &in, &out);\r
+               old_mode = out.h.al;\r
+               // enter mode\r
+               modexEnter();\r
+       }\r
+}\r
 \r
 static void\r
 vgaSetMode(byte mode)\r
@@ -677,7 +677,7 @@ modexPalWhite() {
 }\r
 \r
 \r
-/* utility */
+/* utility */\r
 void\r
 modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)\r
 {\r
@@ -970,15 +970,15 @@ no... wait.... no wwww
 }\r
 \r
 void modexputPixel(page_t *page, int x, int y, byte color)\r
-{
+{\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: */
-       //modexSelectPlane(PLANE(x));\r
-       outp(SC_INDEX, 0x02);\r
-       outp(SC_DATA, 0x01 << (x & 3));\r
+           significant bits of the x-coordinate: */\r
+       modexSelectPlane(PLANE(x));\r
+       //outp(SC_INDEX, 0x02);\r
+       //outp(SC_DATA, 0x01 << (x & 3));\r
 \r
        /* The offset of the pixel into the video segment is\r
           offset = (width * y + x) / 4, and write the given\r
@@ -989,7 +989,7 @@ void modexputPixel(page_t *page, int x, int y, byte color)
 }\r
 \r
 byte modexgetPixel(page_t *page, int x, int y)\r
-{
+{\r
        word pageOff = (word) page->data;\r
        /* Select the plane from which we must read the pixel color: */\r
        outpw(GC_INDEX, 0x04);\r
@@ -997,63 +997,63 @@ byte modexgetPixel(page_t *page, int x, int y)
 \r
        return VGA[(unsigned)((page->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 modexhlin(page_t *page, word xl, word xh, word y, word color)\r
+{\r
+       word x;\r
+       word yy=0;\r
+\r
+       for(x=0;x<xh*4;x+=4)\r
+       {\r
+               if(x+4>=SCREEN_WIDTH-1){ x=0; yy+=4; }\r
+               modexClearRegion(page, x+xl, y+yy, 4, 4, color);\r
+       }\r
+       //modexputPixel(page, x+xl, y, color);\r
 }\r
 \r
 void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
-{
-       word i, s, o, w, j, xp;
+{\r
+       word i, s, o, w, j, xp;\r
        byte l[1024];\r
-       word addr = (word) l;
-       word chw=0;
-       byte c;
-
+       word addr = (word) l;\r
+       word chw=0;\r
+       byte c;\r
+\r
        switch(t)\r
        {\r
-               case 0:
+               case 0:\r
                        w=14;\r
                break;\r
-               case 1:
+               case 1:\r
                        w=8;\r
                break;\r
-               case 2:
+               case 2:\r
                        w=8;\r
                break;\r
-               case 3:
+               case 3:\r
                        w=16;\r
                break;\r
-               default:
+               default:\r
                        t=3;\r
                        w=16;\r
                break;\r
-       }
+       }\r
 \r
        s=romFonts[t].seg;\r
-       o=romFonts[t].off;
+       o=romFonts[t].off;\r
 \r
        for(; *str != '\0'; str++)\r
-       {
-       c = (*str);
-       if((c=='\n'/* || c=="\
-"*/) || chw
->=page->width)
-       {
-               chw=0;
-               y+=w;
-               continue;
-       }
+       {\r
+       c = (*str);\r
+       if((c=='\n'/* || c=="\\r
+"*/) || chw\r
+>=page->width)\r
+       {\r
+               chw=0;\r
+               y+=w;\r
+               continue;\r
+       }\r
        //load the letter 'A'\r
        __asm {\r
                MOV DI, addr\r
@@ -1070,64 +1070,64 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons
                INC DI\r
                DEC CX\r
                JNZ L1\r
-       }
+       }\r
 \r
-               for(i=0; i<w; i++)
+               for(i=0; i<w; i++)\r
                {\r
-                       j=1<<8;
+                       j=1<<8;\r
                        xp=0;\r
-                       while(j)
-                       {
-                               modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);
-                               xp++;
-                               j>>=1;
-                       }
+                       while(j)\r
+                       {\r
+                               modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
+                               xp++;\r
+                               j>>=1;\r
+                       }\r
                }\r
                chw += xp;\r
        }\r
-}
-
+}\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;
+{\r
+       word i, s, o, w, j, xp;\r
        byte l[1024];\r
-       word addr = (word) l;
-       word chw=0;
-       byte c;
-
+       word addr = (word) l;\r
+       word chw=0;\r
+       byte c;\r
+\r
        switch(t)\r
        {\r
-               case 0:
+               case 0:\r
                        w=14;\r
                break;\r
-               case 1:
+               case 1:\r
                        w=8;\r
                break;\r
-               case 2:
+               case 2:\r
                        w=8;\r
                break;\r
-               case 3:
+               case 3:\r
                        w=16;\r
                break;\r
-               default:
+               default:\r
                        t=3;\r
                        w=16;\r
                break;\r
-       }
+       }\r
 \r
        s=romFonts[t].seg;\r
-       o=romFonts[t].off;
+       o=romFonts[t].off;\r
 \r
        for(; *str != '\0'; str++)\r
-       {
-       c = (*str);
-       if((c=='\n'/* || c=="\
-"*/)/* || chw>=page->width*/)
-       {
-               chw=0;
-               y+=w;
-               continue;
-       }
+       {\r
+       c = (*str);\r
+       if((c=='\n'/* || c=="\\r
+"*/)/* || chw>=page->width*/)\r
+       {\r
+               chw=0;\r
+               y+=w;\r
+               continue;\r
+       }\r
        //load the letter 'A'\r
        __asm {\r
                MOV DI, addr\r
@@ -1144,19 +1144,19 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c
                INC DI\r
                DEC CX\r
                JNZ L1\r
-       }
+       }\r
 \r
-               for(i=0; i<w; i++)
+               for(i=0; i<w; i++)\r
                {\r
-                       j=1<<8;
+                       j=1<<8;\r
                        xp=0;\r
-                       while(j)
-                       {
-                               //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;
-                       }
+                       while(j)\r
+                       {\r
+                               //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
+                               modexClearRegion(page, (x+xp+chw)*8, (y+i)*8, 8, 8, l[i] & j ? col:bgcol);\r
+                               xp++;\r
+                               j>>=1;\r
+                       }\r
                }\r
                chw += xp;\r
        }\r