ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/03/30/16:34:51

Date: Thu, 30 Mar 1995 13:52:18 -0500 (CDT)
From: Aaron Ucko <UCKO AT VAX1 DOT ROCKHURST DOT EDU>
Subject: Re: accessing video memory
To: jmccaski AT CS DOT Trinity DOT Edu
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Organization: Rockhurst College; Kansas City, MO

>In one of the the on-line faqs at dj's web site, I found the following:
>
>   When I use 0xD0000000 as the starting address to access the video RAM
>   in graphics mode, nothing appears on the screen. What am I doing
>   wrong?
>
>   You have to call GrSetMode() function to initialize the 0xD0000000
>   area manager which takes care of the mapping described above.
>
>Where can I find more information on this "area manager"?  What source 
>file(s) is it in?  Is it in (or called from) GrSetMode?  The reason I ask is 
>that I'm tying to port some mode X routines that were written for watcom, 
>and the following causes a segmentation fault:

Try looking at GRX stuff. (docs/source)

>memset((unsigned char *)(0xD000 << 4), 0x00, 0x0001000);
>In the original code, the first arg was 0xA000 << 4, but from I've read 
>in various documents about libgr, apparently go32 mapss this address to 
>0xd0000000.  Obviously, I'm no expert on these things--I just have some 
>nice mode x graphics routines that I'd like to be able to use with djgpp.

The address your code is requesting is 0xD0000, not 0xD0000000.  Since you
most likely have not allocated 12MB of RAM, 0xD0000 points to nowhere and
your code naturally segfaults.  Just replace (0xD000 << 4) with 0xD0000000
and memset() should work fine.

Not that this will not work under DPMI (and hence under V2) because there's
no way to guarantee that anything will be mapped to any given linear address;
you'll have to do your own banking (using go32_conventional_memory_selector()
or something + 0xA0000).

>I've even tried calling GrSetMode(GR_320_200_graphics) and then the mode 
>x setmode routines, but it still dies at the memset.

It is a rather good idea to start with a GrSetMode if you want to rely on
GRX's automatic banking.

--- Aaron Ucko (ucko AT vax1 DOT rockhurst DOT edu; finger for PGP public key) | httyp!
Geek code 2.1 [for explanation, finger hayden@ | `God's Laws' (Rudy Rucker,  
vax1.mankato.msus.edu]: GCS/M/S d(-) H s g+ p? \ _Master of Space and Time_):
!au a17 w+ v+(++) C++(+++)>++++ UL++(S+)>++++	\ 1) Be clean. 2) Follow Gary.
P+(++) L++ 3(-) E- N+(++) K- W--(---) M-@ V-(--) \ 3) Teach God's Laws.
po-(--) Y+ t(+) !5 j(++) R(-) G' tv--(-) b+++	  +---------------------------
!D(--) B--(---) e>++++(*) u++(@) h!() f(+) r-(--)>+++ n+(-) y?

- Raw text -


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