delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/05/18:21:14

Date: Thu, 5 May 94 17:44:00 EDT
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: arra AT dsd DOT camb DOT inmet DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Video memory: Native and Windows DOS
Reply-To: babcock AT cfa DOT harvard DOT edu

> Is there a way for a djgpp-compiled C or GNAT-compiled Ada program to
> directly access video memory in both native DOS AND also in a Windows
> DOS box?

The problem arises because DPMI 0.9 used in a Windows DOS box doesn't allow
mapping the video memory to a place where gcc can get at it without using far
pointers, and gcc doesn't support far pointers.  DJ just released, as part of
the maint5 release, a set of inline functions which allow efficient access to
DOS memory.  Look at farptr.h for details.  BTW, dosmemput and dosmemget do
not switch to real mode, they just load a selector into the gs register and
use that to reference DOS memory.  The only inefficiency is the overhead of a
subroutine call.

A somewhat painful alternative, which I started using before farptr.h was
available, is to write your low level video access routines as if you had a
pointer to screen memory, get assembly language output from the compiler, and
edit it to add gs overrides manually.  This is really equivalent to writing
the routines in assembly language, but uses the C compiler to do most of the
initial work.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019