ACE C
- Medium
- Disk
- Publisher
- Distributed through public-domain libraries (e.g. Bellcom, Page 6)
- Type
- Language
- Category
- Small-C compiler and linker (P-code), Deep Blue C successor
- Developer
- Ralph E. Walden (based on Deep Blue C by John Palevich)
- Language
- 6502 machine language (run-time engine) and C
- Requirements
- 48K Atari 400/800/XL/XE, disk drive, no cartridges; Atari DOS 2 or OS/A+-style DOS; any text editor that saves ATASCII files
- Tags
- c, compiler, p-code, small-c, deep-blue-c, public-domain, disk
Overview
ACE C is an improved version of Deep Blue C, the C compiler John Palevich wrote for the Atari Program Exchange. Its title screen credits both men: "The ACEC C Compiler by John Palevich and Ralph Walden". Ralph E. Walden of Eugene, Oregon reworked the compiler, linker and run-time so that, by his account, ACE C compiles 10 to 15 times faster (especially with #defines), links 4 to 5 times faster, and produces programs that run about twice as fast. It spread as free software through user-group and public-domain libraries, including Bellcom and the Page 6 library, and was later reposted online in ARC form.
Like Deep Blue C, ACE C implements a subset of C taken mainly from Ron Cain's public-domain Small-C. Walden's documentation tells newcomers to learn the language from Kernighan and Ritchie, and notes that most ACE C programs will compile unchanged on other C systems.
The language
Supported:
char,int, pointers andextern, plus single-dimensional arrays- the usual unary and binary operators, including
?:, the comma operator and compound assignments such as+= asm,break,case,continue,default,do,else,for,if,return,switchandwhile#defineand#include- decimal, hex, octal and backslash constants
Not supported: structures and unions, multidimensional arrays and pointer arrays, functions returning anything but int, sizeof and type casts. Characters are unsigned (0–255).
Braces are written as $( and $) and the tilde as $-. Backslash codes cover Atari screen control: \f clears the screen, \u, \d, \l and \r move the cursor, and \g rings the bell. There are some quirks worth knowing:
- Comments start at
/*and run to the end of the line. They cannot be embedded mid-line or span lines. - Tabs are not whitespace (a CFORMAT utility converts them), and source lines can carry BASIC-style line numbers.
- Constants are folded at compile time strictly right to left with no precedence when written without spaces:
num=5*6+1;gives 35. Add a space or parentheses to avoid this. - The last
caseordefaultin aswitchmust end withbreak,continueorreturn. - Floating point is available only through library calls on six-byte
chararrays, for exampleatof(a,"3.14"),fadd(a,b,c),fmul,fdiv,log,clog,exp, andftoi, which rounds rather than truncates.
Compile, link, run
- Write
PROG.Cin any ATASCII editor. - Load
ACEC.COMfrom DOS (or just typeACECunder OS/A+). The screen blanks while it compiles toPROG.CCC. On an error it stops and shows the offending line; otherwise it lists the functions found. A single.CCCfile can be at most about 9K, so large programs should be split up. - Load
LINK.COMand give a.LNKfile listing the modules, for examplePROG.CCC,ACECIO.CCCand finallyENGINE.OBJorENGLOAD.OBJ. If no link file exists, the linker creates that default list itself. - Run the resulting
PROG.COMfrom DOS.
ACE C is really a P-code system. ENGINE.OBJ (about 4K, loaded at $2C00) holds the interpreter and most of the I/O library, rewritten in assembly language. Linking ENGLOAD.OBJ instead (about 130 bytes) makes the program fetch the engine from D1: at run time. When a program works, FASTC rewrites the .CCC pseudo-code with 27 new combined instructions, typically saving another 20–30% in run time. Machine code is reached through asm functions or usr(addr,...): arguments sit on a stack pointed to by $C6, their count is in $BF, and zero-page $80–$B5 and $C8–$CF are free.
Walden achieved some of the speed by dropping safety checks. There are no version checks, so linking ACE C code with Deep Blue C's DBC.OBJ crashes the machine. There is no check for the stack running into screen memory and no division-by-zero check. Deep Blue C assembly routines must also be rewritten, because asm works differently.
Using it today
ACE C's compact P-code made it practical for real projects. Its users included the authors of a mid-1980s BBS who moved from Deep Blue C to ACE C. Decades later, one of them noted that the ACE C version fitted on an unmodified 800XL or 65XE, while a cc65 port of the same code needed 128K. Disk images circulate as public-domain software. Boot DOS 2.x in Altirra or atari800 with BASIC off, keep ENGINE.OBJ on D1:, and follow the README files on the disk. For new C work, cc65 is the modern choice, but ACE C remains the best way to experience native C development on the Atari.
Credits
- Picture: The ACE C compiler's start-up prompt. — Screenshot from the Internet Archive item 'Miscellaneous PD Disks: Ace C Compiler' (a8b_misc_acec) (Screenshot of public-domain/freely distributed software)
- ACE C documentation files (READTHIS.TXT, BLUE.TXT, FASTC.TXT, FLOAT.TXT, ASM.TXT, 00README)
- ACE C — BLUE.TXT (differences from Deep Blue C)
- Internet Archive — Miscellaneous PD Disks: Ace C Compiler (a8b_misc_acec), disk image and screenshot — Screenshot from the Internet Archive item 'Miscellaneous PD Disks: Ace C Compiler' (a8b_misc_acec) (Screenshot of public-domain/freely distributed software)
- Gury — ACE C Compiler (BELLCOM PD Library, Page 6; John Palevich, Ralph E. Walden) — Gury (Atari 8-bit Forever portal)
- AtariAge forum — Deep Blue C / ACE C BBS ported to cc65 (size comparison) — AtariAge forum members
- AtariAge forum — BBS originally in Deep Blue C, then ACE C, moved to cc65 — AtariAge forum members
