Article View: comp.os.msdos.programmer
Article #1231Re: Changing and restoring Video Mode
From: DAVID SCOTT PASCHAL
Date: Wed, 02 Sep 1992 15:48
Date: Wed, 02 Sep 1992 15:48
54 lines
3216 bytes
3216 bytes
In article <HENRIK.JOHANSSON.92Sep2140043@ariel.nexus.comm.se>, Henrik.Johansson@nexus.comm.se (Henrik Johansson) writes: |> Newsgroups: comp.os.msdos.programmer |> Path: taco!rock!stanford.edu!agate!ames!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!comm!newshost!Henrik.Johansson |> From: Henrik.Johansson@nexus.comm.se (Henrik Johansson) |> Subject: Changing and restoring Video Mode |> Message-ID: <HENRIK.JOHANSSON.92Sep2140043@ariel.nexus.comm.se> |> Sender: news@c3consult.comm.se |> Organization: Communicator NEXUS AB, Uppsala, Sweden |> Distribution: comp |> Date: Wed, 2 Sep 92 09:00:43 GMT+5:00 |> Lines: 18 |> |> |> How do I save _all_ relevant information about current video mode so |> that I can restore it afterwards exactly as it was? |> |> This problem comes from a Device Driver that is triggered and needs |> some input from the user. Therefore the screen gets blanked, user |> input requested, some action taken, and afterwards the driver must |> return to wherever the pc was running with the video mode completely |> intact. |> |> Anyone? |> |> /hj |> -- |> Real life: Henrik Johansson Email: Henrik.Johansson@Nexus.Comm.SE |> Snailmail: Communicator Nexus Phone: +46 18 171811 |> Box 857 Fax: +46 18 696516 |> S - 751 08 Uppsala, Sweden |> Hi. You need to save the video-relevant variables in the ROM-BIOS data area (at segment 40h), all the VGA registers (you can't do this on an EGA since most of them are write-only), and the entire video buffer (which can be anything between 256K to 4 megabytes depending on the adapter). Then set the mode you want and do anything you like. Then use the ROM-BIOS to put the mode back to what it was before (which is one of the variables in the saved copy of the ROM-BIOS data area but you could have also just gotten it with INT 10h function 0Fh), copy the ROM-BIOS data back, copy the registers back, and copy the video buffer back (and be sure to restore the registers you used to traverse the video buffer). I know it's complicated (and possibly memory-comsuming) to be able to swap over any text or graphics mode on any adapter, but you would need to code your (interrupt?) handler to refuse to swap over any mode you don't recognize. And you could make it a whole lot simpler just by refusing to swap over any graphics mode (i.e. you'd only have to swap 80x25x2 bytes rather than 256K or more). Tschuess, David Paschal
Technical Details
Message-ID:
<1992Sep2.154857.1270@ncsu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!uvaarpa!concert!rock!taco!dspaschaReferences:
<HENRIK.JOHANSSON.92Sep2140043@ariel.nexus.comm.se>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!uvaarpa!concert!rock!taco!dspascha From: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL) Subject: Re: Changing and restoring Video Mode Message-ID: <1992Sep2.154857.1270@ncsu.edu> Originator: dspascha@c00015-118dan.eos.ncsu.edu Lines: 54 Sender: news@ncsu.edu (USENET News System) Reply-To: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL) Organization: North Carolina State University, Project Eos References: <HENRIK.JOHANSSON.92Sep2140043@ariel.nexus.comm.se> Distribution: comp Date: Wed, 2 Sep 1992 15:48:57 GMT