Article View: rec.games.programmer
Article #1446Re: Write Mode 1 on EGA/VGA cards
From: Brian K. W. Hook
Date: Tue, 16 Apr 1991 01:02
Date: Tue, 16 Apr 1991 01:02
56 lines
3176 bytes
3176 bytes
In article <1991Apr15.061148.29923@watcgl.waterloo.edu> anicolao@watcgl.waterloo.edu (Alex Nicolaou) writes:
|>
|> I know that it is possible to do the following on EGA and VGA cards,
|>but am not clear on the exact step by step actions you need to do it.
|>I would love it if someone has a ready made source example that does this
|>or would be willing to write one - my problem is that although I am
|>proficient in C and C++, I can barely code in assembly. So here's
|>the problem/program I need solved/written:
|>
|> 1. Draw an image on an off-screen area of video memory
|> 2. Set the card into "Write Mode 1"
|> 3. Use a fast machine instruction to copy the block
|> containing the off screen image onto the screen (MOVSW)
|> 4. Restore the card to the previous write mode
|>
|>Now, if anyone can provide me with ANY code written in ANYTHING (excepting
|>fortran :-) that does this, I want to read it. Please mail it to me!
|>
|>I am operating under the following constraints:
|>
|> 1. I would like to draw off screen using the Borland graphics
|> functions, but don't know if it clips to the screen boundaries
|> or not.
As far as I know, you might as well give it up using the Borland graphics
functions. They are quite powerful (for being bundled with the compiler)
but don't support writing to an offscreen buffer. However....you can write
to a hidden page using setvisualpage() and setactivepage() and swap pages,
which is faster than doig a bitblt transfer. However, you can adapt this
to writing to an offscreen buffer via using setactivepage() and
setvisualpage(), then using getimage() and putimage()...e.g.
setvisualpage(0); // look at page 0
setactivepage(1); // write to hidden page
.
. // do graphics things to hidden page
.
getimage(/* graphics block on hidden page */);
setactivepage(0); // put the image on page 0
putimage(/* wherever you want */);
While this is not near as fast as assembly, it does get the job done
using the BGI. However, using the MetaGraphics code library you can write
to offscreen virtual bitmaps (very handy) and it is only 99 dollars and it
is written in asm. Unfortunately, the library is a set of hooks into a
~90K TSR. MetaWindows/Plus is a linkable library, but costs about 300
bucks.
|>
|> 2. I want the code I eventually produce to run on an 8088 (and
|> therefore it will run on anything better, too).
Ouch. Better do it ALL in asm then. Can't help you then. I wouldn't aim
so high (or low) since the 80286 is now officially the most predominant
machine on the market.a Also, not many XTs are running EGA/VGA boards
these days anyhow.
Technical Details
Message-ID:
<28041@uflorida.cis.ufl.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!rex!uflorida!swamp.cis.ufl.edu!jdbReferences:
<1991Apr15.061148.29923@watcgl.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!rex!uflorida!swamp.cis.ufl.edu!jdb From: jdb@swamp.cis.ufl.edu (Brian K. W. Hook) Newsgroups: rec.games.programmer,comp.os.msdos.programmer Subject: Re: Write Mode 1 on EGA/VGA cards Message-ID: <28041@uflorida.cis.ufl.EDU> Date: 16 Apr 91 01:02:46 GMT References: <1991Apr15.061148.29923@watcgl.waterloo.edu> Sender: news@uflorida.cis.ufl.EDU Organization: UF CIS Dept. Lines: 56