Newsgroups: comp.sys.ibm.pc.misc
Path: utzoo!censor!meadow!py
From: py@meadow.uucp (Peter Yeung)
Subject: Re: Direct address access via C
Message-ID: <1991Jan29.184353.23437@meadow.uucp>
Reply-To: py@meadow.UUCP (Peter Yeung)
Organization: Amdahl Canada Ltd., Software Development Center
References: <1991Jan28.202900.11946@unhd.unh.edu>
Distribution: comp
Date: Tue, 29 Jan 91 18:43:53 GMT

In article <1991Jan28.202900.11946@unhd.unh.edu> rg@msel.unh.edu (Roger Gonzalez) writes:
>I'd like to directly manipulate the text video area via Turbo C.  I gather
>that it is located at B something or 8 something, depending on your adaptor.
>How do you do the memory access, though?  On a VMEbus based machine, all 
>you have to do is coerce a pointer to be the address, and then you can do
>stuff like overlay structures on the memory map.  I'm new to this aspect
>of PC programming, since I'm mainly a Unix programmer.
>

Use the macro MK_FP(seg,off) to create a far * <seg>:<off>.

>Is there any speed gain in doing C->addr manipulations rather than using
>Turbo's (a little too restrictive) routines, or do I have to learn Intel's
>assembler to really get anything out of it?
>

On a plain 8088 type machine, writing directly to video ram is considerably 
faster than going through the BIOS/DOS (depending which calls you are using). 
I am not sure about the speed gain on faster machines, especially those
386's with BIOS shadow ram.

However, it makes life more complicated since you have to handle video 
attributes, scrolling etc. Scrolling is slightly more complex when using a 
true blue CGA card due to its poor design.

You should be able to do almost anything in Turbo C without resorting
to assembly language. However, you have to know about low level hardware
stuff (e.g. check for vertical trace to avoid snow on IBM CGA card).

There are a few PD/shareware type packages doing fast video I/O which
by-pass the BIOS.. Typically they are part of "windowing" packages.

>-Roger
>
>-- 
>"The question of whether a computer can think is no more interesting
> than the question of whether a submarine can swim" - Edsgar W. Dijkstra 
>rg@[msel|unhd].unh.edu        |  UNH Marine Systems Engineering Laboratory
>r_gonzalez@unhh.bitnet        |  Durham, NH  03824-3525


-- 
Peter Yeung     Amdahl Canada Ltd., Software Development Center
                2000 Argentia Road, Plaza 2, Suite 300
                Mississauga, Ont.   L5N 1V8
                Phone: (416) 542-6300    Fax: (416) 858-2233
