Subject: [stella] ASM comparison question From: "Dennis Debro" <dennis@xxxxxxxxxxxxxxx> Date: Wed, 25 May 2005 10:05:45 -0400 |
Hi there, I seem to be missing something. I'm trying to take a random number and make it stay between 9 and 149. The code I have is... jsr RandomByte ; get a random number cmp #9 ; compare with lower limit .checkLowerRange bcs .checkUpperRange ; check upper limit if >= lower adc #9 ; here value < lower so add lower limit .checkUpperRange cmp #150 ; compare with upper limit + 1 bcc .storeBetweenValue ; if < upper then in range sbc #149 ; subtract upper limit bcs .checkLowerRange ; shouldn't cross 0 so unconditional branch .storeBetweenValue sta betweenValue I've looked at this for so long that maybe I can't see the forest for the trees. Sometimes I'm getting a number out of the range. Should this work? Take care, Dennis Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://stella.biglist.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Aw: Re: [stella] Superman disas, Tony Wong | Thread | Aw: [stella] ASM comparison questio, cybergoth |
RE: Re: [stella] Superman disassemb, Dennis Debro | Date | Aw: [stella] ASM comparison questio, cybergoth |
Month |