FloppySoftware logo

MESCC / Mike's Enhanced Small C Compiler

MESCC is my project of a C compiler for the CP/M operating system and the Z80 cpu.

MESCC image

Overview

As it is written in MESCC, it can compile itself.

It is based on the version 1.7 (Oct. 1985) of Small C by Ron Cain, Mike Bernson's and John Hill.

MESCC outputs Z80 assembler code that can be assembled with ZSM/Z80ASMUK (supplied with MESCC), in order to build an HEX file.

The HEX file can be converted to an executable COM file with LOAD (supplied with CP/M 2), HEXCOM (supplied with CP/M 3) or HEXTOCOM (supplied with MESCC).

Also is supplied CCOPT, a peephole optimizer.

I use MESCC for nearly all my software projects.

Usage

Usage: cc name[.typ] [options]

-PRG          Out normal file ---- Type=ZSM
-LIB          Out library file --- Type=LIB
-ASM          Out assembler file - Type=ZSM
-O:name[.typ] File name for output
-Cflag        C source as comments?
-Eflag        Pause on errors?
-Sflag        Default type for char is signed?
-E:number     Max. number of errors to abort
-L:letnum     Letter and start number for labels
-S:size       Mininum stack size

Default options are: (flag is + for YES, - for NO)

        -PRG -C- -E+ -S+ -E:50 -L:A0 -S:512
        Input file type is .c
        Output file name is the same as input

The compiler will show you a help text if it is executed without arguments.

Libraries

MESCC is supplied with a bunch of libraries:

  • mescc.h : Runtime. All programs must include this file first.
  • alloc.h : Memory allocation functions.
  • atexit.h : Code for atexit() function.
  • bsearch.h : Binary search function.
  • clock.h : Date & time functions for CP/M Plus.
  • conio.h : Console I/O functions.
  • cpm.h : CP/M specific functions.
  • ctype.h : Test and character conversion functions.
  • fileio.h : Stream file I/O functions.
  • fprintf.h : Formatted output to file.
  • mem.h : Memory functions.
  • printf.h : Formatted output to console.
  • qsort.h : Sort function.
  • rand.h : Pseudo-random number generation.
  • setjmp.h : Non-local jumps.
  • sprintf.h : Formatted output to memory.
  • string.h : String functions.
  • xprintf.h : Support library for printf, fprintf and sprintf.
  • z80.h : Z80 specific functions.