X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=e184dc1e2e0e4d251b7c17bb866cd3b039dddde7;hb=280b2698e9eb1af403b0ae29c357a4ae8fdd51a3;hp=624a96d683366ec3e105636e6511d821d7b2dd6a;hpb=c3104b1494bd0f31ce49e3365d36e4ace02e69c7;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 624a96d6..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; } } @@ -70,55 +78,48 @@ vgaSetMode(byte mode) int86(VIDEO_INT, ®s, ®s); } - /* -========================= Entry Points ==========================- */ void modex__320x240_256__Enter(global_game_variables_t *gv) { word i; dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ - word CRTParms[] = { -// 0x5f00, /* horizontal total */ -// 0x3f01, /* horizontal display enable end */ - 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 */ -// 0x2013, /* 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