Using HI TECH C - RC2014Z80/RC2014 GitHub Wiki
HI-TECH Z80 C is a C compiler that runs under CP/M on a Z80, a Z180, or a Z280. The current release is V3.09-21. This page covers use on the RC2014. The repository README holds the change history.
The compiler runs under CP/M on the RC2014. It is not a host cross compiler. It does not run on an 8085. The same .COM files also run under RunCPM, SIMH AltairZ80, or ZXCC.
The compiler is free for any use, private or commercial, strictly as-is. Copyright stays with HI-TECH Software. There is no warranty. See the licence.
An MS-DOS cross compiler (V4.11) is a separate repository: HI-TECH-Z80-C-Cross-Compiler.
Install on CP/M
- Download the binary library: https://raw.githubusercontent.com/agn453/HI-TECH-Z80-C/master/htc-bin.lbr
- Copy that file to a CP/M drive.
- Extract it with a
.LBRtool. The README names NULU.COM. - Copy every extracted file to drive A:, user area 0.
- Copy
C309-21.COMtoC.COMon that drive. - Set the SYS attribute on those files so other user areas can find them.
The archive also contains C309.COM. That file is the original compiler. Use C309-21.COM, which is the current compiler.
Put the tools on A:, user 0. The compiler uses 0:A: when P1.COM is not on the current drive. A normal build calls CPP.COM, P1.COM, CGEN.COM, ZAS.COM, LINQ.COM, and $EXEC.COM. It links CRTCPM.OBJ and LIBC.LIB. -O also runs OPTIM.COM. Keep the .H headers with the tools.
LINQ.COM is the HI-TECH linker. The original name was LINK.COM. That name clashes with the Digital Research linker. The 1989 manual still says LINK. This compiler calls LINQ.
LIBF.LIB is the single-precision float library. float and double are the same width. LIB9511.LIB is the APU Module library.
A Z280 build is a separate archive: https://raw.githubusercontent.com/agn453/HI-TECH-Z80-C/master/z280bin.lbr The RC2014 Z80 path does not need it.
Compile
Log on to the drive that holds the source. The program loads at 0100h. The compiler writes PROG.COM when the source is PROG.C.
A>C PROG.C
-O runs the peephole optimiser for a smaller program. -OF optimises for speed. -V prints each step. C -H prints the OPTIONS file.
A>C -O -V PROG.C
LIBC.LIB has no float routines. -LF searches LIBF.LIB.
A>C -O -LF PROG.C
-C writes the object file and does not link. -S writes assembler and does not assemble. The compiler writes temporary files named $CTMP1.$$$ and similar, then deletes them.
-R is accepted and ignored. Wildcard expansion is built in. -N selects the small start-up, NRTCPM.OBJ, which does less argument work.
APU Module
On an RC2014 with the APU Module, search LIB9511.LIB before LIBF.LIB. Include am9511.h. That header includes math.h and adds pi, log2, exp2, and exp10.
A>C -O -L9511 -LF PROG.C
The data port is 42h. The command port is 43h. Overflow, underflow, divide by zero, and a domain error return 0. Details are in am9511/README.TXT.
bdos()
bdos() returns the full 16-bit value from HL. It does not sign-extend an 8-bit result. Test the low byte when the call documents an 8-bit code.
if ((bdos(fn, arg) & 0xFF) == 0xFF)
A low byte of 0xFF is not an error for every function. Read that BDOS call before you test the result. The prototype is short bdos(short func, ...).
Documentation
Report problems on the GitHub issues list, or by email to [email protected].
See also Using CP/M and Using Z88DK. Z88DK is the host cross compiler. HI-TECH C is the compiler that runs under CP/M.
Page accuracy
Checked against HI-TECH Z80 C V3.09-21 on 12 Nov 2026 (htc-bin.lbr, cpm/C309-21.C, dist/OPTIONS, and am9511/README.TXT).