X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fmodex16.c;h=5c0cab2c0031bc35accfac37ab355a60a6c1b114;hb=6340f73596b16d6b718e3ddca2b09f13ce521f6d;hp=cb4c53123337f7fffa4e57b33c392c25571483d5;hpb=8e9c24c25f7496303be4d3e8e3c6aac38a652e99;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index cb4c5312..5c0cab2c 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -90,11 +90,13 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) { word i; dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */ + struct vga_mode_params cm; int CRTParmCount; - /* common mode X initiation stuff~ */ - modexsetBaseXMode(gv->video.page); - vga_enable_256color_modex(); // VGA mode X + + vgaSetMode(VGA_256_COLOR_MODE); + vga_enable_256color_modex(); update_state_from_vga(); + vga_read_crtc_mode(&cm); switch(vq) { @@ -104,80 +106,46 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) gv->video.page[0].sw=vga_state.vga_width = 320; // VGA lib currently does not update this gv->video.page[0].sh=vga_state.vga_height = 240; // VGA lib currently does not update this - /* send the CRTParms */ - /*for(i=0; ivideo.page[0].sw=120; - gv->video.page[0].sh=160; - - /* send the CRTParms */ - for(i=0; ivideo.page[0].sw=320; - gv->video.page[0].sh=200; - - /* send the CRTParms */ - for(i=0; ivideo.page[0].sw=192; - gv->video.page[0].sh=144; - - /* send the CRTParms */ - for(i=0; ivideo.page[0].sw=256; - gv->video.page[0].sh=192; - - /* send the CRTParms */ - for(i=0; ivideo.page[0].tilesw = gv->video.page[0].sw/TILEWH; @@ -190,39 +158,8 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) void modexLeave() { - /* TODO restore original mode and palette */ - vgaSetMode(TEXT_MODE); -} - -// setBaseXMode() does the initialization to make the VGA ready to -// accept any combination of configuration register settings. This -// involves enabling writes to index 0 to 7 of the CRT controller (port -// 0x3D4), by clearing the most significant bit (bit 7) of index 0x11. -void -modexsetBaseXMode(page_t *page) -{ - word temp; - /* TODO save current video mode and palette */ - vgaSetMode(VGA_256_COLOR_MODE); - - /* disable chain4 mode */ - outpw(SC_INDEX, 0x0604); - - /* synchronous reset while setting Misc Output */ - outpw(SC_INDEX, 0x0100); - - /* select 25 MHz dot clock & 60 Hz scanning rate */ - outp(MISC_OUTPUT, 0xe3); - - /* undo reset (restart sequencer) */ - outpw(SC_INDEX, 0x0300); - - /* reprogram the CRT controller */ - outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */ -// temp = inp(CRTC_DATA) & 0x7F; -// outp(CRTC_INDEX, 0x11); - outp(CRTC_DATA, 0x7f); /* get current write protect on varios regs */ -// outp(CRTC_DATA, temp); /* get current write protect on varios regs */ + /* TODO restore original mode and palette */ + vgaSetMode(TEXT_MODE); } page_t