[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc65 / ca65: how to interface C and assembly?



Lyrical Nanoha wrote:
On Wed, 7 Dec 2005, Michael J. Mahon wrote:

A volatile type is a necessity in any optimized language used to
access addresses when the access has side effects.  As noted, the
Apple (and indeed, any 6502 machine) is loaded with such side effects.

One must also make some "policy" decisions about indirect accesses
(through pointers).  Without explicit information to the contrary,
it is best to assume that a pointer *cannot* point to a volatile,
since to do otherwise would eliminate almost all optimizations.


I for one don't like my code computer-optimized because I lose control over it.

In high-level languages, optimization is often necessary to allow
more efficient execution of natural expressions of algorithms.

For example, a loop counter may be kept in a register, even
though it is expressed as a variable (typically in memory).

Of course, if you like the compiler's unoptimized code, then you
can turn optimization off.

-michael

Music synthesis for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."