Re: [cc65] const/volatile

Date view Thread view Subject view

From: Christian Krüger (christian.krueger_at_pace.de)
Date: 2003-02-01 17:06:37


Hi,

even if I hate to complain, you wrote:

>const" means that the value passed to the function is not modified by
>the function.

...so when the value passed to the function is given in accu/x
it means that accu/x will not change...

>There is no way to write any decent 6502 code without using the
>accumulator.

I disagree. Because I program 'a little bit object oriented' even
in 'C' I have many 'getters' & 'setters'. So the function bodies of
approx. 20% of my functions looks like this:

--8<----

void __fastcall__ setAnyData(const unsigned char anydata);

setAnyData:
      sta anydata
      rts

--8<----

When writing to daughter chip registers (like setting colors,
doing sound etc.) the same is true...

There are much more functions possible on 65(S)C02, thanks
to the 'stz'-instructions, where clearing a given table (pointer
in accu/x) won't corrupt the accu...

But maybe I should use my energy for writing an enhanced optimizer
which will support this feature... ;-)

>> out of the box: inline functions (even when I have worse
>> assumptions, which problems are tied to that feature...)
>
>Yes, that's one of my favourites, too:-)

Phew - I promise to shut up... ;-)

Regards
chrisker
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-02-01 17:07:22 CET