🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1620

Re: speedup PutBlock

#1620
From: John A. Slagel
Date: Thu, 19 Nov 1992 08:30
50 lines
2697 bytes
blaisdel@ucrengr.ucr.edu (james blaisdell) writes:

>however the table lookup is much more flexible and faster, the only
>possible argument against the table look up is that it requires 400 bytes

   One point--- If you're using ModeX on a 386, remember this:
   1. The Y-coordinate can be greater than 256.
   2. There are several X-modes that have different resolution.
   3. Most people using ModeX have a 386 or higher.

   My point---
   Remember the early-out feature for multiplication on a 386.  If the
   argument to the MUL instruction is small, the multiply routine times
   out, so the MUL takes much less time on a 386.


   My 2nd point---
   ModeX addressing uses the X-width divided by 4 to multiply by
   to find the pixel offset.  This will always be less than 256, so
   enter the early-out feature on 386s.   

   My main point---
   MUL works almost as fast as shifts on a 386 with VGA, but has the
   potential, unlike shifts and adds, to be used across many different
   ModeX resolutions. 

   The point of this note--
   Please, please, please, keep code portible between different modes.
   There is *ABSOLUTELY NO SENSE* in writing shift and adds to save 2 or
   3 clock cycles per sprite at the sake of code portability.  Just always
   use the X width divided by 4 as the argument for MUL, and your ModeX
   routines will *NOT* be significantly slower than shifts and adds.

   Forgive me for taking a long time to drive a point home.... Its
   just that a lot of people keep saving a few clock cycles per
   sprite on a 386 at the expense of portability.   Figure-- If you
   have 50 sprites miving around, and save 10 clock cycles per sprite,
   you save 500 clock cycles, which is insignificant, compared to the
   delays necessary for page-flipping, collision detecting, Z-sorting,
   etc...



   Think about global, not local, optimizations.

-- 
-----------------------------------------------------------------------------
 John A. Slagel              "My old man used to tell me, before he left this
 j-slagel1@uiuc.edu           shitty world, never chase buses or women- you
 (217) 337-7930               always get left behind." -The Marlboro Man
Technical Details
Message-ID: <BxyFn4.Ktu@news.cso.uiuc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876
References: <24034@galaxy.ucr.edu>

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876
From: jas37876@uxa.cso.uiuc.edu (John A. Slagel)
Subject: Re: speedup PutBlock
References: <24034@galaxy.ucr.edu>
Message-ID: <BxyFn4.Ktu@news.cso.uiuc.edu>
Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
Organization: University of Illinois at Urbana
Date: Thu, 19 Nov 1992 08:30:39 GMT
Lines: 50