[Coco] CCASM procedures

David golgotha at toughguy.net
Sun Dec 5 04:14:07 EST 2004


Well, even as a novice-level 6809 programmer, this just makes sense to me..
I'm looking forward to using libary-style functions to bring about some more
coco software.. I can just picture the graphics library being sweated over
by many, trying to find a routine which uses just one less clock-tick

I dont really know what sort of feedback you're looking for here, Roger..
but all I can say is I'm looking forward to using the new library-style
functions :)

thanks for bringing excellent coding one step nearer to the masses :)

- David R


----- Original Message -----
From: Roger Taylor <rtaylor at bayou.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Sunday, December 05, 2004 3:56 PM
Subject: Re: [Coco] CCASM procedures


> So far, here is where I'm at.  I need some feedback on whether my methods
> are "good" or not.
>
> I haven't added the actual CALL function yet which will push the supplied
> parameters to the stack then call the procedure, etc.  I'm also not
> planning on doing too much or any type checking or checking too much to
see
> if the CALL parameters are legal or not.
>
> The first listing is the source code defining 2 procedures, and the second
> listing is what CCASM output during assembly.
>
>
> org 3584
>
> * Convert to upper: toupper(char c)
> toupper proc chr:byte
> lda chr,s Get char argument
> cmpa #'a' Lower case?
> blo ?1 No, leave alone
> cmpa #'z' Lower case
> bhi ?1 No, leave alone
> anda #%11011111 Convert to upper
> ?1 rts
> endproc
>
> * Convert to lower: tolower(char c)
> tolower proc chr:byte
> lda chr,s
> cmpa #'A' Upper case?
> blo ?1 No, leave alone
> cmpa #'Z' Upper case
> bhi ?1 No, leave alone
> ora #%00100000 Convert to lower
> ?1 rts
> endproc
>
> end
>
>
> LISTING-->
>
>                                          org 3584
>
>                        * Convert to upper: toupper(char c)
>                         toupper           proc chr:byte
>   0E00 A6   62                            lda chr,s Get char argument
>   0E02 81   61                            cmpa #'a' Lower case?
>   0E04 25   06                            blo ?1 No, leave alone
>   0E06 81   7A                            cmpa #'z' Lower case
>   0E08 22   02                            bhi ?1 No, leave alone
>   0E0A 84   DF                            anda #%11011111 Convert to upper
>   0E0C 39               ?1                rts
>                                           endproc
>
>                        * Convert to lower: tolower(char c)
>                         tolower           proc chr:byte
>   0E0D A6   62                            lda chr,s
>   0E0F 81   41                            cmpa #'A' Upper case?
>   0E11 25   06                            blo ?1 No, leave alone
>   0E13 81   5A                            cmpa #'Z' Upper case
>   0E15 22   02                            bhi ?1 No, leave alone
>   0E17 8A   20                            ora #%00100000 Convert to lower
>   0E19 39               ?1                rts
>                                           endproc
>
>                {$0000}                    end
>
> ?10007                   =[     0E19] ?10006                   =[
0E0C]
> toupper_chr              =[0001_0002] tolower_chr
=[0001_0002]
>
>
> Note that the tolower_ and toupper_ local symbols in the bottom table
> contain two joined 16-bit codes.
> The MSW (on the left) is how many bytes that parameter needs.  The LSW is
> the offset into the stack, since it's a local variable.
> These codes are used in the expression evaluator whenever you're inside of
> a procedure, to translate the symbol into its "address" (the offset in
this
> case) so that it works seamlessly with the indexed instructions, such as
> variablename,s.
>
> Before I go too far with all of this, I wanted to get some opinions so
that
> I won't end up having to change too much stuff later and possibly breaking
> a bunch of source code somebody spent their hard hours on.
>
> --
> Roger Taylor
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco




More information about the Coco mailing list