delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/10/01:00:31

From: csantill AT lausd DOT k12 DOT ca DOT us
Message-ID: <33C46C4D.4879@lausd.k12.ca.us>
Date: Wed, 09 Jul 1997 21:59:57 -0700
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: New Approach to VGA MEM
References: <33C08F31 DOT 2A78 AT lausd DOT k12 DOT ca DOT us> <199707080035 DOT RAA13562 AT greatdane DOT webnexus DOT com>

Samuel S. Paik wrote:
> None of these will do what you want (some of them aren't even legal).
> C declaration syntax is powerful, but sometimes tricky to get right
> without a lot of experience.
> 
> I would recommend doing the array arithmetic yourself--you get into
> less trouble that way.  However, if you insist, try:
> 
>   // a vgaarray is a "2D array" 320x200
>   typedef unsigned char vgaarray[320][200];
>   // vid_mem is a pointer to a vgaarray
>   vgaarray *vid_mem;
> 
> Use with:
> 
>   // deref pointer and index
>   (*vid_mem)[100][20];
> 
> C doesn't really have 2D arrays, which is a problem for many people.
> 
> The second part is to get the address of the memory into that
> pointer.  You will need to use one of the memory mapping services,
> check the FAQ for info.  IT IS NOT AT A0000H!  That is a physical
> address, you want the virtual address.  Note that the virtual address
> can change under certain conditions, you can either deal with this
> by recomputing the virtual address from the linear address (which
> is what you get from the memory mapping service) or by locking
> down virtual memory (I forget how to do this), which can break
> compatibility with some software, but not much.
from: csantill AT lausd DOT k12 DOT ca DOT us

The reason I want a "2D" array is because it will involve fewer cycles
when I actually set a pix(about 20 or so cycles from the ASM mul-add-mov
instuctions-I'm guessing though).  When you draw a hline 200 pixels
long, you probably wasting 4000 cycles!

Well does anbody know a simple way to map the area physically(I dont
really care if mem protect is turned off) but I would like to see a
simple code example.

- Raw text -


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