I wrote this file on or about October 1997. Any mistakes or omissions are mine. Morgan Toal. ------------------------------------------------------------------------ Setting up the MICRO-C C Compiler: The current version of MICRO-C is v3.14. In order to set up MICRO-C, you will need to obtain the following files: * MC314PC1.ZIP (the Micro-C Compiler) * VALLINK.ZIP (VAL, a freeware linker) * ARROWASM.ZIP (a freeware x86 assembler). Use the following procedure to set up MICRO-C v3.14: 1. Download and unzip the above files into a directory C:\MICRO-C, C:\BIN\MC or whatever. 2. Set the environment variable MCDIR=C:\MICRO-C (or whatever you set it to above) 3. You might as well include the above in your AUTOEXEC.BAT while you're at it 4. Run MCSETUP.EXE. You are using: Arrowasm 2.0 and the Val Linker, and let it recompile CC.C. IMPORTANT!!! To compile a program with MICRO-C use the following switches: cc source.c -fop Additional Points of Interest: * If MCDIR is not set, MICRO-C will look for its libraries and object code in the directory C:\MC. * Set the TEMP environment variable to have MICRO-C store its temporary compile-time files there. * You may want to add MCDIR to your path, unless you do all your work in MCDIR. * Generally, programs are compiled using the command: cc source.c -fop Setup notes for the more technically minded: The switches "fop" are necessary for the following reasons: * Switch "f" performs "folding" on the string table, so that string literals are stored only once in memory. Not a big deal, but can result in more efficient code. If you're enough of a C guru to know what this means, then you'll know when not to use it. * Switch "o" invokes the optimizer. Again, optional, but recommended so we can get some nicely optimized ASM output from the compiler. * Switch "p" invokes MCP, the C Pre-Processor. Without it, you'll get silly errors like: "Can't find stdio.h". This is what you need, since it is the pre-processor which interprets things like "#include" directives. MC works a little differently from other C compilers. There are several programs involved in compilation. MCP preprocesses the C source file, care of include statements and such. MCC is the compiler itself, it reads a C source code file, translates it into ASM, and writes this to an output file. Next is MCO, the optimizer, which performs some magic on the Asm file to make it nice and efficient. The Assembler transforms the Asm file into object code, which is transformed into an executable by the linker. The key here is that the assembler and linker are external programs, and must be supplied by the user. Hence the reliance on the free Arrowsoft Assembler, and Val Linker. Theoretically, a program could be compiled entirely by invoking each program separately, in a fashion similar to this for a tiny model program: mcp source.c source.cp l=c:\mc mcc source.cp source.co l=c:\mc mco source.co source.asm asm /s /ml source.asm source.obj val /nci /com c:\mc\pc86rl_t.obj source.obj, source.com, NUL, c:\mc\mclib Of course, this is a complete nuisance so CC.COM is created to do this for you. CC.C can be set up and re-compiled as a convenience, depending on what assembler and linker you are using. You can do this by hand by editing CC.C, though it does come out of the box set up to run Arrowsoft Assembler 2.0, and the Val Linker. Look in the comment headers of CC.C for switch combinations known to work with various assemblers and linkers such as MASM and Watcom. Here are the relevant sections of CC.C if you would like to edit these yourself. The section that invokes the assembler begins at line158: /* Assemble into object module */ if(oasm) { sprintf(ofile,"%s%s.OBJ", link ? temp : "", fnptr); message("Assemble... "); sprintf(tail,"/s/ml %s,%s;", ifile, ofile); docmd("ASM.EXE"); The sprintf statement contains the switches necessary for the assembler of your choice, and the docmd function string argument is the file name of the assembler. Immediately following is the section for the linker at line 168: /* Link into executable program */ if(link) { message(tiny ? "Link TINY...\n" : "Link SMALL...\n"); sprintf(ofile,"%s.%s", fnptr, tiny ? "COM" : "EXE"); sprintf(tail,"/NCI%s %s\\PC86RL_%c %s,%s,NUL,%s\\MCLIB;", tiny ? "/COM" : "", mcdir, tiny ? 'T' : 'S', ifile, ofile, mcdir); docmd("VAL.EXE"); erase(ifile); } } At this point, recompile CC.C via the command: cc cc.c -fop