Xref: news2.mv.net comp.os.msdos.djgpp:3426 From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Copying normal mem to graphics mem (VBE 2.0 & linear) Date: Fri, 3 May 1996 16:37:46 +0100 Organization: The University of York, UK Lines: 28 Message-ID: NNTP-Posting-Host: tower.york.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <4mborc$bq0@news.mel.aone.net.au> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On 3 May 1996, Leath Muller wrote: > I have setup a area of graphics memory using UniVBE and the VBE 2.0 calls > which I have mapped to a segment using __djgpp_allocate_LDT_descriptors. > The problem is, whenever I try to copy memory to this new selector using > the segment returned from the call, I get either a protection fault (if it Is this using the VBE 2.0 linear framebuffer? You can't go straight to that via an LDT descriptor, because the descriptor refers to linear memory, whereas the address returned by VBE 2.0 is a physical one. The two are not the same: page mapping tables convert from one to the other (these are what dpmi providers use to implement virtual memory). You need to use dpmi to map the physical address into linear memory, then make an LDT descriptor to access the linear address. There is some code that does this in my Allegro library (on my homepage and on x2ftp.oulu.fi in /pub/msdos/programming/djgpp2/alleg20.zip)): look in vesa.c. Charles Sandmann also wrote a demo of how to access the framebuffer in djgpp v2, but I can't remember where to find this, it might be on DJ's web server somewhere... /* * Shawn Hargreaves. Why is 'phonetic' spelt with a ph? * Check out Allegro and FED on http://www.york.ac.uk/~slh100/ */