delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/02/17/09:31:14

Date: Mon, 17 Feb 92 08:59:05 EST
From: DJ Delorie <dj AT ctron DOT com>
To: SORROW%MAPLE DOT decnet AT pine DOT circa DOT ufl DOT edu
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: How do I write to VGA memory using my own graphics routines?
Status: O

>I want to write out to VGA memory for this mode x stuff that I am working
>on, but I can't seem to be able to do it the normal way ( i.e. making
>ES point 0xA000 and altering DI to point to the individual pixel ).

>This is probably due to the fact that segments no longer exist and
>that VGA memory has been remapped.  So, in my assembly code ( using
>i386 BSD style assembly ) could someone show me how to alter a single
>pixel/address where I used to use:

>mov ax, 0a000h
>mov es, ax
>mov di, [ value wherever ]
>rep stosb

>How would this translate to the protected mode environment?

Correct - under go32, there are no segments and you should NEVER
change DS, ES, FS, or GS.

In order to access physical memory, remember that go32 maps it
linearly starting at 0xe0000000.  Thus, graphics memory begins at
0xe00a0000.  Your assembly should look like this:

	movl	$0xe00a000,%edi
	rep stosb

DJ
dj AT ctron DOT com
Life is a banana.

- Raw text -


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