C compiler for CP/M - there are a lot of them ...
What compiler should somebody use for programming CP/M applications ...
:... if you do not like or just do not want to use Turbo PASCAL 3.0 ?
Since 1973 (earliest versions of 'C') many C compilers were published, of course also for CP/M. Some of them surprisingly offers floating number support, some of them are at least K&R (Kernighan-Ritchie) standard compatible.
As a foreword: I am offering the following compiler just for educational, non profit purpose. If any of the former copyright holder send me a mail that this is unwanted, I will immediately delete the concerned file.
Here are the C compiler as complete packages:
Arnor C 1.00 (no math lib, originally for Amstrad CPCs)
ASCII C 1.1 (for MSX-DOS, which is almost CP/M compatible)
Aztec C 1.06d
BDS-C 1.6 & 2.0 (complete package for CP/M + ZCPR3)
Ecosoft C Compiler 3.43 (Z80; thanks to Rolf Harrmann !)
HiTech C 3.09 (Z80. locally mirrored) and a manual for it (locally mirrored)
HiSoft C 1.35
Mix C Compiler 2.0
Mix C Compiler 2.1 - see Bill Buckels web pages
Q/C Compiler V3.1a (Z80, Codeworks aka Quality Computer Systems)
SIL 1.5 from Digilog (with a subset of C, but with some other extensions)
Small C 2.1 (no float, partly K & R, source exists here)
Small C 2.7 (created by F. A. Scacchitti in Oct. 1986)
Small C 1.2 with floats (Z80, SIG/M 224)
Small C/Plus with floats and structs/unions (v1.0, 1988)
Another Small C variant named MESCC with code optimizations from Miguel I. García López can be found at his webpage , a local mirror is here (his web page is meanwhile again online, so take a look at his page, too)
Supersoft C 1.3 (not sure all needed files are included, plz feedback)
Whitesmith C 2.0 (seems complete)
Whitesmith C 2.1 (now also complete !)
Some additional info to interpreters for C or C-alike languages:
Tiny-C CP/M version (C alike interpreter for learning purposes)
"Small C" Interpreter 1.2 from Bob Brodt (real C)
Interesting for Small C enthusiasts can be this site, it contains also some historical background to Small-C and CP/M.
Dave Dunfield's "Micro C" which can produce also 8080 code, please visit also his great pages at http://www.dunfield.com/
The Amsterdam Compiler Kit can produce also executables for CP/M (8080 code).
New: sdcc - a retargettable, optimizing ANSI C-Compiler Suite (also for Z80)
Last but not least the z88dk (not only for the z88, it's a cross development tool for several platforms) should me mentioned here also.
Tests of compatibility:
I choosed an unusual source code, AES256 Encryption and Decryption from >Literatecode<, which is a quite complex program for CP/M-80.
I had to change the source code to K&R syntax (good old days), and had to shorten the subroutine names a bit (remember, there's a small limit for external symbol names, which is totally unusual for current C compiler !).
Also, I defined a pointer type for easier subroutine parameter declaration.
For convinience reasons, I did not take aes256.h for type definitions.
I was a bit surprised after I got it really working - at least with HiTech C.
All other C compiler hat their own, special problems, e.g. producing assembler or object code didn't work due to more restrictions for external symbols, or just errors when linking it together.
This is the output of the CP/M-80 AES256 demo program:
txt: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18
19 1A 1B 1C 1D 1E 1F
enc: 8E A2 B7 CA 51 67 45 BF EA FC 49 90 4B 49 60 89
tst: 8e a2 b7 ca 51 67 45 bf ea fc 49 90 4b 49 60 89
dec: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
And here is the source code with the readily compiled CP/M-80 executable:
(aes256.h is not included as a separate file, it's integrated within the source)
The CP/M-80 executable included is the above shown demo.com.
So it would be possible to write your own CP/M-80 encryption program (think about the execution speed... you have to be patient).