From: "Alberto Chessa" Newsgroups: comp.os.msdos.djgpp Subject: Re: far pointers using djgpp Date: 17 Jun 1998 08:22:50 GMT Organization: Telecom Italia Net Lines: 43 Message-ID: <01bd99c9$678e57e0$92c809c0@chessa> References: NNTP-Posting-Host: a-mi23-62.tin.it To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Butler Owen scm2211 wrote in article ... > > 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/