Re: [stella] Programming tricks guide

Subject: Re: [stella] Programming tricks guide
From: Memblers <jparsell317@xxxxxxxxxxx>
Date: Sun, 09 Feb 2003 15:18:16 -0500
On 9 Feb 2003 at 15:35, KirkIsrael@xxxxxxxxxxxxx wrote:

> What would be most helpful to me is something that covered some 
> basic things...for instance, I had trouble figuring out how to
> do the equivalent of "comparison if then"--i.e. in pseudo code
> if  X < Y then
>   do this
> end if

It sounds difficult, but it's actually quite simple once you understand how the CMP 
instruction works.  An older program I made used to do a bunch of INCs or DECs 
with a compare to see which was greater.  (that was _really_ slow and dumb, heheh)

CMP is like the SBC instruction, the difference is that only the status flags are 
affected.  In this case, you'll use the carry flag.

LDA #20
CMP #10
BCC 20_is_greater_than_10


LDA #10
CMP #20
BCS 10_is_less_than_20

See?  CMP subtracts the given value from the accumulator, and sets the flags 

I hope that helps.

Archives (includes files) at
Unsub & more at

Current Thread