X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=e5550b4c130f4a969a514d6df63c9f2393d35988;hb=3b3f3b4bc62245426ea4dec22cbfaa7cfbf13645;hp=1e086ea74f130cc9444f67f9a68f2c0a3938f7a8;hpb=a36921f9d31cc4a8e6a8041d5b9968b2cf4bb860;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 1e086ea7..e5550b4c 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -20,9 +20,6 @@ * */ -#include -#include -#include #include #include #include @@ -31,7 +28,37 @@ byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette); -static byte tmppal[PAL_SIZE]; +static byte tmppal[PAL_SIZE]; +int old_mode; + +///////////////////////////////////////////////////////////////////////////// +// // +// 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(); + } +} static void vgaSetMode(byte mode) @@ -650,7 +677,7 @@ modexPalWhite() { } -/* utility */ +/* utility */ void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) { @@ -957,7 +984,7 @@ void modexputPixel(page_t *page, int x, int y, byte color) offset = (width * y + x) / 4, and write the given color to the plane we selected above. Heed the active page start selection. */ - VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff] = color; + VGA[(unsigned)((page->width/4) * y) + (x / 4) + pageOff] = color; } @@ -968,7 +995,7 @@ byte modexgetPixel(page_t *page, int x, int y) outpw(GC_INDEX, 0x04); outpw(GC_INDEX+1, x & 3); - return VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff]; + return VGA[(unsigned)((page->width/4) * y) + (x / 4) + pageOff]; }