delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/22/21:22:20

To: djgpp AT delorie DOT com
Subject: Re: How to program compiled sprites?
Message-ID: <19970122.180301.4975.0.chambersb@juno.com>
References: <32e54b6d DOT 501326 AT news DOT prestel DOT co DOT uk>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Wed, 22 Jan 1997 21:04:07 EST

On Tue, 21 Jan 1997 23:13:25 GMT luke AT metalworks DOT prestel DOT co DOT uk (Luke
Steele) writes:
>Hi,
>I recently obtained the Allegro, the graphics programming library for
>DJGPP.  One of the test programs that comes with it demonstrates
>certain methods of sprite putting, including one called compiled
>sprites.  How does this work?  According to the documentation, the
>routine performs a number of immediate 'mov's, but I am unable to see
>how this could make things faster.  Surely, the time for an immediate
>'mov' is 1 cycle, as is the time for each mov in a 'rep movsd'?  What
>is it that I'm not getting?
Indeed - but the catch is that a simple blit does not use just a rep
movsl (AT&T syntax).  If you mask for transparancy, ie you use color 0
for see-through, then it must perform a cmp on each pixel.  If you don't,
you could use rep movsl, but you have to do this for each line - and
clip.
Compiled sprites, on the other hand, translate into a single move for
each pixel.  Thus, there is no clipping, and you don't have to worry
about transparancy because the pixels colored 0 aren't translated into
MOV's - they're just skipped.  Also, if you're using Pentium and can
manage to keep the code in the on-chip cache (8k on the Pentium, no?) the
instructions will go superscalar for a time of .5 cycles per pixel.

...Chambers

- Raw text -


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