www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/14/21:30:14

From: "Avi Berkovich" <berkovic AT netvision DOT net DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: memset etc.
Date: Tue, 15 Aug 2000 03:10:34 +0300
Organization: NetVision Israel
Lines: 49
Message-ID: <8na1e2$l2n$1@news.netvision.net.il>
References: <8mu28b$202$1 AT nslave1 DOT tin DOT it>
NNTP-Posting-Host: ppp70.ort.org.il
X-Trace: news.netvision.net.il 966297858 21591 62.0.195.79 (15 Aug 2000 00:04:18 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 15 Aug 2000 00:04:18 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello

Well, you have to enable the usage of near pointers before trying to
assigned an IO mapped device address to a C++ pointer.

what you should do is:

#include <sys/nearptr.h>

__djgpp_nearptr_enable();
unsigned char *VGA = (unsigbed char *) (0xA0000 +
__djgpp_conventional_base);


This will setup your pointer and enable you to access the video ram, you
should use the function __djgpp_nearptr_disable() at the end of your
program.

Note: this method won't work under Windows NT, Linux DosEMU and other
systems which don't allow the DS selector to have an absolute maximum
length.

P.S.
There is a replacement of the function MK_FP which is used in Borland Turbo
C++ (if you're familiar with it), in the DJGPP FAQ.


Avi


ClaudioF wrote in message <8mu28b$202$1 AT nslave1 DOT tin DOT it>...
>Sorry I'm newbie. I've a little problem with a code I've ported from
Watcom:
>"General Protection Fault at eip=00002e95 etc. etc."
>
>Here's the code. It writes with memset() to the video memory:
>
>
>  ScreenPointer = (unsigned char *) 0x0a0000;
>  memset (ScreenPointer+(x + (y*320)), color, 1);              //  Here's
>the problem. I can't resolve it
> }
>

>Thanks at all.
>ByeZ



- Raw text -


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