Mail Archives: djgpp/1997/03/09/02:01:01
Mr P. Steele writes:
>In djgpp do I have to initialise far pointers using the farptr.h
>, if so how do I do it. An example would be something like as follows
>
>unsigned char *rom_char_set = (char far *)0xF000FA6EL;
That's a real mode pointer, which can't be accessed directly in
protected mode. I presume you are trying to read some data from segment
0xF000, offset 0xFA6E, right? You have to convert that into a protected
mode address with the formula (seg*16 + offset), which gives an address
of 0xFFA6E.
You can't access that pointer directly, though, because it refers to the
DOS memory area rather than your address space. The easy way to do it is
with the dosmemget() function, eg:
char buffer[size];
dosmemget(0xFFA6E, size, buffer);
Alternatively you can use the functions in <sys/nearptr.h> to get direct
access to conventional memory: type "info libc alpha
__djgpp_nearptr_enable" for details.
btw. these issues are covered in some detail in the FAQ: it's well worth
reading...
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Beauty is a French phonetic corruption of a short cloth neck ornament.
*/
- Raw text -