Re: C-compiler

From: MagerValp (MagerValp_at_Goth.Org)
Date: 1998-10-24 00:56:18

>>>>> "Ruud" == Ruud Baltissen <> writes:

Ruud> Hallo C-men,

*ahem* Now that's a ruud joke :)

Ruud> A Belgium friend of mine, Eduard Hontele, is interested in
Ruud> programming a so called "Domotica"-system with his C64. This
Ruud> system is meant to steer lights, heaters, sun-blinds and more of
Ruud> these things. The modules contain a 8051 and communicate by the
Ruud> main system using RS232, 300 Baud. He asked me if he should use
Ruud> BASIC, ML or C. My experience with BASIC compilers is that they
Ruud> make larger binaries then the original source.

A lot of compilers do that.

Ruud> So my 3 main questions are: 1) What size do C-compilers make?

Depends. With Ullrich von Bassewitz' CC65 this C code:

#include <stdio.h>

int main (void)
    printf ("Hello world");
    return 0;

produces this assembler code:

qstore(42)> more hw.m65
        jsr     enterfun0
        ldax    #L0001+0
        jsr     pushax
        ldy     #$02
        jsr     _printf
        jmp     exitfun00
        .byte   $C8,$45,$4C,$4C,$4F,$20,$57,$4F,$52,$4C,$44,$00
        .globl  _main
        .globl  _printf

Which is pretty compact. The problem is that the runtime library is
about 12.5 KB so the linked and runnable program ends up being over 50
blocks. The good news is that the library source is included with the
compiler so it's fairly easy to edit out the parts you don't need. My
guess would be that the library could be stripped to about 2-3K if you
just need the basics.

Ruud> 2) Who can give me some advise what (Public Domain) C-compiler
Ruud> to use?

CC65. Ullrich is on this list I think so he should be able to give you
the URL. There's some other C compiler that a guy posted about on
comp.sys.cbm, but I think he was developing for the VIC-20. Please
note that both of these are cross-compilers, no C64/128 ports exist
(yet). There's a freeware small C implementation floating around, but
I think that's it for the C64.

Ruud> 3) I'm not good in C compared to my knowledge of C64-BASIC. I
Ruud> don't know Eduards ML-knowledge and I never programmed the
Ruud> RS232-interface in ML so I would advise him to start in BASIC.

Basic is the easiest way to go, but but it might not be fast enough.

Ruud> Please some advise especially regarding the RS232-part.

Since it's just 300 baud the kernal routines will work just fine, and
you shouldn't have any problems with CC65. You might have to write
some C wrappers to call the kernal routines, but that's pretty easy.
  Hope this helps.

    ___          .     .  .         .       . +  .         .      o   
  _|___|_   +   .  +     .     +         .   .     +    + Per Olofsson
    o-o    .      .     .   o         +             MagerValp@Goth.Org
     -       +            +    .
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail

Archive generated by hypermail 2.1.1.