Welcome, Guest. Please login or register.

Author Topic: CC65: A complete C Compiler for 65C02 - 8bit CPUs  (Read 2271 times)


0 Members and 1 Guest are viewing this topic.

Offline RaffaeleTopic starter

  • Full Member
  • ***
  • Join Date: May 2006
  • Posts: 234
    • Show only replies by Raffaele
CC65: A complete C Compiler for 65C02 - 8bit CPUs
« on: April 22, 2007, 10:37:53 PM »
CC65 is a complete cross development package for 65(C)02 systems, including a powerful macro assembler, a C compiler, linker, librarian and several other tools.

It is based on a C compiler that was originally adapted for the Atari 8bit computers by John R. Dunning. The original C compiler is a Small C descendant but has several extensions, and some of the limits of the original Small C compiler are gone. The original copyright allows free redistribution including sources, even if it would not qualify as Open Source Software according to the Open Source Definition.

The original Atari compiler is available from http://www.umich.edu/~archive/atari/8bit/Languages/Cc65/. The complete package consists of the compiler, an assembler, a librarian, a linker, and a C library for the Atari. There are some packages on the net that claim to be adapted as a crosscompiler for DOS or Unix, but was not able to get them working correctly.

Because I wanted a C compiler for my CBM machines, I took the Atari compiler and started a rewrite. Until today, I have rewritten large parts of the compiler, all of the library, completely replaced the assembler, the linker and the librarian, and added a frontend to simplify use. All changes have been done with portability in mind, so porting to new 6502 architectures should be quite easy.


The compiler is almost ISO C compatible, so you should be able to translate many sources from other systems. Here is a list of the differences:
    The compiler allows single line comments that start with //. This feature is disabled in strict ANSI mode.    
    The compiler allows unnamed parameters in parameter lists. The compiler will not issue warnings about unused parameters that don't have a name. This feature is disabled in strict ANSI mode.    
    The compiler has some additional keywords that are needed for special features. In strict ANSI mode, the additional keywords start with two underscores.    
- The volatile modifier has no effect.    
- The datatypes float and double are not available.    
- The compiler does not support bit fields.    
- C functions may not return structs and structs may not be passed as parameters by value. Struct assignment is possible.    
- There are some limitation on the size of local variables. Not all operations are available if the size of local variables exceeds 256 bytes.    
- Part of the C library is available only with fastcall calling conventions (see below). This means, that you may not mix pointers to those functions with pointers to user written functions.    

There may be other target system dependent limitations. One example is file I/O, which is not implemented on all platforms. This is no technical limitation (as with the stuff mentioned above) but does just mean that no one cared enough to write the actual code.

cc65 home site here
Que viva el Amiga!
Long Life the Amiga!
Vive l\'Amiga!
Viva Amiga!

Offline redrumloa

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: CC65: A complete C Compiler for 65C02 - 8bit CPUs
« Reply #1 on: April 23, 2007, 03:10:12 AM »
Boy this sure is getting sweet :-) I hope to have the free time to play with this soon.
Someone has to state the obvious and that someone is me!