delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/29/12:30:34

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with following code
Date: Thu, 29 Apr 1999 17:12:39 +0100
Organization: USENET UK
Lines: 28
Message-ID: <7ga082$fkb$1@hagen.cloud9.co.uk>
References: <8D53104ECD0CD211AF4000A0C9D60AE3013574DD AT probe-2 DOT acclaim-euro DOT net>
NNTP-Posting-Host: hgty.capgemini.co.uk
X-Trace: hagen.cloud9.co.uk 925402178 16011 194.42.240.2 (29 Apr 1999 16:09:38 GMT)
X-Complaints-To: abuse AT usenet DOT co DOT uk
NNTP-Posting-Date: 29 Apr 1999 16:09:38 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>This whole thing is an unnecessarily complex way to plot a pixel,
>though. You could rewrite it much more simply as:
>
>   _farpokeb(_dos_ds, 0xA0000+offset, color);


Or for maximum speed, enable near pointers (be careful, enabling near
pointers switches off _ALL_ memory protection in the DOS area!)

The following code is from Brennans page (the Delorie mirror).

#include <sys/nearptr.h>
char *screen;
if (__djgpp_nearptr_enable() == 0) return ERROR; /* could happen */
/* You must recalculate the screen pointer every time you enter this mode
because __djgpp_conventional_base can change when you malloc/new and other
misc stuff. */

screen = 0xa0000 + __djgpp_conventional_base;
screen[0] = 1;
screen[1] = 1;
/* etc. */
__djgpp_nearptr_disable();

Michael Stewart


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019