[comp.sys.ibm.pc] VGA, direct memory access

tbea@freja.diku.dk (Thomas Edlund Andersen) (02/25/89)

 I have a VGA graphics system in my PS2/50, and wants to write some fast
video rutines for mode E (640 * 200 * 16). Therefore I would like to let
the CPU write directly to the memory for the screen - but I can only write
to the first of the four bitmaps? Is anybody out there able to explain
how to tackle this problem...


    Thomas Andersen
    (tbea@freja.diku.dk)
    Institute of Datalogy, University of Copenhagen
    Denmark
    

kevinf@infmx.UUCP (Kevin Franden) (02/28/89)

In article <4479@freja.diku.dk>, tbea@freja.diku.dk (Thomas Edlund Andersen) writes:
> 
>  I have a VGA graphics system in my PS2/50, and wants to write some fast
> video rutines for mode E (640 * 200 * 16). Therefore I would like to let
> the CPU write directly to the memory for the screen - but I can only write
>     

If all you are really interested in is fast screen writes, use the BIOS,
it is pretty darn fast and you won't have to worry about all that vert. retrace
crap.

As personal experience, I was trying to draw a box around a place on the screen
for a pop-up library I wrote for Turbo-C (Tiny-Windows if you have seen it or
use it) and used the mose efficent algolrithm I could think of.  Even in C it
was slow so I used assembly to speed it up.  

I used the BIOS call to put a char at the cursor location (it's # escapes me 
right now) and all I had to do was feed it the color,character, and video page 
(you can find the current video with another call, it's easie than assuming) 
This allowed all the flexability I needed as well as taking care of the gory
details of determining the right byte for the char and byte for the color and
the dreaded curse of the retrace flicker.  Above all it is FAST!  To draw a box
around the whole screen was "instantanous". 

hope this helps.

Kevin Franden
Informix Software Inc.
disclaimer("I said what I said and not my employer");

toma@tekgvs.LABS.TEK.COM (Tom Almy) (03/03/89)

In article <953@infmx.UUCP> kevinf@infmx.UUCP (Kevin Franden) writes:
>In article <4479@freja.diku.dk>, tbea@freja.diku.dk (Thomas Edlund Andersen) writes:
>>  I have a VGA graphics system in my PS2/50, and wants to write some fast
>> video rutines for mode E (640 * 200 * 16). Therefore I would like to let
>> the CPU write directly to the memory for the screen - but I can only write

>If all you are really interested in is fast screen writes, use the BIOS,
>it is pretty darn fast and you won't have to worry about all that vert. retrace
>crap.

You don't have to worry about retrace with any graphics system except for the
CGA cards made by IBM and a few CGA clones, and then only in text mode.
Also, the BIOS is much slower than good assembly code.

>I used the BIOS call to put a char at the cursor location (it's # escapes me 
>right now) and all I had to do was feed it the color,character, and video page 
>(you can find the current video with another call, it's easie than assuming) 

If you use your own routine, you can put the character at any graphic pixel
location (640x200 in mode E, for instance) rather than at character locations
(80x25 in mode E).

Pick up a copy of "Programmer's Guide to PC & PS/2 Video Systems", by Richard
Wilton, Microsoft Press, 1987.  This book contains the assembly code for just
about anything a mortal might want to do with EGA, VGA, or Hercules graphics.

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply

ralf@b.gp.cs.cmu.edu (Ralf Brown) (03/04/89)

In article <4715@tekgvs.LABS.TEK.COM> toma@tekgvs.LABS.TEK.COM (Tom Almy) writes:
}You don't have to worry about retrace with any graphics system except for the
}CGA cards made by IBM and a few CGA clones, and then only in text mode.

Or the occasional oddball like the monographics board in the Eagle PC-2, 
which required snow prevention in graphics mode only (and the graphics mode
addressed the display like this:

	0	16	...
	1	17
	...	...
	15	31
	1360	1376	...
	1361	1377
	...	...
	1375
when programmed for 680x384 graphics)


-- 
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) 
ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?
--