www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/01/08:38:01

Message-ID: <34AB9AF1.3119A760@no.spam.mcs.nl>
Date: Thu, 01 Jan 1998 14:32:33 +0100
From: "A.P. Zijlstra" <peter AT no DOT spam DOT mcs DOT nl>
Reply-To: peter AT no DOT spam DOT mcs DOT nl
Organization: Physics student @ University of Amsterdam
MIME-Version: 1.0
To: dave DOT nugent AT ns DOT sympatico DOT ca
CC: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: Help with optimizing for speed
References: <34A40538 DOT F19 AT ns DOT sympatico DOT ca>

Dave Nugent wrote:
> 
> Hello, can anyone tell me if they see a way to optimize this code at
> all.
> I am trying to write a scrolling style game.  Nothing fancy.
> I have a large buffer set up around 1.2MB called screen_hold that holds
> the
> entire level (draw).  I then copy 160 lines*320 bytes of this to a
> secondary
> buffer called screen where I will then add sprites to the background and
> blast to vga memory screen mode13.  I am using 160 lines, because the
> bottom
> 40 lines will be used for a score bar & other info that will not always
> need
> to be redrawn constantly.  I am just new to DJGPP and have been using
> Borland
> C++ v3.0 for DOS up til now, but figured I could really increase the
> speed
> with a 32 bit compiler, but with the code I am using, there is not much
> difference (speed wise) between the code generated by DJGPP and
> Borland's
> Turbo C++ 16bit code.  Is there a way that would be faster?  I'm trying
> to get speed similar to that in Jazz JackRabbit.. I can't think of a
> faster
> way than this in 32 bit!!
> 
<...snip, code section...>
> I would appreciate any optimization suggestions, or any different
> approaches
> you may have.
> 
> Thanks!
> Dave.

How about using those features of the vga card usually revered to as
Mode-X
or something like that... It will enable you to use hardware scrolling
and
more nifty thingies....
Setup a virtual screen, with an extra 2 sprites high and width, this
will
save you a LOT of moves. 
You might also play with the XOR write mode, this mode enables you to do
some nifty tricks like transparants and saves you the -if zero dont plot
pixel check- so you can blast away 32bits per move. It does require some
pre-processing and palette tricks...
Use two virtual pages for double-buffering, dirty rectangles etc...


Hope I make some sence,..
Peter

- Raw text -


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