Re: [cc65] Space efficiency?

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-05-17 17:59:23


Hi!

On Fri, May 17, 2002 at 03:37:32PM +0200, Stephan Lesch wrote:
> What do you think, can I assume that the size of a compiled C program
> (modulo silly programming :)) will be about 1 to 1.5 times that of a
> hand-written assembly program for the same purpose, plus ca 3 K for the
> library?

Ths depends a lot on teh program itself and your coding style, but reaching
the same size as a hand optimized assembler program is unreachable (at least I
have never seen this), and reaching a factor of 1.5 would be quite a good
ratio.

But may suggestion would be to develop in C for some other reasons: You are a
lot faster writing C code, and in many situations you are even faster if you
write a first version in C and rewrite it in assembler later. The reason for
this is that a software developing process often requires several rewrites of
a modules, and each version needs some debugging. When this happens you gain
more by writing in a high level language than you loose by the final rewrite
in assembler.

Using this technique, the final version of you program will probably be a mix
of C and assembler, and for this mix, the ratio of 1.5 is achievable.

> Generally, those who already have realized larger projects under cc65,
> particularly on the c64 and including interfaces to binary parts like musics
> and IRQ loaders, could you tell how well it went, and what experiences
> you made? Does it actually become easier to write a program like a game
> in C, compared to assembly, and can you write the major parts in C, or
> do you end up with a frame program in C, and the rest mostly written in
> assembly?

This depends on your program. For example, I would not write any interrupt
handlers in C, mostly because of the overhead of saving and restoring the
registers and the zero page locations used by the compiler. So if your
interrupt handler is large, you will have a lot of code where assembler is the
better solution.

But as mentioned above, IMHO you don't loose anything if you start with C.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
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 : 2002-05-17 17:59:31 CEST