Re: LZ: A few optimizations and congrats for Daedalus Raytracer


[Prev][Next][Index][Thread]

Re: LZ: A few optimizations and congrats for Daedalus Raytracer



Ryan Myers wrote:
> 
> The only catch with the ReadKey routines, which is why I like SCANKEY
> better, is that there's all those pushes and pops.  SCANKEY only needs 3
> instructions and some #DEFINEs for keys.  Everything else is up to you, so
> with 3 instructions it's REALLY REALLY REALLY fast. :)


4 instructions to be exact. And 8 byte. If you want to check for 11 keys
or more, my routine will save memory :) (just solve the equation 62+2x=8x),
since you only call it once, then you compare it with the key you want to
check.


And since you can make it about 20 bytes shorter by removing the
push and pops at the beginning and the two key check, it will be
better to use my routine instead. Most games do at least 7 keychecks,
the four arrow keys, 2nd, exit and often at least one more key.


The only drawback is, of course, that it doesn't detect multiple keys.
Many games have no need of multiple keys though.


<pre>
-- 
Real name: Jimmy Mårdell
Email....: mailto:mja@algonet.se
IRC-name.: Yarin
WWW......: http://www.algonet.se/~mja


"Strap me down with disillusion 
  Tie me up in lifelines
   Nothing stops my thoughts from breeding
    Nothing's stopping my mind" - Leather Strip
</pre>


References: