From: Si Newsgroups: comp.os.msdos.djgpp Subject: Correct Memory Mapping Date: Thu, 29 Jan 1998 10:30:12 -0800 Organization: BT Labs, Martlesham Heath, Ipswich, UK Lines: 25 Message-ID: <34D0CAB4.24DD@vecktorlite.demon.co.uk> Reply-To: vecktor AT vecktorlite DOT demon DOT co DOT uk NNTP-Posting-Host: pc5685.btlabs.bt.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hello , I am relatively new to protected mode programming, and am having a few memory problems. I am using a VESA 2.0 linear frame buffer in various resolutions (256 cols only), when setting the mode I use nearptrs to directly access the frame buffer( I know this disables mem protection, but its what I want to use) I use code as described in Charles Sandmanns vbetest.c demo (downloaded from brennans page) to get the correct address of the buffer if(__dpmi_physical_address_mapping(&info) == -1) { printf("Physical mapping of address 0x%x failed!\n",mb->PhysBasePtr); exit(2); } then I add the __djgpp_conventional_base the problem comes when I malloc some mem the address always is illegal when I try to access that memory how do I calc the correct address, I tried afew things and on thing that did work was to add __djgpp_conventional_base to the malloced address before I used it that seemed to sort of work but not always??? also what does sbrk() have to do with things, I know It may change some addresses, but which ones, what does it affect, what do I need to watch out for when using nearptrs. Any help will be greatly appreciated,, thanks in advance Si....