[Coco] Mod10 Suggestions
L. Curtis Boyle
curtisboyle at sasktel.net
Sat Feb 18 21:29:04 EST 2017
Yeah… “crowdsourcing”. :-)
(Also, since it looks like you don’t care what A or B is on return from the subroutine, you could remove my suggested leas 1,s near the end, and change the RTS to a PULS PCR,A)
L. Curtis Boyle
curtisboyle at sasktel.net
TRS-80 Color Computer Games website
http://www.lcurtisboyle.com/nitros9/coco_game_list.html
> On Feb 18, 2017, at 8:22 PM, William Mikrut <wmikrut72 at gmail.com> wrote:
>
> Which is the beauty of this project.
>
> Clearly there are at least 3 ways to do this...each with a slightly
> different outcome.
>
> Some optimization for size,speed... or both.
>
> There is a wealth of information and experience here from everone and I
> truly appreciate all the input!
>
> I can't wait to start the next project and see where it leads!!
>
>
>
> On Feb 18, 2017 8:10 PM, "L. Curtis Boyle" <curtisboyle at sasktel.net> wrote:
>
>> I was just going to mention that if speed is more important, doing an leas
>> -1,s before the loop, and then just a sta ,a /adda ,s (instead of pshs
>> a/add ,s+), and then a final leas 1,s after the loop is done would be a bit
>> longer, but a bit faster.
>>
>> L. Curtis Boyle
>> curtisboyle at sasktel.net
>>
>> TRS-80 Color Computer Games website
>> http://www.lcurtisboyle.com/nitros9/coco_game_list.html
>>
>>
>>
>>> On Feb 18, 2017, at 7:41 PM, Dave Philipsen <dave at davebiz.com> wrote:
>>>
>>> That's pretty well optimized! Have you ever considered the difference
>> between optimizing for size and optimizing for speed? So, for instance, if
>> you weren't necessarily constrained for size but you knew you were going to
>> process a list of jillions of cc numbers would you write it differently?
>>>
>>> Dave Philipsen
>>>
>>>> On Feb 18, 2017, at 5:06 PM, William Mikrut <wmikrut72 at gmail.com>
>> wrote:
>>>>
>>>> Some slight re ordering of the code and it works perfectly!
>>>> 48 Bytes total, Less 17 for storage -- 31 program bytes to get the job
>> done.
>>>>
>>>> My original code was 61 program bytes... down to half the size and does
>> the
>>>> exact same thing.
>>>> Absolutely amazing!
>>>>
>>>>
>>>> ORG $1200
>>>> CCD RMB 16
>>>> RESULT RMB 1
>>>>
>>>> START LEAX CCD+16,PCR
>>>> CLRA
>>>> LDB #8
>>>>
>>>>
>>>> LOOP ADDA ,-X
>>>> DAA
>>>> PSHS A
>>>> LDA ,-X
>>>> LSLA
>>>> CMPA #10
>>>> BLO LOOP2
>>>> SUBA #9
>>>> LOOP2 ADDA ,S+
>>>> DAA
>>>>
>>>> DECB
>>>> BNE LOOP
>>>>
>>>>
>>>>
>>>> ANDA #$0F
>>>> STA RESULT,PCR
>>>> ENDPGM RTS
>>>> END START
>>>>
More information about the Coco
mailing list