delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/02/12:14:39

Message-ID: <37CE6D5B.D3754914@swipnet.se>
From: Anders David Skarin <hobbit AT swipnet DOT se>
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Weird pointer!
Lines: 45
NNTP-Posting-Host: 130.244.45.124
X-Complaints-To: news-abuse AT swip DOT net
X-Trace: nntpserver.swip.net 936275467 130.244.45.124 (Thu, 02 Sep 1999 14:31:07 MET DST)
NNTP-Posting-Date: Thu, 02 Sep 1999 14:31:07 MET DST
Organization: A Customer of Tele2
X-Sender: s-437261 AT dialup45-2-60 DOT swipnet DOT se
Date: Thu, 02 Sep 1999 14:28:11 +0200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I'm having trouble with my vesa routines. I had it 
all working fine, with some fast asm flip functions.
But trying it on a second computer I found out it was
pure luck. So now I tried a new approach, but somehow
my asm routines won't work anymore.

The crash will occur in this version:

void VBE_blitBGR(VBE_32bitScreen *screen, long pixels)
{
	__djgpp_nearptr_enable();
	VBE_PTR = (VIDEO_PTR+__djgpp_conventional_base);	/* This will be placed
in EDI */
	VBE_flip24bppBGR((long)(screen), pixels);		/* Asm flip function */
	__djgpp_nearptr_disable();
}

but not in this version:

void VBE_blitBGR(VBE_32bitScreen *screen, long pixels)
{
	long offset;
	__djgpp_nearptr_enable();

	byte *video_ptr = (byte*)(VIDEO_PTR+__djgpp_conventional_base);
	for(offset=0;offset<pixels;offset++)
	{
		*(video_ptr++) = screen->data[offset].B; 	
		*(video_ptr++) = screen->data[offset].G;	
		*(video_ptr++) = screen->data[offset].R;
	}
	__djgpp_nearptr_disable();
}

What the .... is wrong!! The two functions do EXACTLY the same thing but
one is 
partially in assembler (and about 3times faster). 

What happens to the pointer when entering the asm function?
Will nearpointers be disabled as soon as I make a function call?

Thanks to anyone that has any info on the subject and is kind enough
to share it with a desperate coder.

- Raw text -


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