]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/modex16.c
wwww
[16.git] / src / lib / modex16.c
index 55fa5d183cf86855c6ab9c1167951bb0af259187..ea61e718c3cc916a476a081539b8818235bd4e1b 100755 (executable)
@@ -77,15 +77,18 @@ modex__320x240_256__Enter(global_game_variables_t *gv)
        word i;\r
        dword far*ptr=(dword far*)VGA;      /* used for faster screen clearing */\r
        word CRTParms[] = {\r
-//             0x5f00,         /* horizontal total */\r
-//             0x3f01,         /* horizontal display enable end */\r
+//             0xe300,         /* horizontal total */\r
+               0x4f01,         /* horizontal display enable end */\r
+               0x5002,         /*  */\r
+               0x5404,         /*  */\r
+               0x8005,         /*  */\r
                0x0d06,         /* vertical total */\r
                0x3e07,         /* overflow (bit 8 of vertical counts) */\r
                0x4109,         /* cell height (2 to double-scan */\r
                0xea10,         /* v sync start */\r
                0xac11,         /* v sync end and protect cr0-cr7 */\r
                0xdf12,         /* vertical displayed */\r
-//             0x2013,         /* offset/logical width */\r
+               0x2813,         /* offset/logical width */\r
                0x0014,         /* turn off dword mode */\r
                0xe715,         /* v blank start */\r
                0x0616,         /* v blank end */\r
@@ -96,9 +99,6 @@ modex__320x240_256__Enter(global_game_variables_t *gv)
        /* width and height */\r
        //TODO WWWW\r
 \r
-       /* TODO save current video mode and palette */\r
-       vgaSetMode(VGA_256_COLOR_MODE);\r
-\r
        /* disable chain4 mode */\r
        outpw(SC_INDEX, 0x0604);\r
 \r
@@ -127,6 +127,23 @@ modex__320x240_256__Enter(global_game_variables_t *gv)
        }\r
 }\r
 \r
+//    setBaseXMode() does the initialization to make the VGA ready to\r
+//    accept any combination of configuration register settings.  This\r
+//    involves enabling writes to index 0 to 7 of the CRT controller (port\r
+//    0x3D4), by clearing the most significant bit (bit 7) of index 0x11.\r
+void\r
+modexsetBaseXMode(void)\r
+{\r
+       int temp;\r
+\r
+       /* TODO save current video mode and palette */\r
+       vgaSetMode(VGA_256_COLOR_MODE);\r
+\r
+       outp(CRTC_INDEX, 0x11);\r
+       temp = inp(CRTC_DATA) & 0x7F;\r
+       outp(CRTC_INDEX, 0x11);\r
+       outp(CRTC_DATA, temp);\r
+}\r
 \r
 void\r
 modexLeave() {\r