Mail Archives: djgpp/1997/01/29/13:36:06
From: | Moo-Juice <Ben AT flag DOT demon DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | 0xB8000
|
Date: | Wed, 29 Jan 1997 10:28:11 +0000
|
Organization: | Honest Ron's Car Emporium
|
Distribution: | world
|
Message-ID: | <Ke0udLA7Yy7yEwJb@flag.demon.co.uk>
|
NNTP-Posting-Host: | flag.demon.co.uk
|
MIME-Version: | 1.0
|
Lines: | 63
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi all,
Some of you may remember the question I posted some days back,
concerning accessing the screen memory. I decided that the easiest
method would be to to use nearptrs.
#include <pc.h>
#include <sys/nearptr.h>
void CApp::BuffUpdate(CWin *WItem)
{
int x; // Current X Position
int y; // Current Y Position
int c; // Counter
int Len = WItem->Pos.w; // Len of text to write
POINT Query;
Cov Offender;
MouseHide();
if(__djgpp_nearptr_enable()==0) return; // Enable near pointers
char *video = (char*)(__djgpp_conventional_base + 0xb8000);
// Clip to Screen Width
if(1-(WItem->Pos.x + Len) > (79))
Len = (80 - WItem->Pos.x+1);
for(y=WItem->Pos.y;y<=WItem->Pos.y+WItem->Pos.h-1;y++)
{
if(y>ScreenRows()-1) break;
for(x=WItem->Pos.x;x<=WItem->Pos.x+Len-1;x++)
{
Query.x = x - WItem->Pos.x;
Query.y = y - WItem->Pos.y;
Offender = IsCoveredX(WItem,Query);
if((Offender.Back==NULL) || (Ignore==TRUE))
{
*** video[(y*160)+x] = WItem->Front[c];
video[(y*160)+x+1] = WItem->Front[c+1];
}
else
{
Offender.Back[Offender.Pos] = WItem->Front[c];
Offender.Back[Offender.Pos+1] = WItem->Front[c+1];
};
c+=2;
};
};
MouseShow();
__djgpp_nearptr_disable(); // Disable near pointers
};
It crashes on the line marked '***', with a signal error.
Can anybody shed any light on this problem?
--
Moo-Juice
- Raw text -