X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=e184dc1e2e0e4d251b7c17bb866cd3b039dddde7;hb=280b2698e9eb1af403b0ae29c357a4ae8fdd51a3;hp=21b5862a5ce1920d5180567e2a76236855065055;hpb=23409e23e494a09098fc299416d360def67efa9e;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 21b5862a..e184dc1e 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -40,23 +40,31 @@ void VGAmodeX(sword vq, global_game_variables_t *gv) { 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 = gv->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); - gv->old_mode = out.h.al; - // enter mode - modex__320x240_256__Enter(gv); + switch (vq) + { + case 0: // 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 = gv->old_mode; + int86(0x10, &in, &out); + break; + case 1: // init the video + // get old video mode + in.h.ah = 0xf; + int86(0x10, &in, &out); + gv->old_mode = out.h.al; + // enter mode + modex__320x240_256__Enter(gv); + break; + case 2: // init the video + // get old video mode + in.h.ah = 0xf; + int86(0x10, &in, &out); + gv->old_mode = out.h.al; + // enter mode + modex__256x192_256__Enter(gv); + break; } } @@ -76,51 +84,42 @@ modex__320x240_256__Enter(global_game_variables_t *gv) { word i; dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ - word CRTParms[] = { -// 0xe300, /* horizontal total */ -// 0x4f01, /* horizontal display enable end */ - 0x5002, /* */ - 0x5404, /* */ - 0x8005, /* */ - 0x0d06, /* vertical total */ - 0x3e07, /* overflow (bit 8 of vertical counts) */ - 0x4109, /* cell height (2 to double-scan */ - 0xea10, /* v sync start */ - 0xac11, /* v sync end and protect cr0-cr7 */ - 0xdf12, /* vertical displayed */ - 0x2813, /* offset/logical width */ - 0x0014, /* turn off dword mode */ - 0xe715, /* v blank start */ - 0x0616, /* v blank end */ - 0xe317 /* turn on byte mode */ - }; - - int CRTParmCount = sizeof(CRTParms) / sizeof(CRTParms[0]); + + int CRTParmCount = sizeof(ModeX_320x240regs) / sizeof(ModeX_320x240regs[0]); /* width and height */ //TODO WWWW - /* TODO save current video mode and palette */ - vgaSetMode(VGA_256_COLOR_MODE); + /* common mode X initiation stuff~ */ + modexsetBaseXMode(); - /* disable chain4 mode */ - outpw(SC_INDEX, 0x0604); + /* send the CRTParms */ + for(i=0; i