Subject: Re: [stella] Brick wall ahead From: Erik Mooney <emooney@xxxxxxxxxxxxxxxx> Date: Sun, 24 Oct 1999 14:39:46 -0400 |
>I'm slowly but surely programming, but I need some >help. Specifically, a branch for zero. I'm need the >computer to comare a number in RAM with zero and >branch if is 0, otherwise just keep steamrolling >ahead. Now, the questions: > >1) How do I control the zero flag? I see CLC (CLear >Carry), CLD (CLear Decimal), CLI (CLear Interupt), and >CLV (CLear oVerflow), but nothing like a CLZ (CLear >Zero). Is there a command to do it and it's just not >listed in this book? Noo, noo, noo, you don't control the zero flag, instructions set it. Any arithmetic operation as well as any load (LDA, LDX, LDY) simply sets the zero flag if the result of the operation or the value loaded is zero or clears the zero flag if the result is nonzero. >Or do I pull the byte for the >flags into A, AND it to turn off the zero flag bit, >and STA it back in RAM? Methinks someone should've had a bit more assembly language experience before diving headlong into the 2600.. that sentence makes very little sense :) >2) Is this how I'm supposed to do this: >Somehow clear the zero flag >LDA the number I want to compare into A, do whatever >it is I need to with it there. >CMP #$0 >BEQ to the end of where the commands for no-zero are >(no more that 127 bytes) >Clear zero flag, do next comparison, etc. Just LDA the number and then BEQ to where the commands for zero are. (BEQ looks at the zero flag and branches if the flag is set.) -- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[stella] Brick wall ahead, Pete Holland | Thread | Re: [stella] Brick wall ahead, doppel |
[stella] Brick wall ahead, Pete Holland | Date | Re: [stella] Brick wall ahead, doppel |
Month |