[comp.os.msdos.programmer] accessing video RAM: how advisable is it?

tr@SAMADAMS.PRINCETON.EDU (Tom Reingold) (03/17/91)

Are PC's running DOS more compatible with IBM video cards these days
than they were when MS-DOS came out?  Years ago, you were asking for
trouble if you wrote directly to video RAM because many cards had their
display buffers at various addresses.  Is this no longer true?  I'd
like to know because it would be nice if the product I am developing
didn't need to care.

Also, are the two addresses still the only ones to worry about?  There
is one for monochrome and one for color, including CGA, EGA and VGA.
--
        Tom Reingold
        tr@samadams.princeton.edu  OR  ...!princeton!samadams!tr
        "Warning: Do not drive with Auto-Shade in place.  Remove
        from windshield before starting ignition."

david@kessner.denver.co.us (David Kessner) (03/17/91)

In article <9103162053.AA02053@samadams.Princeton.EDU> tr@SAMADAMS.PRINCETON.EDU (Tom Reingold) writes:
>Are PC's running DOS more compatible with IBM video cards these days
>than they were when MS-DOS came out?  Years ago, you were asking for
>trouble if you wrote directly to video RAM because many cards had their
>display buffers at various addresses.  Is this no longer true?  I'd
>like to know because it would be nice if the product I am developing
>didn't need to care.
>
>Also, are the two addresses still the only ones to worry about?  There
>is one for monochrome and one for color, including CGA, EGA and VGA.
>--
>        Tom Reingold
>        tr@samadams.princeton.edu  OR  ...!princeton!samadams!tr

These days it is expected that you will write directly to video RAM.  It is
considered a fact of life.  You might have compatability problems with some
really strange computers (like those not-quite compatables from 1983 or so), 
but I wouldent worry about these-- no-one else does!

Yes, there are only two addresses of TEXT VIDEO RAM to worry about.

I have written a program that is currently in use on over 100 machines-- from
the original PC to 386's.  It figures out which address to use, then writes
directly to it.  Out of those 100+ machines, I have never ran into 
compatability problems (even on a few Tandys :).  

Hope that helps...

-- 
David Kessner - david@kessner.denver.co.us            | do {
1135 Fairfax, Denver CO  80220  (303) 377-1801 (p.m.) |    . . .
If you cant flame MS-DOS, who can you flame?          |    } while( jones);

markh@csd4.csd.uwm.edu (Mark William Hopkins) (03/29/91)

In article <9103162053.AA02053@samadams.Princeton.EDU> tr@SAMADAMS.PRINCETON.EDU (Tom Reingold) writes:
>Are PC's running DOS more compatible with IBM video cards these days
>than they were when MS-DOS came out?

BIOS video modes 0 to 10 in IBM compatibles have buffers at segment address
b800, except video mode 7 whose segment address is at b000.  Video modes 13 to
19 are a000.

Video memory to screen mapping is different for different modes though.

There is a BIOS function that allows you to determine the current PC model
you're running on, to determine the current video mode and I think to determine
whether such and such a video mode can be set up in the current hardware.

The book "IBM Microcomputers A programmer's handbook" by Julio Sanchez
and Maria Canton describes absolutely everything a programmer needs to know
about this and almost all other parts of the IBM and BIOS.  BIOS interrupt
10 (hex) contains all the video service routines.