Re: [stella] ASM comparison question

Subject: Re: [stella] ASM comparison question
From: "Dennis Debro" <dennis@xxxxxxxxxxxxxxx>
Date: Wed, 25 May 2005 10:46:54 -0400
Hi there,

> It might be better to
> generate a number between 0 and 140, then add 9 to the result.  (Plus,
> this way you don't have to check if the number is higher than a low
> limit!)

Good point. It saves bytes too.

    jsr RandomByte
    cmp #140
    bcc .shiftValue
    sbc #140
.shiftValue
    clc              ; not guarenteed to be cleared
    adc #9

or if the PRNG doesn't take too long

.nextNumber
    jsr RandomByte
    cmp #140+1
    bcs .nextNumber
    adc #9           ; clc always cleared :-)

> Second, after the sbc #149 statement, you have a bcs to .checkLowerRange.
> However, the very first statement in .checkLowerRange is a bcs
> to .checkUpperRange.  Was this intentional?

Oops, that was to go up to compare the min value of 9 again.

Take care,
Dennis

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread