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

Re: C programming langauge on Apple II



mdj wrote:

> Using a cross-compiler, you can get pretty good results. Unfortunately
> the 6502 is pretty poorly suited to C in terms of optimisation, so
> you'll usually find that compiled code will be fairly large and not
> particularly fast.

Yes, but compare cc65 to the execution speed of Applesoft, and even
Apple Pascal. I bet it's faster than them and if you're familiar with C
that might be plenty good.

Sadly, they didn't base cc65 on Hendrix's version 2.2 of Small C, which
is where he added intermediate code and a somewhat efficient optimizer.
It turns out to be easier to optimize intermediate code unless you go
to a lot of trouble to optimize native code. Most of the Small C native
code optimizers are fairly simple and nowhere near as effective.

Once Hendrix has optimized the intermediate code, he sends it through a
final native code generation phase. This can't compete with commercial
compilers/optimizers but it's surprisingly effective given the
relatively few lines of code it requires.

Eric