Date: Wed, 8 May 1996 17:16:51 +0200 (IST) From: Eli Zaretskii To: Enrico Horn Cc: Bruno Kraychete da Costa , djgpp AT delorie DOT com Subject: Re: MK_FP, peekb and pokeb In-Reply-To: <318F49B9.7BD4@prakinf.tu-ilmenau.de> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 7 May 1996, Enrico Horn wrote: > If you need a pointer the best method is: > #include > char *p; > __djgpp_nearptr_enable(); > p=(char *)(0xb8000); When posting code fragments that you didn't try to compile and run, please at least say so, or point people to the place in the official docs for more info. THE ABOVE CODE IS INCORRECT! Under certain circumstances it will happily wipe out your hard disk! The following is an example from the libc on-line docs which shows how the nearptr facility should be used: if (__djgpp_nearptr_enable()) { short *screen = (short *)(__djgpp_conventional_base + 0xb8000); for (i=0; i<80*24*2; i++) screen[i] = 0x0720; __djgpp_nearptr_disable(); } The crucial difference is that `__djgpp_conventional_base' offset. Without it you are writing to a random location, and since memory protection is effectively disabled by `__djgpp_nearptr_enable', you can really hurt your system.