[Coco] Mod10 Suggestions
wmikrut72 at gmail.com
Fri Feb 17 18:34:53 EST 2017
The code has been reduced to 63 bytes... 45 actually if I don't count the
45 Program Bytes.... and a whole mod10 is performed.
That's absolutely insane.
The program to handle this in RPG is over 50 lines of code... most
certainly way, way more than 45 bytes.
On Fri, Feb 17, 2017 at 5:12 PM, William Mikrut <wmikrut72 at gmail.com> wrote:
> I see the math there... I am processing 16 numbers -- and I keep thinking
> However, the actual memory range populated is 1200 - 120F
> Let me give it a try!
> On Fri, Feb 17, 2017 at 5:04 PM, William Astle <lost at l-w.ca> wrote:
>> On 2017-02-17 03:50 PM, William Mikrut wrote:
>>> The reason being I am actually reading the number from right to left.
>>> So I need that A,x (16,X) then (15,X) and so on offset to process the
>>> I don't know of another way to maintain that index while counting down.
>> Actually, I did make an error in my description. It should be BPL to
>> branch when not negative so it keeps looping until DECA results in 255 (or
>> -1). That's what I get for being distracted when I wrote the message.
>> However, if you do exactly what I wrote (modulo the BMI/BPL error), you
>> will have *exactly* the same result. That's because you're doing the DECA
>> at the start of the loop so it doesn't change the conditions inside the
>> loop if you start with A at 15 and do the decrementing at the end of the
>> loop or start with A at 16 and do the decrementing at the start of the
>> loop. Either way, A is still in the range of 0...15 during the loop.
>> Basically, you have "LDA #15" at the start. Remove the DECA at "LOOP.00".
>> Replace CMPA #0 (or TSTA) with "DECA" and change the "BNE LOOP.00" to "BPL
>> LOOP.00". Unless I'm miscalculating that will save you one additional byte.
>> Coco mailing list
>> Coco at maltedmedia.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 929 bytes
Desc: not available
More information about the Coco