Re: [stella] Newbie: Efficiency in Code, Joystick Routine as Example

Subject: Re: [stella] Newbie: Efficiency in Code, Joystick Routine as Example
From: Erik Mooney <erik@xxxxxxxxxx>
Date: Sun, 14 Jul 2002 21:16:46 -0400
On Sun, 14 Jul 2002 11:56:07 -0700, you wrote:

>Here is a joystick read routine that is not so efficient, it follows the
>standard programming technique one would use in something like C++ or basic:

Except that that code (both the 'usual' and your version) can't handle two
directions at once (like up-left.)  You need to set up something like
this:

        LDA  SWCHA
        ASL
        BCS notright
	;do stuff for right without changing A
notright        ASL
        BCS notleft
	;do stuff for left without changing A
notleft        ASL

and so on.  Alternatively, you could do
LDA SWCHA
STA TempVar
ASL TempVar
BCS notright
...
notright ASL TempVar

and so on.

(yes, optimiziation gurus, I realize it could be LDA SWCHA | ASL |
STA TempVar | BCS .  I'm going for clarity :) )
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread