Atari eight-bit

C/65 & C alternatives

C/65 takes the lead, alongside Tiny C, Deep Blue C, and cc65.

← All programming languages

C/65: C in a small machine

C/65, written by Sam Dillon and John Lowry of LightSpeed Software and published by OSS, is a compact C subset for the eight-bit Atari. It compiles source into MAC/65 assembly, which must then be assembled with the required runtime support.

It supports characters, integers, pointers, one-dimensional arrays, functions, conditionals, and while loops. Its original dialect omits floating point, structures, and for loops. Blocks use $( and $) in place of braces.

Example: reach an Atari color register

This C/65 program writes 68 ($44), a reddish color, to COLOR2, the OS shadow register at decimal address 710. Run it from an ordinary text screen to see the background change.

Original OSS C/65 dialect — COLOR.C
main()
$(
  char *background;

  background = 710;
  *background = 68;
  return 0;
$)
Expected result: the text-screen background becomes reddishIllustrative preview

The background changes from the usual blue to a reddish color. Existing text is preserved and the routine prints nothing. This preview uses an empty text screen; the exact shade varies with the Atari palette and display.

Save the listing as ATASCII source using an Atari text editor. Compile it with C/65, then assemble its output with MAC/65 and the startup/runtime files supplied with C/65. Follow the package’s build procedure to produce a DOS-loadable program.

Reference: OSS C/65 manual — text transcription.

Other C alternatives for Atari eight-bit

  • Tiny C (OSS tiny-c): an Atari implementation of the tiny-c interpreter from tiny-C Associates. It provides an interactive C-like language subset. This historical interpreter is distinct from the much later TinyCC/TCC compiler.
  • Deep Blue C: an APX Small-C-derived system. It compiles to intermediate code executed by a runtime, offering another period route to C on an Atari.
  • cc65: a cross-development toolchain with Atari targets, a C compiler, assembler, linker, and runtime libraries. You build on a host computer and run the resulting program on an Atari or emulator.

Reference: OSS tiny-c manual (PDF).

Reference: APX Deep Blue C documentation.

A separate cc65 example

This example uses cc65’s console library and standard braces. Save it as hello.c on the host computer. It clears the Atari screen, prints a greeting, and waits for a key.

cc65 — hello.c for the Atari target
#include <conio.h>

int main(void)
{
    clrscr();
    cputs("HELLO FROM CC65 ON ATARI!");
    cgetc();
    return 0;
}
Expected result: a greeting while waiting for a keyIllustrative preview
HELLO FROM CC65 ON ATARI!

The console is cleared, the greeting is printed, and cgetc waits for a key. Pressing a key ends the program. The preview assumes the standard blue text-screen palette; the program does not set the colors.

Host build command — cc65 installed
cl65 -t atari -O -o hello.xex hello.c
Expected result: hello.xex is createdIllustrative preview
hello.xexAtari executable built on the host computer

With cc65 installed and hello.c in the working directory, a successful build creates hello.xex. The compiler normally needs no success message. Load the executable on the Atari to see the greeting above; the build command itself does not display that greeting.

Load hello.xex through Atari DOS or an emulator’s executable loader. Disable Atari BASIC for the default cc65 Atari memory layout. C/65 and cc65 have different source conventions and build tools; use each example with its named compiler.

Reference: cc65 Atari target documentation.