delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/14/17:19:22

From: Emil0 AT aol DOT com
Date: Mon, 14 Oct 1996 17:03:02 -0400
Message-ID: <961014170302_333643612@emout14.mail.aol.com>
To: djgpp AT delorie DOT com
Subject: Another way to access VGA memory

Hello all!

I have a neat way to access video memory which I haven't seen done anywhere
else. Maybe I'm wrong - maybe everyone does it - but here it is:

Get a descriptor by calling the (badly named) __dpmi_segment_to_descriptor()
to segment 0xA000. Whack this into a global variable. You can now use this in
any assembler module - you can put it in a segreg in one instruction, ie.
movw _vga_ram_descriptor, %es. There is no overhead of calling a library
function. You don't even need to trash another register!

At first this method might seem to be a "hack" - the documentation says this
function should be "used sparingly". It is however in the DPMI specs, and so
is guaranteed to be in all future DPMI versions (I think...). It's worked on
every host I've tried it on. Also, there is still full memory protection as
the segment limit will default to 64k. Therefore you can only access video
memory which can't do any harm.

Any comments? Maybe someone knows how Carmack-Abrash do it?

Richard.  :)  Please reply to emil0 AT aol DOT com as I only get the weekly digest.
Thanks!

- Raw text -


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