#####################################################################
#                     CL386.DOC (English)                           # 
#####################################################################

0. Introduction.
     0.1 CL386 - what is it ?
1. How CL386 works?
     1.1 What is need for CL386?
     1.1 Algorithm of CL386.
     1.2 Remarks.
     1.3 Errorlevels.
2. Option of CL386.
A. Appendix.
     A.0 Tips for using TASM v4.1 for DOS !!!
     A.1 Warranty.
     A.2 Copyright.
     A.3 How to contact to the author?

#####################################################################


0. Introduction.
**************** 

0.1 CL386 - what is it ?

CL386 is shell for compile, assemble and link. 
It written special for CC386.EXE - David C compiler !
I compile it with :

    Borland C/C++ v3.1 
    Watcom C/C++ v10.6 
    Watcom 386 C/C++ v10.6 .
    
Analogs CL386 is :

    BCC.EXE (Borland C/C++)
    WCL.EXE (Watcom C/C++) 
    CL.EXE  (MS C/C++)
    SC.EXE  (Symantec C/C++) etc


1. How CL386 works?
******************* 

1.1 What is need for CL386?

For CL386 are necessary next files: 
    CC386.EXE - need !!!
    TASM.EXE, NASM.EXE, MASM.EXE, ML.EXE, LASM.EXE or WASM.EXE
    TLINK.EXE, WLINK.EXE, VALX.EXE  or LINK.EXE ( MS LINK don't work correct )
Check (or add) path to this programs in environment variable PATH !

1.1 Algorithm of CL386.

1) Parameters get.  The parameters are <file> or <option>.
   Parameters you can set in :
    - configuration file CL386.CFG. If you rename CL386.EXE to
      XXX.EXE, name of config file will XXX.CFG. CL386.CFG search
      in current directory, and if NOT found - in the directory, 
      when CL386.EXE start.
    - variable of environment CL386. For example :
      SET CL386=-A -$L=WLINK
    - in command line. Files can with '?' and '*'.
2) For compile, assemble & link generate file TEMP.$$$ in current
   directory. Them called CC386, assembler and linker.
3) If found option /? (/h or /H ) or no file in parameters -
   help output.

1.2 Remark.

- don't use included response files !!!
- use option /K for view response file 'TEMP.$$$';
- use option /k for view .ASM & .OBJ files;
- use option /a for ONLY assemble and /c for ONLY compile;
- use option /v for make the debug version of the program (ONLY with PMODE);
- change DOS extender -$D=name option;
- don't add option /? (/h, /H) in CL386.CFG or CL386 environ var;
- generate .OBJ and .ASM files put to current directory;
- if you want see response file for compile(assemble), use -c -k ( -a -k );
- name of listing file CC386 and TASM equ, use option -a or -c for see it;
- CL386 used about 50 Kb memory, for more memory use MK386.EXE;
- you can add path to libs, /Lpath1;path2; , BUT only FIRST path ( path1 )
  used for search CLDOS.LIB & C0DOS.OBJ !

1.3 Errorlevels.

Program return next exitcode :

          == 0  - Ok
          != 0  - Error !
        
Also return errorlevel's CC386 etc !

2. Option CL386.
***************

/i      - produce the file after the preprocessor,
    there can be /i+ or /i-, /i that, as /i+;
/l      - produce .LST the file, 
    there can be /l+ or /l-, /l that,as /l+;
/e      - produce .ERR the file, 
    there can be /e+ or /e-, /e that,as /e+;
/A      - enable ANSI compatibility, 
    there can be /A+ or /A-, /A that, as /A+;
/w-xxx  - disable warnings, look documentation on CC386.EXE;
/Cxxx   - option for generation of the code,
    look documentation on CC386.EXE;
/Dxxx   - define symbol for the preprocessor,
    look documentation on CC386.EXE;
/Enn    - define max count of errors for CC386;
/Ipath  - set path to included files;
/Oxxx   - option for optimization, look documentation on CC386.EXE;
@name   - define the file with parameters for response;
/K      - not delete files TEMP.$$$;
    there can be /K+ or /K-, /K that, as /K+;
/Lxxx   - set path to files .LIB and .OBJ;
/a      - generate only .ASM files;
/c      - generate only .OBJ files;
/v      - full the debugging information and debug version;
/m      - generate .MAP the file;
/n      - not link files by default;
/k      - not delete files *.ASM & *.OBJ;
    there can be /k+ or /k-, /k that, as /k+;
/$C=compiler  - set compiler, may be ONLY CC386
/$A=assembler - set assembler, may be TASM, NASM, MASM, WASM or LASM
/$L=assembler - set linker, may be TLINK, VALX, LINK or WLINK
/$D=assembler - set DOS extender, may be PMODE, PMODEW, DOS4G, DOS32A, WDOSX,
    ZRDX or CAUSEWAY
/e=name  - set name to .EXE file
/?,/h,/H - help.


A. Appendix
***********

A.1 MASM v5.1 know only .386p .387 instruction, but no .486p :(

A.2 LINK.EXE - I tested OPTLINK from Symantec C/C++ v7.2,
    LINK.EXE from MASM is suxx !

A.3 Tips for using TASM v4.1 for DOS !!!

Don't use TASM v4.1 !!! For example compile with TASM v4.1 :

============================================= 1.ASM
        .model tiny
        .code
        .386
start:
        rept 1024
        local hi
        jc hi
hi:
        endm
        end start
=============================================

        tasm /m2 1.ASM
        tlink /3/c/t 1.OBJ

and see in disassembler code in 1.COM :(
PS: Now I use TASM32 v5.2, where this bug correct (from C++ Builder v4.0).

A.4 Warranty.

The program CL386 is FREEWARE and is delivered with source codes.  The
author does not  bear ANY  responsibility for damage  brought by  this
program. You use this program at own risk!!!

A.5 Copyright.

(c) CL386 Kirill Joss
(c) CC386 David Lindauer (camille@bluegrass.net)

A.6 How to contact to the author?

Your notes, warnings, beer etc send on addresses:

Kirill Joss

 E-mail: jossik@gmail.com
FidoNet: 2:463/218.12
     AKA 2:463/59.29
