www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/28/18:21:19

From: "Marp" <Marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: nearptr access to memory mapped devices
Date: Sun, 28 Nov 1999 16:06:05 -0500
Organization: MindSpring Enterprises
Lines: 44
Message-ID: <81s582$bmt$1@nntp8.atl.mindspring.net>
NNTP-Posting-Host: c7.b7.cf.2b
X-Server-Date: 28 Nov 1999 21:01:54 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have a question about accessing a memory mapped device using a near
pointer. I was reading through the vbe 3.0 spec and it suggested the
following to access the linear frame buffer:

/*spec starts*/
1. Map the physical memory address to a linear memory address (using DPMI
function 0x800 for example).

2. Find the base address for the default DS selector for your operating
environment.

3. Subtract the base address from the linear address computed in step 1 to
give you a near pointer (relative to DS) that you can use from within your
code.
/* spec ends */

Okay sounds good. I interpret it this way for doing it in djgpp assuming
I've already determined the address and size of the lfb:

/* code starts */
void *lfbptr;
__dpmi_meminfo meminf;
unsigned long baseaddr;

/* step 1 */
meminf.address = address_of_lfb;
meminf.size = size_of_lfb;
__dpmi_physical_address_mapping(&meminf);

/*step 2 */
__dpmi_get_segment_base_address(_my_ds(), &baseaddr);

/* step 3 */
lfbptr = meminf.address - baseaddr;
/* code ends */

The problem is that when I go to use lfbptr, I get SIGSEGV. Actually I'm not
trying to use a lfb but I'm trying to access a memory mapped device above
the 1mb mark and I thought this could be used for that as well. So my
question is, am I doing this right, or does the method suggested by the vbe
spec not work? If the method suggested doesn't work why is it in the vbe
spec???


- Raw text -


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