[Coco] Mod10 Suggestions
William Astle
lost at l-w.ca
Fri Feb 17 17:34:00 EST 2017
You can replace CMPA #0 with TSTA to save one more byte.
Alternatively, you can start with A at 15 and not bother with the DECA
at the start of the loop. Then replace your CMPA #0 with DECA and use
BMI to branch if you've gone past 0 (negative). (DEC sets N (negative),
Z (zero), and V (overflow) correctly. It just doesn't change C (carry))
On 2017-02-17 02:58 PM, William Mikrut wrote:
> Thank you for all of the great suggestion!
>
> I have implemented them and the byte count shrunk from 79 -> 65 ( Almost
> 20% reduction) and it actually runs faster without the excessive loop
> overhead.
>
> The only thing I didn't try was storing a variable in the DP ($0003)
> because I always want my code to be completely independent of there it's
> loaded.
>
> Here is the revised version 2!
>
> (A CoCo based CCD reader would be Awesome!
> I wonder if Ingenico would be on board!!)
>
>
>
> On Fri, Feb 17, 2017 at 4:34 AM, Mark McDougall <msmcdoug at iinet.net.au>
> wrote:
>
>> On 17/02/2017 5:57 PM, Dave Philipsen wrote:
>>
>> Here's a problem. It's not the credit card digit itself that is being
>>> tested for odd/even. It's the position of the digit. So you need to do
>>> a 'bitb #1' instead of a 'bita #1'.
>>>
>>
>> Good catch - thanks!
>>
>> Regards,
>>
>> --
>> Mark McDougall
>> <http://retroports.blogspot.com.au>
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>>
>>
>>
More information about the Coco
mailing list