cc65 Library Overview

Ullrich von Bassewitz

2014-04-12
An overview over the runtime and C libraries that come with the cc65 compiler, including a discussion of the differences to the ISO standard.

1. Overview

2. ISO C compatible library

3. CPU specific stuff - 6502.h

4. Target specific stuff

5. Direct console I/O - conio.h

6. Using the joystick - joystick.h

7. Using a mouse - mouse.h

8. Copyright


1. Overview

This file contains a short overview of the libraries available for the cc65 C compiler. Please have a look at the function reference for a list function by function. Since the function reference is not complete (I'm working on that) it may happen that you don't find a specific function. In this case, have a look into the header files. All functions, that are not defined by the ISO C standard have a short comment in the headers, explaining their use.

2. ISO C compatible library

The C library contains a large subset of the ISO C library. Functions are usually missing in areas, where there is no support on typical 6502 systems. Wide character sets are an example for this.

I will not go into detail about the ISO functions. If a function is not mentioned here explicitly, expect it to be available and to behave as defined in the C standard.

Functions that are not available:

Functions not available on all supported systems:

Functions that are limited in any way:

In addition to these limitations, some more functions are limited if inlined versions are requested by using -Os:

3. CPU specific stuff - 6502.h

The header file 6502.h contains some functions that make only sense with the 6502 CPU. Examples are macros to insert more or less useful instructions into your C code, or a function to call arbitrary machine language subroutines, passing registers in and out.

4. Target specific stuff

For each supported system there's a header file that contains calls or defines specific for this system. So, when programming for the C64, include c64.h, for the C128, include c128.h and so on. To make the task for the Commodore systems easier, there is also a header file named cbm.h that will define stuff common for all CBM systems, and include the header file for the specific target system.

The header files contain

5. Direct console I/O - conio.h

The conio.h header file contains a large set of functions that do screen and keyboard I/O. The functions will write directly to the screen or poll the keyboard directly with no more help from the operating system than needed. This has some disadvantages, but on the other side it's fast and reasonably portable. conio implementations exist for the following targets:

The conio.h header file does also include the system specific header files which define constants for special characters and keys.

6. Using the joystick - joystick.h

For systems that have a joystick, joystick.h will define a subroutine to read the current value, including constants to evaluate the result of this function.

7. Using a mouse - mouse.h

Some target machines support a mouse. Mouse support is currently available for the following targets:

The available functions are declared in mouse.h.

8. Copyright

This C runtime library implementation for the cc65 compiler is (C) Copyright 1998-2002 Ullrich von Bassewitz. For usage of the binaries and/or sources the following conditions do apply:

This software is provided 'as-is', without any expressed or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.