-

UTILITIES PUBLIC DOCUMENT CC

From HI-TECH C for CP/M Fan WIKI(EN)
Revision as of 09:31, 25 August 2017 by Kumokosi (talk | contribs)
Jump to: navigation, search

CC_en

CC - improved control program for HiTech-C and msx-dos2

About

The program cc.com executes the passes to compile a C-program with HiTech-C automatically. The c.com from Hi-Tech does the same, but cc.com has the following advantages:

  • cc.com does not use a batchfile and stops if a pass has failed
  • cc.com sets the append-variable so that your source can be in a different directory than the compiler.

How to install

First you need to install MSX-DOS2. Then get the HI-TECH Z80 CP/M C Compiler from ftp://ftp.funet.fi/pub/msx/programming/c/hitech-?.pma and unpack with pmext. HiTech has been so kind to grant permission to use their C-compiler free of charge, see also http://www.htsoft.com/products/CPM.php .

Unpack cc.lzh to the directory that contains the C-compiler.

You should get the following files:

cc.com - replacement for c.com libdos2.lib - IO-library using msx-dos2, source is in libdos.lzh vsh1.o ) variants of crt.o for vsh2.o ) - programs executing other programs vsh3.o ) see vsh.txt for details vsh.txt - text about vsh?.o redir.obj - used in a work-around for -U bug in link.com cc.txt - this text cc.c - source for cc.com vshrt.as - source for vsh?.o redir.as - source for redir.obj makefile pack.bat

Using cc

You can invoke CC with:

cc <options> <files>

The following options are recognised:

-C  
keep the object file; do not link
-CR[file]  
produce cross refenerence file
-O  
optimise assembly code generated by CGEN with OPTIM

,-O<file>  : put output in <file>

-I<dir>  
passed to CPP as extra search-path for include files, only works for drives, the directory where cc.com is stored is always searched via APPEND environment variable
-V  
verbose mode, print out commands of subprocesses
-F<file>  
write symbol file
-U<sym>  
undefine symbol for CPP
-D<sym>[=<def>]
define symbol for CPP
-S  
keep assembly file; do not assemble or link
-X  
strip local symbols, also passed to LINK
-P<pspec>  
define order of psect (not normally needed)
-M<file>  
write map file
-W<n>  
width for map file
-l<xx>  
pass lib<xx>.lib to LINK, order is important

All options are case insensitive.

Files

Files with no extension get the extension ".c". Files with extension ".c" are treated as C language sourcefiles. Files with extension ".as" are treated as assembly assembly language source files. All other files are passed directly to the linker.

Environment item

VSHTOP
If set, VSHTOP specifies the first page of video memory that will not be used or probed by CC. Pages 0..7 are ordinary video memory, pages 8..11 are the extended video memory. Legal values are 2..12, default is 12. Other values are silently ignored. If VSHTOP is 2, CC will not work. You can use this to protect data in higher pages. Some emulators may need vshtop=8.

Notes

CC.COM uses video memory for temporary storage, so it will corrupt the contents of a ramdisk that also uses video memory. The screen will flash between the compilation steps, this is to improve reliability of reading/writing from/to video memory and should not be cause for concern.

HiTech-C cannot handle large C-files. This is not a real problem; just split your program in to C-files of about 6 or 7 kB. The MAKE program by Arnold metselaar can be used with CC.com to compile only those modules that need to be recompiled.

See also:

  • The documantation that comes with HiTech-C
  • Documentation about the C language in general
  • vsh.txt

Authors

CC.C is based on work by HiTech and Pierre Gielen. Arnold Metselaar added the code to execute a subprogram and then continue the main program.