xyzzy

pcdosasm.zip archive

0  Contents of pcdosasm.zip (104 KB):

1     pcdosasm.html           this file
2     2&1.asm, 2&1.exe        STDERR to STDOUT redirection for PC DOS
3     TRY.asm, TRY.exe        Displays non-zero errorlevel for PC DOS
4     TEE.sid, TEE.com        Redirects STDOUT to file and STDERR
5     XDEL.sid, XDEL.com      Deletes complete subdirectory trees
6     CONTILD2.asm            Allows to bypass ANSI.SYS with CTTY COÑ
      CONTILDE.sys + asm      COÑ driver + source (new version)
7     SMALLEST.asm            The smallest possible PC DOS 5 RAM disk
      SMALLEST.sys            SMALLEST driver (unmodified recreation)
8     EAT.asm                 Eats DOS memory for tests in a subshell
9     ENVSIZE.asm             Determines free / used environment size
      ENVSIZE.exe + was       ENVSIZE exe + WASM source
A     MEMDRIVE.asm            Access on RAM and floppy images as files
      DISK1440.sys            1440 KB variant (copy of MEMDRIVE.sys)
      DISK2880.sys            2880 KB variant
B     DOS622.asm, DOS622.com  Start command pretending to be DOS 6.22
C     WINDUMB.asm             Experimental UMB A200...B7FF for NT VDM
      WINDUMB.sys             Abuse video memory A200...B7FF as UMB
      NOP.com                 Bonus program for DOS DEBUG fans
D     CSTART_T.asm            Modified Watcom C/C++ DOS 16-bit startup
      CSTART_T.wmk            WATCOM C/C++ 12.0 CSTART.OBJ makefile

1  Overview

      Manual : http://purl.net/xyzzy/dos/pcdosasm.htm
      Archive: http://purl.net/xyzzy/dos/pcdosasm.zip

Local date   Size  Filename      MD5sum -b (for binaries)
1991-09-15  13884  2&1.asm
1991-09-15   2552  2&1.exe       4f2c94d84811ffb1b401fe59e601fd64
1991-09-15  28468  TRY.asm
1991-09-15   4945  TRY.exe       452e0af33faa82fc0ff919361d35b066
1990-03-22   5236  TEE.sid
1990-03-22    256  TEE.com       c589a38eddd8791443779ff9fff61e23
1990-03-20   8849  XDEL.sid
1990-03-20    768  XDEL.com      24a226b9a1da3da7851bf2972d50fb45
2000-10-22  16832  CONTILD2.asm
2010-07-03  34783  CONTILDE.asm
2010-07-03   1023  CONTILDE.sys  dad6d9dc5cc89175d601d881751099e4
1991-09-18  23284  SMALLEST.asm
2009-01-02   1076  SMALLEST.sys  36db19cfba77b12229e48a8d9c905f3d
1991-09-15  17349  EAT.asm
1992-05-13   8606  ENVSIZE.asm
2009-01-18   8664  ENVSIZE.was
2009-01-18    614  ENVSIZE.exe   9a3bfd95c4b612e27c415dd80a1a0e07
2010-07-07  83751  MEMDRIVE.asm
2010-07-07   2614  MEMDRIVE.sys  a2b1651171c8281fa8d44bcf60d89c97
2010-07-07   2614  DISK1440.sys  a2b1651171c8281fa8d44bcf60d89c97
2010-07-07   2678  DISK2880.sys  4b6b10d3371000c32d56fc33e7fad445
2010-06-16  31941  DOS622.asm
2010-06-16   1040  DOS622.com    263a374dee684273bb603781cbf69655
2010-07-06  40531  WINDUMB.asm
2010-07-06   1630  WINDUMB.sys   87dbf1909dc878c4db917a9a5e518025
2010-06-17    823  NOP.com       cd01b7466d72f13e41360a2891a25ce8
2010-07-03  42680  CSTART_T.asm
2010-07-04   3930  CSTART_T.wmk

2  2&1.exe

Usage:  2&1 [<path>]<name> [<arguments>] [<redirections>]

Use 2&1 to redirect a program's error output ( DOS handle 2 STDERR ) to
the standard output device or file ( DOS handle 1 STDOUT ).  2&1 called
with no arguments shows a usage message on STDERR, use this feature for
a 2&1 demonstration:

2&1     > NUL: displays usage message (STDERR goes to CON, not to NUL),
2&1 2&1      : displays usage message (2&1 calls 2&1 without argument),
2&1 2&1 > NUL: 2&1 STDERR redirection (STDERR same as STDOUT here NUL).

2&1 searches <name> much like DOS itself, i.e. if no <path> given first
in the current directory ( of actual or specified disk ) before all DOS
PATH directories until <name>.COM or <name>.EXE found.  Use PATH or 2&1
without arguments to see the PATH setting.

2&1 cannot execute BATch files directly, however 2&1 COMMAND /C <batch>
should work.  An even more complex 2&1 application is collecting STDERR
output only in a LOG-file without STDOUT redirection:

2&1 COMMAND > LOG : start subshell with STDERR and STDOUT going to LOG,
COMMAND > CON     : sub-subshell STDERR still to LOG but STDOUT to CON,
2&1               : e.g. call 2&1, 2&1 usage message redirected to LOG,
EXIT              : exit sub-subshell, 1st subshell prompt goes to LOG,
EXIT              : exit ( no echo for this and COMMAND > CON line ! ),
TYPE LOG          : sub-subshell STDERR output and any subshell output.

If you install any TSR ( Terminated Staying Resident ) programs in your
AUTOEXEC.BAT do not redirect STDOUT or STDERR output to NUL.  Often TSR
programs do not close STDOUT and STDERR before going resident, and open
NUL- unlike standard CON-, AUX-, LST-handles reduce the number of FILES
available for DOS ( default 8 or whatever FILES= value in CONFIG.SYS ).

3  TRY.exe

Usage: TRY [<path>]<name>[.<ext>] [<arguments>]

TRY executes <name> and shows any non-zero return code from <name> with
its usual DOS meaning.  TRY can be useful in testing program exit codes
or analyzing batch ERRORLEVELs.  You may optionally specify a <path> to
the tested program <name>, its <arguments> or even DOS i/o redirections.

TRY searches <name> much like DOS itself, i.e. if no <path> given first
in the current directory ( of actual or specified disk ) before all DOS
PATH directories until <name>.COM or <name>.EXE found.  Use PATH or TRY
without arguments to see the PATH setting.

You cannot TRY internal DOS commands like DIR and batch files ( *.BAT )
because TRY executes <name> without calling COMMAND.COM or undocumented
interrupt 2Eh.  Both would support internal DOS commands or batch files,
but destroy the exit code before return to caller.

TRY shows the meaning for return code 1..13, 15..18 ( DOS 2.1 ), 19..31
( critical error 1..13 ), 32..36 ( DOS 3.0 ), 37..39 ( DOS 3.3 or 4.0 ),
50..72, 80 and 82..88 ( network ).  Some return code meanings depend on
the DOS version, e.g. codes above 31 came with DOS 3.0 or later, 36 was
"Sharing buffer overflow" and 88 "Network device fault" before DOS 4.0 :

01 Invalid function number           02 File not found
03 Path not found                    04 Too many open files
05 Access denied                     06 Invalid handle
07 Memory control blocks destroyed   08 Insufficient memory
09 Invalid memory block address      10 Invalid environment
11 Invalid format                    12 Invalid access code
13 Invalid data

15 Invalid disk drive
16 Attempt to remove current directory
17 Not same device                   18 No more files

19 Disk write-protected              20 Unknown disk unit
21 drive not ready                   22 Unknown command
23 Data error (CRC)                  24 Bad request structure length
25 Seek error                        26 Unknown media type
27 Sector not found                  28 Printer out of paper
29 Write fault                       30 Read fault
31 General failure                   32 Sharing violation
33 Lock violation                    34 Invalid disk change
35 FCB unavailable                   36 System resource exhausted
37 Code page mismatch                38 Out of input
39 Insufficient disk space

50 Network request not supported     51 Remote computer not listening
52 Duplicate name on network         53 Network name not found
54 Network busy                      55 Network device no longer exists
56 Network BIOS command limit exceeded
57 Network adapter hardware error    58 Incorrect response from network
59 Unexpected network error          60 Incompatible remote adapter
61 Print queue full                  62 Print queue not full
63 Print file deleted (not enough space)
64 Network name deleted              65 Access denied
66 Network device type incorrect     67 Network name not found
68 Network name limit exceeded
69 Network BIOS session limit exceeded
70 Temporarily paused                71 Network request not accepted
72 Print or disk redirection paused

80 File already exists
82 Cannot make directory entry       83 Failure on Int 24H
84 Too many redirections             85 Duplicate redirection
86 Invalid password                  87 Invalid parameter
88 Network data fault

There are 4 program termination classes : 0 (0..255) program terminated
normally, 1 (256..511) program terminated by ^C or ^BREAK, 2 (512..767)
program aborted in critical error handler, and 3 (768..1023) terminated
staying resident.  TRY displays hex. return codes, therefore code YYXXh
means termination class YYh and exit code XXh, where XXh corresponds to
one of the DOS codes listed above or follows an arbitrary definition in
the tested program.  ( For assembler programmers: DOS functions 4Ch and
31h take the value in register AL as exit code. )  If you TRY Terminate
Staying Resident (TSR) programs this leaves a memory hole of about 4 KB
used for TRY execution ( unless the TSR decides to terminate normally ).

Unlike DOS TRY respects an explicitly given <name>.<ext> file extension.
This allows execution of <name>.EXE even if <name>.COM would be located
by DOS before <name>.EXE - in the same directory or depending on actual
PATH setting.  This feature lets you bypass any hidden COM-virus if the
EXE-file is still intact.  If you TRY <name>.<ext>, and extension <ext>
is neither COM nor EXE, TRY will ask for your confirmation.  Do not TRY
execution of non-executable files, it can crash your system and destroy
disk data.

TRY writes its own messages to STDERR (usually display) and takes input
directly from the keyboard, i.e. redirections of STDIN or STDOUT do not
interfere with TRY i/o.  You may even TRY filter programs within a pipe:

      TYPE TRY.DOC | TRY MORE

as an example shows a non-zero MORE return code like abortion by ^BREAK.

4  TEE.com

TEE.sid is "Symdeb Input Data" in a form also accepted by PC DOS DEBUG:

      DEBUG < TEE.sid

This creates TEE.com (256 bytes). It's not really a UNIX-like tee, but
allows to redirect STDOUT into a file (or pipe) while still displaying
the output also on STDERR.

5  XDEL.com

xdel.sid is "Symdeb Input Data" in a form also accepted by PC DOS DEBUG:

      DEBUG < XDEL.sid

This creates XDEL.com (768 bytes).  XDEL contains its own usage info:

      XDEL [drive:]path

XDEL deletes all files in the specified directory and its subdirectories
keeping read-only/hidden/system files. XDEL removes empty subdirectories
and the specified directory if possible. XDEL root acts as a soft FORMAT.

6  CONTILDE.asm

Creation: MASM CONTILDE, LINK CONTILDE, EXE2BIN CONTILDE CONTILDE.SYS
Or:   WASM -wx -we -q -3 -bt=DOS -mt CONTILDE
      WDIS -l -fi CONTILDE
      WLINK op q,map format dos com file CONTILDE name CONTILDE.SYS

Installation: DEVICE[high]=[<drive>:][<path>\]CONTILDE.SYS

COÑ notes the actual INT 29h handler.  When COÑ is opened it swaps the
noted old and the current handler until finally closed.  It makes only
sense if ANSI.SYS is installed after COÑ.  ANSI also modifies INT 29h,
but some ANSI.SYS versions do not support more than 25 display lines.
Use CTTY COÑ to bypass ANSI.SYS output limitations and later CTTY CON
to undo this effect.  Caveat, files COÑ.* are not accessible while COÑ
is installed, this is a DOS character device feature.

This is a variant for Open Watcom.  Two options of the "vintage 2000"
version (larger keyboard buffer and MACH32 oddity) have been removed,
the installation message is also gone.

This version hooks interrupt 2DH to prevent double installations with
the AMIS (alternative mux) protocol.  Define NOSTACK to get rid of the
stack - it might be too small, and the stack of the caller (i.e. DOS)
should be good enough for BIOS keyboard input and teletype output.

Caveats:  The 386 check was not tested with a 286 and is disabled for
a NOSTACK version because LSS is so far the only used 386 instruction.

INT 0 is only hooked to modify its offset, the old INT 0 handler is
always used.  The modified offset is 00CDh, "embedding" an INT 0 in
the INT 0 vector.  This might help with erroneous programs trying to
call a NULL function at 0000:0000.  The xxxx:00CDh pointer called as
code triggers an INT 0 (CD 00, little endian 00CDh).

7  SMALLEST.asm

Source for MASM SMALLEST, LINK SMALLEST, EXE2BIN SMALLEST SMALLEST.SYS

SMALLEST possible RAM disk allowing MKDIR, FORMAT, DISKCOPY (if there
are 2 of it), RMDIR (RMDIR bug assumes at least 128 bytes per cluster,
otherwise SMALLEST would be 64 bytes smaller), and CHKDSK (DOS 5 only,
below DOS 5 CHKDSK does not like 64 bytes per sector).

8  EAT.asm

EAT.ASM source for EAT.EXE program: MASM EAT, LINK EAT

       Sorry, no binary available in the archive at the moment.

Usage: EAT [ F | B | L | - ] [ <number> ]

Use EAT to test programs under controlled free memory conditions.  Some
programs crash the system if run with less memory than used, and others
assume that they own all memory above themselves.  You may want to test
programs before installing them e.g. on a network server.

EAT  allocates the specified <number> of memory paragraphs and enters a
COMMAND.COM subshell if possible.  The EXIT command leaves the subshell
and releases EATen memory.  EAT without arguments gives a usage message
and shows actual free memory sizes:
-  biggest free memory block ( exclusive memory needed to execute EAT ),
-  totals for other free blocks ( resulting from memory fragmentation ),
-  memory used by EAT itself,
-  actual size of environment ( SET without argument shows most of it ).

These sizes include 1 paragraph (= 16 bytes) memory management overhead
per block.  To determine the memory size allocated by a COMMAND.COM sub-
shell use EAT 0, note free memory size, call EAT again and subtract all
shown sizes.  The result depends on DOS version and current environment.
The maximum you can EAT will be much smaller because loading a subshell
needs additional memory.

EAT -<number> creates a "memory hole" of the given size.  DOS loads the
subshell in this "hole" if it is big enough and the default "first fit"
memory allocation strategy is not modified.  To create a hole EAT first
allocates it, then allocates an empty block just behind it and releases
the hole ( assuming your DOS supports allocation of empty blocks ).

Often the biggest free memory block is also the last block.  EAT allows
allocation of the last block in two steps: First EAT -<number> creating
a ( big ! ) memory hole, then EAT 0 to allocate all smaller free blocks
inclusive last.  Running programs with allocated last memory block is a
very hard test, look for your RESET button before.

No DOS command allows modifications of the global DOS memory allocation
strategy although DOS supports 3 different strategies:
-  First fit allocates in first big enough free block ( default, fast ),
-  Best  fit looks for a block causing the least fragmentation ( rest ),
-  Last  fit allocates top down ( slow because DOS searches bottom up ).

EAT F, EAT B, or EAT L set the global DOS strategy to first, best, last
fit.  Last fit is very strange, and ill-behaved program probably crash.
Normally EAT B is NOT a candidate for your AUTOEXEC.BAT, but if some of
Your favourite tools tend to create bigy"memory holes" try EAT B before.
You can combine EAT B etc. with EAT <number> in a single EAT B <number>.

9  ENVSIZE.asm

ENVSIZE.ASM source for ENVSIZE.EXE program: MASM ENVSIZE, LINK ENVSIZE
ENVSIZE.WAS source for ENVSIZE.EXE program (2009 Open Watcom variant):
   wasm -wx -we -q -d1 -3 -ms ENVSIZE
   wlink option q,map,nod,stat,st=512 system dos file ENVSIZE

ENVSIZE displays the total, used, and remaining size of the current DOS
environment in bytes on STDERR.

A  MEMDRIVE.asm

Installation:
      devicehigh=memdrive.sys
Requirements:
      The resident part of MEMDRIVE needs 2000 bytes conventional
      memory for 1.44 MB floppy images.  If XMS is available the
      virtual floppy unsurprisingly needs 1440 KB XMS.  MEMDRIVE
      requires an 80386 CPU and PC DOS 5 or better.
Usage:
      Without XMS MEMDRIVE creates one drive containing a single
      file MEMORY.DAT corresponding to the memory below 1 MB.  Two
      other directory entries HMA.DAT and DISK1440.IMG are hidden.
      If HIMEM.SYS is installed 65520 bytes in HMA.DAT are visible.
      If the free XMS space allows it MEMDRIVE creates a drive for
      DISK1440.IMG, an initially empty formatted 1.44 data floppy.
      All floppy access methods on the second drive should work as
      expected, e.g., FORMAT, FORMAT /T:80 /N:18, FORMAT /F:1.44,
      DISKCOMP, DISKCOPY, CHKDSK, Norton DISKEDIT, NDD, etc.
      A DISKCOPY of the initial image to a real floppy results in a
      non-bootable floppy returning control to BIOS INT 18h without
      user intervention.
      DISK1440.IMG in the first drive can be deleted to work with
      other images, just "insert" (i.e. copy) another floppy image
      in the first drive.  The content is immediately available as
      ordinary floppy on the second drive.
Features:
      The four system sectors (MBR, FAT, FAT copy, and root directory)
      on the first drive are to varying degrees virtual, e.g., unused
      zero bytes do not really exist in memory, and the root directory
      entries for MEMORY.DAT and HMA.DAT are read-only.
      The volume label directory entry can be removed for experiments
      with two writable root directory entries instead of one.
      Low level write access on the MEMORY.DAT or HMA.DAT sectors is
      possible and expected to crash the system.  Disk surface tests,
      e.g., SCANDISK, on the first drive cause havoc, NDD 8.0 is okay.
      The file date of MEMORY.DAT is the BIOS date.  The timestamp of
      the volume label is 12:34:56 08/07/09.  Other times correspond
      to the installation (typically reboot) time.  The volume serial
      number of the initial DISK1440.IMG has the form Whhh:tttt, with
      Hhhh:tttt timer ticks since midnight of the last reboot.  W is
      H+D for weekday D of a MEMDRIVE installation (H is normally 0).
720 KB, 2880 KB:
      Inserting 720 KB images in the 1.44 MB slot works as expected.
      Formats needing more than 1440 KB, e.g., XDF, will not work.
      The MEMDRIVE source is prepared to create a 2880 KB variant by
      defining the symbol EXTRA.  After that DISK2880.IMG works like
      DISK1440.IMG.  The resident code for the 2880 KB variant needs
      64 bytes more for 1440/32*(3/2) FAT12 bytes on the first drive.
WASM (Open Watcom)
      wasm -wx -we -q -3 -mt memdrive
      wdis memdrive -l -fi
      wlink format dos com file memdrive name memdrive.sys
-or-  (after creating a system dossys in e.g. wlsystem.lnk):
      wlink system dossys file memdrive name memdrive.sys
WLINK (optional system dossys still needs a name directive):
      system begin dossys
          option osname='DOS .SYS'
          op map,nodefault,stat
          format dos com
      end
MASM (untested, might require a dummy stack segment):
      masm memdrive
      link memdrive
      exe2bin memdrive memdrive.sys
Development:
      The boot sector is used up to the last byte.  Be careful with
      the size of the "overlay" part of the code at the end after
      procedure "format".  The initialization code removes itself when
      done.  You can add new resident code near the begin before the
      boot sector.
Caveats:
      At some places 80386 instructions are used.  This requires wasm
      option -3 and explicit USE16 segments because the -3 default is
      USE32.  The check to prevent installation on an 80286 was never
      tested, an installation on older CPUs should immediately crash.
      At some places the code abuses the fact that subunit 0 has one
      head and subunit 1 two heads/sides.  Procedure "format" called
      by "init" uses the begin of the init code as buffer.
      IOCTL 861h/841h (track i/o) and 866h/846h (get/set volume label)
      work as expected.  860h/840h (get/set parameters), 868h (sense
      media), 862h/842h (verify/format track), and 867h/847h (get/set
      lock) are mostly unclear, but apparently good enough for FORMAT.
      848h is unknown and clears an internal access flag.

B  DOS622.asm

Usage:        DOS622 command [arguments]

      DOS622 starts the specified external command (COM or EXE) with
      the given arguments.  When the command returns DOS622 terminates
      itself with the exit code ("errorlevel") of this command.  While
      DOS622 waits for this return all ordinary INT 21h AH 30h version
      questions are answered with MS DOS 6.22 (BH FFh, AX 1606h).

      DOS622 is for quick experiments with programs expecting version
      6.22, use SETVER.EXE for permanent solutions.  To clone DOS622
      patch the last seven bytes 36 32 32 00 06 16 FF of the binary:
      - Use 37 00 00 00 07 00 00 for PC DOS 7 (OEM id. 00 for IBM).
      - Use 37 00 00 00 07 00 FF for MS DOS 7 (a.k.a. Windows 95).

      INT 0 is only hooked to modify its offset; the old INT 0 handler
      is always used.  The modified offset is 00CDh, "embedding" an
      INT 0 in the INT 0 vector.  This might help with buggy programs
      trying to call a NULL function at 0000:0000.  The new xxxx:00CDh
      (little endian CD 00 xx xx) address called as code triggers an
      INT 0 (CD 00).

C  WINDUMB.asm

Installation: DEVICE[high]=[<drive>:][<path>\]WINDUMB.SYS

Creation: WASM -wx -we -q -3 -bt=DOS -mt WINDUMB
          WDIS -l -fi WINDUMB
          WLINK op q,map format dos com file WINDUMB name WINDUMB.SYS
Untested: MASM WINDUMB && LINK WINDUMB && EXE2BIN WINDUMB WINDUMB.SYS

WINDUMB is a dummy DOS character device installed after HIMEM.SYS.
WINDUMB uses the XMS API in HIMEM.SYS to create a single UMB (upper
memory block) at A200 up to B7FF.  This is similar to EMM386 option
i=A200-B7FF.  The RAM from A000 to BFFF is used as video memory, but
video modes 0..6 need only B800 up to BFFF.  This covers text modes
0..3 and VESA text modes, but not mode 7 (monochrome text).
Clearly WINDUMB cannot coexist with applications for other modes or
task switchers modifying video memory below B800, e.g., the PC DOS 7
DOSSHELL is incompatible with WINDUMB.  The PC DOS 7 command MODE
apparently uses 8 KB from A000 up to A1FF as buffer, and therefore
WINDUMB starts at A200.
WINDUMB and EMM386 can coexist:  Use EMM386 option x=A200-B7FF to
exclude the WINDUMB RAM.  However, it is more straight forward to
install only EMM386 including this RAM with i=A200-B7FF.  When
WINDUMB is installed its character device name UMB§A200 allows no
access on files with the same name.
WINDUMB is interesting where EMM386 is unavailable, notably in an
NT VDM (virtual DOS machine) without UMB.   The resident size of
WINDUMB is about 336 bytes in low memory and 92 KB video memory
available as UMB.

So far PC DOS 7 hangs when WINDUMB is installed.  W2K NTVDMs use
the UMB as expected.  A test version of WINDUMB can be created by
defining TEST, e.g., use option -dTEST for WASM.  The test version
marks its UMB as allocated and can be installed in PC DOS 7.

D  CSTART_T.asm

Modified Open Watcom C/C++ DOS 16-bit ..\STARTUP\DOS\CSTRT086.ASM code.
For __TINY__ (COM) stored in ..\LIB286\DOS\CSTART_T.OBJ use:
      set WASM=-we -wx -zld -1r -bt#DOS
      wasm -q %WASM% -mt cstart_t
The __SMALL__ and __COMPACT__ cstart.obj in CLIB?.LIB are identical:
      wasm -q %WASM% -ms cstart_t -focstart -nmcstart
      wlib -q clibs -+cstart.obj
      wasm -q %WASM% -mc cstart_t -focstart -nmcstart
      wlib -q clibc -+cstart.obj
Identical __MEDIUM__, __LARGE__, and __HUGE__ objects in CLIB?.LIB:
      wasm -q %WASM% -mm cstart_t -focstart -nmcstart
      wlib -q clibm -+cstart.obj
      wasm -q %WASM% -ml cstart_t -focstart -nmcstart
      wlib -q clibl -+cstart.obj
      wasm -q %WASM% -mh cstart_t -focstart -nmcstart
      wlib -q clibh -+cstart.obj
Unverified, CLIBOM and CLIBM libraries may differ wrt overlays:
      wasm -q %WASM% -mm cstart_t -focstart -nmcstart -dOVERLAY
      wlib -q clibom -+cstart.obj
Unverified, CLIBOL and CLIBL libraries may differ wrt overlays:
      wasm -q %WASM% -ml cstart_t -focstart -nmcstart -dOVERLAY
      wlib -q clibol -+cstart.obj

Differences between this CSTART_T.ASM and CSTRT086.ASM (2003-11-20):
 1 -  The __TINY__ case for "format dos com" was integrated into
      the normal _cstart_ handling using __TINY__ "CSGROUP equ cs"
      vs. "CSGROUP equ DGROUP" in all other models.
 2 -  There was no __TINY__ NULL pointer assignmemt check at exit,
      now 20CDh at PSP:0 is expected to survive.
 3 -  WLINK enforces a minimal stack size of 512 for *.EXE files.
      The minimal __TINY__ stack size is now the same value 512
      instead of 2048.  The total stack size at C runtime startup
      is now always stored in __stacksize.  WLINK cannot set the
      __TINY__ stack size, it has to be declared in a variable,
      e.g., size_t volatile __stacksize = 512;  The default stack
      size for __TINY__ is still 2048.
 4 -  The DGROUP including stack is still limited to 64 KB.  If a
      far stack (SS != DGROUP) cannot be aligned with the DGROUP
      a _Not_Enough_Memory_ error exit is triggered.
 5 -  A _Not_Enough_Memory_ error and the added NULL errors will
      now exit if the debugger returns from fatal runtime errors.
      The old code apparently assumed that this cannot happen.
 6 -  The __do_exit_with_msg__ code did not set DS for __TINY__
      access on "con"; this is now handled as in all other models.
 7 -  The __do_exit_with_msg__ code now verifies that open "con"
      actually worked and uses STDERR otherwise.  For DOS 2 and
      3.x AVAILDEV compatibility (see INT 21h AH 37h) "\dev\con"
      is used instead of "con".
 8 -  The __do_exit_with_msg__ stack is now word aligned for an
      odd _end.  Now SS:SP instead of only SP is reset.
 9 -  The "dynamic halt" for a NULL call has been replaced by a
      fatal runtime error inspired by code in 386\CSTRTX32.ASM.
10 -  NULL pointer calls in the first physical code segment of
      far code models are now trapped as in near models.  Really
      far 0000:0000 calls are trapped by a modified INT 0 handler
      with an INT 0 (CD 00) in its own address xxxx:00CDh.
11 -  The _nullarea was reduced from 16 to 6 words 00CDh instead
      of 0101h.  Again 00CDh triggers INT 0 if a NULL pointer in
      the _nullarea is called.
12 -  The command line copy now handles length 0 as 0 instead of
      1 (REPE SCASB needs a set Z-flag if CX can be 0).  Clearing
      _BSS and stack instead of only _BSS simplified the code.
13 -  Old %WATCOM%\STARTUP\DOS\MDEF.INC definitions are replaced
      by "CSLABEL equ far" and "CSLABEL equ near" for the far and
      near code models.  Apparently MDEF.INC was removed from the
      Open Watcom ..\STARTUP\DOS directory (good riddance).
14 -  Overlay code is now only generated if OVERLAY is defined.
      Maybe this was the original idea of clib[lm] vs. clibo[lm].
      However, there is no cliboh.lib to support this theory.
15 -  A .286p directive was downgraded to .186.  The startup code
      does not use .286 instructions.  The recommended option -0r
      for CSTRT086.ASM anyway only allowed 808[86] instructions.
      For CSTART_T.ASM option -1r allows three .186 instructions;
      compare "shr bx,4", "shr di,4", and "push CSGROUP" below.
      Use WASM options -0r -d__SW_0r to get pure 808[86] code.
      Unfortunately WASM does not yet automatically define __SW_x
      for option -x (unlike all Open Watcom C/C++ compilers).

CSTART_T.wmk is a Watcom WMAKE makefile for CSTART_T.asm:

      WATCOM C/C++ 12.0 CSTART.OBJ maintenance makefile

      wmake ALL updates cstart.obj in the small, compact,
      medium, large, and huge versions of the libraries
      watcom\lib286\dos\clib?.lib based on cstart_t.asm.
      The standalone cstart_t.obj file for format dos com
      (a.k.a. tiny) is also updated.

      This makefile and cstart_t.asm should be installed
      in the watcom\lib286\dos directory.  Actually only
      four cstart objects are used:  the cstart_t.obj for
      tiny (*.COM), a cstart.obj for small and compact, a
      cstart.obj for far code variants (medium, large, or
      huge), and a version for clibom.lib and clibol.lib
      supporting overlays.

      Presumably the purpose of clibom.lib and clibol.lib
      was to support overlays.  OVERLAY is defined here
      only for clibom and clibol.  Modify cstart_t.asm to
      retain the overlay support in other C libraries.

      wmake CLEAN removes *.bak, *.err, and *.lst files.


W3 validator Last update: 26 Jul 2010 18:38 by F.Ellermann