Re: A86: What C-compilers have we got? [82/83/83+/85/86]


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

Re: A86: What C-compilers have we got? [82/83/83+/85/86]





On Wed, 8 Nov 2000, David Phillips wrote:

> The reason to use assembly on the calc is simple: size.  [...]

> Everything you see about modern
> optimizing compilers is speed, not size.  And that makes the code a lot
> larger, too.  

For the Z80 processor, faster code is generally also smaller (remember, it
doesn't have a maniacal architecture like x86) so optimizing for speed
will usually make it smaller too (when optimizing by hand, how often do
you gain a speed increase by using a much longer sequence of
instructions?  I doubt it's often on the Z80).

Of course there are optimizations that will make code larger, like
inlining functions or unrolling loops, but most compilers that do them
allow them to be turned off.

The real problem is that none of the compilers for the TI-86 can come
close to reasonably claiming to be 'modern optimizing compilers'.


> Take a game like Nibbles.  Bill Nagel's version was around 2100 bytes I
> believe.  That's the version that everyone plays.  I know it was one of his
> first programs, so it's no doubt a lot larger than it has to be.  I got
> bored one night last year sitting in my dorm room, decided that 2k was far
> too large for a Nibbles game, and that I'd never written Nibbles, so I wrote
> one.  It was a little under 400 bytes.  I didn't go after optimizing it,
> just sat down and spent maybe a couple hours writing it.  This is a good
> example of what an experienced assembly coder can do.  I sent it to a few pe
> ople, and they obviously had too much free time on their hands, and I think
> they got it pretty close to 200 bytes (Jonah, got the final numbers on that?
> :)  

> Now, write an equivalent Nibbles game in C.  Just sit down and write it.
> I would expect it to be at least 5k or so.  

Fine.  Just tell me what exactly it has to do to be considered an
'equivalent'.  (Presumably your 200 byte version didn't include the same
title screen and high scoring, as the title and high score prompt text
alone would be about half the whole program's size).

Without knowing exactly what the requirements are, I won't predict what
size it will come out to, but 5K is certainly way too high, even for the
non-optimizing compilers we have now.




References: