

                                LIBRARY REFERENCE
                                -----------------

     The library files contain standard routines that can be used in most
     WASM programs.  The files consist of source code that is included into
     the target program.  The routines may be examined and modified.

     The files should be included near the start of the program, with no
     code or data before the INCLUDE statements.  Many of the files have
     start-up code that must be executed, so do NOT branch around the
     INCLUDE statements.  EQUates may be defined before the include
     statements.

     The registers DS, ES, and SS should be set to the initial code/data
     segment.  These registers may be modified as long as their original
     values are restored before calling any library functions.

     The registers DI, SI, DS, ES, and BP are always preserved.  The
     direction flag (as set by the CLD and STD instructions) is NOT
     preserved.  You should always explicitly set the direction before
     using any 80x86 string instructions (CMPSB, CMPSW, LODSB, LODSW,
     MOVSB, MOVSW, STOSB, or STOSW)

     Parameters are passed to and from the routines in registers. The
     register usage is documented in the library files at the start of each
     routine in the comments.  Unless stated otherwise, all addresses
     passed are 16 bit offsets into the data segment.  Strings are defined
     as a sequence of bytes terminated by an ASCII code 0 (these type of
     strings are called ASCIIZ strings).

     Routines that access the system usually return a DOS error code if the
     system call fails.  Success and failure return values are documented
     in the library files.

     Several of the library files require code or data in other library
     files.  These dependencies are documented in the Library Files section
     and at the start of each library file in the comments.  Note that
     required library files may require additional library files, for
     instance all library files that require CONVERT.ASM will also require
     CASE1.ASM (because CONVERT.ASM requires CASE1.ASM).

                                LIBRARY OVERVIEW
                                ----------------

     The file START.ASM provides start up code for standard COM programs.
     Many of the other library files require that this file be INCLUDEd.

     A program's command line parameters can be accessed with the routines
     in the file PARMS.ASM.  The environment strings can accessed with the
     routines in ENVIRO.ASM.  Interrupt vectors can be set and retrieved
     with the routines in INTR.ASM.

     Memory can be allocated from two separate sources.  The file
     MEMORY.ASM provides routines for allocating large chunks of memory
     from the system.  The file STACK.ASM provides two macros for
     allocating small blocks of temporary memory from the stack.

     Direct keyboard i/o is performed using the routines in the file


     KEYBRD.ASM.  The state of the shift keys can be read using the routine
     in the file SHIFT.ASM.  String and other types of input routines are
     available in the file INPUT.ASM.

     The files MESSAGE1.ASM and MESSAGE2.ASM provide simple TTY output.
     Direct full screen video output is available through the files
     VIDEO1.ASM to VIDEO9.ASM and DRAW1.ASM.  The file PROMPT.ASM provides
     a few special purpose output routines used by INPUT.ASM.

     The file FILE.ASM provides direct DOS file access for reading and
     writing to files.  The files BUFFER1.ASM through BUFFER4.ASM provide a
     buffered file i/o system.  Use buffered i/o if you wish to read or
     write file information one byte at a time.

     The serial ports can be accessed by using the files SERIAL1.ASM to
     SERIAL9.ASM.  Routines for performing xmodem file transfers are
     available in the files XMODEM1.ASM and XMODEM2.ASM.

     The routines in SOUND.ASM allow the speaker to be turned on and off at
     specific frequencies.

     You can execute other programs from within your WASM program by using
     the the file SHELL1.ASM.  You can run a secondary command processor
     (i.e., a DOS shell) with the file SHELL2.ASM.

     The files CASE1.ASM and CASE2.ASM provide routines to change the case
     of characters and strings.  The file CONVERT.ASM provides routines to
     convert between strings and numbers.  The files STRING.ASM and
     STRINGF.ASM provide general purpose string manipulation routines.  The
     files JUSTIFY1.ASM and JUSTIFY2.ASM define routines to insert
     characters into a string.

     Various checksum calculations can be performed using the routines in
     CHECK1.ASM to CHECK4.ASM.  Random numbers can be generated with the
     routines in RANDOM.ASM.

     The routines in TICKS.ASM measure the passage of time in "ticks," a
     ROM system of time measurement.

     The routines in TSR1.ASM to TSR2.ASM simplify the task of writing
     TSR's.

     A Fourth-like macro language can be added to an application with the
     routines in MACRO1.ASM.  The file MACRO2.ASM provides some additional
     macro support routines.

                                  LIBRARY FILES
                                  -------------

     BUFFER1.ASM

       Defines:

         BufAll              allocate a buffer
         BufRel              release a buffer
         BufOpn              open a buffer file
         BufClo              close a buffer file



         BUFFER_RECORD       bytes in a buffer record

         BUFFER_READ         open buffered file for reading
         BUFFER_WRITE        open buffered file for writing
         BUFFER_CREATE       create or truncate buffered file

       Requires:

         FILE.ASM
         MEMORY.ASM

       The routines in this file allocate, deallocate, open, and close
       buffers.  All buffer i/o is performed through a buffer record.  The
       buffer record must exist in the current data segment (usually
       declared or allocated using the StkAll macro).  The actual buffer is
       allocated from the system by BufAll.  A buffer must be allocated and
       then opened before it can be read from or written to.

     BUFFER2.ASM

       Defines:

         GetByt              read a buffer byte
         BufGet              read an entire buffer

       Requires:

         BUFFER1.ASM
         FILE.ASM

       The routines in this file are for reading from a buffered file.  The
       routine BufGet is used internally by GetByt when the buffer is
       empty.

     BUFFER3.ASM

       Defines:

         PutByt              write a buffer byte
         BufPut              write an entire buffer

       Requires:

         BUFFER1.ASM
         FILE.ASM

       The routines in this file are for writing to a buffered file.
       IMPORTANT: If PutByt is used, BufPut must be explicitly called to
       flush the file before it is closed with BufClo.

     BUFFER4.ASM

       Defines:

         GetTok              read a buffer token

       Requires:



         BUFFER2.ASM

       The routine in this file reads a delimited token from a buffered
       file.  GetTok is used by the macro library files.

     CASE1.ASM

       Defines:

         ChrLwr              convert a character to lower case
         ChrUpr              convert a character to upper case

       These routines convert single characters to upper or lower case.

     CASE2.ASM

       Defines:

         StrLwr              convert a string to lower case
         StrUpr              convert a string to upper case

       Requires:

         CASE1.ASM

       The routines in this file convert entire strings to upper or lower
       case.

     CHECK1.ASM

       Defines:

         SumBlk              return the checksum of a block

       The routine in this file calculates the checksum of a block of data.
       This routine is used in xmodem file transfers.

     CHECK2.ASM

       Defines:

         SumRes              reset the current checksum
         SumCur              return the current checksum
         SumUpd              update the current checksum by a byte

       The routines in this file calculate the checksum of a sequence of
       bytes.  These routines perform the same function as SumBlk, but one
       byte at a time.

     CHECK3.ASM

       Defines:

         CrcBlk              return the CRC of a block

       The routine in this file calculates the cyclic redundancy checksum
       (CRC) of a block of data using the xmodem polynomial.  This routine
       is used in xmodem file transfers.


     CHECK4.ASM

       Defines:

         CrcRes              reset the current CRC
         CrcCur              return the current CRC
         CrcUpd              update the current CRC by a byte

       The routines in this file calculate the CRC of a sequence of bytes.
       These routines perform the same function as CrcBlk, but one byte at
       a time.

     CONVERT.ASM

       Defines:

         Num2Str             convert a 32 bit number to a string
         Str2Num             convert string to a 32 bit number

       Requires:

         CASE1.ASM

       The routines in this file convert 32 bit numbers to strings and from
       strings to 32 bit numbers.

     DRAW1.ASM

       Defines:

         DrwBox              draw a double line box

       Requires:

         VIDEO4.ASM
         VIDEO5.ASM

       The routine in this file draws a double line box.  This is useful
       when creating pop-up windows.

     ENVIRO.ASM

       Defines:

         EnvPro              get the current program path\name
         EnvRes              reset the environment reader
         EnvGet              return the next environment string

       The routines in this file are used to access the environment
       strings.  EnvPro, which returns the name of the program, only works
       with DOS version 3.0 or higher.  EnvGet returns each environment
       string in sequence.  EnvRes forces EnvGet to start with the first
       environment string.  EnvRes is automatically called when this file
       is INCLUDEd.

     FILE.ASM

       Defines:


         FilOpn              open an existing file
         FilCre              create a new file or truncate an existing file
         FilClo              close an open file
         FilRea              read from a file
         FilWri              write to a file
         FilSee              move a file read/write pointer

         OPEN_READ           open for reading
         OPEN_WRITE          open for writing
         OPEN_BOTH           open for reading and writing

         ATTR_NORMAL         create normal file
         ATTR_READONLY       create readonly file
         ATTR_HIDDEN         create hidden file
         ATTR_SYSTEM         create system file

         SEEK_FRONT          seek from beginning of file
         SEEK_CURRENT        seek from current location in file
         SEEK_END            seed from end of file

       The routines in this file directly read and write to files.  All
       file access if performed with a file handle, returned by FilOpn or
       FilCre.

     INPUT.ASM

       Defines:

         InpVer              verify something with a yes or no
         InpEsc              prompt and wait for the escape key
         InpStr              input a string

       Requires:

         CASE1.ASM
         KEYBRD.ASM
         PROMPT.ASM
         VIDEO4.ASM
         VIDEO5.ASM

       The routines in this file allow three types of input with prompting.

     INTR.ASM

       Defines:

         IntGet              get an interrupt vector
         IntSet              set an interrupt vector

       The routines in this file get and set interrupt vector addresses.

     JUSTIFY1.ASM

       Defines:

         StrJusR             right justify a string

       Requires:


          STRING.ASM

       The routine in this file inserts characters on the left side of a
       string to make the string a specific length.  This is useful when
       lining up the right edge of a column of strings.

     JUSTIFY2.ASM

       Defines:

         StrJusL             left justify a string

       Requires:

          STRING.ASM

       The routine in this file inserts characters on the right side of a
       string to make the string a specific length.  This is useful when
       lining up the left edge of a column of strings.

     KEYBRD.ASM

       Defines:

         KeyGet              get keystroke if available
         KeyWai              wait for a keystroke
         KeyRep              replace a keystroke
         KeyHit              return the keyboard status
         KeyClr              clear the keyboard buffer

       The routines in this file input keystrokes directly from DOS. KeyRep
       does not return the keystroke to DOS, but rather stores it in a
       variable so it will be returned by the other keyboard routines.
       NOTE: I've encountered a DOS bug when using KeyHit and do not
       recommend its use.

       Equates for many keystrokes are provided in this file.  Some
       examples are: KEY_ESC, KEY_PGUP, KEY_ALT_TAB, KEY_CTL_A, KEY_ALT_F1.

     MACRO1.ASM

       Defines:

         MacAll              allocate macro code and data areas
         MacRel              release macro code and data areas
         MacCom              load and compile a macro
         MacRes              reset the currently loaded macro
         MacRun              run the currently loaded macro
         MacAdr              return the address of a symbol
         MacLoa              load a stack item from an external routine
         MacSto              store a stack item from an external routine
         MacBug              the debug flag (an 8 bit variable)

         MACRO_TOKEN         maximum token size including NUL

         MACRO_MEMORY        not enough memory for compile
         MACRO_SYMBOL        out of symbol memory during compile
         MACRO_CODE          out of code memory during compile


         MACRO_LONGTOK       token too long during compile
         MACRO_UNDEF         undefined symbol during compile
         MACRO_BADEOF        unexpected EOF during compile
         MACRO_FILE          error reading file during compile
         MACRO_BADNUM        invalid number after ALLOC during compile

       Requires:

         BUFFER1.ASM
         BUFFER2.ASM
         BUFFER4.ASM
         CONVERT.ASM
         MEMORY.ASM
         STACK.ASM
         STRING.ASM

       The routines in this file compile and run macros.  A macro may be
       run with MacRun once the code and data areas have been allocated
       with MacAll and the macro compiled with MacCom.  Note that MacBug is
       a byte variable, not a routine.  MacAdr will only work if MacBug is
       set to non-zero before a compile.  See the file MACRO.DOC for more
       information regarding macros.

     MACRO2.ASM

       Defines:

         MacUnd              return an undefined compile symbol
         MacCur              return the current state (IP,stack,return)
         MacStk              read values from the stack
         MacRet              read values from the return stack
         MacSym              return the symbol associated with an address

       Requires:

         MACRO1.ASM

       The routines in this file assist in debugging a macro.  MacUnd
       fetches an undefined symbol after compiling a macro.  MacUnd and
       MacSym will only work if MacBug is non-zero before a compile.  See
       the file MACRO.DOC for more information regarding macros.

     MEMORY.ASM

       Defines:

         MemAll              allocate a memory block
         MemRel              release a memory block

       The routines in this file allocate and deallocate system memory.
       Note that START.ASM must be INCLUDEd to use these routines since COM
       files do not begin with any (or much) available system memory.

     MESSAGE1.ASM

       Defines:

         MesPut              type a message to standard output


         MesPutL             type message plus a CR/LF to standard output

       The routines in this file type messages to the standard output
       device.

     MESSAGE2.ASM

       Defines:

         MesErr              type a message to error output
         MesErrL             type a message plus a CR/LF to error output

       The routines in this file type messages to the standard error
       device.

     PARMS.ASM

       Defines:

         ParRes              reset the parameter reader
         ParGet              return the next parameter

       The routines in this file retrieve parameters from the command line.
       ParGet returns each parameter in sequence.  ParRes forces ParGet to
       start with the first parameter.  ParRes is automatically called when
       this file is INCLUDEd.  The command line parameters must be
       separated by one or more spaces.

     PROMPT.ASM

       Defines:

         ProWrt              display a prompt
         ProVer              display a prompt with " (Y/N)?" appended
         ProEsc              display a prompt with "  ; Press ESC" appended

       Requires:

         VIDEO4.ASM
         VIDEO5.ASM

       The routines in this file display various formatted strings for the
       routines in INPUT.ASM.

     RANDOM.ASM

       Defines:

         RndSed              seed the number generator
         RndNum              return a random number
         RndNumN             return a random number in the range 0 to N-1

       The routines in this file generate random numbers.  The random
       number generator is automatically seeded when this file is INCLUDEd.
       Note that a particular seed always returns the same sequence of
       random numbers.

     SERIAL1.ASM


       Defines:

         ComAll              allocate an input buffer
         ComRel              release an input buffer
         ComOpn              open a serial port
         ComClo              close a serial port
         ComClr              clear the input buffer
         ComByt              return the bytes waiting in the input buffer
         ComGet              read a byte from serial port
         ComPut              write a byte to the serial port

         SERIAL_RECORD       bytes in serial record

         PARITY_NONE         no parity
         PARITY_ODD          odd parity
         PARITY_EVEN         even parity

       Requires:

         MEMORY.ASM

       The routines in this file allow data to be read from and written to
       the first two serial ports.  All serial i/o is performed through a
       serial record.  The serial record must exist in the current data
       segment (usually declared or allocated using the StkAll macro).  All
       input is interrupt driven.  The input buffer must be allocated with
       ComAll and then the serial port opened with ComOpn before i/o can
       take place.

       I think the maximum reliable speed using this code is 19200 bps.  On
       some systems I've had trouble sending and receiving data at speeds
       greater than 2400 bps.

     SERIAL2.ASM

       Defines:

         ComGetW             read a word of data from the serial port
         ComPutW             write a word of data to the serial port

       Requires:

         SERIAL1.ASM

       The routines in this file transfer 16 bits at a time to and from the
       serial port.

     SERIAL3.ASM

       Defines:

         ComRea              read a block of data from the serial port

       Requires:

         SERIAL1.ASM
         SERIAL5.ASM



       The routine in the file reads a block of data from the serial port.

     SERIAL4.ASM

       Defines:

         ComWri              write a block of data to the serial port

       Requires:

         SERIAL1.ASM

       The routine in this file writes a block of data to the serial port.

     SERIAL5.ASM

       Defines:

         ComWai              wait for a byte of data from the serial port
         ComWaiW             wait for a word of data from the serial port
         ComAny              wait for any data from the serial port

       Requires:

         SERIAL1.ASM
         SERIAL2.ASM
         TICKS.ASM

       The routines in this file wait for data from the serial port.

     SERIAL6.ASM

       Defines:

         ComEmp              wait for pause in the flow of serial data

       Requires:

         SERIAL1.ASM
         TICKS.ASM

       The routine in this file waits for a pause in the flow of data from
       the serial port.  This routine is used in xmodem file transfers.

     SERIAL7.ASM

       Defines:

         ComRng              return the modem ring flag
         ComCar              return the modem carrier flag

       Requires:

         SERIAL1.ASM

       The routines in this file return information about the modem through
       the serial port.



     SERIAL8.ASM

       Defines:

         ComBrk              send a modem break signal
         ComDtr              force the modem DTR line low

       Requires:

         SERIAL1.ASM
         TICKS.ASM

       The routines in this file allow a break signal to be sent by the
       modem and force the DTR line to be lowered (which causes some modems
       to hang up).

     SERIAL9.ASM

       Defines:

         ComRep              store a byte to the input buffer

       Requires:

         SERIAL1.ASM

       The routine in this file stores a byte to the serial input buffer as
       if the byte had been received through the serial port.  NOTE: ComRep
       does not check to see if the buffer is full.  The serial interrupt
       handlers do not use this routine for storing data.

     SHELL1.ASM

       Defines:

         RunPro              execute a program

       Requires:

         STACK.ASM
         STRING.ASM

       The routine in this file runs another program.

     SHELL2.ASM

       Defines:

         RunSys              run a secondary command processor

       Requires:

         ENVIRO.ASM
         SHELL1.ASM
         STACK.ASM
         STRINGF.ASM

       The routine in this program runs a secondary command processor (i.e.


       a DOS shell).  RunSys uses the COMSPEC environment variable to find
       the pathname of the command processor.

     SHIFT.ASM

       Defines:

         KeyShf              return shift state

         KEY_RIGHT_SHIFT     the right shift is pressed
         KEY_LEFT_SHIFT      the left shift is pressed
         KEY_CTRL            a control key is pressed
         KEY_ALT             an alternate key is pressed
         KEY_LEFT_CTRL       the left control key is pressed
         KEY_LEFT_ALT        the left alternate key is pressed

       The routine in this file returns the current shift state.

     SOUND.ASM

       Defines:

         SndOn               turn the speaker on
         SndOff              turn the speaker off

       The routines in this file turn the speaker on or off at specific
       hertz frequencies.

     STACK.ASM

       Defines:

         StkAll              allocate stack memory (macro)
         StkRel              release stack memory (macro)

       The macros in this file allocate memory from the stack.  Adequate
       stack memory must be available for these macros and all instructions
       that use the stack (like PUSH's, CALL's, and INT's).  StkAll
       allocates memory by subtracting the bytes to allocate from SP and
       then storing SP to a register or variable.  StkRel releases the
       memory by adding the bytes back to SP.  The bytes allocated and
       released must always match.  Memory allocated within a routine must
       be released before the routine returns.  Registers may be pushed and
       popped outside, around, or within a StkAll/StkRel pair, but may not
       cross a StkAll/StkRel boundary:

         ; this code is okay

         push ax        ;-- push/pop, outside
         pop ax         ;
         push bx                   ;----------;-- push/pop, around
         StkAll di, 10                        ;
         push cx        ;-- push/pop, within  ;
         pop cx         ;                     ;
         StkRel 10                            ;
         pop bx                    ;----------;



         ; this code is NOT okay

         push ax        ;--;-- push/pop, crosses boundary
         StkAll di, 10     ;
         pop ax         ;--;
         StkRel 10

       DS must equal SS when accessing memory allocated with StkAll.

     START.ASM

       Defines:

         STACK_SIZE          bytes reserved for stack

       This file contains standard COM program startup code.  The startup
       code checks that the DOS version is 2.0 or higher and reduces the
       system memory allocation to a minimum while reserving a specific
       amount of memory for the stack.  The startup code will terminate the
       program if an improper version of DOS is running or insufficient
       memory is available.

     STRING.ASM

       Defines:

         StrLen              return the length of a string
         StrCpy              copy a string
         StrCmp              compare two strings

       The routines in this file provide three commonly used string
       routines.

     STRINGF.ASM

       Defines:

         StrLenF             return the length of a far string
         StrCpyF             copy a far string
         StrCmpF             compare two far strings

       The routines in this file provide three commonly used string
       routines.  These routines are identical to the routines in
       STRING.ASM except the string addresses consist of a segment and
       offset (instead of only an offset).  These routines are used to
       access strings that are in another segment.

     TICKS.ASM

       Defines:

         TicSys              return the current system time
         TicRes              reset a timer
         TicPas              return the ticks since a timer was reset
         TicWai              do nothing for a tick duration

         TICK_TIMERS         number of timers



       The routines in this file measure time.  The unit of measurement is
       "ticks," which occur about 18.2 times a second.  There are several
       independent timers available.  Timers 0 and 1 may be used (i.e.
       reset) by the library routines.  Since the timer routines return 16-
       bit values, only an hour's worth of ticks can be measured (65535 /
       18.2 seconds).  All the timers are automatically reset when this
       file is INCLUDEd.

     TSR1.ASM

       Defines:

         Keep                install TSR

       The macro in this file terminates a program and makes it resident.
       The user must define a symbol TSR_END, which marks the end of the
       resident code.  The code and data after TSR_END is usually part of
       the TSR installation code.

     TSR2.ASM

       Defines:

         Trap21              hook interrupt 21
         Free21              release interrupt 21
         Okay21              verify interrupt 21
         Query               query resident TSR

       Requires:

         INTR.ASM

       The macros in this file hook and release interrupt 21H.  This
       interrupt is used to communicate with a resident copy of the
       program.  The user must define: TSR_ID1, TSR_ID2, and TsrUsr.
       TSR_ID1 and TSR_ID2 are 16 bit values that should be unique among
       all installed TSR's.  The value of TSR_ID1 must be greater than 3000
       (decimal).  TsrUsr defines a table of Query codes and associated TSR
       functions.  The format of TsrUsr is:

         TsrUsr LABEL BYTE
           DB code, OFFSET routine
           DB code, OFFSET routine
           DB 0

       'code' is a one byte, non-zero code used by Query and 'routine' is
       the procedure associated with the code.  The routines to service the
       codes can return values in all registers except AX, DS, and ES.  No
       registers need to be preserved.  Once the TSR is installed, you can
       interface with it by using the Query macro:

           Query 1

       This statement will call the routine associated with code 1.  These
       macros are used for things like disabling a TSR, determining if a
       TSR is installed, and retrieving the segement of a TSR for
       uninstalling it.



     TSR3.ASM

       Defines:

         Trap16              hook interrupt 16
         Free16              release interrupt 16
         Okay16              verify interrupt 16

       Requires:

         INTR.ASM
         SHIFT.ASM

       The macros in this file allow a TSR to be invoked with a keystroke
       sequence.  The user must define TSR_SHIFT and TsrKey.  TSR_SHIFT
       should be equated to the shift keys (as defined in SHIFT.ASM) that
       must be pressed to invoke the TSR.  TsrKey defines the table of
       keystokes and associated TSR functions.  The format of TsrKey is:

         TsrKey LABEL BYTE
           DW code, OFFSET routine
           DW code, OFFSET routine
           DW 0

       'code' is a 16 bit keystroke code returned by INT 16 and 'routine'
       is the procedure associated with the keystroke.  You will need some
       sort of BIOS reference to look up the key codes returned by INT 16.

       Note that this manner of invoking TSR's (via interrupt 16) does not
       allow DOS functions to be used.  I/O can be performed through the
       BIOS.  The biggest disadvantage of the DOS restriction is that disk
       files cannot be accessed.

     VIDEO1.ASM

       Defines:

         ModDim              return the screen dimensions
         ModGet              return the current mode
         VidInit             initialize the video routines

         TEXT4012            40 x 12 mode (color VGA)
         TEXT4014            40 x 14 mode (color VGA)
         TEXT4021            40 x 21 mode (color VGA)
         TEXT4025            40 x 25 mode (CGA, color EGA, color VGA)
         TEXT4028            40 x 28 mode (color VGA)
         TEXT4043            40 x 43 mode (color EGA, color VGA)
         TEXT4050            40 x 50 mode (color VGA)
         TEXT8012            80 x 12 mode (color VGA)
         TEXT8014            80 x 14 mode (color VGA)
         TEXT8021            80 x 21 mode (VGA)
         TEXT8025            80 x 25 mode (all adapters)
         TEXT8028            80 x 28 mode (VGA)
         TEXT8043            80 x 43 mode (EGA, VGA)
         TEXT8050            80 x 50 mode (VGA)

       The routines in this file initialize and provide global support for
       the direct video routines.  VidInit must be called before the video


       routines in VIDEO3.ASM through VIDEO9.ASM are used.  Only text modes
       are supported.  The adapter must be in a valid text mode before
       running VidInit.  If the state of the adapter is uncertain, use the
       routines VidOpn and VidClo in VIDEO2.ASM instead of VidInit.

       The video routines may not work on some systems if the video page is
       non-zero when VidInit is called.  This occurs on systems that use a
       non-compatible video page addressing scheme.

       VidInit attempts to save the cursor appearance when turning the
       cursor on and off.  On some systems this feature will not work
       properly because the ROM does not always return the correct cursor
       type.  If turning the cursor on and off (using CurSet in VIDEO4.ASM)
       changes the appearance of the cursor, you might be able to fix the
       problem by using CurFix in VIDEO9.ASM.

     VIDEO2.ASM

       Defines:

         VidTyp              return the adapter type
         ModSet              switch to a mode
         VidOpn              initialize the video routines
         VidClo              uninitialize the video routines

         MDA                 monochrome display adapter
         CGAMON              color graphics adapter (monochrome)
         CGACOL              color graphics adapter
         EGAMON              enhanced graphics adapter, monochrome
         EGACOL              enhanced graphics adapter, color
         VGAMON              video graphics array, monochrome
         VGACOL              video graphics array, color
         MCGAMON             multi-color graphics adapter, monochrome
         MCGACOL             multi-color graphics adapter, color

       Requires:

         VIDEO1.ASM

       The routines in this file support video mode switching.  The
       routines VidOpn save the current video mode, switch to a valid text
       mode, and initialize the video routines.  VidClo restores the saved
       video mode.

     VIDEO3.ASM

       Defines:

         AtrSet              set the current attribute
         AtrGet              return the current attribute
         AtrFor              set the current foreground
         AtrBac              set the current background

         BLACK               black attribute
         BLUE                blue attribute
         GREEN               green attribute
         CYAN                cyan attribute
         RED                 red attribute


         MAGENTA             magenta attribute
         BROWN               brown attribute
         WHITE               white (gray) attribute
         BOLD                bold attribute
         BLINK               blink attribute

       Requires:

         VIDEO1.ASM

       The routines in this file get and set the attribute used in
       displaying output to the screen.  The initial attribute is read from
       the screen.  AtrGet and AtrSet work with a combined foreground and
       background attribute.  In a combined attribute, the foreground and
       background colors are stored in the first three bits of the lower
       and upper nibble of the attribute byte.  Colors can be combined into
       an attribute bytes as follows:

         mov al, (WHITE * 16) OR BLACK       ;back=WHITE, fore=BLACK
         call AtrSet                         ;set attribute

       Foreground and background colors can also be set separately with
       AtrFor and AtrBac.  The colors BLACK through WHITE can be used as
       either foreground or background colors.  BOLD and BLINK are
       characteristics that affect the entire attribute and must be
       combined with a foreground, background, or attribute byte using an
       OR.

     VIDEO4.ASM

       Defines:

         CurGet              return the cursor on/off state
         CurSet              turn the cursor on or off
         CurCol              return the current column
         CurRow              return the current row
         CurPos              return the current column and row
         CurMov              move the cursor to a location
         CurAdv              advance the cursor

       Requires:

         VIDEO1.ASM

       The routines in this file handle cursor positioning.  CurAdv moves
       the cursor toward the right edge of the screen by the number of
       characters last displayed by one of the routines in VIDEO5.ASM. Note
       that the cursor does not wrap around to the next line when the edge
       of the screen is reached.

     VIDEO5.ASM

       Defines:

         WrtChr              write a character
         WrtChrs             write multiple characters
         WrtStr              write a string
         WrtStrc             write a string with length


       Requires:

         VIDEO1.ASM

       The routines in this file writes characters and strings to the
       screen.

     VIDEO6.ASM

       Defines:

         ScrCls              clear the entire screen
         ScrClr              clear a screen area
         ScrPut              copy a screen area to memory
         ScrGet              copy memory to a screen area
         ScrSiz              return the bytes required for a screen area

       Requires:

         VIDEO1.ASM

       The routines in this file clears and copies portions of the screen.

     VIDEO7.ASM

       Defines:

         ScrCpy              copy a screen area to a new location

       Requires:

         VIDEO1.ASM

       The routine in this file copies areas of the screen to new areas of
       the screen.  ScrCpy can be used to scroll the screen.

     VIDEO8.ASM

       Defines:

         VidCol              determine if the adapter supports color

       Requires:

         VIDEO2.ASM

       The routine in this file determines if the adapter supports color.
       This is can be important for applications that must run on both
       color and monochrome adapters.

     VIDEO9.ASM

       Defines:

         CurFix              force standard underline cursor

       Requires:



         VIDEO1.ASM
         VIDEO2.ASM
         VIDEO4.ASM

       The routine in this file tries to make the cursor to appear as a
       blinking underline.  Though VidInit attempts to preserve the cursor
       appearance, not all systems return the correct cursor type.  Use
       CurFix to correct an odd looking cursor.  CurFix should be used
       after running VidInit or VidOpn.  CurFix will only work in 80 column
       by 25 row mode.

     XMODEM1.ASM

       Defines:

         XmdPutH             send an xmodem handshake
         XmdPut              send an xmodem block
         XmdRep              wait for an xmodem reply
         XmdGetH             receive an xmodem handshake
         XmdGet              receive an xmodem block
         XmdClr              clear the input pipe

         XMODEM_128          received a 128 byte block
         XMODEM_1024         received a 1024 byte block
         XMODEM_TIME         timeout error
         XMODEM_HEADER       bad block header
         XMODEM_NUMBER       block number error
         XMODEM_LAST         last block number
         XMODEM_WRONG        wrong block number
         XMODEM_CHECK        checksum error
         XMODEM_REPLY        bad reply
         XMODEM_NAKED        remote error (NAK)
         XMODEM_END          end of file (EOT)

         XMODEM_CRC          use 16 bit CRC (otherwise 8 bit checksum)
         XMODEM_BIG          use 1024 byte blocks (otherwise 128 bytes)
         XMODEM_FAST         use fast timer values (otherwise slow)

         XMODEM_SOH          start of 128 byte block constant
         XMODEM_STX          start of 1024 byte block constant
         XMODEM_ACK          acknowledge constant
         XMODEM_NAK          negative acknowledge constant
         XMODEM_EOT          end of transmission constant

       Requires:

         CHECK1.ASM
         CHECK3.ASM
         SERIAL1.ASM
         SERIAL2.ASM
         SERIAL3.ASM
         SERIAL4.ASM
         SERIAL5.ASM
         SERIAL6.ASM

       The routines in this file provide xmodem file transfer primitives.

     XMODEM2.ASM


       Defines:

         XmdUpl              upload a file
         XmdDwn              download a file

         XMODEM_MEMORY       not enough memory to perform transfer
         XMODEM_FILE         error read or writing file during transfer
         XMODEM_ABORT        transfer was aborted

       Requires:

         BUFFER1.ASM
         BUFFER2.ASM
         BUFFER3.ASM
         SERIAL1.ASM
         STACK.ASM
         XMODEM1.ASM

       The routines in this file implement full xmodem file transfers.  The
       result XMODEM_FILE is usually returned when the file cannot be
       opened or the disk being full.  A special NEAR procedure called
       XmdUsr must be written by the user.  XmdUsr is called by both XmdUpl
       and XmdDwn.  XmdUsr allows a program to check the current status and
       abort the transfer.

       The registers upon entering XmdUsr are:

         AL= flags
           bits 8 and 7 -
             00 handshake
             01 waiting for block
             10 waiting for reply
           bits 6 to 0 -
             xmodem flags (XMODEM_BIG, XMODEM_FAST, XMODEM_CRC)
         AH= last result code
         BX= total number of errors
         DX:CX= total bytes transferred

       On exiting, XmdUsr should set the carry flag if the transfer should
       abort, or clear the carry flag if the transfer should continue.

                                LIBRARY ROUTINES
                                ----------------

     AtrBac   VIDEO3.ASM    set the current background
     AtrFor   VIDEO3.ASM    set the current foreground
     AtrGet   VIDEO3.ASM    return the current attribute
     AtrSet   VIDEO3.ASM    set the current attribute
     BufAll   BUFFER1.ASM   allocate a buffer
     BufClo   BUFFER1.ASM   close a buffer file
     BufGet   BUFFER2.ASM   read an entire buffer
     BufOpn   BUFFER1.ASM   open a buffer file
     BufRel   BUFFER1.ASM   release a buffer
     BufPut   BUFFER3.ASM   write an entire buffer
     ChrLwr   CASE1.ASM     convert a character to lower case
     ChrUpr   CASE1.ASM     convert a character to upper case
     ComAll   SERIAL1.ASM   allocate an input buffer
     ComAny   SERIAL5.ASM   wait for any data from the serial port


     ComBrk   SERIAL8.ASM   send a modem break signal
     ComByt   SERIAL1.ASM   return the bytes waiting in the input buffer
     ComCar   SERIAL7.ASM   return the modem carrier flag
     ComClo   SERIAL1.ASM   close a serial port
     ComClr   SERIAL1.ASM   clear the input buffer
     ComDtr   SERIAL8.ASM   force the modem DTR line low
     ComEmp   SERIAL6.ASM   wait for pause in the flow of serial data
     ComGet   SERIAL1.ASM   read a byte from serial port
     ComGetW  SERIAL2.ASM   read a word of data from the serial port
     ComOpn   SERIAL1.ASM   open a serial port
     ComPut   SERIAL1.ASM   write a byte to the serial port
     ComPutW  SERIAL2.ASM   write a word of data to the serial port
     ComRea   SERIAL3.ASM   read a block of data from the serial port
     ComRel   SERIAL1.ASM   release an input buffer
     ComRep   SERIAL9.ASM   store a byte to the input buffer
     ComRng   SERIAL7.ASM   return the modem ring flag
     ComWai   SERIAL5.ASM   wait for a byte of data from the serial port
     ComWaiW  SERIAL5.ASM   wait for a word of data from the serial port
     ComWri   SERIAL4.ASM   write a block of data to the serial port
     CrcBlk   CHECK3.ASM    return the CRC of a block
     CrcCur   CHECK4.ASM    return the current CRC
     CrcRes   CHECK4.ASM    reset the current CRC
     CrcUpd   CHECK4.ASM    update the current CRC by a byte
     CurAdv   VIDEO4.ASM    advance the cursor
     CurCol   VIDEO4.ASM    return the current column
     CurFix   VIDEO9.ASM    force standard underline cursor
     CurGet   VIDEO4.ASM    return the cursor on/off state
     CurMov   VIDEO4.ASM    move the cursor to a location
     CurPos   VIDEO4.ASM    return the current column and row
     CurRow   VIDEO4.ASM    return the current row
     CurSet   VIDEO4.ASM    turn the cursor on or off
     DrwBox   DRAW1.ASM     draw a double line box
     EnvGet   ENVIRO.ASM    return the next environment string
     EnvPro   ENVIRO.ASM    get the current program path\name
     EnvRes   ENVIRO.ASM    reset the environment reader
     FilClo   FILE.ASM      close an open file
     FilCre   FILE.ASM      create a new file or truncate an existing file
     FilOpn   FILE.ASM      open an existing file
     FilRea   FILE.ASM      read from a file
     FilSee   FILE.ASM      move a file read/write pointer
     FilWri   FILE.ASM      write to a file
     Free16   TSR3.ASM      release interrupt 16
     Free21   TSR2.ASM      release interrupt 21
     GetByt   BUFFER2.ASM   read a buffer byte
     GetTok   BUFFER4.ASM   read a buffer token
     InpEsc   INPUT.ASM     prompt and wait for the escape key
     InpStr   INPUT.ASM     input a string
     InpVer   INPUT.ASM     verify something with a yes or no
     IntGet   INTR.ASM      get an interrupt vector
     IntSet   INTR.ASM      set an interrupt vector
     Keep     TSR1.ASM      install TSR
     KeyClr   KEYBRD.ASM    clear the keyboard buffer
     KeyGet   KEYBRD.ASM    get keystroke if available
     KeyHit   KEYBRD.ASM    return the keyboard status
     KeyRep   KEYBRD.ASM    replace a keystroke
     KeyShf   SHIFT.ASM     return shift state
     KeyWai   KEYBRD.ASM    wait for a keystroke
     MacAdr   MACRO1.ASM    return the address of a symbol


     MacAll   MACRO1.ASM    allocate macro code and data areas
     MacBug   MACRO1.ASM    the debug flag (an 8 bit variable)
     MacCom   MACRO1.ASM    load and compile a macro
     MacCur   MACRO2.ASM    return the current state (IP,stack,return)
     MacLoa   MACRO1.ASM    load a stack item from an external routine
     MacRel   MACRO1.ASM    release macro code and data areas
     MacRes   MACRO1.ASM    reset the currently loaded macro
     MacRet   MACRO2.ASM    read values from the return stack
     MacRun   MACRO1.ASM    run the currently loaded macro
     MacStk   MACRO2.ASM    read values from the stack
     MacSto   MACRO1.ASM    store a stack item from an external routine
     MacSym   MACRO2.ASM    return the symbol associated with an address
     MacUnd   MACRO2.ASM    return an undefined compile symbol
     MemAll   MEMORY.ASM    allocate a memory block
     MemRel   MEMORY.ASM    release a memory block
     MesErr   MESSAGE2.ASM  display a message to error output
     MesErrL  MESSAGE2.ASM  display a message and CR/LF to error output
     MesPut   MESSAGE1.ASM  display a message to standard output
     MesPutL  MESSAGE1.ASM  display a message and CR/LF to standard output
     ModDim   VIDEO1.ASM    return the screen dimensions
     ModGet   VIDEO1.ASM    return the current mode
     ModSet   VIDEO2.ASM    switch to a mode
     Okay16   TSR3.ASM      verify interrupt 16
     Okay21   TSR2.ASM      verify interrupt 21
     ParGet   PARMS.ASM     return the next parameter
     ParRes   PARMS.ASM     reset the parameter reader
     ProEsc   PROMPT.ASM    display a prompt with "  ; Press ESC" appended
     ProVer   PROMPT.ASM    display a prompt with " (Y/N)?" appended
     ProWrt   PROMPT.ASM    display a prompt
     PutByt   BUFFER3.ASM   write a buffer byte
     Query    TSR2.ASM      query resident TSR
     RndNum   RANDOM.ASM    return a random number
     RndNumN  RANDOM.ASM    return a random number in the range 0 to N-1
     RndSed   RANDOM.ASM    seed the number generator
     RunPro   SHELL1.ASM    execute a program
     RunSys   SHELL2.ASM    run a secondary command processor
     ScrClr   VIDEO6.ASM    clear a screen area
     ScrCls   VIDEO6.ASM    clear the entire screen
     ScrCpy   VIDEO7.ASM    copy a screen area to a new location
     ScrGet   VIDEO6.ASM    copy memory to a screen area
     ScrPut   VIDEO6.ASM    copy a screen area to memory
     ScrSiz   VIDEO6.ASM    return the bytes required for a screen area
     SndOff   SOUND.ASM     turn the speaker off
     SndOn    SOUND.ASM     turn the speaker on
     StkAll   STACK.ASM     allocate stack memory
     StkRel   STACK.ASM     release stack memory
     StrCmp   STRING.ASM    compare two strings
     StrCmpF  STRINGF.ASM   compare two far strings
     StrCpy   STRING.ASM    copy a string
     StrCpyF  STRINGF.ASM   copy a far string
     StrJusL  JUSTIFY2.ASM  left justify a string
     StrJusR  JUSTIFY1.ASM  right justify a string
     StrLen   STRING.ASM    return the length of a string
     StrLenF  STRINGF.ASM   return the length of a far string
     StrLwr   CASE2.ASM     convert a string to lower case
     StrUpr   CASE2.ASM     convert a string to upper case
     SumBlk   CHECK1.ASM    return the checksum of a block
     SumCur   CHECK2.ASM    return the current checksum


     SumRes   CHECK2.ASM    reset the current checksum
     SumUpd   CHECK2.ASM    update the current checksum by a byte
     TicPas   TICKS.ASM     return the ticks since a timer was reset
     TicRes   TICKS.ASM     reset a timer
     TicSys   TICKS.ASM     return the current system time
     TicWai   TICKS.ASM     do nothing for a tick duration
     Trap16   TSR3.ASM      hook interrupt 16
     Trap21   TSR2.ASM      hook interrupt 21
     VidClo   VIDEO2.ASM    uninitialize the video routines
     VidCol   VIDEO8.ASM    determine if the adapter supports color
     VidInit  VIDEO1.ASM    initialize the video routines
     VidOpn   VIDEO2.ASM    initialize the video routines
     VidTyp   VIDEO2.ASM    return the adapter type
     WrtChr   VIDEO5.ASM    write a character
     WrtChrs  VIDEO5.ASM    write multiple characters
     WrtStr   VIDEO5.ASM    write a string
     WrtStrc  VIDEO5.ASM    write a string with length
     XmdClr   XMODEM1.ASM   clear the input pipe
     XmdDwn   XMODEM2.ASM   download a file
     XmdGet   XMODEM1.ASM   receive an xmodem handshake
     XmdGetH  XMODEM1.ASM   receive an xmodem handshake
     XmdPut   XMODEM1.ASM   send an xmodem handshake
     XmdPutH  XMODEM1.ASM   send an xmodem handshake
     XmdRep   XMODEM1.ASM   wait for an xmodem reply
     XmdUpl   XMODEM2.ASM   upload a file
