Mail Archives: djgpp/1998/06/19/01:45:54
Butler Owen scm2211 <s9708172 AT tiger DOT vut DOT edu DOT au> wrote in article
<Pine DOT SOL DOT 3 DOT 95 DOT 980617000723 DOT 17603A-100000 AT tiger DOT vut DOT edu DOT au>...
>
> Hello,
>
> I would like to create a pointer to my VGA cards memory. I know this
> starts at 0xA000,0000
>
> in another compiler I would use:
>
> char far *screen= (char far *) MK_FP(0xa000,0);
>
> problems arise:
> 1. djgpp does not support the "far" keyword
> 2. the implementation of "dos.h" that comes with djgpp does not contain
> MK_FP()
You have to map the DOS memory in the virtual space of your program. This
is just avaiable throught the selector _dos_ds that can be used with
function _farpoke*() (see farptr.h and go32.h):
farpokeb(_dos_ds, 0xA0000+offset, value) // write byte value at
0xA0000+offset
> if I try this:
>
> char * screen = (char *) 0xa0000000;
>
> it compiles fine, then crashes at the point I try and set anything
through
> this pointer.
Of course. All djgpp pointers are 32bits pointer in virtual memory. They
are translated to physical address by page table and Memory Management
Unit.
> Any suggestions?
Look at FAQ 10.2 and 18.4 (http://www.delorie.com/djgpp/v2faq/). Also look
at DJGPP Graphic Programmiong Guide by Avly
(http://www.castle.net/~avly/djgfx.html) and other stuff from
http://www.delorie.com/djgpp/doc/
- Raw text -