Mail Archives: djgpp/1996/05/01/14:36:27
Xref: | news2.mv.net comp.os.msdos.djgpp:3293
|
From: | Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Yet about MK_FP, pokeb, and peekb
|
Date: | Tue, 30 Apr 1996 11:35:12 +0100
|
Organization: | The University of York, UK
|
Lines: | 31
|
Message-ID: | <Pine.SGI.3.91.960430110540.12198C-100000@tower.york.ac.uk>
|
NNTP-Posting-Host: | tower.york.ac.uk
|
Mime-Version: | 1.0
|
In-Reply-To: | <Pine.A32.3.90.960429134020.72338B-100000@canudos.ufba.br>
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
On Mon, 29 Apr 1996, Bruno Kraychete da Costa wrote:
> Guys, sorry if I seem to insist at the same point (about
> MK_FP). What I'd like to have is the facility of refering to a memory
> position using a pointer, instead of a function (like dosmemput/get). On
> the Borland version of a program of mine I had:
The problem is that memory addresses in djgpp aren't absolute, because it
is running in protected mode. In Borland C real mode you can specify a
physical address, like 0xA0000, and know exactly where it will go. In
protected mode, however, all addresses are relative to your program's
virtual address space. When you create a pointer to 0xA0000, the
processor treats it as being relative to the base address of your data
segment, rather than absolute, plus all addresses go through the page
mapping tables before they are actually used to refer to physical bits of
ram (check a book on 386 asm for more detail on this).
If you want to refer to a specific physical address, you have to load a
different value into one of the segment registers, which means either
using asm or the farptr functions. Alternatively there is a trick you can
use with near pointers, by setting an infinite limit on your data
segment and then using negative offsets (look at nearptr.h), but this
disables memory protection and won't work under all DPMI providers.
I know this can be a pain, but it's what you get for using protected mode :-)
Shawn Hargreaves. Why is 'phonetic' spelt with a ph?
Check out Allegro and FED on http://www.york.ac.uk/~slh100/
- Raw text -