home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / wasm202.zip / WASM.DOC < prev   
Text File  |  1987-03-08  |  196KB  |  4,756 lines

  1.  
  2.        
  3.        
  4.        
  5.        
  6.        
  7.        
  8.        
  9.        
  10.        
  11.        
  12.        
  13.        
  14.        
  15.                                   \\\ WASM ///
  16.        
  17.                                Wolfware Assembler
  18.                                   Version 2.02
  19.        
  20.                                   User's Manual
  21.        
  22.        
  23.                         (C) Copyright 1987 by Eric Tauck
  24.        
  25.                                 Wolfware Programs
  26.        
  27.  
  28.        
  29.        
  30.                                 Table of Contents
  31.        
  32.              Introduction ....................................... 1
  33.              Distribution Policy ................................ 2
  34.              Assembling Programs ................................ 3
  35.              Basic Syntax ....................................... 5
  36.                Symbols .......................................... 7
  37.                Instructions ..................................... 8
  38.                Operands ......................................... 9
  39.                Operand Expressions ............................. 13
  40.              Program Structure ................................. 15
  41.              Procedures ........................................ 16
  42.              Conditional Assembly .............................. 17
  43.                Conditional Directives .......................... 18
  44.                Nested Conditional Assembly ..................... 21
  45.                Conditional Operators ........................... 23
  46.                Conditional Operand Testing ..................... 24
  47.              Macros ............................................ 26
  48.                Defining Macros ................................. 27
  49.                Invoking Macros ................................. 29
  50.                Nested Macros ................................... 31
  51.                Conditional Macros .............................. 32
  52.                Listing of Macros ............................... 33
  53.              Data .............................................. 34
  54.              Assembly Directives ............................... 36
  55.              Functional Operands ............................... 54
  56.              Assembly Constants ................................ 60
  57.              Reserved Symbols .................................. 63
  58.              Assembly Listing .................................. 64
  59.              Symbol Table Listing .............................. 66
  60.              Assembly Messages ................................. 67
  61.              Instruction Set ................................... 78
  62.              External Subroutines .............................. 90
  63.              Source Code Clarification ......................... 91
  64.              Memory Limitations ................................ 95
  65.              Bibliography ...................................... 96
  66.              Index ............................................. 97
  67.        
  68.  
  69.        Introduction                                                     1
  70.        
  71.                                   Introduction
  72.        
  73.        Wolfware Assembler (WASM) is an assembler for the 8086 and related
  74.        microprocessors.  It takes a standard ASCII text file of
  75.        instruction mnemonics for input and produces an executable COM
  76.        file and an optional list file for output.
  77.        
  78.        - Minimum system requirements: an IBM PC or compatible computer,
  79.          MS/PC DOS 2.00 or up, and about 100 kilobytes of free memory.
  80.        
  81.        - Features: supports full range of 8086 instructions and
  82.          addressing, most standard assembly directives, signed and
  83.          unsigned numbers, operand expressions, conditional assembly,
  84.          macros, produces executable code (does not require linking), and
  85.          fairly fast operation.
  86.        
  87.        Assembly language is a programming language in which the source
  88.        statements are translated directly into individual microprocessor
  89.        instructions.  This direct translation allows complete control
  90.        over the computer and the greatest possible optimization of a
  91.        program.  Programming in assembly language has immediate and
  92.        practical benefits:
  93.        
  94.        - Programs can be made to run hundreds, maybe thousands of times
  95.          faster than their high level language counterparts.
  96.        
  97.        - Programs are usually much smaller and more efficient.
  98.        
  99.        - Programs can take full advantage of the system it is meant to
  100.          run on.
  101.        
  102.        Assembly language is essential where speed, compactness, and low
  103.        level or hardware control are the primary requirements.  WASM is
  104.        best suited for writing smaller, stand-alone programs and
  105.        optimized routines that are used by other programs.  WASM is ideal
  106.        for writing machine language subroutines for BASIC or Turbo
  107.        Pascal.
  108.        
  109.        The disadvantage of assembly language is that the writing and
  110.        debugging of such programs are often more difficult.  Another
  111.        consideration is that assembly language is not very portable, i.e.
  112.        programs written in assembly language are usually restricted to
  113.        one type of computer.
  114.        
  115.        WASM is easier to use than most commercial assemblers because of
  116.        its simplified syntax and program structure.  Of course, by the
  117.        same token, WASM is not necessarily compatible with other
  118.        assemblers.
  119.        
  120.        Though this documentation explains some of the basic concepts of
  121.        assembly language, no attempt is made to to teach it.  The user
  122.        should be familiar with the basic concepts of programming and have
  123.        a general knowledge of the the 8086 microprocessor.  See the
  124.        bibliography for some possible reference materials.
  125.        
  126.  
  127.        2                                              Distribution Policy
  128.        
  129.                                Distribution Policy
  130.        
  131.        You are encouraged to freely share and distribute unmodified
  132.        copies of this program and documentation.  A nominal fee may be
  133.        charged to cover the costs of duplication and distribution.
  134.        
  135.        If you find this program useful, you are asked to help support its
  136.        development by registering your copy.  To register, send $10 to:
  137.        
  138.          Eric Tauck
  139.          Wolfware Programs
  140.          1304 Deerpass Road
  141.          Marengo, IL  60152
  142.        
  143.        You can use the registration form in the file REGFORM.DOC for this
  144.        purpose.  Please make checks payable to Eric Tauck.
  145.        
  146.        Registration entitles you to one year of support, which includes:
  147.        
  148.          1) Notification of any significant new versions of WASM.
  149.          2) The option to upgrade at any time for $5.
  150.        
  151.        The terms and prices of registration will be effective at least
  152.        through 1987.  Whether you register or not, feel free to comment
  153.        about the program or documentation.  In addition to the address
  154.        above, I can also be reached electronically at:
  155.        
  156.          BIX ........... etauck
  157.          CompuServe .... 72457,1557
  158.          GEnie ......... e.tauck
  159.          People/Link ... ofr215
  160.        
  161.        I usually check for electronic mail twice a week.
  162.        
  163.  
  164.        Assembling Programs                                              3
  165.        
  166.                                Assembling Programs
  167.        
  168.        Programs are assembled by running the assembler and specifying the
  169.        names of the source, object, and list files.  To run the assembler
  170.        from any DOS prompt, you type "WASM" and then a carriage return.
  171.        A brief opening message will be displayed and you will be prompted
  172.        for all the required information.  Default file names will be
  173.        provided if no name is otherwise specified.  The default name
  174.        appears in brackets at the end of the prompt line.  An entire file
  175.        name consists of a path, filename, and extension.  The drive
  176.        specification is considered part of the path.
  177.        
  178.        The source file contains the list of instructions that are to be
  179.        assembled into machine code.  It must be a standard ASCII text
  180.        file created by the user before assembly.  If you enter a source
  181.        file name without an extension, the default extension of ASM will
  182.        be automatically added to it.  ASM is the standard filename
  183.        extension for assembler source files.
  184.        
  185.        The object file contains the machine code result of the assembly.
  186.        The object file will be created if it doesn't already exist; if
  187.        does exist the original file will be overwritten.  The default
  188.        name is the source path and filename with an extension COM.  You
  189.        may enter any component(s) of the name which you want to be
  190.        different from the default name (like only the path and extension
  191.        for instance).  COM is reserved by DOS as the filename extension
  192.        for executable "command" files.  The object file is not a linkable
  193.        object file, but a binary image of the compilation.  The object
  194.        file, assuming the source code was logically correct and that
  195.        there were no errors during assembly, is directly executable from
  196.        DOS.  If you use the extension COM, you can run the assembled
  197.        program just by typing its filename.
  198.        
  199.        The list file contains the listing of the assembly.  The list file
  200.        will be created if it doesn't already exist; if does exist the
  201.        original file will be overwritten.  If no list file is specified,
  202.        no listing will be produced. If you do enter a filename, the
  203.        object path and an extension of LST will be used as the default.
  204.        Specifying CON as the list file will send the listing to the
  205.        screen, and specifying PRN as the list file will send the listing
  206.        to the printer.  The listing itself is more thoroughly described
  207.        under Assembly Listing.
  208.        
  209.        The names of the three files may be entered on the command line
  210.        when WASM is initially executed.  To do this you must provide at
  211.        least the name of the source file.  The other two names are
  212.        optional.  All names should be separated from each other by a
  213.        comma.  You can use a default name by placing a comma without a
  214.        name, or by just leaving the name off the end.  The normal
  215.        defaults to all names still apply.  WASM will display the names of
  216.        the three files taken from the command line.
  217.        
  218.  
  219.        4                                              Assembling Programs
  220.        
  221.        Examples of command line file specifications:
  222.        
  223.          WASM TEST
  224.            source is TEST.ASM, object is TEST.COM, and there is no list
  225.        
  226.          WASM ABC, , ABC
  227.            source is ABC.ASM, object is ABC.COM, and list is ABC.LST
  228.        
  229.          WASM  SUBRT, .BLD
  230.            source is SUBRT.ASM, object is SUBRT.BLD, and there is no list
  231.        
  232.          WASM TEST.TXT, STUPID.BIN, HELLO.DOC
  233.            source is TEST.TXT, object is STUPID.BIN, and list is
  234.            HELLO.DOC
  235.        
  236.          WASM A:\ASSM\PROG1,,B:PROG1
  237.            source is A:\ASSM\PROG1.ASM, object is A:\ASSM\PROG1.COM, and
  238.            the list is B:PROG1.LST
  239.        
  240.          WASM GAME.SRC, C:\GAMES\.COD, C:\LISTS\GAME
  241.            source is GAME.SRC, object is C:\GAMES\GAME.COD, and the list
  242.            is C:\LISTS\GAME.LST
  243.        
  244.        If there are errors detected during assembly, they will be
  245.        displayed in the listing.  If there is no listing being generated,
  246.        the errors will be displayed to the screen along with the line
  247.        causing the error.  Any errors should be corrected and the program
  248.        reassembled before running or debugging the program.
  249.        
  250.        At the end of assembly several statistics are displayed: the
  251.        number of errors, the number of lines assembled, the number of
  252.        bytes of code, and the number of symbols defined.  These
  253.        statistics are sent to the list file if a listing is being
  254.        generated, otherwise they will be displayed to the screen.  A
  255.        message stating if any errors where detected will shown if the
  256.        assembly statistics were not displayed to the screen.
  257.        
  258.        An error code is returned upon termination.  This error code can
  259.        be acted upon in a batch file with ERRORLEVEL (see your DOS manual
  260.        for details).  The error codes are as follows:
  261.        
  262.         Code  Meaning
  263.         ----  -------
  264.          0    no lines flagged
  265.          1    lines were flagged for comment but no errors were detected
  266.          2    errors were detected but the assembly was completed
  267.          3    the assembly was prematurely terminated due to errors
  268.          4    assembly could not begin (incorrect DOS or not enough mem.)
  269.        
  270.  
  271.        Basic Syntax                                                     5
  272.        
  273.                                   Basic Syntax
  274.        
  275.        The source file must be a standard ASCII text file.  The only
  276.        control characters given special treatment are line boundaries
  277.        (ASCII codes 13 and 10) and end of file markers (ASCII code 26).
  278.        All other control characters are treated as spaces.  The source
  279.        lines may be up to 160 characters long.  If the source file does
  280.        not have an end of file marker, the assembler will read the number
  281.        of bytes recorded in the directory. The line editor EDLIN.COM
  282.        provided with DOS is suitable for creating source files.
  283.        
  284.        All 8086 instructions perform an operation on zero, one, or two
  285.        operands.  Assembly directives (commands to control the assembler
  286.        itself) are implemented in a similar manner.  Generally each line
  287.        will contain a single 8086 instruction, or directive, and its
  288.        operands.  In addition to instructions and their operands, a line
  289.        may contain a symbol declaration.
  290.        
  291.        The source file is assembled line by line.  Each line is divided
  292.        up into fields separated by delimiters.  Delimiters consist of
  293.        spaces and most control characters.  How the assembler tries to
  294.        interpret each field is based on the location of the field within
  295.        the line.  Lines are interpreted according to the following
  296.        format:
  297.        
  298.                    Symbol    Instruction  Operands    ;Comment
  299.        
  300.        Symbols must begin on the first character of the line.  If the
  301.        first character of a line is a delimiter, the line is assumed not
  302.        to contain a symbol declaration.  Symbols are only required when
  303.        the instruction is one that specifically defines some sort of
  304.        symbol (like an equate or macro declaration).  Symbols may be any
  305.        length as long as they fit on the line.  Symbols may consist of
  306.        most characters as long as they are unique from each other and all
  307.        predefined symbols.  The rule of thumb is to start symbols with a
  308.        letter and make the rest of the symbol out of numbers, letters,
  309.        and underscores.  Restrictions on symbol declarations are more
  310.        thoroughly described under Reserved Symbols.  Symbols in general
  311.        are described under Symbols.
  312.        
  313.        Instructions must be separated by at least one delimiter from the
  314.        symbol.  If there is no symbol, at least one delimiter must
  315.        precede the instruction (so it doesn't start on the first
  316.        character of the line).  All instructions are predefined.  See
  317.        Instructions.
  318.        
  319.        Operands must be separated by at least one delimiter from the
  320.        instruction.  Since a single operand may consist of multiple
  321.        fields, operands must be separated from each other by commas.  The
  322.        instruction determines how many of what kind of operands are
  323.        required.  See Operands.
  324.        
  325.  
  326.        6                                                     Basic Syntax
  327.        
  328.        Comments come at the end of the line after a semi-colon.  Comments
  329.        may consist of anything and be any length as long as they fit on
  330.        the line.  Comments are always optional and are only there to
  331.        assist the programmer in understanding the source code.
  332.        
  333.        Blank lines may be placed in the source code to improve
  334.        readability.  Blank lines are ignored by the assembler.  Lines may
  335.        also contain only a comment, in which case they are treated as
  336.        blank lines.
  337.        
  338.  
  339.        Symbols                                                          7
  340.        
  341.                                      Symbols
  342.        
  343.        Symbols are used to identify certain aspects of the source
  344.        program.  Symbols allow those aspects to be referenced
  345.        symbolically.  The effective use of symbols can make a program
  346.        easier to understand.  Symbols can also simplify the modification
  347.        of a program.  By changing the portion of the program represented
  348.        by the symbol, you automatically change the program at every
  349.        location the symbol is used.
  350.        
  351.        A symbol is created by declaring it.  This is done by placing the
  352.        symbol field on the first column of a source line.  A line may
  353.        contain only a symbol, or only a symbol and a comment.  Declaring
  354.        a symbol causes the assembler to internally store it in the symbol
  355.        table.  An ambiguity arises if a particular field is defined more
  356.        than once as a symbol, since if that symbol is used, the assembler
  357.        will not be able to tell which definition is actually being
  358.        accessed.  For this reason, all symbols must be unique from each
  359.        other.  In addition to being unique from each other, programmer
  360.        defined symbols must be unique from all predefined symbols.
  361.        Restrictions on symbol declarations are more thoroughly described
  362.        under Reserved Symbols.
  363.        
  364.        Symbols come in several different types, the most common of which
  365.        is the label.  Labels identify a location in memory.  Labels are
  366.        used for two purposes, branching and data access.  Labels for
  367.        branching are called near labels.  Labels for data access are
  368.        called memory labels.  Memory labels come in different sizes
  369.        according to how many bits of memory are referenced.  The other
  370.        symbol types are equates and macros.  Equates represent a single
  371.        number.  Macros represent an entire series of instructions.
  372.        
  373.        The symbol type is determined by the instruction.  The declaration
  374.        directives (DB, DW, and DS) create memory labels, the EQU
  375.        directive creates an equate, the MACRO directive creates a macro,
  376.        and the LABEL directive creates a label of a specified type.  Most
  377.        other instructions, and symbols on lines without instructions,
  378.        result in near labels.
  379.        
  380.        Symbols are used by the program in two different ways, as
  381.        instructions and as operands.  Only macros are used as
  382.        instructions.  The remaining symbol types are used as operands.  A
  383.        symbol does not have to be declared before it is used, i.e. memory
  384.        references, equates, and macros may be declared anywhere in the
  385.        program.  Near labels should be placed at the location where the
  386.        code execution should continue after the branch.
  387.        
  388.  
  389.        8                                                     Instructions
  390.        
  391.                                   Instructions
  392.        
  393.        An 8086 instruction specifies the action that should be carried
  394.        out on the operands by the microprocessor.  Assembly directives
  395.        are special instructions to control the assembly itself.  8086
  396.        instructions and directives are implemented in the same manner,
  397.        there is no syntactic difference between the two.
  398.        
  399.        Over a hundred different instructions are recognized by the 8086
  400.        microprocessor.  The two major types of instructions are those
  401.        that manipulate bits in memory and those that transfer control
  402.        from one location in the program to another.  A summary of all the
  403.        legal instructions can be found under Instruction Set. For a full
  404.        explanation of all 8086 instructions, you should acquire a book on
  405.        the subject.
  406.        
  407.        There are assembly directives for many different purposes.
  408.        Specific assembly directives are described in their relevant
  409.        sections and under Assembly Directives.
  410.        
  411.  
  412.        Operands                                                         9
  413.        
  414.                                     Operands
  415.        
  416.        The operands describe what is being acted upon by the instruction.
  417.        There are many different types of operands.  The number and type
  418.        of operands required is determined by the particular instruction.
  419.        The operands needed for an instruction can be looked up under
  420.        Instruction Set.  WASM figures out the type of an operand by
  421.        looking at it and trying to match it to one of the formats it
  422.        recognizes.  If the operand is not recognized as a standard
  423.        predefined type, the symbol table is searched to see if has been
  424.        defined by the programmer.
  425.        
  426.        The following is a list of the legal operand types and their
  427.        formats:
  428.        
  429.          I. Immediate data operands.
  430.        
  431.             A. Numbers with an optional plus or minus preceding it.  All
  432.                numbers must begin with a 0 to 9, and anything that begins
  433.                as such is considered a number.  Numbers with a sign must
  434.                be in the range -32768 to +32767, otherwise they must be 0
  435.                to 65535
  436.        
  437.                1. A binary number of up to 16 digits of ones and zeros
  438.                   followed by a "B".
  439.        
  440.                2. A decimal number from 0 to 65535.
  441.        
  442.                3. A hexadecimal number of up to 4 digits of 0 to F
  443.                   followed by an "H".  Hexadecimal numbers that begin
  444.                   with A to F should have a preceding 0.
  445.        
  446.             B. A character enclosed in single quotes.  The character is
  447.                converted to an 8 bit ASCII value, so 'z' would be the
  448.                same as the number 122.
  449.        
  450.             C. A pair of characters enclosed in single quotes.  The
  451.                characters are converted to a 16 bit value calculated from
  452.                their ASCII values.  If 'ab' where moved into a register,
  453.                the high byte would receive the value of 'b' and the low
  454.                byte would receive the value of 'a'.  'ab' is the same as
  455.                the number (98*256)+97 = 25185 or 6261H.  The values of
  456.                'a' and 'b' are backwards because of the way the 8086
  457.                stores 16 bit numbers.
  458.        
  459.             D. Assembly constants.  These are special symbols that return
  460.                a value set by the assembler.  See Assembly Constants.
  461.        
  462.         II. Register operands.
  463.        
  464.             A. One of the following 8 bit registers:
  465.        
  466.                 AH  AL  BH  BL  CH  CL  DH  DL
  467.        
  468.  
  469.        10                                                        Operands
  470.        
  471.             B. One of the following 16 bit registers:
  472.        
  473.                 AX  BX  CX  DX  SP  BP  SI  DI
  474.        
  475.             C. One of the following segment registers:
  476.        
  477.                 CS  SS  DS  ES
  478.        
  479.        III. Memory operands.
  480.        
  481.             A. Direct addressing with a value enclosed by brackets.  All
  482.                numbers (immediate data) inside the brackets are added or
  483.                subtracted together to form the value.
  484.        
  485.             B. Indirect addressing through the use of one of the
  486.                following register combinations with an optional value
  487.                added or subtracted in:
  488.        
  489.                 BX  BP  DI  SI
  490.        
  491.                 BX+DI  BX+SI  BP+DI  BP+SI
  492.        
  493.                All the addressing components should be surrounded by
  494.                brackets.  The registers can appear in any order and may
  495.                be mixed up with any numbers.  All numbers (immediate
  496.                data) are added or subtracted together to form the value.
  497.                The OFFSET function is assumed for any labels (OFFSET can
  498.                be left out).
  499.        
  500.         IV. A string of any sequence of characters surrounded by single
  501.             quotes.  Note: single quotes cannot be represented as a
  502.             character in a string or as an immediate data character, it
  503.             can only be represented as a numerical value.
  504.        
  505.          V. A single question mark.  This means the the programmer
  506.             doesn't know or care what the operand is.  A question mark is
  507.             interpreted as a zero.
  508.        
  509.         VI. Certain symbols types are used as operands, including equates
  510.             and labels.  See Symbols.
  511.        
  512.        VII. Functional operands may be used to modify or isolate specific
  513.             aspects of of other operands.  See Functional Operands.
  514.        
  515.        Operands always have a size associated with them (measured in
  516.        bits).  If the instruction is one that transfers data from one
  517.        operand to another, the sizes of the operands for the instruction
  518.        must agree.
  519.        
  520.        The size of immediate data is the number bits it represents.
  521.        Usually 8 bits of immediate data is compatible with 16 bits (i.e
  522.        WASM is smart enough to extend 8 bits of data into 16 bits).
  523.        
  524.  
  525.        Operands                                                        11
  526.        
  527.        Immediate data sizes:
  528.        
  529.          Immediate Data                 Size in Bits
  530.          --------------                 ------------
  531.          unsigned number 0 to 255         8 or 16
  532.          signed number -128 to 127        8 or 16
  533.          character in quotes              8 or 16
  534.          unsigned number 0 to 65535       16
  535.          signed number -32728 to 32727    16
  536.          double character in quotes       16
  537.        
  538.        The size of register and memory operands are the number of bits
  539.        that can be moved in and out of them.  The size of registers are
  540.        predefined.  The size of memory operands must be defined in the
  541.        declaration or with a functional operand that sets the size.  If a
  542.        memory operand is being operating upon with a register, the memory
  543.        operand is assumed to be the same size as the register.
  544.        
  545.        Examples of operands:
  546.        
  547.          ;*** Immediate Data ***
  548.        
  549.           Mov Dh, -100
  550.           Mov Bl, 00101001b
  551.           Mov Al,'W'     ;move the ASCII value of upper-case w to AL
  552.        
  553.           Mov Ax,', '    ;move a comma and space into AX,
  554.           Stosw          ;it is stored in the same order (comma first)
  555.        
  556.          ;remember that numbers MUST start with 0 to 9, even
  557.          ;hexadecimal numbers
  558.           Mov Ax,0ffffh  ;move ffff hex to AX
  559.        
  560.          ;*** Registers ***
  561.        
  562.          ;8 bit examples
  563.           Mov AL,DL
  564.           Mov CL,0
  565.        
  566.          ;16 bit examples
  567.           Mov Ax,Dx
  568.           Mov Cx,0
  569.        
  570.          ;segment examples
  571.           Mov Dx,Ss
  572.           Mov Cx,0   ;
  573.           Mov Es,Cx  ;cannot move immed. directly to seg
  574.        
  575.  
  576.        12                                                        Operands
  577.        
  578.          ;*** Memory operands ***
  579.        
  580.          ;direct reference examples
  581.           Mov [100],Ax           ;size is the same as AX
  582.           Mov Byte [100], 0      ;size is set with BYTE
  583.           Push Data              ;DATA is defined below, not ambiguous
  584.           Mov Data,0
  585.        
  586.          ;the next three produce the same effect
  587.           Mov CX,[Data]          ;OFFSET implied
  588.           Mov CX,[Offset Data]
  589.           Mov CX,Data            ;this is best
  590.        
  591.          ;indirect reference examples
  592.           Mov [Bx],Ax
  593.           Mov Dx,[Bx+Si+100]
  594.           Inc Byte [Offset Data+Di-1001011b+Bp-3]
  595.           Mov Cx, [Data+Bx]      ;BX acts as an index into DATA
  596.        
  597.          Data Dw  ?
  598.        
  599.          ;*** Near labels ***
  600.        
  601.          Label1                  ;no code, points to line below
  602.          Lable2  Label   Near    ;a label declaration, same as above
  603.          Label3  Nop             ;points to its own instruction
  604.          ;
  605.          ;all three of these jump to the NOP instruction above
  606.           Jmps Label1
  607.           Jmps Label2
  608.           Jmps Label3
  609.        
  610.          ;*** Strings ***
  611.        
  612.           Db 'this is a string'
  613.           Db 'it',39,'s cold'    ;this declares the string "it's cold"
  614.        
  615.  
  616.        Operand Expressions                                             13
  617.        
  618.                                Operand Expressions
  619.        
  620.        Immediate data operands may be combined into expressions.  Any
  621.        number of operands may be combined sequentially.  Parenthesis may
  622.        also be used within expressions to control the order of
  623.        evaluation.  Parenthesis can be nested approximately ten deep.  A
  624.        sign may come before parenthesis, but the range of the value
  625.        within the parenthesis is not checked.  All operand expressions
  626.        are evaluated during assembly.
  627.        
  628.        Near and memory labels may also be modified via expressions.  Any
  629.        immediate data operands may be combined with a near or memory
  630.        label.  Adding or subtracting a value to or from a label has the
  631.        effect of an additional displacement.  The label must be the first
  632.        component of the expression.
  633.        
  634.        The legal operators for combining operands are:
  635.        
  636.          Operator  Function
  637.          --------  --------
  638.             +      addition        <--)  Arithmetic
  639.             -      subtraction        )
  640.             *      multiplication     )
  641.             /      division           )
  642.             \      remainder          )
  643.             MOD    remainder       <--)
  644.             AND    and             <----)  Logic
  645.             OR     or                   )
  646.             XOR    xor             <----)
  647.             =      equals          <------)  Conditional
  648.             <      less than              )
  649.             >      greater than    <------)
  650.        
  651.        The use of conditional operators are described under Conditional
  652.        Operators, the other operators carry out the specified standard
  653.        arithmetic and logic operations.  If some sort of error occurs
  654.        with AND, OR, XOR, or MOD, instead of displaying the literal
  655.        operator, only the first letter A, O, X, or \ for MOD will be
  656.        displayed.
  657.        
  658.        Examples of operand expressions:
  659.        
  660.          ;the following lines all assemble to "move zero to AX"
  661.           Mov Ax,0
  662.           Mov Ax,-21 + ((20 Mod 19)+ 20)
  663.           Mov Ax,-21 - -21
  664.           Mov Ax,50000 * (10\10)
  665.           Mov Ax,-6 / -3 - 2
  666.           Mov Ax,Not (1111111111111110b Or (0feh Xor (65535 And 1)))
  667.           Mov Ax,0ffh-128-64-32-16-8-4-2-1
  668.        
  669.  
  670.        14                                             Operand Expressions
  671.        
  672.          ;here is how to load a double word
  673.          ;of storage a word at a time
  674.           Mov Word Location, Offset Routine   ;load first word
  675.           Mov Ax, Ds
  676.           Mov Word Location + 2, Ax           ;load second word
  677.        
  678.          Location Label Dword
  679.           Ds 4
  680.        
  681.  
  682.        Program Structure                                               15
  683.        
  684.                                 Program Structure
  685.        
  686.        Though programs may be organized in any fashion, it is usually a
  687.        good idea to make them "structured."  Structured programs are
  688.        generally easier to understand and modify.  Because of their
  689.        inherently straightforward design, structured programs are less
  690.        likely to contain errors and usually accomplish the task with a
  691.        minimum of code.
  692.        
  693.        Structured programming divides a program into separate routines,
  694.        each of which is treated like a separate program.  Every routine
  695.        encompasses a single or group of functions that make up the total
  696.        operation of the program.  Direct transfer of control from one
  697.        routine to another is not allowed.  Direct communication between
  698.        routines is also not allowed.  A routine may call another routine,
  699.        but when the other routine is finished, control must be returned
  700.        to the caller.  Information should only be passed from a routine
  701.        to its subroutine by parameters or by data that is explicitly
  702.        intended as global.
  703.        
  704.        Assembly language doesn't naturally lend itself to structured
  705.        programming the way a high-level language like Pascal does.  There
  706.        is nothing to prevent the programmer from entering a routine and
  707.        then jumping directly to another routine.  WASM provides two
  708.        methods to assist in creating a structured program: procedures and
  709.        macros.  The implementation for procedures and macros are
  710.        described under Procedures and Macros, respectively.
  711.        
  712.  
  713.        16                                                      Procedures
  714.        
  715.                                    Procedures
  716.        
  717.        A procedure is a type of programmer defined routine.  A procedure
  718.        is accessed with the 8086 CALL instruction.  Only one copy of a
  719.        procedure exists, unlike macros, which, in the process of
  720.        assembly, create a copy of their routine every time they are
  721.        invoked.  The use of procedures makes a program shorter but
  722.        slower.  Lengthy routines should always be declared as procedures,
  723.        especially if they are called in many different places.
  724.        Parameters are passed to procedures through registers or by
  725.        placing the data on the stack.
  726.        
  727.        Procedures are implemented by the PROC and ENDP directives.  PROC
  728.        starts a procedure.  Its operand is either NEAR, for routines in
  729.        the same segment, or FAR, for routines that may be in another
  730.        segment.  All procedures that are called from within the program
  731.        should be NEAR.  FAR should be used by procedures that will be
  732.        called externally from another program, like a machine language
  733.        BASIC subroutine, or for routines that are called indirectly, like
  734.        an interrupt handler.  A symbol may be declared along with the
  735.        PROC directive.  This symbol becomes the label that identifies the
  736.        procedure and is used when calling it.  ENDP finishes a procedure.
  737.        It has no operands.
  738.        
  739.        The last executed 8086 instruction in a procedure should be a RET.
  740.        This instruction will return control to the code that called the
  741.        routine in the first place.
  742.        
  743.        Procedures may be nested up to ten deep.  The nest number of a
  744.        procedure is displayed in the listing, see Assembly Listing.
  745.        Nesting a procedure doesn't really make it local, as is implied,
  746.        though it still should be treated as if it were.  Procedures
  747.        should not be called outside of the procedure that they were
  748.        declared in.  Also data declared inside of a procedure should not
  749.        be accessed outside of it.
  750.        
  751.        Procedural declarations create object code.  This means that the
  752.        program must either jump around them or the declarations must be
  753.        placed somewhere out of the way, like at the end of the program.
  754.        
  755.          ;small example of program structure and
  756.          ;syntax using procedures
  757.        
  758.          Main Proc Far   ;start of main program
  759.             :            ;main program
  760.           Call Subrt     ;transfer control to the subroutine
  761.             :            ;main program
  762.        
  763.          Subrt Proc Near ;start of subroutine declaration
  764.             :            ;subroutine code
  765.           Ret            ;returns control to main program
  766.           Endp           ;end of subroutine declaration
  767.        
  768.           Endp           ;end of main program
  769.        
  770.  
  771.        Conditional Assembly                                            17
  772.        
  773.                               Conditional Assembly
  774.        
  775.        Conditional assembly is to assemble or skip certain defined parts
  776.        of the source code based on programmer defined conditions.
  777.        Conditional assembly may be used anywhere within a program, to
  778.        enable or disable any sections of source code.  Source code that
  779.        is disabled (skipped) has no effect upon the assembly.
  780.        
  781.        Conditional assembly is probably most useful in macros, where the
  782.        programmer may want a macro to assemble in a certain way based
  783.        upon its parameters.
  784.        
  785.        Conditional assembly is controlled by special conditional
  786.        directives. These directives themselves never show up in the
  787.        listing.
  788.        
  789.  
  790.        18                                          Conditional Directives
  791.        
  792.                              Conditional Directives
  793.        
  794.        Conditional assembly is controlled by the IF, IFN, NEXTIF, ELSEIF,
  795.        ELSE, and ENDIF directives.  All conditional sections of code must
  796.        start with an IF or IFN and end with an ENDIF.  The other
  797.        directives, NEXTIF, ELSEIF, and ELSE, may optionally be used in
  798.        the middle.
  799.        
  800.        The IF directive starts a conditional section of code.  The IF
  801.        directive can be thought of as "if the condition is true, then
  802.        assemble the following code."  The "condition" for conditional
  803.        directives is a single immediate data operand.  The operand is
  804.        true if its value is not equal to zero, false if its value is
  805.        equal to zero.  If the condition is false, all the source code
  806.        after the IF is skipped up until a matching ENDIF or another
  807.        conditional statement is reached.
  808.        
  809.          ;IF is true, MOV AX,1 is assembled
  810.           If 9283    ;value not equal to zero, true
  811.            Mov Ax,1
  812.           Endif
  813.        
  814.          ;IF is false, ADD DX,CX is not assembled
  815.           If 0       ;value equal to zero, false
  816.            Add Dx,Cx
  817.           Endif
  818.        
  819.        The IFN directive works just like an IF directive except that the
  820.        condition is reversed.  IFN can be thought of as "if the condition
  821.        is not true then assemble the following code."  IFN starts a
  822.        section of conditional code, just like IF.
  823.        
  824.          ;the IFN condition is false, so the
  825.          ;MOV AX,1 is assembled
  826.           Ifn 0      ;value is zero, false
  827.            Mov Ax,1
  828.           Endif
  829.        
  830.          ;the IFN condition is true, ADD DX,CX
  831.          ;is not assembled
  832.           Ifn -6     ;value not equal to zero, true
  833.            Add Dx,Cx
  834.           Endif
  835.        
  836.        The NEXTIF directive works like an ENDIF/IF combination.  If a
  837.        NEXTIF is encountered, the present present conditional block of
  838.        code is finished (like an ENDIF) and a new conditional block is
  839.        started (like an IF).  NEXTIF, like IF, has a single conditional
  840.        operand.  Any number of NEXTIF's may follow an IF. NEXTIF's are
  841.        most useful for defining a sequential series of source code blocks
  842.        in situations where none, some, or all of the blocks may be
  843.        assembled or skipped.
  844.        
  845.  
  846.        Conditional Directives                                          19
  847.        
  848.          ;the NOP and SUB DI,SI are assembled
  849.           If 1
  850.            Nop
  851.           Nextif 0
  852.            Mov Ax,Dx
  853.           Nextif 1
  854.            Sub Di,Si
  855.           Endif
  856.        
  857.        The ELSEIF directive can be thought of as "if the previous IF was
  858.        false and if the condition is true, then assemble the following
  859.        code."  In other words, the conditional operand will only be
  860.        tested if the previous IF was false.  ELSEIF has a single
  861.        conditional operand.  Any number of ELSEIF's may follow an IF.
  862.        ELSEIF's are most useful for defining a sequential series of
  863.        source code blocks in situations where only one of the blocks will
  864.        be assembled and the remaining blocks skipped.
  865.        
  866.          ;the DEC AL is assembled
  867.           If 0
  868.            Nop
  869.           Elseif 1  ;previous IF=false and operand=true, true
  870.            Dec Al
  871.           Endif
  872.        
  873.          ;only the INC BP is assembled, the ELSEIF directives
  874.          ;default to false because the first IF is true
  875.           If 1
  876.            Inc Bp
  877.           Elseif 1
  878.            Nop
  879.           Elseif 1
  880.            Call Near [Ax]
  881.           Endif
  882.        
  883.          ;only the NOP is assembled
  884.           If 0
  885.            Inc Bp
  886.           Elseif 1
  887.            Nop
  888.           Elseif 1
  889.            Call Near [Bx]
  890.           Endif
  891.        
  892.        The ELSE directive is just like an ELSEIF directive where the
  893.        condition is always true.  The source code after the ELSE is
  894.        automatically assembled if the previous IF was false, otherwise
  895.        the source code is skipped.  Only a single ELSE should follow an
  896.        IF.  ELSE's are used when a section of code should be assembled
  897.        either one way or another.
  898.        
  899.  
  900.        20                                          Conditional Directives
  901.        
  902.          ;the SUB WORD [DI],6 is assembled
  903.           If 0
  904.            Mov Word [Di],0
  905.           Else
  906.            Sub Word [Di],6
  907.           Endif
  908.        
  909.        The NEXTIF, ELSEIF, and ELSE directives generally should not be
  910.        mixed together in a single conditional structure.  The only
  911.        exception may be using ELSEIF's or a single ELSE after a NEXTIF,
  912.        or a single ELSE after an ELSEIF.  Remember that all conditional
  913.        structures start with an IF and end with an ENDIF.  The ENDIF must
  914.        come after any intermediary conditional directives (NEXTIF,
  915.        ELSEIF, and ELSE).
  916.        
  917.          ;the SUB DI,10 and SUB SI,30 are assembled
  918.           If 1
  919.            Sub Di,10
  920.           Nextif 0
  921.            Add Si,20
  922.           Else
  923.            Sub Si,30
  924.           Endif
  925.        
  926.          ;the MOV DL,AL is assembled
  927.           If 0
  928.            Mov Dl,Cl
  929.           Elseif 0
  930.            Mov Dl,Bl
  931.           Else
  932.            Mov Dl,Al
  933.           Endif
  934.        
  935.  
  936.        Nested Conditional Assembly                                     21
  937.        
  938.                            Nested Conditional Assembly
  939.        
  940.        Conditional statements may be nested up to ten deep.  An IF or IFN
  941.        following an IF, IFN, NEXTIF, ELSEIF, or ELSE, but before the
  942.        ENDIF, starts a nested conditional structure.  The NEXTIF, ELSEIF,
  943.        ELSE, and ENDIF directives always match the last IF or IFN.  The
  944.        nested conditional code continues until its ENDIF is reached.
  945.        
  946.          ;only the last SUB DX,DX is assembled, the
  947.          ;remaining code is skipped because of the
  948.          ;initial false IF; comments on conditional
  949.          ;statements that say "true" or "false" are
  950.          ;actually evaluated, comments that say "skipped"
  951.          ;aren't evaluated because of a previous
  952.          ;false conditional statement
  953.           If 0             ;false
  954.            Add Dx,Dx
  955.            Ifn 0           ;skipped
  956.             Add Ax,Ax
  957.            Else            ;skipped
  958.             Sub Ax,Ax
  959.            Endif           ;end of nested code
  960.           Else             ;true
  961.            Sub Dx,Dx       ;line is assembled
  962.           Endif
  963.        
  964.  
  965.        22                                     Nested Conditional Assembly
  966.        
  967.          ;... and a more complicated nesting example,
  968.          ;only the ADD AX,AX is assembled
  969.           If 0             ;false
  970.            Nop
  971.           Elseif 0         ;false
  972.            Nop
  973.           Else             ;true
  974.            If 0            ;false
  975.             Nop
  976.             Ifn 0          ;skipped
  977.              Nop
  978.             Nextif 0       ;skipped
  979.              Nop
  980.             Else           ;skipped
  981.              Nop
  982.             Endif
  983.            Elseif 1        ;true
  984.             Ifn 1          ;false
  985.              Nop
  986.             Nextif 0       ;false
  987.              Nop
  988.             Nextif 1       ;true
  989.              If 1          ;true
  990.               Add Ax,Ax    ;line is assembled
  991.              Else          ;false
  992.               Nop
  993.              Endif
  994.             Endif
  995.            Elseif 1        ;false
  996.             Nop
  997.            Endif
  998.           Endif
  999.        
  1000.  
  1001.        Conditional Operators                                           23
  1002.        
  1003.                               Conditional Operators
  1004.        
  1005.        Conditional operators return a true or false value after comparing
  1006.        two immediate data operands.  Conditional operators are used for
  1007.        evaluating and comparing conditional operands.
  1008.        
  1009.        Conditional operators check for ranges or particular values
  1010.        through the use of: "<", ">", and "=".  They work like normal
  1011.        operators, except that they return either FFFFH for true or 0 for
  1012.        false.
  1013.        
  1014.          ;the SHR CX is assembled, since one is equal
  1015.          ;to one; it may seem silly to write "1=1",
  1016.          ;but maybe it was originally "Parm=1", inside
  1017.          ;of a macro, where PARM is a macro parameter that
  1018.          ;may be different each time the macro is called
  1019.           If 1=1
  1020.            Shr Cx
  1021.           Endif
  1022.        
  1023.          ;the SHR CX is assembled, only the 2<3 is true
  1024.           If 2 = 3
  1025.            Shr Ax
  1026.           Nextif 2 > 3
  1027.            Shr Bx
  1028.           Nextif 2 < 3
  1029.            Shr Cx
  1030.           Endif
  1031.        
  1032.          ;the CLC is assembled; the condition is true
  1033.          ;because (2>2) = 0, (2=2) = 0FFFFH, so the
  1034.          ;condition is the same as 0 OR 0FFFFH, which is
  1035.          ;equal to 0FFFFH, which is true; this construction
  1036.          ;creates a "greater or equal to" condition;
  1037.          ;all the various numerical comparisons can be
  1038.          ;constructed using logical operators and parenthesis
  1039.           If (2 > 2) Or (2 = 2)
  1040.            Clc
  1041.           Endif
  1042.        
  1043.  
  1044.        24                                     Conditional Operand Testing
  1045.        
  1046.                            Conditional Operand Testing
  1047.        
  1048.        The functions TYPE, VALUE, and SIZE are used to check for specific
  1049.        operand qualities.  Each of these functions return a 16 bit value
  1050.        that corresponds to a particular attribute of its argument.
  1051.        
  1052.        The type represents how the operand is interpreted (register,
  1053.        immediate data, near label, etc.).  The value may be a number to
  1054.        distinguish a register from another registers, the location of a
  1055.        label, or the actual value of an immediate data number.  The size
  1056.        is how many bits the register or memory location represents, or
  1057.        the number of bits that an immediate data number can represented
  1058.        by.  The type and size work on a bit by bit basis, that is, a
  1059.        particular bit represents a particular type or size.  An operand
  1060.        may be represented by more than one type or size (i.e. have
  1061.        multiple bits set).  Two operands are identical only if their
  1062.        type, value, and size are all identical.
  1063.        
  1064.        Operands can be tested for certain characteristics by comparing
  1065.        the bit settings to those of known operands.  It can be a bit
  1066.        tricky to test for the exact conditions you want, some
  1067.        experimentation may be necessary.  For the most part, if the any
  1068.        of the type or size bits match, the operands will be compatible in
  1069.        size or type.
  1070.        
  1071.        For the following examples, assume that P1 and P2 are macro
  1072.        parameters passed to the conditional statement:
  1073.        
  1074.          ;the following is true only if P1 and P2 are
  1075.          ;identical, the equates are used to make it
  1076.          ;fit all on one line
  1077.        
  1078.          P_Type Equ Type(P1) = Type(P2)
  1079.          P_Size Equ Size(P1) = Size(P2)
  1080.          P_Value Equ Value(P1) = Value(P2)
  1081.           If P_Type And P_Size And P_Value
  1082.        
  1083.          ;the following is true only if P1 is a non-
  1084.          ;segment register (a segment register is not
  1085.          ;not necessarily compatible with a normal
  1086.          ;register); only matching bits will make the
  1087.          ;result non-zero (true), and only
  1088.          ;non-segment registers have matching bits
  1089.           If Type(P1) And Type(Ax)
  1090.        
  1091.          ;the following is true only if P1 IS a
  1092.          ;segment register, the opposite of above
  1093.           If Type(P1) And Type(Ds)
  1094.        
  1095.  
  1096.        Conditional Operand Testing                                     25
  1097.        
  1098.          ;the following is true only if P1 is AX or
  1099.          ;AL; this statement is testing for equality,
  1100.          ;not just matching bits; a normal register
  1101.          ;wouldn't work because AX has an extra bit
  1102.          ;set (which defines it as the accumulator)
  1103.           If Type(P1) = Type(Ax)
  1104.        
  1105.          ;the following is true only if P1 is AL; like
  1106.          ;above, the accumulator type is tested for, but
  1107.          ;also the size must be the same as CH
  1108.           If (Type(P1) = Type(Ax)) And (Size(P1) = Size(Ch))
  1109.        
  1110.          ;you might think that the following is true if P1
  1111.          ;is any non-segment eight bit register, since it
  1112.          ;checks for compatible types and compatible sizes;
  1113.          ;unfortunately it doesn't necessarily work; the
  1114.          ;type and size comparisons each produce a bit
  1115.          ;pattern; those patterns individually, if
  1116.          ;compatible, are an arbitrary non-zero; there is
  1117.          ;no guarantee that these the two individually
  1118.          ;compatible bit patterns are compatible with
  1119.          ;each other
  1120.           If (Type(P1) And Type(Dx)) And (Size(P1) And Size(Dh))
  1121.        
  1122.          ;instead you can write the previous statement in
  1123.          ;the following manner; this statement, like the
  1124.          ;above, tests the size and type for compatibility,
  1125.          ;but then compares the result to zero; the type
  1126.          ;and size comparisons now return FFFFH if they
  1127.          ;are false (equal to zero), and 0 if they are
  1128.          ;true; now the two results can then be compared;
  1129.          ;since we want a positive result to be true,
  1130.          ;rather than a negative one, the entire
  1131.          ;expression must be placed within a NOT
  1132.           If Not((Type(P1) And Type(Dx)=0) And (Size(P1) And Size(Dh)=0))
  1133.        
  1134.          ;the above statement can more easily be written
  1135.          ;with the IFN directive as follows
  1136.           Ifn (Type(P1) And Type(Dx)=0) And (Size(P1) And Size(Dh)=0)
  1137.        
  1138.        More examples of conditional operand testing are provided under
  1139.        Conditional Macros.
  1140.        
  1141.  
  1142.        26                                                          Macros
  1143.        
  1144.                                      Macros
  1145.        
  1146.        A macro is a type of programmer defined routine.  A macro consists
  1147.        of a symbol that has some number of source lines assigned to it.
  1148.        The programmer creates a macro by assigning a section of code to a
  1149.        symbol.  Any time the assembler encounters the symbol as an
  1150.        instruction, the source code assigned to it is inserted into the
  1151.        program.  A macro may be used any number of times and at any
  1152.        location in the program.  In addition, the macro may have some
  1153.        number of "operands," which are passed as parameters to the
  1154.        inserted source code.  Macros are often used in conjunction with
  1155.        conditional assembly to create routines that adjust to different
  1156.        parameters.
  1157.        
  1158.        Macros are useful for inserting sections of code that are used
  1159.        several times in a single program.  Macros are also used to define
  1160.        a standard set of routines that are used by many different
  1161.        programs.  By including a file with commonly used macro
  1162.        declarations, the programmer can use only those macros that are
  1163.        needed by that particular program.  Macros only create object code
  1164.        by the source lines they insert, that is, the macro declarations
  1165.        themselves do not take up any space in the assembled program.
  1166.        
  1167.  
  1168.        Defining Macros                                                 27
  1169.        
  1170.                                  Defining Macros
  1171.        
  1172.        Macros may be defined anywhere within the program, except inside
  1173.        of other macro declarations.  The MACRO directive starts a macro
  1174.        declaration.  The required symbol declaration becomes the name of
  1175.        the macro.  Any number of operands may follow the MACRO directive.
  1176.        These operands are used to pass parameters into the macro.
  1177.        Whenever the macro is invoked, the parameter names are replaced
  1178.        (inside of the macro) by whatever corresponding operands where
  1179.        placed after the macro name.  The parameter names are local to the
  1180.        macro and need only be unique within that macro, otherwise all the
  1181.        normal restrictions to symbol declarations apply.  The parameters
  1182.        names should be single fields separated by commas (no expressions
  1183.        or functional operands).
  1184.        
  1185.        Any number of source lines may follow the MACRO directive.  Macro
  1186.        declarations are stored internally, and are thus limited by
  1187.        memory.  If the macro area becomes full, the assembly will
  1188.        terminate and display the appropriate error message.  The entire
  1189.        source line, including all spaces, non-standard control
  1190.        characters, and extended ASCII characters, are preserved
  1191.        throughout the macro storage and expansion.
  1192.        
  1193.        Symbols may be defined normally within macros.  Symbols defined
  1194.        within a macro are local and cannot be accessed outside of that
  1195.        macro.  The symbols need only be unique within that macro.  Local
  1196.        equates may be defined using the macro parameters.
  1197.        
  1198.        All 8086 instructions and assembly directives may be used within
  1199.        macros.  Macros may also be invoked within other macros.  You can
  1200.        even have a macro call itself recursively.  Conditional statements
  1201.        within macros apply to the overall conditional structure of the
  1202.        program, in other words, an ENDIF inside of a macro could be
  1203.        matched to an IF that appeared sometime outside and before the
  1204.        macro.  Note that macros are not expanded if they are in false
  1205.        conditional code, except for conditional macros, see Conditional
  1206.        Macros.
  1207.        
  1208.        A operand field inside of a macro may either be a parameter name,
  1209.        one of the predefined operand types, a local symbol, or a global
  1210.        symbol.  Parameter names take precedence over all other fields and
  1211.        are replaced before any interpretation occurs.  Local symbols take
  1212.        precedence over global symbols.  When specifying parameter names,
  1213.        if it is possible that the parameter will receive a nul string, it
  1214.        is a good idea to put parenthesis around the name.  This allows
  1215.        the line to be parsed correctly if a nul parameter is passed.
  1216.        
  1217.        Conditional statements can be used to test for valid parameters.
  1218.        If a parameter is not valid, it can be flagged with the ERROR
  1219.        directive.
  1220.        
  1221.        A macro declaration is ended by the ENDM directive.
  1222.        
  1223.  
  1224.        28                                                 Defining Macros
  1225.        
  1226.          ;defines a macro to move a value into segment
  1227.          ;register, especially immediate date, since
  1228.          ;immediate data cannot be moved directly into
  1229.          ;a segment register
  1230.        
  1231.          Mov_Seg Macro Segment_Reg, Location
  1232.           Push Ax
  1233.           Mov Ax, Location
  1234.           Mov Segment_Reg, Ax
  1235.           Pop Ax
  1236.           Endm
  1237.        
  1238.          ;defines a macro to execute an interrupt, also
  1239.          ;if a function number is provided, it is placed
  1240.          ;in AH; if the interrupt number is not immediate
  1241.          ;data, it is flagged.
  1242.        
  1243.          Interrupt Macro Int_Num, Func_Num
  1244.           If Type(Int_Num) And Type(0)
  1245.            Ifn Type(Func_Num) = Type()
  1246.             Mov Ah, Func_Num
  1247.            Endif
  1248.            Int Int_Num
  1249.           Else
  1250.            Error 'Interrupt must be immediate data'
  1251.           Endif
  1252.           Endm
  1253.        
  1254.  
  1255.        Invoking Macros                                                 29
  1256.        
  1257.                                  Invoking Macros
  1258.        
  1259.        Macros are invoked by using the macro name as an instruction.  Any
  1260.        operands will be passed as parameters.  The operands may be any
  1261.        kind, of any length, including expressions and functional
  1262.        operands.  Parameters are assigned in the order in which they were
  1263.        defined in the macro declaration.  Extra operands are ignored,
  1264.        missing parameters pass a nul string.  A parameter may be skipped
  1265.        and be assigned a nul string by placing a comma without an
  1266.        operand.
  1267.        
  1268.        Parameter names are blindly replaced in the macro source lines by
  1269.        their passed parameters.  Nul parameters simply remove the
  1270.        parameter name.  The resulting source line may be longer or
  1271.        shorter than the original.  Unnecessary spaces are removed from
  1272.        the parameters, so they may not look exactly the same in the
  1273.        source line as they did when they were first specified as
  1274.        operands.
  1275.        
  1276.        Macros are not normally expanded if the present source code is
  1277.        being skipped because of a false conditional statement.  Any
  1278.        conditional statements within that macro will be ignored.
  1279.        Conditional macros, on the other hand, are expanded under those
  1280.        circumstances, see Conditional Macros.
  1281.        
  1282.  
  1283.        30                                                 Invoking Macros
  1284.        
  1285.          ;defines a macro to declare three bytes, any
  1286.          ;missing parameters are declared as zero
  1287.        
  1288.          Dec_Bytes Macro Byte1, Byte2, Byte3
  1289.           Ifn Type(Byte1) = Type()
  1290.            Db Byte1
  1291.           Else
  1292.            Db 0
  1293.           Endif
  1294.           Ifn Type(Byte2) = Type()
  1295.            Db Byte2
  1296.           Else
  1297.            Db 0
  1298.           Endif
  1299.           Ifn Type(Byte3) = Type()
  1300.            Db Byte3
  1301.           Else
  1302.            Db 0
  1303.           Endif
  1304.           Endm
  1305.        
  1306.           Dec_Bytes         ;produces 000000
  1307.        
  1308.           Dec_Bytes 1       ;produces 010000
  1309.           Dec_Bytes ,2      ;produces 000200
  1310.           Dec_Bytes ,,3     ;produces 000003
  1311.        
  1312.           Dec_Bytes 1,2     ;produces 010200
  1313.           Dec_Bytes ,2,3    ;produces 000203
  1314.           Dec_Bytes 1,,3    ;produces 100003
  1315.        
  1316.           Dec_Bytes 1,2,3   ;produces 010203
  1317.        
  1318.  
  1319.        Nested Macros                                                   31
  1320.        
  1321.                                   Nested Macros
  1322.        
  1323.        Macros may be nested up to ten deep.  A macro invocation inside of
  1324.        another macro works no differently than any other macro
  1325.        invocation.  When the nested macros finishes, the original macro
  1326.        resumes.  A macro may even call itself recursively, though, unless
  1327.        the recursion is controlled by conditional statements, an error
  1328.        will occur when the maximum nest level is exceeded.
  1329.        
  1330.        Parameters may be passed to successive macro levels.  Local
  1331.        symbols within a macro cannot be accessed by any nested macros
  1332.        within it.
  1333.        
  1334.          ;defines a macro that uses recursion to produce
  1335.          ;a specified number of single shift right
  1336.          ;instructions, the macro calls itself as long as
  1337.          ;the count parameter is greater than zero; note
  1338.          ;that the count cannot exceed nine (assuming it is
  1339.          ;not called from within another macro), otherwise
  1340.          ;the macros will nest too deeply
  1341.        
  1342.          Shift_Right Macro Operand, Count
  1343.           If Count > 0
  1344.            Shr Operand
  1345.            Shift_Right Operand, Count-1
  1346.           Endif
  1347.           Endm
  1348.        
  1349.  
  1350.        32                                              Conditional Macros
  1351.        
  1352.                                Conditional Macros
  1353.        
  1354.        Conditional macros are similar to normal macros.  They are
  1355.        declared with MACROC instead of MACRO.  The purpose of conditional
  1356.        macros are to create custom conditional statements.  Conditional
  1357.        macros do three things that normal macros don't: the line invoking
  1358.        the macro is not listed (like like a conditional statement), the
  1359.        macro expansion is not listed (by an implicit EXPAND-), and the
  1360.        macros are expanded in false conditional code.  Generally one
  1361.        would declare the macro with just a single conditional line that
  1362.        expresses the relationship that is desired.
  1363.        
  1364.          ;defines an "if the parameter doesn't exist" statement by
  1365.          ;testing to see if the type returned for the parameter
  1366.          ;is the same as the type returned for a nul operand
  1367.        
  1368.          If_None Macroc Parameter
  1369.           If Type(Parameter) = Type()
  1370.           Endm
  1371.        
  1372.          ;defines an "if the parameter exists" statement
  1373.          ;by taking the opposite result of the declaration above
  1374.        
  1375.          If_Exist Macroc Parameter
  1376.           Ifn Type(Parameter) = Type()
  1377.           Endm
  1378.        
  1379.          ;defines an "if the parameter is a byte" statement
  1380.          ;by testing if any of the same size bits are set in the
  1381.          ;size of the parameter and the size of a byte value
  1382.        
  1383.          If_Byte Macroc Parameter
  1384.           If Size(Parameter) And Size(Byte 0)
  1385.           Endm
  1386.        
  1387.          ;defines an "if the sizes of the parameters are
  1388.          ;compatible" statement by testing for matching
  1389.          ;size bits
  1390.        
  1391.          If_Compatible_Size Macroc Parameter1, Parameter2
  1392.           If Size(Parameter1) And Size(Parameter2)
  1393.           Endm
  1394.        
  1395.          ;defines an "if the parameters are identical"
  1396.          ;statement testing if the type, value, and size
  1397.          ;are identical; equates are used to simplify and
  1398.          ;shorten the final statement
  1399.        
  1400.          If_Same Macroc Op1, Op2
  1401.          Stype Equ Type(Op1) = Type(Op2)
  1402.          Ssize Equ Size(Op1) = Size(Op2)
  1403.          Svalue Equ Value(Op1) = Value(Op2)
  1404.           If Stype And Ssize And Svalue
  1405.           Endm
  1406.        
  1407.  
  1408.        Listing of Macros                                               33
  1409.        
  1410.                                 Listing of Macros
  1411.        
  1412.        Macro expansions are listed like any other source line.  The
  1413.        special list indicator byte is a plus (+) in inserted macros
  1414.        lines.  The present macro nest level is displayed when the macro
  1415.        is first invoked.  This number is shown in the area normally
  1416.        reserved for the object code.  There is no way to tell when a
  1417.        nested macro ends within another macro.
  1418.        
  1419.        The listing of inserted macro lines may be globally suppressed or
  1420.        enabled with the EXPAND- and EXPAND+ directives.  The listing of
  1421.        individual macros may also be controlled by these directives.  If
  1422.        EXPAND- and EXPAND+ directives appear in a macro, they only affect
  1423.        that macro (and any nested macros).  EXPAND- and EXPAND+ do not
  1424.        have any effect if the source code is not otherwise being listed.
  1425.        Note that EXPAND- and EXPAND+ only affect the listing of macros,
  1426.        not the actual expansion of macros.
  1427.        
  1428.        Errors occurring within macro expansions are treated normally,
  1429.        except that the error message shows the last real line number and,
  1430.        if in an included file, the name of the source file.  The line
  1431.        number is in parenthesis following the error message.
  1432.        
  1433.          ;defines a macro that adds the parameters
  1434.          ;together and puts the result in DX; this
  1435.          ;macro is never listed because of the
  1436.          ;EXPAND-
  1437.        
  1438.          Adder Macro Parameter1, Parameter2
  1439.           Expand-
  1440.           Mov Dx,Parameter1
  1441.           Add Dx,Parameter2
  1442.           Endm
  1443.        
  1444.  
  1445.        34                                                            Data
  1446.        
  1447.                                       Data
  1448.        
  1449.        Data that is used by the program during execution must be placed
  1450.        in the program by declaration.  Data that is declared includes
  1451.        things like numbers and strings.  This is in contrast to the
  1452.        declaration of macros and equates which are only used when the
  1453.        program is assembled.  The DB, DW, and DS directives are used to
  1454.        make data declarations.
  1455.        
  1456.        DB is used to declare byte values, strings, words, and
  1457.        combinations of all three.  If a symbol is declared with the DB
  1458.        directive, it becomes an eight bit memory reference label.  The
  1459.        data declared by the DB may be accessed through the label.  Values
  1460.        are declared as bytes if possible, only if they must be words are
  1461.        they declared as words.  The BYTE and WORD functions may be used
  1462.        to explicitly set the number bits that DB data is declared as.
  1463.        
  1464.        DW is used to declare word values.  If a symbol is declared with
  1465.        the DW directive, it becomes a sixteen bit memory reference label.
  1466.        The data declared by the DW may be accessed through the label.
  1467.        Values are always declared as words, even if they may be bytes.
  1468.        
  1469.        DS is used to declare any number of identical bytes.  If a symbol
  1470.        is declared with the DS directive, the it becomes a memory
  1471.        reference label with no size.  The size should be specified
  1472.        whenever this label is accessed (via the size functions BYTE,
  1473.        WORD, DWORD, etc.).  The LABEL directive may be used to declare a
  1474.        label of a particular type and size immediately before the DS.
  1475.        
  1476.        Word values are always stored low byte first with the exception of
  1477.        two byte strings.  Assuming '1' = 31H and 'B' = 42H, the hex
  1478.        number 3142H will be stored as 4231H, though '1B' will be stored
  1479.        as 3142H.  The reverse format is how word numbers should be
  1480.        stored.  If for some reason a word value is stored as two separate
  1481.        bytes (using DB), the low byte should always be stored first,
  1482.        otherwise the number will be backwards for arithmetic operations.
  1483.        
  1484.        Declarations may be made anywhere in the program.  Since
  1485.        declarations produce non-executable object code, they should not
  1486.        be placed in a location where they might be interpreted as part of
  1487.        the code.  Branch the program around declarations, or put them at
  1488.        the end of the program or routine, after the executable code.
  1489.        
  1490.        Examples of data declarations:
  1491.        
  1492.          ;declare a byte
  1493.           Db -5
  1494.        
  1495.          ;declare a byte and then a word value
  1496.           Db Byte 0, Word 0
  1497.          ;... or just
  1498.           Db 0, Word 0
  1499.        
  1500.  
  1501.        Data                                                            35
  1502.        
  1503.          ;declare a string
  1504.           Db 'This is the string'
  1505.        
  1506.          ;declare some words
  1507.           Dw 0, 1, 2, 3, 65533, 65534, 65535
  1508.        
  1509.          ;the following declaration can be accessed through VALUES
  1510.          Values Db 100,-20, 36/10, 0, 010100110b
  1511.        
  1512.          ;this instruction accesses the numbers
  1513.          ;in VALUES above based on an index in BX
  1514.           Mov Al, [Values + Bx]  ;load number
  1515.        
  1516.          ;declare storage
  1517.           Ds 10          ;ten bytes of 00
  1518.           Ds 100, 0ffh   ;a hundred bytes of FFH
  1519.        
  1520.  
  1521.        36                                             Assembly Directives
  1522.        
  1523.                                Assembly Directives
  1524.        
  1525.        Assembly directives are instructions to control the assembly, they
  1526.        do not encode into 8086 machine language instructions, though some
  1527.        of the directives do produce object code.  Assembly directives are
  1528.        implemented the same way as normal instructions.
  1529.        
  1530.        This section describes all the assembly directives.  Most of the
  1531.        directives are also described in sections pertinent to their
  1532.        operation.
  1533.        
  1534.        The major categories of assembly directives are those that are
  1535.        used to declare symbols (EQU, LABEL, ORG), those that declare data
  1536.        (DB, DS, DW), those that declare procedures and macros (PROC,
  1537.        ENDP, MACRO, MACROC, ENDM), those used to control conditional
  1538.        assembly (ELSE, ELSEIF, ENDIF, IF, IFN, NEXTIF), those that
  1539.        control the assembly listing (EXPAND+, EXPAND-, LINSIZE, LIST+,
  1540.        LIST-, PAGE, PAGE+, PAGE-, PAGESIZE, SUBTITLE, SYMDUMP+, SYMDUMP-,
  1541.        TITLE), those that control error flagging and detection (ERROR,
  1542.        ERRORMAX, FLAGALL+, FLAGALL-, JUMP+, JUMP-, UNUSED+, UNUSED-), and
  1543.        some miscellaneous ones (INCLUDE, RESETC).
  1544.        
  1545.        ******************************************************************
  1546.        
  1547.        DB value/string, ...
  1548.        
  1549.        Declare byte.
  1550.        
  1551.        Places literal bytes of data into the assembled code.
  1552.        
  1553.        DB may have any number of operands, as long as they fit on the
  1554.        line.  The value of each operand is placed sequentially into the
  1555.        assembled code.  The operands can be immediate data or strings.
  1556.        Immediate data operands are declared as bytes if possible,
  1557.        otherwise they are declared as words.  Strings are inserted just
  1558.        as they appear (minus the string delimiters).
  1559.        
  1560.        See Data.
  1561.        
  1562.          ;the following declares a sentence with its
  1563.          ;length preceding it, including a carriage
  1564.          ;return and linefeed at the end of the sentence;
  1565.          ;the BYTE function is needed to make the length
  1566.          ;an explicit eight bit value
  1567.        
  1568.          A
  1569.           Db Byte(Offset B - Offset A - 1),'The sentence.',10,13
  1570.          B
  1571.        
  1572.          ;this declares a byte FFH and then a word FFFFH
  1573.           Db  -1, Word -1
  1574.        
  1575.  
  1576.        Assembly Directives                                             37
  1577.        
  1578.        ******************************************************************
  1579.        
  1580.        DS bytes [, value]
  1581.        
  1582.        Declare storage.
  1583.        
  1584.        Places some number of identically initialized bytes into the
  1585.        assembled code.
  1586.        
  1587.        DS can have one or two operands.  The first operand is the number
  1588.        of bytes to declare and the second is the value that the storage
  1589.        should be initialized to.  The initialization value is optional,
  1590.        and, if absent, the storage is initialized to zero.  The number of
  1591.        bytes to declare must be immediate data (0 to 65535).  The
  1592.        initialization value must be eight bit immediate data.
  1593.        
  1594.        See Data.
  1595.        
  1596.          ;declare a thousand bytes of FFH
  1597.           Ds 1000, 0ffh
  1598.        
  1599.        ******************************************************************
  1600.        
  1601.        DW value, ...
  1602.        
  1603.        Declare word.
  1604.        
  1605.        Places literal words of data into the assembled code.
  1606.        
  1607.        DW can have any number of operands, as long as they fit on the
  1608.        line.  The value of each operand is placed sequentially into the
  1609.        assembled code.  The operands must be immediate data.  The
  1610.        operands are always declared as words, even if they could be
  1611.        bytes.
  1612.        
  1613.        See Data.
  1614.        
  1615.          ;this sort of construction can be useful
  1616.          ;for creation a table of addresses, note
  1617.          ;that this particular example would work
  1618.          ;equally well with DB
  1619.           Dw Offset Subrt1, Offset Subrt2
  1620.        
  1621.        ******************************************************************
  1622.        
  1623.        ELSE
  1624.        
  1625.        Conditional "else."
  1626.        
  1627.        Assembles the following source code only if the previous IF
  1628.        directive was false.
  1629.        
  1630.        Requires no operands.
  1631.        
  1632.  
  1633.        38                                             Assembly Directives
  1634.        
  1635.        See Conditional Assembly.
  1636.        
  1637.          ;the code after the ELSE is carried out
  1638.          ;if NUMBER is not greater than 10
  1639.           If Number > 10
  1640.            Mov Ax, Bx
  1641.           Else
  1642.            Mov Bx, Ax
  1643.           Endif
  1644.        
  1645.        ******************************************************************
  1646.        
  1647.        ELSEIF condition
  1648.        
  1649.        Conditional "else if."
  1650.        
  1651.        Assembles the following source code only if the previous IF
  1652.        directive was false and the condition is true.
  1653.        
  1654.        ELSEIF requires a single immediate data operand.  This operand is
  1655.        the condition to test.
  1656.        
  1657.        See Conditional Assembly.
  1658.        
  1659.          ;only one of the following are true:
  1660.          ;if OPTION is equal to zero, CALL SUBRT1 is
  1661.          ;assembled; if OPTION is equal to one,
  1662.          ;CALL SUBRT2 is assembled; if OPTION is equal
  1663.          ;to two, CALL SUBRT3 is assembled
  1664.           If Option=0
  1665.            Call Subrt1
  1666.           Elseif Option=1
  1667.            Call Subrt2
  1668.           Elseif Option=2
  1669.            Call Subrt3
  1670.           Endif
  1671.        
  1672.        ******************************************************************
  1673.        
  1674.        ENDIF
  1675.        
  1676.        End of conditional structure.
  1677.        
  1678.        Finishes a conditional structure started by an IF directive.
  1679.        
  1680.        Requires no operands.
  1681.        
  1682.        See Conditional Assembly.
  1683.        
  1684.  
  1685.        Assembly Directives                                             39
  1686.        
  1687.          ;ENDIF finishes the conditional structure,
  1688.          ;so the CLC is assembled no matter what
  1689.           If Type(Parameter)=Type(Ax)
  1690.            Sub Ax, Ax
  1691.           Endif
  1692.           Clc
  1693.        
  1694.        ******************************************************************
  1695.        
  1696.        ENDM
  1697.        
  1698.        End of macro.
  1699.        
  1700.        Finishes a macro declaration started by a MACRO or MACROC
  1701.        directive.
  1702.        
  1703.        Requires no operands.
  1704.        
  1705.        See Macros.
  1706.        
  1707.          ;the ENDM finishes the rather simple declaration
  1708.          ;of the macro NUL_INST
  1709.        
  1710.          Nul_Inst Macro
  1711.           Nop
  1712.           Endm
  1713.        
  1714.        ******************************************************************
  1715.        
  1716.        ENDP
  1717.        
  1718.        End of procedure.
  1719.        
  1720.        Finishes a procedure declaration started by a PROC directive.
  1721.        
  1722.        Requires no operands.
  1723.        
  1724.        See Procedures.
  1725.        
  1726.          ;the ENDP finishes the declaration of the
  1727.          ;procedure SUBRT
  1728.        
  1729.          Subrt Proc Near
  1730.           Xchg Ax, [Si]
  1731.           Ret
  1732.           Endp
  1733.        
  1734.        ******************************************************************
  1735.        
  1736.        EQU value
  1737.        
  1738.        Equate a value.
  1739.        
  1740.  
  1741.        40                                             Assembly Directives
  1742.        
  1743.        Defines a symbol that may be used anywhere in place of a specified
  1744.        value.
  1745.        
  1746.        EQU requires a single immediate data operand and the symbol to be
  1747.        equated.  The operand becomes equated to the symbol.
  1748.        
  1749.        EQU is useful for making the source code more readable by
  1750.        replacing arbitrary numbers with meaningful symbols.  The value of
  1751.        the equate generally should not reference any symbols that have
  1752.        not been defined yet in the source code.  This means that the
  1753.        value should not contain a forward reference to another equate, or
  1754.        use OFFSET when its argument has not yet been defined.
  1755.        
  1756.        See Symbols.
  1757.        
  1758.          ;equate the number 50 times 20, or 1000, to the
  1759.          ;symbol NUMBER, and then move NUMBER into AX
  1760.        
  1761.          Number Equ 50*20
  1762.           Mov Ax, Number
  1763.        
  1764.        ******************************************************************
  1765.        
  1766.        ERROR message
  1767.        
  1768.        Programmer defined error.
  1769.        
  1770.        Causes an error to occur using the specified message.
  1771.        
  1772.        ERROR requires a single string operand.  This operand becomes the
  1773.        error message.
  1774.        
  1775.        No line is displayed with the error message, the listing of the
  1776.        statement itself is suppressed.  The error is included in total
  1777.        number of errors at the end of the program.  ERROR is useful for
  1778.        flagging invalid macro parameters.
  1779.        
  1780.          ;defines a macro that checks for a missing operand;
  1781.          ;if the macro is invoked with the operand is missing,
  1782.          ;an error is displayed using an ERROR directive
  1783.        
  1784.          Mover Macro Op1
  1785.           If Type(Op1) = Type()
  1786.            Error 'Missing operand'
  1787.           Endif
  1788.           Endm
  1789.        
  1790.          ;this will cause the error
  1791.           Mover       ;invoked with no operands
  1792.        
  1793.  
  1794.        Assembly Directives                                             41
  1795.        
  1796.        ******************************************************************
  1797.        
  1798.        ERRORMAX number
  1799.        
  1800.        Maximum errors.
  1801.        
  1802.        Places an upper limit on the number of errors and comments
  1803.        occurring before the assembly is halted.
  1804.        
  1805.        ERRORMAX requires a single immediate data operand.  This operand
  1806.        becomes the new number of maximum allowed errors.
  1807.        
  1808.        The default is 65535.  Note that both errors and comments are
  1809.        counted.
  1810.        
  1811.          ;set the number of allowed errors to ten, if a tenth error
  1812.          ;or comment ever occurs, the assembly will be terminated
  1813.           Errormax 10
  1814.        
  1815.        ******************************************************************
  1816.        
  1817.        EXPAND+ 
  1818.        EXPAND-
  1819.        
  1820.        List macro expansions.
  1821.        
  1822.        When activated (EXPAND+), lines resulting from a macro expansion
  1823.        will be listed.  When deactivated (EXPAND-), lines resulting from
  1824.        a macro expansion will not be listed, only the line containing the
  1825.        macro invocation will be visible.
  1826.        
  1827.        Requires no operands.
  1828.        
  1829.        The default is EXPAND+.  EXPAND+ and EXPAND- directives that are
  1830.        within macros only apply to those macros.  Macros will not be
  1831.        listed regardless of the EXPAND+ and EXPAND- directives if the
  1832.        source code is not otherwise being listed.
  1833.        
  1834.        See Macros and Assembly Listing.
  1835.        
  1836.          ;macro expansions are globally listed because
  1837.          ;of the EXPAND+, except the defined macro TERMINATE
  1838.          ;explicitly suppresses only its own listing
  1839.           Expand+
  1840.        
  1841.          Terminate Macro
  1842.           Expand-
  1843.           Mov Ah, 4ch
  1844.           Int 21h
  1845.           Endm
  1846.        
  1847.  
  1848.        42                                             Assembly Directives
  1849.        
  1850.        ******************************************************************
  1851.        
  1852.        FLAGALL+ 
  1853.        FLAGALL-
  1854.        
  1855.        Undefined symbol flagging.
  1856.        
  1857.        When activated (FLAGALL+), an undefined symbol is flagged each
  1858.        time it is used, even if it has been flagged before.  When
  1859.        deactivated (FLAGALL-), an undefined symbol is only flagged the
  1860.        first time it is used.
  1861.        
  1862.        Requires no operands.
  1863.        
  1864.        The default is FLAGALL-.
  1865.        
  1866.          ;assuming BADSYM is undefined, it is flagged when
  1867.          ;it is moved to AX and BX, but not when it is
  1868.          ;moved to CX or DX, since it has been flagged
  1869.          ;previously and because of the FLAGALL-
  1870.           Flagall+
  1871.           Mov Ax, Badsym
  1872.           Mov Bx, Badsym
  1873.           Flagall-
  1874.           Mov Cx, Badsym
  1875.           Mov Dx, Badsym
  1876.        
  1877.        ******************************************************************
  1878.        
  1879.        IF condition
  1880.        
  1881.        Conditional "if."
  1882.        
  1883.        Assembles the following source code only if the condition is true.
  1884.        
  1885.        IF requires a single immediate data operand.  This operand is the
  1886.        condition to test.
  1887.        
  1888.        The IF directive starts a conditional structure. See Conditional
  1889.        Assembly.
  1890.        
  1891.          ;if COND is zero, the IN AX,DX will be assembled
  1892.           If Not(Cond)
  1893.            In Ax, Dx
  1894.           Endif
  1895.        
  1896.        ******************************************************************
  1897.        
  1898.        IFN condition
  1899.        
  1900.        Conditional "if not."
  1901.        
  1902.        Assembles the following source code only if the condition is
  1903.        false.
  1904.        
  1905.  
  1906.        Assembly Directives                                             43
  1907.        
  1908.        IFN requires a single immediate data operand.  This operand is the
  1909.        condition to test.
  1910.        
  1911.        The IFN directive starts a conditional structure.  IFN is the
  1912.        opposite of IF.  See Conditional Assembly.
  1913.        
  1914.          ;if COND is zero, the OUT DX,AX will be assembled
  1915.           If Cond
  1916.            Out Dx, Ax
  1917.           Endif
  1918.        
  1919.        ******************************************************************
  1920.        
  1921.        INCLUDE file
  1922.        
  1923.        Include source file.
  1924.        
  1925.        The specified file is inserted into the main source code
  1926.        immediately after the INCLUDE directive.
  1927.        
  1928.        INCLUDE requires a single string operand.  This operand should
  1929.        contain the name of the file to insert.  If no path is specified,
  1930.        the main source file path is used.  If no extension is specified,
  1931.        the extension of ASM is used.
  1932.        
  1933.        The included source code is not treated any differently than the
  1934.        rest of the program.  Included files may NOT be nested, which
  1935.        means that the file being inserted may not contain any INCLUDE
  1936.        directives.  Neither may INCLUDE's be used within macros.  INCLUDE
  1937.        is useful for inserting source code used by many different
  1938.        programs, like standard macro declarations.  INCLUDE can also be
  1939.        used to break up a source file into several smaller chunks, if,
  1940.        for instance, your text editor cannot handle the entire source
  1941.        file at once.
  1942.        
  1943.          ;the following directive inserts the file
  1944.          ;INCLUDE.INC, the source drive and path are
  1945.          ;used
  1946.           Include 'Source.Inc'
  1947.        
  1948.        ******************************************************************
  1949.        
  1950.        JUMP+ 
  1951.        JUMP-
  1952.        
  1953.        Short jump checking.
  1954.        
  1955.        When activated (JUMP+), all long near jump instructions will be
  1956.        flagged if a short near jump could be substituted.  When
  1957.        deactivated (JUMP-), long jumps that could be short jumps are not
  1958.        flagged.
  1959.        
  1960.        Requires no operands.
  1961.        
  1962.  
  1963.        44                                             Assembly Directives
  1964.        
  1965.        The default is JUMP-.  Substituting a short jump for a long jump
  1966.        does not logically change the program, but does make the assembled
  1967.        code one byte shorter.
  1968.        
  1969.          ;both of the following jumps could be
  1970.          ;JMPS (a short unconditional jump); the
  1971.          ;first JMP LABEL is not flagged, the
  1972.          ;second one is
  1973.           Jump-
  1974.           Jmp Label
  1975.           Jump+
  1976.           Jmp Label
  1977.          Label
  1978.        
  1979.        ******************************************************************
  1980.        
  1981.        LABEL type
  1982.        
  1983.        Label declaration.
  1984.        
  1985.        Defines a branch or memory reference label using the present
  1986.        location counter.
  1987.        
  1988.        LABEL requires a single operand and a symbol to be defined.  The
  1989.        operand NEAR or FAR is used for branch locations.  The operand
  1990.        BYTE, WORD, or DWORD is used for memory references of eight,
  1991.        sixteen, or thirty-two bit sizes, respectively.
  1992.        
  1993.        Explicitly defining a symbol as NEAR has the same effect as
  1994.        placing a symbol on an otherwise empty line or a line with some
  1995.        sort of operation (not a data declaration).  Explicitly declaring
  1996.        a symbol as BYTE or WORD has the same effect as placing a symbol
  1997.        on a byte (DB) or  word (DW) data declaration.  LABEL can be used
  1998.        in conjunction with the ORG directive to define labels independent
  1999.        of the actual code being assembled.
  2000.        
  2001.        See Symbols.
  2002.        
  2003.          ;this label ...
  2004.          Bran1 Label Near
  2005.          ;...is the same type as
  2006.          Bran2 Mov Ds, Dx
  2007.        
  2008.          ;and this ...
  2009.          Dat1 Label Word
  2010.          ;... produces the same sort of label as ...
  2011.          Dat2 Dw ?
  2012.        
  2013.  
  2014.        Assembly Directives                                             45
  2015.        
  2016.          ;the following causes MEM_SIZE to point at the word
  2017.          ;in program segment prefix that tells how many bytes
  2018.          ;are available in the segment; if you use this method
  2019.          ;to define any labels, make sure to reset the location
  2020.          ;counter back to its proper value before defining any
  2021.          ;other normal labels in the program
  2022.           Org 6
  2023.          Mem_Size Label Word
  2024.        
  2025.        ******************************************************************
  2026.        
  2027.        LINESIZE [length] [, code, ...]
  2028.        
  2029.        List line length.
  2030.        
  2031.        Sets the maximum number of characters in each list line.
  2032.        
  2033.        The optional first operand is the list line length.  The remaining
  2034.        optional eight bit immediate data operands are printer codes.
  2035.        These printer codes are sent directly to the printer if the list
  2036.        file is PRN.
  2037.        
  2038.        The default is 79.  The length must be in the range 45 to 158.
  2039.        The number of characters per line should only be set once in a
  2040.        program, though multiple LINESIZE directives may be used to send
  2041.        several bunches of printer codes.  If a list line would come out
  2042.        any longer than specified by the LINESIZE, it will be truncated.
  2043.        PAGESIZE can also be used to set the number of characters per
  2044.        line.
  2045.        
  2046.        See Assembly Listing.
  2047.        
  2048.          ;set up for IBM Graphics printer compressed font, the
  2049.          ;printer code (15) is sent if PRN is the list file
  2050.           Linesize 131, 15
  2051.        
  2052.        ******************************************************************
  2053.        
  2054.        LIST+ 
  2055.        LIST-
  2056.        
  2057.        Assembly listing.
  2058.        
  2059.        When activated (LIST+), a listing of the program will be
  2060.        generated.  When deactivated (LIST-), no listing will be
  2061.        generated.
  2062.        
  2063.        Requires no operands.
  2064.        
  2065.  
  2066.        46                                             Assembly Directives
  2067.        
  2068.        If a list file was specified at the start of the program, the
  2069.        default is LIST+.  If no list file was specified, no list will be
  2070.        generated (regardless of any LIST+ or LIST- directives).  LIST+
  2071.        and LIST- directives that are within included files only affect
  2072.        those files, so you could, for instance, place a LIST- at the
  2073.        start of a source file to be included and just have the listing of
  2074.        that file suppressed.  LIST+ and LIST- directives are useful for
  2075.        selectively listing isolated sections of the source code.
  2076.        
  2077.        See Assembly Listing.
  2078.        
  2079.          ;turn list off, NOP's are not listed
  2080.           List-
  2081.           Nop
  2082.           Nop
  2083.          ;turn list on, NOP's are listed
  2084.           List+
  2085.           Nop
  2086.           Nop
  2087.        
  2088.        ******************************************************************
  2089.        
  2090.        MACRO [parameter, ...]
  2091.        
  2092.        Macro declaration.
  2093.        
  2094.        Begins a macro declaration that will be finished by the ENDM
  2095.        directive.
  2096.        
  2097.        MACRO may have up to ten operands.  These operands must be unique
  2098.        symbols within the macro declaration.  The operands become the
  2099.        names of any parameters passed to the macro upon invocation.  A
  2100.        symbol declaration to name the macro is also required.
  2101.        
  2102.        See Macros.
  2103.        
  2104.          ;defines the macro LOAD_DS, the MACRO
  2105.          ;directive starts the declaration
  2106.        
  2107.          Load_DS Macro Op1
  2108.           Mov Ax, Op1
  2109.           Mov Ds, Ax
  2110.           Endm
  2111.        
  2112.        ******************************************************************
  2113.        
  2114.        MACROC [parameter, ...]
  2115.        
  2116.        Conditional macro declaration.
  2117.        
  2118.        Begins a conditional macro declaration that will be finished by
  2119.        the ENDM directive.
  2120.        
  2121.  
  2122.        Assembly Directives                                             47
  2123.        
  2124.        MACROC may have up to ten operands.  These operands must be unique
  2125.        symbols within the macro declaration.  The operands become the
  2126.        names of any parameters passed to the macro upon invocation.  A
  2127.        symbol declaration to name the macro is also required.
  2128.        
  2129.        See Conditional Macros.
  2130.        
  2131.          ;defines a conditional directive TOO_SMALL
  2132.          ;that is false if the operand is above ten,
  2133.          ;i.e. "if not above ten then do the following"
  2134.        
  2135.          Too_Small Macroc Op1
  2136.           Ifn Op1 > 10
  2137.           Endm
  2138.        
  2139.          ;with the above declaration, the ADD AX,AX
  2140.          ;will be assembled because 11 is above 10
  2141.           Too_Small 11
  2142.            Sub Ax, Ax
  2143.           Else
  2144.            Add Ax, Ax
  2145.           Endif
  2146.        
  2147.        ******************************************************************
  2148.        
  2149.        NEXTIF condition
  2150.        
  2151.        Conditional "if", same level.
  2152.        
  2153.        Finishes the present conditional block and starts a new one.
  2154.        Assembles the following source code only if the condition is true.
  2155.        
  2156.        NEXTIF requires a single immediate data operand.  This operand is
  2157.        the condition to test.
  2158.        
  2159.        See Conditional Assembly.
  2160.        
  2161.          ;any or all of the following may be true:
  2162.          ;if OPTION is equal to ten, CALL SUBRT1 is
  2163.          ;assembled; if OPTION is less than ten,
  2164.          ;CALL SUBRT2 is assembled; if OPTION is greater
  2165.          ;than ten, CALL SUBRT3 is assembled
  2166.           If Option=10
  2167.            Call Subrt1
  2168.           Nextif Option<10
  2169.            Call Subrt2
  2170.           Nextif Option>10
  2171.            Call Subrt3
  2172.           Endif
  2173.        
  2174.  
  2175.        48                                             Assembly Directives
  2176.        
  2177.        ******************************************************************
  2178.        
  2179.        ORG value
  2180.        
  2181.        Origin.
  2182.        
  2183.        Sets the location counter to the specified value.
  2184.        
  2185.        ORG requires a single immediate data operand.  This operand
  2186.        becomes the new location counter value.  If the operand is signed,
  2187.        the value is treated as a displacement to the present location.
  2188.        
  2189.        The default is 100H, which is the starting offset required for COM
  2190.        programs.  ORG affects the location assigned to labels.  ORG can
  2191.        be used to set the offset of specially defined labels.
  2192.        
  2193.          ;this declares three consecutive memory labels, note
  2194.          ;that these declarations only create the labels and do
  2195.          ;not allow space for them in the object code, this sort
  2196.          ;of thing could be done at the end of the program to
  2197.          ;create uninitialized data locations in memory
  2198.        
  2199.          Data1 Label Word
  2200.             Org $+2
  2201.          Data2 Label Word
  2202.             Org $+2
  2203.          Data3 Label Word
  2204.             Org $+2
  2205.        
  2206.          ;remember that signed numbers are treated as displacements
  2207.        
  2208.             Org 2      ;(unsigned, absolute)
  2209.          Symbol1       ;this symbol points to [0002]
  2210.             Org +2     ;(signed, displacement)
  2211.          Symbol2       ;this symbol points to [0004], two past the
  2212.                        ;location above
  2213.        
  2214.        ******************************************************************
  2215.        
  2216.        PAGE [page|subtitle] 
  2217.        PAGE page [, subtitle]
  2218.        
  2219.        New page.
  2220.        
  2221.        Starts a new list page regardless of whether paging is on or off,
  2222.        or what the size of the previous page was.
  2223.        
  2224.        PAGE may have none, one, or two operands.  If the first operand is
  2225.        immediate data, it becomes the new page number.  If the first
  2226.        operand a string, it becomes the new page subtitle.  If both a
  2227.        page number and a subtitle are included, the page number must come
  2228.        first.
  2229.        
  2230.  
  2231.        Assembly Directives                                             49
  2232.        
  2233.        If the page number is not specified, the previous page number is
  2234.        incremented.  If the subtitle is not included, the subtitle from
  2235.        the previous page is used.  PAGE can be used in conjunction with
  2236.        automatic paging (PAGE+) to start a new section of the code with a
  2237.        new subtitle.
  2238.        
  2239.        See Assembly Listing.
  2240.        
  2241.          ;start a new page and set the page number
  2242.          ;to ten and the subtitle to "Page ten"
  2243.           Page 10, 'Page ten'
  2244.        
  2245.        ******************************************************************
  2246.        
  2247.        PAGE+ [page|subtitle] 
  2248.        PAGE+ page [, subtitle] 
  2249.        PAGE-
  2250.        
  2251.        Automatic paging.
  2252.        
  2253.        When automatic paging is activated (PAGE+), a new page is started
  2254.        after every number of lines specified by the PAGESIZE directive
  2255.        (default 60).  When automatic paging is not activated (PAGE-), no
  2256.        paging is done, except by the PAGE directive.  PAGE+ automatically
  2257.        starts a new page if there are operands (i.e. a page number,
  2258.        subtitle, or both).
  2259.        
  2260.        PAGE+ has operands identical to those of PAGE, see PAGE above.
  2261.        PAGE- requires no operands.
  2262.        
  2263.        Default is PAGE-.  Paging can make the listing of a program look
  2264.        better if a hard copy is printed out on separate pages.
  2265.        
  2266.        See Assembly Listing.
  2267.        
  2268.          ;activate auto paging, start a new page, and
  2269.          ;set the subtitle to "Start of Paging"
  2270.           Page+ 'Start of Paging'
  2271.        
  2272.        ******************************************************************
  2273.        
  2274.        PAGESIZE lines [, characters ]
  2275.        
  2276.        Page size.
  2277.        
  2278.        Sets the lines per page and the maximum number of characters per
  2279.        line.  The lines per page affect the number lines output before a
  2280.        new page is started when automatic paging (PAGE+) is active.  The
  2281.        characters per line affect the final length of each list line.
  2282.        
  2283.        PAGESIZE may have one or two immediate data operands.  The first
  2284.        operand becomes the number of lines per page.  The second operand
  2285.        is optional and is the number of characters per line.
  2286.        
  2287.  
  2288.        50                                             Assembly Directives
  2289.        
  2290.        The default lines per page is 60.  The default characters per line
  2291.        is 79.  The lines per page must be in the range 15 to 255 and the
  2292.        characters per line must be in the range 45 to 158.  The number of
  2293.        lines per page and the number of characters per line should only
  2294.        be set once in a program.  The number of characters per line can
  2295.        also be set with LINESIZE.
  2296.        
  2297.          ;this makes for very long pages
  2298.           Pagesize 200
  2299.        
  2300.          ;the following two lines would have the same effect,
  2301.           Pagesize ,50   ;note that the first operand is nul
  2302.          ;Linsize 50     ;characters per line should only be set once
  2303.        
  2304.        ******************************************************************
  2305.        
  2306.        PROC type
  2307.        
  2308.        Procedure declaration.
  2309.        
  2310.        Begin a procedure declaration that will be finished by the ENDP
  2311.        directive.
  2312.        
  2313.        PROC requires a single operand.  This operand is NEAR for near
  2314.        procedures and FAR for far procedures.
  2315.        
  2316.        Far procedures should only be used for routines that will be
  2317.        called by other programs or are called indirectly.  Far procedures
  2318.        cannot be called locally via a CALL instruction.  The type of
  2319.        procedure determines how the returns (RET instructions) within the
  2320.        procedure will be encoded.
  2321.        
  2322.        See Procedures.
  2323.        
  2324.          ;the procedure ORRER is defined, the PROC
  2325.          ;directive starts the declaration
  2326.        
  2327.          Orrer Proc Near
  2328.           Or Cx, 10101b
  2329.           Ret
  2330.           Endp
  2331.        
  2332.        ******************************************************************
  2333.        
  2334.        RESETC [count] [,checksum]
  2335.        
  2336.        Reset counter.
  2337.        
  2338.        Resets the counter ($COUNT) and counter checksum ($SUM).
  2339.        
  2340.  
  2341.        Assembly Directives                                             51
  2342.        
  2343.        RESETC may have none, one, or two immediate data operands.  Both
  2344.        operands are optional.  If the first operand is present, it
  2345.        becomes the new count value.  If the second operand is present, it
  2346.        becomes the new checksum value.  If an operand is missing, zero is
  2347.        used.
  2348.        
  2349.        The new values take effect on the line after the RESETC directive.
  2350.        This directive does not affect the program byte count ($SIZE) or
  2351.        checksum ($CHKSUM).
  2352.        
  2353.           Resetc         ;set count and checksum to zero
  2354.           Mov Ax, $Count ;will load zero to AX
  2355.           Resetc ,20     ;default (zero) for count, 20 for checksum
  2356.           Mov Ax, $Sum   ;will load 20 to AX
  2357.        
  2358.        ******************************************************************
  2359.        
  2360.        SUBTITLE subtitle
  2361.        
  2362.        Program subtitle.
  2363.        
  2364.        Defines the page subtitle for all subsequent pages.
  2365.        
  2366.        SUBTITLE requires a single string operand.  The operand becomes
  2367.        the subtitle.
  2368.        
  2369.        Note that SUBTITLE sets the subtitle for all pages following the
  2370.        present one, not the page in which the SUBTITLE directive appears.
  2371.        The PAGE, PAGE+, and TITLE directives can also be used to set the
  2372.        subtitle.
  2373.        
  2374.        See Assembly Listing.
  2375.        
  2376.          ;set the subtitle of the following pages
  2377.          ;to "Input and Output Routines"
  2378.           Subtitle 'Input and Output Routines'
  2379.        
  2380.        ******************************************************************
  2381.        
  2382.        SYMDUMP+ 
  2383.        SYMDUMP-
  2384.        
  2385.        Symbol table dump.
  2386.        
  2387.        When activated (SYMDUMP+), the symbol table will be displayed at
  2388.        the end of the listing.  When not activated (SYMDUMP-), the symbol
  2389.        table will not be displayed.
  2390.        
  2391.        Requires no operands.
  2392.        
  2393.        The default is SYMDUMP-.  There is only one symbol dump at the end
  2394.        of the program, i.e. there is no reason to turn the symbol table
  2395.        dump on and then turn it off later.
  2396.        
  2397.  
  2398.        52                                             Assembly Directives
  2399.        
  2400.        See Symbol Table Listing.
  2401.        
  2402.          ;enable symbol dump at the end
  2403.          ;of the program
  2404.           Symdump+
  2405.        
  2406.        ******************************************************************
  2407.        
  2408.        TITLE title [,subtitle]
  2409.        
  2410.        Program title.
  2411.        
  2412.        Defines the page title for the entire program listing.  The
  2413.        starting page subtitle may also be specified.
  2414.        
  2415.        TITLE requires one or two operands.  The first operand becomes the
  2416.        program title.  The optional second operand becomes the subtitle.
  2417.        Both operands must be strings.
  2418.        
  2419.        Only one TITLE directive is valid for the entire program.  The
  2420.        TITLE directive is the only way to set the subtitle on the first
  2421.        page header, since SUBTITLE takes effect on the next page
  2422.        following the directive and PAGE and PAGE+ automatically start a
  2423.        new page.
  2424.        
  2425.        See Assembly Listing.
  2426.        
  2427.          ;set the program title to "Holy Cow" and the
  2428.          ;initial subtitle to "Initialize"
  2429.           Title 'Holy Cow', 'Initialize'
  2430.        
  2431.        ******************************************************************
  2432.        
  2433.        UNUSED+ 
  2434.        UNUSED-
  2435.        
  2436.        Unused symbol flagging.
  2437.        
  2438.        When active (UNUSED+), all symbols that were never accessed will
  2439.        be flagged.  When not active (UNUSED-), unused symbols will not be
  2440.        flagged.
  2441.        
  2442.        Requires no operands.
  2443.        
  2444.        Used to inform the programmer of unnecessary labels, routines,
  2445.        etc.  Unused macro declarations are never flagged.  The default is
  2446.        UNUSED-.
  2447.        
  2448.  
  2449.        Assembly Directives                                             53
  2450.        
  2451.          ;assuming the near labels SYM1 and SYM2 were
  2452.          ;never accessed, SYM1 is flagged and SYM2 isn't
  2453.           Unused-
  2454.          Sym1
  2455.           Unused+
  2456.          Sym2
  2457.        
  2458.        ******************************************************************
  2459.        
  2460.  
  2461.        54                                             Functional Operands
  2462.        
  2463.                                Functional Operands
  2464.        
  2465.        Functional operands modify another operand passed as an argument.
  2466.        Functional operands serve two general purposes: first to change a
  2467.        characteristic of an operand but still use it in more or less the
  2468.        same way, and second to isolate a specific aspect of an operand.
  2469.        All functional operands take another operand as an argument and
  2470.        can be used anywhere in place of a normal operand.
  2471.        
  2472.        The major categories of functional operands are those that set the
  2473.        size of its argument (ANYSIZE, BYTE, DWORD, QWORD, TBYTE, WORD),
  2474.        those that change the type of its argument (FAR, NEAR), those that
  2475.        change the value of its argument (NEG, NOT), and those that are
  2476.        used to access specific qualities of its argument (OFFSET, SIZE,
  2477.        TYPE, VALUE).
  2478.        
  2479.        ******************************************************************
  2480.        
  2481.        ANYSIZE
  2482.        
  2483.        Size any.
  2484.        
  2485.        Set the size of its argument to all allowable sizes.
  2486.        
  2487.        Its argument must be a memory operand or immediate data.  Can also
  2488.        be used with the LABEL directive.
  2489.        
  2490.          ;the following two statements do not
  2491.          ;conflict because of the ANYSIZE below
  2492.           Mov Bx, Data   ;move 16 bits
  2493.           Add Data, Al   ;add 8 bits
  2494.        
  2495.          Data Label Anysize   ;data label
  2496.           Dw ?                ;declare space for data
  2497.        
  2498.        ******************************************************************
  2499.        
  2500.        BYTE
  2501.        
  2502.        Size byte.
  2503.        
  2504.        Set the size of its argument to byte size (8 bit).
  2505.        
  2506.        Its argument must be a memory operand or immediate data.  Can also
  2507.        be used with the LABEL directive.  Used mainly to declare the
  2508.        number of bits acted upon in an operation if the operation would
  2509.        be ambiguous otherwise.
  2510.        
  2511.          ;the size of [SI] would be ambiguous
  2512.           Mov Byte [Si], 0   ;perform an 8 bit move
  2513.        
  2514.  
  2515.        Functional Operands                                             55
  2516.        
  2517.        ******************************************************************
  2518.        
  2519.        DWORD
  2520.        
  2521.        Size double word.
  2522.        
  2523.        Set the size of its argument to double word size (32 bit).
  2524.        
  2525.        Its argument must be a memory operand or immediate data.  Can also
  2526.        be used with the LABEL directive.  Used mainly to declare the
  2527.        number of bits acted upon in an operation if the operation would
  2528.        be ambiguous otherwise.
  2529.        
  2530.          ;make an intersegment call
  2531.           Call Routine_Location  ;call routine
  2532.        
  2533.          Routine_Location Label Dword   ;the location is 367A:6374
  2534.           Dw 06374h   ;offset
  2535.           Dw 0367ah   ;segment
  2536.        
  2537.        ******************************************************************
  2538.        
  2539.        FAR
  2540.        
  2541.        Type far label.
  2542.        
  2543.        Set the type of its argument to far label.
  2544.        
  2545.        Its argument must be a near label, far label, or memory operand.
  2546.        If its argument is a near or far label, the label is simply
  2547.        converted to a far label.  If its argument is a memory operand,
  2548.        FAR has the same effect as the DWORD function.  This allows FAR to
  2549.        be used in specifying indirect intersegment branching.  FAR is
  2550.        mainly used to declare a far procedure.
  2551.        
  2552.          ;execute an intersegment call, [BX] must point to a location
  2553.          ;containing the segment and offset of the subroutine to execute
  2554.           Call Far [Bx] ;transfer control to routine
  2555.        
  2556.          ;declare a rather insignificant far procedure, cannot
  2557.          ;be called directly, but may be an interrupt handler
  2558.        
  2559.          Subrt Proc Far  ;make far procedure
  2560.           Ret            ;return, don't do anything
  2561.           Endp           ;end of declaration
  2562.        
  2563.        ******************************************************************
  2564.        
  2565.        NEAR
  2566.        
  2567.        Type near label.
  2568.        
  2569.        Set the type of its argument to near label.
  2570.        
  2571.  
  2572.        56                                             Functional Operands
  2573.        
  2574.        Its argument must be a near label, far label, memory operand, or
  2575.        immediate data.  If its argument is a near or far label or
  2576.        immediate data, the operand is simply converted to a near label.
  2577.        If its argument is a memory operand, NEAR has the same effect as
  2578.        the WORD function.  This allows NEAR to be used in specifying
  2579.        indirect same segment branching.  NEAR is mainly used to declare a
  2580.        near procedure.
  2581.        
  2582.          ;execute a same segment call, DATA must point to a location
  2583.          ;containing the offset of the subroutine to execute
  2584.           Call Near Data ;transfer control to routine
  2585.        
  2586.          Data Ds 2       ;two bytes of storage (offset)
  2587.        
  2588.          ;declare a near procedure that doubles AX
  2589.        
  2590.          Double Proc Near ;make near procedure
  2591.           Sal Ax          ;double AX
  2592.           Ret             ;return
  2593.           Endp            ;end of procedure
  2594.        
  2595.          ;NEAR can be used to jump to a literal location
  2596.           Jmp Near 100h  ;branch to start of program
  2597.        
  2598.        ******************************************************************
  2599.        
  2600.        NEG
  2601.        
  2602.        Negate value.
  2603.        
  2604.        Perform an arithmetic negate on the value of its argument.
  2605.        
  2606.        Its argument must be immediate data.  Acts the same as a preceding
  2607.        sign, except that the validity of the result is not checked.
  2608.        
  2609.          ;the following two statements produce the same code
  2610.           Mov Dx, Neg 1 ;load minus one
  2611.           Mov Dx, -1    ;load minus one
  2612.        
  2613.          ;the following statement is really an undetected error
  2614.           Mov Dx, Neg 40000 ;-40000 cannot be represented with 16 bits
  2615.        
  2616.        ******************************************************************
  2617.        
  2618.        NOT
  2619.        
  2620.        Logical not of value.
  2621.        
  2622.        Perform a logical not on the value of its argument.
  2623.        
  2624.        Its argument must be immediate data.
  2625.        
  2626.  
  2627.        Functional Operands                                             57
  2628.        
  2629.          ;the following two statements produce the same code
  2630.           Mov Dh, Not 10101010b  ;load 55H
  2631.           Mov Dh, 01010101b      ;load 55H
  2632.        
  2633.        ******************************************************************
  2634.        
  2635.        OFFSET
  2636.        
  2637.        Offset of label.
  2638.        
  2639.        Return the offset of its argument.
  2640.        
  2641.        Its argument must be a near, far, or memory label.  The offset, or
  2642.        location, is returned as 16 bit immediate data.  Is mainly used by
  2643.        sections of code or individual routines which access data that may
  2644.        be any length (like strings of characters).
  2645.        
  2646.          ;put message location in SI
  2647.           Mov Si, Offset Start               ;location
  2648.          ;put message length in CX
  2649.           Mov Cx, Offset End - Offset Start  ;size
  2650.        
  2651.          Start Db 'This is the message'      ;message data
  2652.          End                                 ;end of message marker
  2653.        
  2654.        ******************************************************************
  2655.        
  2656.        QWORD
  2657.        
  2658.        Size quadruple word.
  2659.        
  2660.        Set the size of its argument to quadruple word (64 bit).
  2661.        
  2662.        Its argument must be a memory operand.  Not fully implemented,
  2663.        will be used for 8087 support.
  2664.        
  2665.        ******************************************************************
  2666.        
  2667.        SIZE
  2668.        
  2669.        Size of operand.
  2670.        
  2671.        Return the size of its argument.
  2672.        
  2673.        Its argument may be anything.  The size is returned as 16 bit
  2674.        immediate data for comparison with the size of other operands.
  2675.        See Conditional Operand Testing.
  2676.        
  2677.          ;the NOP is assembled if the sizes are identical
  2678.           If Size Ax = Size Symbol ;compare sizes
  2679.            Nop                ;code if true
  2680.           Endif               ;end of conditional
  2681.        
  2682.  
  2683.        58                                             Functional Operands
  2684.        
  2685.        ******************************************************************
  2686.        
  2687.        TBYTE
  2688.        
  2689.        Size ten byte.
  2690.        
  2691.        Set the size of its argument to ten bytes (80 bit).
  2692.        
  2693.        Its argument must be a memory operand.  Not fully implemented,
  2694.        will be used for 8087 support.
  2695.        
  2696.        ******************************************************************
  2697.        
  2698.        TYPE
  2699.        
  2700.        Type of operand.
  2701.        
  2702.        Return the type of its argument.
  2703.        
  2704.        Its argument may be anything.  The type is returned as 16 bit
  2705.        immediate data for comparison with the type of other operands.
  2706.        See Conditional Operand Testing.
  2707.        
  2708.          ;the NOP is assembled if the types are identical
  2709.           If Type Ax = Type Symbol ;compare types
  2710.            Nop                ;code if true
  2711.           Endif               ;end of conditional
  2712.        
  2713.        ******************************************************************
  2714.        
  2715.        WORD
  2716.        
  2717.        Size word.
  2718.        
  2719.        Set the size of its argument to word (16 bit).
  2720.        
  2721.        Its argument must be a memory operand or immediate data.  Can also
  2722.        be used with the LABEL directive.  Used mainly to declare the
  2723.        number of bits acted upon in an operation if the operation would
  2724.        be ambiguous otherwise.
  2725.        
  2726.          ;the size of [BX+SI-10] would be ambiguous
  2727.           Mov Word [Bx+Si-10], 0   ;perform a 16 bit move
  2728.        
  2729.        ******************************************************************
  2730.        
  2731.        VALUE
  2732.        
  2733.        Value of operand.
  2734.        
  2735.        Return the value of its argument.
  2736.        
  2737.  
  2738.        Functional Operands                                             59
  2739.        
  2740.        Its argument may be anything.  The value is returned as 16 bit
  2741.        immediate data for comparison with the value of other operands.
  2742.        See Conditional Operand Testing.
  2743.        
  2744.          ;the NOP is assembled if the values are identical
  2745.           If Value Ax = Value Symbol ;compare sizes
  2746.            Nop                ;code if true
  2747.           Endif               ;end of conditional
  2748.        
  2749.        ******************************************************************
  2750.        
  2751.  
  2752.        60                                              Assembly Constants
  2753.        
  2754.                                Assembly Constants
  2755.        
  2756.        Assembly constants are special symbols that are interpreted into
  2757.        immediate data during assembly.  Assembly constants may be used
  2758.        anywhere in place of immediate data.  Beware that these constants
  2759.        can cause an otherwise unexplained phase errors when used with
  2760.        instructions that directly manipulate the the location counter,
  2761.        like ORG.  Care should also be taken when using assembly constants
  2762.        with assembly directives that must control the assembly based on a
  2763.        value. Assembly constants may always be safely used as operands
  2764.        for 8086 instructions and in byte and word declarations (DB and
  2765.        DW).
  2766.        
  2767.        All symbols starting with a dollar sign are reserved as assembly
  2768.        constants.
  2769.        
  2770.        ******************************************************************
  2771.        
  2772.        $
  2773.        
  2774.        Present location.
  2775.        
  2776.        Returns the present value of the location counter.  Same as $LOC.
  2777.        May be safely used with the ORG directive.  16 bit.
  2778.        
  2779.          ;declares two memory labels that are ten bytes from each other
  2780.        
  2781.          Data_Area1 Label Byte   ;first label
  2782.                     Org $ + 10   ;advance location counter
  2783.          Data_Area2 Label Byte   ;second label
  2784.        
  2785.        ******************************************************************
  2786.        
  2787.        $CHKSUM
  2788.        
  2789.        Program checksum.
  2790.        
  2791.        Returns the byte checksum of the object code up to and including
  2792.        the previous source line.  8 bit.
  2793.        
  2794.        ******************************************************************
  2795.        
  2796.        $COUNT
  2797.        
  2798.        Byte count.
  2799.        
  2800.        Returns the number of bytes of code since the beginning of the
  2801.        program or the last RESETC directive.  16 bit.
  2802.        
  2803.  
  2804.        Assembly Constants                                              61
  2805.        
  2806.          ;branch around the string and then load its size
  2807.           Jmps Continue                  ;skip string
  2808.           Resetc                         ;reset counter
  2809.           Db 'Which way did he go?'      ;string declaration
  2810.          Continue                        ;continue execution
  2811.           Mov Cx, $Count                 ;load byte count
  2812.        
  2813.        ******************************************************************
  2814.        
  2815.        $DATE1
  2816.        
  2817.        Month and day.
  2818.        
  2819.        Returns the present day and month in the system format.  The high
  2820.        byte is the month (1 to 12) and the low byte is the day (1 to 31).
  2821.        16 bit.
  2822.        
  2823.        ******************************************************************
  2824.        
  2825.        $DATE2
  2826.        
  2827.        Year.
  2828.        
  2829.        Returns the present year in the system format.  The value is 1980
  2830.        to 2099.  16 bit.
  2831.        
  2832.        ******************************************************************
  2833.        
  2834.        $LOC
  2835.        
  2836.        Present location.
  2837.        
  2838.        Returns the present value of the location counter.  Same as $.
  2839.        May be safely used with the ORG directive.
  2840.        
  2841.        ******************************************************************
  2842.        
  2843.        $SIZE
  2844.        
  2845.        Program size.
  2846.        
  2847.        Returns the total size of the assembled program in bytes.  16 bit.
  2848.        
  2849.          ;load the size of the program into AX
  2850.           Mov Ax, $Size  ;load size
  2851.        
  2852.        ******************************************************************
  2853.        
  2854.        $SUM
  2855.        
  2856.        Counter checksum.
  2857.        
  2858.  
  2859.        62                                              Assembly Constants
  2860.        
  2861.        Returns the byte checksum of the object code up to and including
  2862.        the previous source line since the beginning of the program or the
  2863.        last RESETC.  8 bit.
  2864.        
  2865.        ******************************************************************
  2866.        
  2867.        $TIME1
  2868.        
  2869.        Second and 1/100 second.
  2870.        
  2871.        Returns the present second and 1/100 second in the system format.
  2872.        The high byte is the second (0 to 59) and the low byte is the
  2873.        1/100 second (0 to 99).  16 bit.
  2874.        
  2875.        ******************************************************************
  2876.        
  2877.        $TIME2
  2878.        
  2879.        Hour and minute.
  2880.        
  2881.        Returns the present hour and minute in the system format.  The
  2882.        high byte is the hour (0 to 23) and the low byte is the minute (0
  2883.        to 59).  16 bit.
  2884.        
  2885.        ******************************************************************
  2886.        
  2887.        $VERSION
  2888.        
  2889.        Assembler version.
  2890.        
  2891.        Returns the version number of the assembler.  The high byte is the
  2892.        minor version number and the low byte is the major version number.
  2893.        
  2894.          ;if assembling with WASM 2.14, AL get 2 and AH gets 14
  2895.           Mov Ax, $Version
  2896.        
  2897.        ******************************************************************
  2898.        
  2899.  
  2900.        Reserved Symbols                                                63
  2901.        
  2902.                                 Reserved Symbols
  2903.        
  2904.        The following are guidelines for what not to use as symbols.  All
  2905.        of these symbols have special meaning to WASM:
  2906.        
  2907.          AX      AL      ES       BYTE      OR
  2908.          CX      CL      CS       WORD      AND
  2909.          DX      DL      SS       DWORD     XOR
  2910.          BX      BL      DS       QWORD     MOD
  2911.          SP      AH      NOT      TBYTE     SIZE
  2912.          BP      CH      OFFSET   ANYSIZE   TYPE
  2913.          SI      DH      NEAR     ST        VALUE
  2914.          DI      BH      FAR      NEG
  2915.        
  2916.        A single question mark is also a reserved symbol.  All fields
  2917.        beginning with 0 to 9 are reserved for numbers.  All fields
  2918.        starting with a dollar sign ($) are reserved for assembly
  2919.        constants.  The following characters should never be used in
  2920.        symbols: control characters (ASCII 0 to 31), spaces, commas; and
  2921.        also any of the following: ; + - * = ' / \ ( ) < > [ ]  Macros
  2922.        should be unique from all other instructions, rather than the
  2923.        special symbols above.  It is recommended that programmer defined
  2924.        symbols start with a letter and consist of only letters, numbers,
  2925.        and underscores.
  2926.        
  2927.  
  2928.        64                                                Assembly Listing
  2929.        
  2930.                                 Assembly Listing
  2931.        
  2932.        The assembly listing is a comprehensive trace of the assembly and
  2933.        can be useful in debugging or making a hard copy of a program.  A
  2934.        listing is only generated if a list file is specified.  The
  2935.        assembly is speeded up if no list is generated.  A listing can be
  2936.        started or stopped with LIST+ and LIST- (these directives are
  2937.        ignored if no list file is specified).  The listing of macro
  2938.        expansion lines can be enabled with EXPAND+ (the default), or
  2939.        disabled with the EXPAND-.  Also a listing of the symbol table
  2940.        will be generated if a SYMDUMP+ is included somewhere in the
  2941.        program (see Symbol Table Listing).
  2942.        
  2943.        List directives within an included file only apply to the listing
  2944.        of that file, and expand directives within a macro only apply to
  2945.        the expansion of that macro.  This means you can place a LIST- at
  2946.        the start of an included file to suppress the listing of just that
  2947.        file. You can use an EXPAND- similarly to create a macro that is
  2948.        never expanded.
  2949.        
  2950.        The listing may be divided up into pages.  An individual page can
  2951.        be started with PAGE.  Automatic paging can be turned on with
  2952.        PAGE+ and turned off with PAGE- (the default).  The default page
  2953.        size is 60 lines (which includes a five line page header).  The
  2954.        page size can be modified with PAGESIZE.
  2955.        
  2956.        Each list page starts with a formfeed (ASCII 12) and a list
  2957.        header.  The formfeed is not included on the first page or on any
  2958.        pages of a listing sent to CON.  The list header consists of a
  2959.        programmer defined title and subtitle, the name of the main source
  2960.        file, the page number, the time and date, columnar headings for
  2961.        the list lines, and the assembler version.
  2962.        
  2963.        The title and subtitle are left justified in lines one and two
  2964.        respectively.  Only one title applies for an entire assembly
  2965.        listing.  Both the title and subtitle can be set with TITLE.  The
  2966.        subtitle can also be set with SUBTITLE, PAGE, and PAGE+.
  2967.        
  2968.        The source file name is displayed with the present page number,
  2969.        separated by a pair of dashes, right justified on the first line
  2970.        (opposite to the title).  Only the main source file name is
  2971.        displayed (never any included file names).  The page number starts
  2972.        at one and increments with each page.  The page number is never
  2973.        directly based on the pages within a source file (unlike list line
  2974.        numbers).  The page number can be set with PAGE and PAGE+.
  2975.        
  2976.        The time and date are right justified on the second line (opposite
  2977.        to the subtitle).
  2978.        
  2979.  
  2980.        Assembly Listing                                                65
  2981.        
  2982.        The columnar headings and the assembler version follow a blank
  2983.        line after the first two lines of the header (they are on line
  2984.        four).  In the columnar list headings: Loc stands for location
  2985.        counter, Obj stands for object code, Line stands for line number,
  2986.        and Source stands for source code.  The assembler version is
  2987.        justified to the right of the headings.
  2988.        
  2989.        The listing starts after another blank line (i.e. the sixth line
  2990.        of the page).  Each list line contains the location counter value
  2991.        (in hex), the object code for that line (also in hex), the source
  2992.        line number, a special indicator byte, and the source line itself.
  2993.        
  2994.        The location counter is not displayed if the line is blank or the
  2995.        location is not relevant to the instruction contained in that
  2996.        source line.
  2997.        
  2998.        No object code will be displayed if, of course, none is generated
  2999.        by the source line.  Some instructions (DS) never display their
  3000.        object code.  Procedure (PROC) and End-Procedure (ENDP) directives
  3001.        display the present procedure nest level instead.  Macros display
  3002.        the present macro nest level.
  3003.        
  3004.        The line number is always the actual line number within the source
  3005.        file.  Included source files maintain their own line numbering.
  3006.        You can use this number in your text editor to locate the line
  3007.        within its file.  Since macro expansion lines are not in the
  3008.        source file, no line number is displayed.
  3009.        
  3010.        The special indicator byte is a plus (+) for macro expansion
  3011.        lines, a minus (-) for included source files, and is blank
  3012.        otherwise.
  3013.        
  3014.        The source line is converted to upper-case (except for strings and
  3015.        comments), and will be truncated if necessary to make the entire
  3016.        list line the proper width.  The default width is 79.  The width
  3017.        can be modified with LINESIZE and PAGESIZE.  The LINESIZE
  3018.        directive can also be used to send special codes to your printer
  3019.        (with the purpose of setting a font).
  3020.        
  3021.        All the assembly directives mentioned in this description can be
  3022.        looked up under Assembly Directives.
  3023.        
  3024.  
  3025.        66                                            Symbol Table Listing
  3026.        
  3027.                               Symbol Table Listing
  3028.        
  3029.        A symbol table listing can be activated with SYMDUMP+.  The symbol
  3030.        table is listed at the very end of the assembly.  All symbols in
  3031.        the program are included, except symbols within macro expansions
  3032.        or declarations, and symbols that were defined in code that was
  3033.        skipped due to conditional assembly.
  3034.        
  3035.        The symbol table listing is divided five parts: Branch Locations,
  3036.        Memory References, Equated Values, Defined Macros, and Undefined
  3037.        Symbols.  Each section starts a new page.  The titles describing
  3038.        the section replace the normal columnar headings.
  3039.        
  3040.        The symbols are sorted alphabetically within each section.  For
  3041.        the purposes of alphabetization, underscores are ignored, for
  3042.        example: the symbol A_B carries the same weight as AB, both of
  3043.        these symbols would come after AA and before AC.  If a value is
  3044.        displayed with the symbol, it will be lined up to the right,
  3045.        expressed in hex.
  3046.        
  3047.        The branch locations section lists all the branch labels (types
  3048.        NEAR and FAR) within the program, including the names of
  3049.        procedures (which are just near labels).  Each symbol is
  3050.        accompanied by the location it represents.
  3051.        
  3052.        The memory reference section lists all the memory reference labels
  3053.        (type BYTE, WORD, etc.) within the program.  Each symbol is
  3054.        accompanied by the location it represents.
  3055.        
  3056.        The equated values section lists all the symbols defined by the
  3057.        EQU directive.  Each symbol is accompanied by the value it
  3058.        represents.
  3059.        
  3060.        The defined macros section lists all the macros that where defined
  3061.        within the program.  Every macro that was defined will be listed,
  3062.        whether or not it was used.
  3063.        
  3064.        The undefined symbols section lists all symbols that were used but
  3065.        not defined.
  3066.        
  3067.  
  3068.        Assembly Messages                                               67
  3069.        
  3070.                                 Assembly Messages
  3071.        
  3072.        The integrity of the source code is constantly checked during
  3073.        assembly.  Lines containing errors will be flagged with an
  3074.        appropriate error message.  Some lines are only flagged with a
  3075.        comment.  A comment is more of an observation than an error.
  3076.        Comments try to provide useful advice about the assembly.
  3077.        Comments are not included in the error count displayed at the end
  3078.        of assembly.
  3079.        
  3080.        Error and comment messages will be sent to the list file if a
  3081.        listing is being generated, otherwise the message will be
  3082.        displayed to the screen followed by the source line that caused
  3083.        the error or comment.  A line may be flagged with more than one
  3084.        message.  Paging occurs indiscriminately, so that error or comment
  3085.        messages may not appear on the same page as the line that they are
  3086.        flagging.
  3087.        
  3088.        Error messages start with "- - - Error: " and comment messages
  3089.        start with "- - - Comment: ".  Many error and comment messages are
  3090.        followed on the same line by sections of the source code or
  3091.        numbers.  Numbers will either be decimal or hexadecimal (followed
  3092.        by an "H").  If a line is flagged in an included file, the name of
  3093.        the file will appear in parenthesis following the message.  If a
  3094.        line is flagged in a macro expansion, the last source line number
  3095.        will appear in parenthesis.  If both of these conditions are true,
  3096.        then both the file name and line number will appear.
  3097.        
  3098.        Many times the thing that caused one error will cause others, so
  3099.        fixing up one error will often clear up others.  If the reasons
  3100.        for a particular error are unclear, try solving any previous
  3101.        errors first.
  3102.        
  3103.        Some errors may terminate the assembly.  If this happens, the
  3104.        message ">>>Cannot Continue<<<" will be displayed to the screen
  3105.        and the speaker will be sounded.
  3106.        
  3107.        Several assembly directives allow control over error flagging and
  3108.        detection.  The flagging of every undefined symbol occurrence can
  3109.        be activated or deactivated with FLAGALL+ and FLAGALL-; the
  3110.        detection of possible short unconditional jumps may be activated
  3111.        or deactivated with JUMP+ and JUMP-; and the flagging of unused
  3112.        symbols may be activated or deactivated with UNUSED+ and UNUSED-.
  3113.        A programmer defined error may be created with ERROR.  Finally,
  3114.        the maximum number of errors detected before the assembly is
  3115.        terminated can be controlled with ERRORMAX.  See Assembly
  3116.        Directives for more information on these directives.
  3117.        
  3118.  
  3119.        68                                               Assembly Messages
  3120.        
  3121.        The following is a description of all assembly messages:
  3122.        
  3123.        Address error
  3124.          There is some kind of error in an indirect memory operand.
  3125.          Probably an illegal combination of addressing registers.  The
  3126.          legal addressing register combinations are: BX, BP, DI, SI,
  3127.          BX+DI, BX+SI, BP+DI, and BP+SI.  Any of these combinations may
  3128.          also include an immediate data offset or displacement.
  3129.        
  3130.        Ambiguous memory reference
  3131.          A memory operand does not have its size properly specified.
  3132.          Usually occurs when the operands are a memory operand and
  3133.          immediate data and the size of the first is not defined.  Under
  3134.          those circumstances, the size of the memory operand should be
  3135.          defined with an explicit BYTE or WORD function.  This error also
  3136.          occurs if a LABEL directive is missing its operand.
  3137.        
  3138.        Cannot create list file: <file name>
  3139.          The list file could not be created or opened.  Probably because
  3140.          of an invalid file name.  The name of the list file is
  3141.          displayed.  Refer to the DOS manual for a description of legal
  3142.          file names.  Critical error.
  3143.        
  3144.        Cannot create object file: <file name>
  3145.          The object file could not be created or opened.  Probably
  3146.          because of an invalid file name.  The name of the object file is
  3147.          displayed.  Refer to the DOS manual for a description of legal
  3148.          file names.  Critical error.
  3149.        
  3150.        Could use JMPS: <displacement>
  3151.          The branch location is close enough so that a short
  3152.          unconditional jump (JMPS) instruction could be substituted for a
  3153.          normal jump (JMP).  The only effect this change would have is to
  3154.          shorten the resulting object code by one byte, i.e. the code is
  3155.          not incorrect the way it stands.  The flagging of possible short
  3156.          jumps is enabled with the JUMP+ directive.
  3157.        
  3158.        Data too long in declaration: <operand value>
  3159.          The initialization value (the second operand) of the DS
  3160.          directive is more than eight bits.  The value is displayed, it
  3161.          should be in the range 0 to 255.
  3162.        
  3163.        Disk full or write error: <file name>
  3164.          An error occurred in writing to the object or list file.
  3165.          Probably because the disk is full.  The name of the file in
  3166.          which the error occurred is displayed.  Make sure that the disk
  3167.          has enough free space, or send the object file or listing to
  3168.          another disk or device.  Critical error.
  3169.        
  3170.        Division by zero
  3171.          A division by zero occurred somewhere in an operand expression.
  3172.          The The value of the divisor must be changed to something other
  3173.          than zero.
  3174.        
  3175.  
  3176.        Assembly Messages                                               69
  3177.        
  3178.        Duplicate definition: <symbol>
  3179.          A symbol was declared more than once.  In addition to normal
  3180.          symbol declarations at the start of source lines, the parameter
  3181.          names after a MACRO directive are also considered symbol
  3182.          declarations (though only local to that macro).  Every duplicate
  3183.          definition of a symbol is flagged.  The symbol declarations must
  3184.          be changed so that they are all unique.  The symbol is
  3185.          displayed.
  3186.        
  3187.        ENDM without MACRO
  3188.          An ENDM directive was found without a corresponding MACRO or
  3189.          MACROC.
  3190.        
  3191.        ENDP without PROC
  3192.          An ENDP directive was found without a corresponding PROC.
  3193.        
  3194.        EQU without symbol
  3195.          The EQU directive was used without a symbol declaration.  An
  3196.          equate is meaningless without a symbol, thus a symbol
  3197.          declaration is required.
  3198.        
  3199.        IF statements nested too deeply: <maximum nest level>
  3200.          Conditional IF or IFN directives were nested too deeply.  The
  3201.          maximum nest level is displayed.
  3202.        
  3203.        Illegal addressing operand: <operand>
  3204.          An operand within brackets is not a valid addressing operand.
  3205.          The valid addressing operands are BX, BP, DI, SI, memory labels,
  3206.          and immediate data.  The operand is displayed.
  3207.        
  3208.        Illegal argument for ANYSIZE: <argument>
  3209.          The argument given for ANYSIZE is not valid.  The argument
  3210.          should be immediate data or a memory operand.  The argument is
  3211.          displayed.
  3212.        
  3213.        Illegal argument for BYTE: <argument>
  3214.          The argument given for BYTE is not valid.  The argument should
  3215.          be immediate data or a memory operand.  The argument is
  3216.          displayed.
  3217.        
  3218.        Illegal argument for DWORD: <argument>
  3219.          The argument given for DWORD is not valid.  The argument should
  3220.          be immediate data or a memory operand.  The argument is
  3221.          displayed.
  3222.        
  3223.        Illegal argument for FAR:
  3224.          The argument given for FAR is not valid.  The argument should be
  3225.          a near label, far label, or memory operand.  The argument is
  3226.          displayed.
  3227.        
  3228.        Illegal argument for NEAR: <argument>
  3229.          The argument given for NEAR is not valid.  The argument should
  3230.          be a near label, far label, memory operand, or immediate data.
  3231.          The argument is displayed.
  3232.        
  3233.  
  3234.        70                                               Assembly Messages
  3235.        
  3236.        Illegal argument for NEG: <argument>
  3237.          The argument given for NEG is not valid.  The argument should be
  3238.          immediate data.  The argument is displayed.
  3239.        
  3240.        Illegal argument for NOT: <argument>
  3241.          The argument given for NOT is not valid.  The argument should be
  3242.          immediate data.  The argument is displayed.
  3243.        
  3244.        Illegal argument for OFFSET: <argument>
  3245.          The argument given for OFFSET is not valid.  The argument should
  3246.          be a near label, far label, or memory label.  The argument is
  3247.          displayed.
  3248.        
  3249.        Illegal argument for QWORD: <argument>
  3250.          The argument given for QWORD is not valid.  The argument should
  3251.          be a memory operand.  The argument is displayed.
  3252.        
  3253.        Illegal argument for ST: <argument>
  3254.          The argument given for ST is not valid.  The argument should be
  3255.          immediate data.  ST, an 8087 stack operand, is not officially
  3256.          implemented.
  3257.        
  3258.        Illegal argument for TBYTE: <argument>
  3259.          The argument given for TBYTE is not valid.  The argument should
  3260.          be a memory operand.  The argument is displayed.
  3261.        
  3262.        Illegal argument for WORD: <argument>
  3263.          The argument given for WORD is not valid.  The argument should
  3264.          be immediate data or a memory operand.  The argument is
  3265.          displayed.
  3266.        
  3267.        Illegal number or symbol: <operand field>: <illegal character>
  3268.          An operand field started with a numerical digit (0 to 9), thus
  3269.          is interpreted as a number, but has an illegal character in it.
  3270.          Usually is a result of leaving the "H" off the end of
  3271.          hexadecimal numbers.  May also be the result of using a symbol
  3272.          that was inadvertently declared with a digit as its first
  3273.          character.  The operand field and the illegal character within
  3274.          it are displayed.
  3275.        
  3276.        Illegal operand in declaration: <operand>
  3277.          An operand in a DB or DW directive is invalid.  All DB operands
  3278.          must be immediate data or strings.  All DW operands must be
  3279.          immediate data.  The operand is displayed.
  3280.        
  3281.  
  3282.        Assembly Messages                                               71
  3283.        
  3284.        Illegal operand(s): <first type> <second type>
  3285.          One or both of the operands given for the instruction are
  3286.          not valid.  The first two operand types are displayed.  The
  3287.          valid operands for any given instruction may be looked up under
  3288.          Instruction Set.
  3289.        
  3290.          The following table shows the meaning of the displayed type
  3291.          bits.  Multiple bits may be active, like AX = 0006H (bits one
  3292.          and two):
  3293.        
  3294.          Bit  Operand Type
  3295.          ---  ------------
  3296.            0  no operand
  3297.            1  non-segment register
  3298.            2  accumulator (AX or AL)
  3299.            3  segment register
  3300.            4  memory operand in brackets
  3301.            5  immediate data
  3302.            6  string
  3303.            7  near label
  3304.            8  far label
  3305.            9  memory label
  3306.           10  (8087 stack)
  3307.           11  (8087 stack top)
  3308.           12  signed operand
  3309.           13  undefined symbol
  3310.           14  (internal use)
  3311.           15  (internal use)
  3312.        
  3313.        Illegal operator or symbol: <operator>
  3314.          One of the special delimiters was out of place or some sort of
  3315.          broader syntax error occurred in the operands of the
  3316.          instruction.  May be because of an illegal operand expression,
  3317.          like AX+1.  May be because of an extra operator, like 1+++1.
  3318.          May be because of a generally illegal construct, like (1+) or
  3319.          [OFFSET].  May be because of an illegal operator within a memory
  3320.          operand, like [5*3] or [1-BX].  May be because of illegal
  3321.          operators in the parameter names after the MACRO directive, like
  3322.          A+B.  The illegal character (operator) is displayed.  The
  3323.          operators AND, OR, XOR, and MOD will only show up as A, O, X,
  3324.          and \.
  3325.        
  3326.        Illegal printer code: <operand>
  3327.          A printer code following the LINESIZE directive is not valid.
  3328.          The printer codes must be 8 bit immediate data.
  3329.        
  3330.        Illegal reference: <value>
  3331.          The value of an equate changed during assembly and is thus not
  3332.          valid.  Probably because a changeable assembly constant was
  3333.          used, or the equate referenced an operand with OFFSET in it
  3334.          before the OFFSET argument was defined, or the equate referenced
  3335.          another, not yet defined equate.  The initial value of the
  3336.          equate is displayed.
  3337.        
  3338.  
  3339.        72                                               Assembly Messages
  3340.        
  3341.        Illegal use of MACRO symbol: <symbol>
  3342.          A macro symbol was used as an operand.  Macros may only be used
  3343.          as instructions.  The symbol is displayed.
  3344.        
  3345.        INCLUDE file not found: <file name>
  3346.          The include file could not be found or opened.  Probably because
  3347.          of an incorrect file name.  Make sure that all components of the
  3348.          file name are correct.  Remember that the source drive/path and
  3349.          an extension of ASM are assumed if not otherwise specified.  The
  3350.          name of the include file is displayed.
  3351.        
  3352.        INCLUDE's nested too deeply
  3353.          An INCLUDE directive inside of an included file was encountered.
  3354.          Include files may not be nested.
  3355.        
  3356.        INCLUDE within macro
  3357.          An INCLUDE directive inside of a macro expansion was detected.
  3358.          INCLUDE's may not be placed in macros.
  3359.        
  3360.        Invalid character in symbol: <symbol>
  3361.          The symbol being declared contains invalid character(s).
  3362.          Presently all symbols with a first character of "0" through "9"
  3363.          (reserved for numbers) or a first character of "$" (reserved for
  3364.          assembly constants) are flagged.  Macro parameter names
  3365.          (following a MACRO directive) can also be flagged in a similar
  3366.          manner.  The symbol must be changed so it conforms to the legal
  3367.          format.  The symbol is displayed.  See Reserved Symbols.
  3368.        
  3369.        Invalid operand size: <first size> <second size>
  3370.          No version of the instruction was found with matching operand
  3371.          sizes. This comment is provided to assist in fixing an Invalid
  3372.          Operands error.  The size of the first two operands are
  3373.          displayed. The valid operands and sizes for any given
  3374.          instruction may be looked up under Instruction Set.
  3375.        
  3376.          The following table shows the meaning of the displayed size
  3377.          bits.  Multiple bits may be active, like 5 = 0003H (bits zero
  3378.          and one):
  3379.        
  3380.          Bit  Operand Size
  3381.          ---  ------------
  3382.           0   8 bits, byte
  3383.           1   16 bits, word
  3384.           2   32 bits, double word
  3385.           3   64 bits, quadruple word
  3386.           4   80 bits, ten byte
  3387.        
  3388.          Bits 5 through 15 are for internal use.
  3389.        
  3390.        LABEL without label
  3391.          The LABEL directive was used without a symbol declaration.  A
  3392.          label declaration is meaningless without a symbol, thus a symbol
  3393.          is required.
  3394.        
  3395.  
  3396.        Assembly Messages                                               73
  3397.        
  3398.        Line size out of range: <specified size>
  3399.          The length of the line specified by a LINESIZE or PAGESIZE
  3400.          directive is either too small or too large.  The value must be
  3401.          in the range 45 to 158.  The value is displayed.
  3402.        
  3403.        MACRO without symbol
  3404.          The MACRO directive was used without a symbol declaration.  A
  3405.          macro declaration is meaningless without a symbol, thus a symbol
  3406.          is required.
  3407.        
  3408.        Macros nested too deeply: <maximum nest level>
  3409.          Macros are being expanded too deeply.  The maximum nest level is
  3410.          displayed.
  3411.        
  3412.        Missing ENDIF: <number>
  3413.          At least one ENDIF directive was found to be missing when the
  3414.          end of the source code was reached.  The number of missing
  3415.          ENDIF's are displayed.
  3416.        
  3417.        Missing ENDM
  3418.          An ENDM directive was found without a corresponding MACRO.
  3419.        
  3420.        Missing ENDP: <number>
  3421.          At least one ENDP directive was found to be missing when the end
  3422.          of the program was reached.  Since specific PROC's are not
  3423.          matched to specific ENDP's, the actual error may exist anywhere
  3424.          in the program, even though it isn't detected until the end of
  3425.          the program.  The number of missing ENDP's are displayed.
  3426.        
  3427.        Missing IF
  3428.          A NEXTIF, ELSEIF, ELSE, or ENDIF directive was found without a
  3429.          corresponding IF or IFN.  All conditional sections of source
  3430.          code must start with an IF or IFN.
  3431.        
  3432.        Missing or illegal operator: <field>
  3433.          Two fields were found not separated by a comma or valid
  3434.          operator.  Individual components of an operand expression must
  3435.          be separated by some kind of operator.  The individual operands
  3436.          of an instruction must be separated by commas.  Something like a
  3437.          misspelled AND operator could cause this error.  The second of
  3438.          the two fields are displayed.
  3439.        
  3440.        Missing PROC
  3441.          A RET instruction was found outside of a procedure.  Since the
  3442.          RET instruction needs a PROC directive to set the type of
  3443.          return, all RET's must fall within a procedure.  Near and far
  3444.          returns can be encoded independent of procedure definitions with
  3445.          RETN and RETF.
  3446.        
  3447.        Missing right bracket
  3448.          A memory operand using brackets came to an end without a right
  3449.          bracket (via an end of line or comma).  May occur because of a
  3450.          general error in syntax, like [OFFSET], where the bracket is
  3451.          passed to the OFFSET function as an argument and is overlooked.
  3452.        
  3453.  
  3454.        74                                               Assembly Messages
  3455.        
  3456.        Operand cannot be combined: <operand>
  3457.          The operand may not be used in an expression.  The operand is
  3458.          displayed.  Only immediate data may be used in expressions.
  3459.        
  3460.        Operands are incompatible sizes: <first size> <second size>
  3461.          The operands for the instruction are not compatible sizes,
  3462.          though the instruction involves exchanging data between the two.
  3463.          The sizes of the first two operands are displayed.  See the
  3464.          Invalid Operand Size error for a description of the size bits.
  3465.        
  3466.        Out of memory for code table: <maximum lines>
  3467.          The internal code table is full and no more lines can be
  3468.          assembled.  The maximum number of source lines that can be
  3469.          assembled is displayed.  See Memory Limitations.  Critical
  3470.          error.
  3471.        
  3472.        Out of memory for macro table: <bytes available>
  3473.          The internal macro storage area is full and no more macros can
  3474.          be defined.  The total available bytes of macro storage is
  3475.          displayed.  See Memory Limitations.  Critical error.
  3476.        
  3477.        Out of memory for symbol table: <symbol>: <bytes available>
  3478.          The internal symbol table is full and no more symbols may be
  3479.          defined.  The symbol that caused the error and the total
  3480.          available bytes for the symbol table is displayed.  See Memory
  3481.          Limitations.  Critical error.
  3482.        
  3483.        Overflow: <number>
  3484.          A number or the result of an expression is too big or too small.
  3485.          Individual numbers must be in the range 0 to 65535 (unsigned) or
  3486.          +32767 to -32768 (signed).  If any single value in an expression
  3487.          is signed, the entire expression is considered signed.  The
  3488.          final result of an expression must fall in the same unsigned or
  3489.          signed ranges as individual numbers.  If the error occurs
  3490.          because of an individual number, the number will be displayed.
  3491.        
  3492.        Page size out of range: <specified size>
  3493.          The length of the page specified by a PAGESIZE directive is
  3494.          either too small or too large.  The value must be in the range
  3495.          15 to 255. The value is displayed.
  3496.        
  3497.        Parenthesis nested too deeply
  3498.          The parenthesis in an operand expression were nested too deeply.
  3499.          Parenthesis may only be nested ten deep.
  3500.        
  3501.        Parenthetical error
  3502.          There was some kind of error in an operand expression involving
  3503.          parenthesis, like ((1).
  3504.        
  3505.  
  3506.        Assembly Messages                                               75
  3507.        
  3508.        Phase error: <previous value>
  3509.          The location counter somehow became out of phase with previous
  3510.          assembly passes.  The error may be occurring sometime previous
  3511.          to its detection, since the phase is only checked for symbol
  3512.          declarations (only labels).  This error probably means that the
  3513.          source code was assembled differently in different passes.
  3514.          Could be caused by something like conditionally assembling a
  3515.          section of the code based on the one of the time constants (like
  3516.          $TIME1), which may be different each pass.  Could also be caused
  3517.          by directly manipulating the location counter in an unsound
  3518.          fashion, like using assembly constants (which aren't really very
  3519.          constant) to set the location counter.  The previous location
  3520.          counter value is displayed.
  3521.        
  3522.        Procedures nested too deeply: <maximum nest level>
  3523.          Procedure declarations are nested too deeply.  The maximum nest
  3524.          level is displayed.
  3525.        
  3526.        Register size override: <first size> <second size>
  3527.          The size of the register is not compatible with the size of the
  3528.          memory operand.  The size of the memory operand may explicitly
  3529.          changed with a BYTE or WORD function.  The sizes of the first
  3530.          two operands are displayed.  See the Invalid Operand Size error
  3531.          for a description of the size bits.  This message doesn't
  3532.          necessarily indicate an error, but merely acts as a warning.
  3533.        
  3534.        Should be byte data
  3535.          The immediate data operand (port number) of an IN or OUT
  3536.          instruction is not eight bits.
  3537.        
  3538.        Source file not found: <file name>
  3539.          The source file could not be found or opened.  Probably because
  3540.          of an incorrectly typed file name.  Make sure that all
  3541.          components of the file name are correct.  Remember that the
  3542.          default drive/path and an extension of ASM are assumed if not
  3543.          otherwise specified.  The name of the source file is displayed.
  3544.          Critical error.
  3545.        
  3546.        Source line too long: <excess>
  3547.          The line within a macro expansion would be too long if all the
  3548.          parameters in that line were inserted.  The parameters or the
  3549.          line itself must be shortened.  The approximate amount by which
  3550.          the line is too long by is displayed.
  3551.        
  3552.        String not closed
  3553.          A string field was started with a single quote but not closed by
  3554.          a matching one.  A matching single quote must be added.
  3555.        
  3556.  
  3557.        76                                               Assembly Messages
  3558.        
  3559.        Too far for short jump: <displacement>
  3560.          The target of the branch is not close enough for a short jump
  3561.          (its displacement should be in the range +127 to -128, or 007F
  3562.          to FF80 hex).  If the instruction is a JMPS, then JMP may be
  3563.          used instead.  If the instruction is one of the conditional
  3564.          branches, the source code must be moved around so that target is
  3565.          closer, or a combination of conditional and unconditional
  3566.          branching must be used.  The present displacement is displayed.
  3567.        
  3568.            ;you could change the following ...
  3569.             Jz Toofar    ;TOOFAR is too far for a short jump
  3570.        
  3571.            ;... to the following
  3572.             Jnz Skipjump ;skip long jump on opposite condition
  3573.             Jmp Toofar   ;long jump to TOOFAR
  3574.            Skipjump
  3575.        
  3576.        Too many MACRO parameters: <maximum parameters>
  3577.          Too many parameters are being passed to the macro upon
  3578.          invocation.  The maximum number of parameters is not determined
  3579.          by the number specified in the macro declaration, but rather is
  3580.          based on internal memory constraints.  The number of parameters
  3581.          must be reduced.  The maximum allowed parameters are displayed.
  3582.        
  3583.        Undefined assembly directive: <number>
  3584.          Should not get this error.  It means that the instruction is an
  3585.          assembly directive that is not fully defined.
  3586.        
  3587.        Undefined error
  3588.          Should not get this error.  It means that an undefined error
  3589.          occurred.
  3590.        
  3591.        Undefined symbol: <symbol>
  3592.          The symbol was used but not defined anywhere.  Might be because
  3593.          the first digit of a hexadecimal number was not 0 through 9.
  3594.          This error can be enabled for all subsequent occurrences of
  3595.          the symbol with the FLAGALL+ directive.
  3596.        
  3597.        Unrecognized instruction: <mnemonic>
  3598.          The instruction mnemonic was not recognized.  It is not an 8086
  3599.          instruction, assembly directive, or a macro.  The mnemonic is
  3600.          displayed.
  3601.        
  3602.        Unused symbol: <symbol>
  3603.          The declared symbol was never used.  This message does not
  3604.          indicate an error, but rather assists in "cleaning up" the
  3605.          source code.  The detection of unused symbols enabled is enabled
  3606.          with the UNUSED+ directive.
  3607.        
  3608.        WASM detects checksum failure
  3609.          The copy of WASM.COM is corrupted and cannot be used.  If you
  3610.          don't know why you're getting this message, try making a new
  3611.          working copy from your master disk or the original archive file.
  3612.        
  3613.  
  3614.        Assembly Messages                                               77
  3615.        
  3616.        WASM detects incorrect DOS version
  3617.          The operating system is pre-2.0.  WASM requires PC or MS DOS 2.0
  3618.          or greater to function.
  3619.        
  3620.        WASM detects insufficient memory
  3621.          There is not enough free memory for WASM to function.  Though
  3622.          your computer may have enough memory installed, device drivers
  3623.          and memory resident programs could be using too much.  See
  3624.          Memory Limitations.
  3625.        
  3626.  
  3627.        78                                                 Instruction Set
  3628.        
  3629.                                  Instruction Set
  3630.        
  3631.        This is a brief list of all the legal predefined instructions and
  3632.        their operand types.  The instructions are divided up by function.
  3633.        The groups are: assembly directives, data transfer, arithmetic,
  3634.        logic, flag setting, control transfer, string manipulation, and
  3635.        processor control. The assembly directives are more thoroughly
  3636.        described under Assembly Directives.  The 8086 instructions are
  3637.        not thoroughly described in this documentation, you'll need
  3638.        another source for that.
  3639.        
  3640.        Instruction Format:
  3641.        
  3642.          <mnemonic> = <short description>
  3643.            <operand> [, <operand>, ...] [=<comment>]
  3644.        
  3645.        Operand Types:
  3646.        
  3647.          none     no operands
  3648.          reg      register (non-segment)
  3649.          seg      segment register
  3650.          accum    AX or AL
  3651.          mem      memory operand
  3652.          immed    immediate data
  3653.          near     near label
  3654.          string   string data
  3655.          symbol   a unique symbol
  3656.        
  3657.        Operands separated by slashes mean that either one may be used.
  3658.        Operands in capital letters are the literal operands accepted.
  3659.        Operands in brackets are optional, all others are required.
  3660.        
  3661.        Numbers in parenthesis indicate the allowable size (number of
  3662.        bits) for the specified operands.  If no size is given then the
  3663.        operands may be either 8 or 16 bit (where applicable).
  3664.        
  3665.        ******************************************************************
  3666.        
  3667.                                Assembly Directives
  3668.        
  3669.        DB = declare bytes
  3670.          immed/string [, immed/string, ...]
  3671.        
  3672.        DS = declare storage
  3673.          immed [, immed(8)] = bytes, value (default 0)
  3674.        
  3675.        DW = declare words
  3676.          immed [, immed, ...]
  3677.        
  3678.        ELSE = conditional "else"
  3679.          immed
  3680.        
  3681.        ELSEIF = conditional "else-if"
  3682.          immed
  3683.        
  3684.  
  3685.        Instruction Set                                                 79
  3686.        
  3687.        ENDIF = end of conditional statement
  3688.          none
  3689.        
  3690.        ENDM = end of macro declaration
  3691.          none
  3692.        
  3693.        ENDP = end of procedure
  3694.          none
  3695.        
  3696.        EQU = equate, requires label
  3697.          immed
  3698.        
  3699.        ERROR = programmer defined error
  3700.          string = error message
  3701.        
  3702.        EXPAND+ = list macro expansions (default)
  3703.          none
  3704.        
  3705.        EXPAND- = do not list macro expansions
  3706.          none
  3707.        
  3708.        ERRORMAX = set maximum errors (default 65535)
  3709.          immed
  3710.        
  3711.        FLAGALL+ = flag all occurrences of undefined symbols
  3712.          none
  3713.        
  3714.        FLAGALL- = flag only first occurrence of undef. symbols (default)
  3715.          none
  3716.        
  3717.        IF = conditional "if"
  3718.          immed
  3719.        
  3720.        IFN = conditional "if not"
  3721.          immed
  3722.        
  3723.        INCLUDE = include source file
  3724.          string = file name (default source drive and ext)
  3725.        
  3726.        JUMP+ = flag long jumps that could be short
  3727.          none
  3728.        
  3729.        JUMP- = do not flag long jumps that could be short (default)
  3730.          none
  3731.        
  3732.        LABEL = define label, requires label
  3733.          NEAR/FAR/BYTE/WORD/DWORD/QWORD/TBYTE/ANYSIZE
  3734.        
  3735.        LINESIZE = set page width (default 79)
  3736.          [immed] [, immed(8), ...] = page width, printer codes
  3737.        
  3738.        LIST+ = generate listing (default if list file specified)
  3739.          none
  3740.        
  3741.  
  3742.        80                                                 Instruction Set
  3743.        
  3744.        LIST- = list output off
  3745.          none
  3746.        
  3747.        MACRO = start of macro declaration
  3748.          [symbol, ...] = parameter names
  3749.        
  3750.        MACROC = start of conditional macro declaration
  3751.          [symbol, ...] = parameter names
  3752.        
  3753.        NEXTIF = conditional "if", same level
  3754.          immed
  3755.        
  3756.        ORG = origin (default 100H)
  3757.          immed = relative to location if signed
  3758.        
  3759.        PAGE = start new page
  3760.          [immed/string]  = page number, subtitle
  3761.          immed [, string] = page number, subtitle
  3762.        
  3763.        PAGE+ = start auto paging
  3764.          [immed/string]  = page number, subtitle
  3765.          immed [, string] = page number, subtitle
  3766.        
  3767.        PAGE- = stop auto paging (default)
  3768.          none
  3769.        
  3770.        PAGESIZE = set page size (default 60,79)
  3771.          immed [,immed] = page length, page width
  3772.        
  3773.        PROC = beginning of procedure
  3774.          NEAR/FAR
  3775.        
  3776.        RESETC = reset byte counter
  3777.         [immed] [,immed] = counter value, checksum value (default 0, 0)
  3778.        
  3779.        SUBTITLE = set program subtitle
  3780.          string = subtitle
  3781.        
  3782.        SYMDUMP+ = symbol table dump on
  3783.          none
  3784.        
  3785.        SYMDUMP- = symbol table dump off (default)
  3786.          none
  3787.        
  3788.        TITLE = set program title
  3789.          string [, string] = title, subtitle
  3790.        
  3791.        UNUSED+ = flag unused symbols
  3792.          none
  3793.        
  3794.        UNUSED- = do not flag unused symbols (default)
  3795.          none
  3796.        
  3797.  
  3798.        Instruction Set                                                 81
  3799.        
  3800.        ******************************************************************
  3801.        
  3802.                                   Data Transfer
  3803.        
  3804.        IN = input
  3805.          accum, immed(8) = input from a fixed port
  3806.          accum, DX = input from a variable port in DX
  3807.        
  3808.        LAHF = load AH with flags
  3809.          none
  3810.        
  3811.        LDS = load DS and register (16)
  3812.          reg, reg/mem
  3813.        
  3814.        LEA = load effective address (16)
  3815.          reg, reg/mem
  3816.        
  3817.        LES = load ES and register (16)
  3818.          reg, reg/mem
  3819.        
  3820.        MOV = move
  3821.          reg/mem, reg/seg
  3822.          reg/seg, reg/mem
  3823.          reg/mem, immed
  3824.        
  3825.        OUT = output
  3826.          immed(8), accum = output to fixed port
  3827.          DX, accum = output to variable port in DX
  3828.        
  3829.        POP = pop (16)
  3830.          reg/seg/mem
  3831.        
  3832.        POPF = pop flags
  3833.          none
  3834.        
  3835.        PUSH = push (16)
  3836.          reg/seg/mem
  3837.        
  3838.        PUSHF = pop flags
  3839.          none
  3840.        
  3841.        SAHF = store AH to flags
  3842.          none
  3843.        
  3844.        XCHG = exchange
  3845.          reg/mem, reg
  3846.          reg, reg/mem
  3847.        
  3848.        XLAT = translate byte in AL
  3849.          none
  3850.        
  3851.  
  3852.        82                                                 Instruction Set
  3853.        
  3854.        ******************************************************************
  3855.        
  3856.                                    Arithmetic
  3857.        
  3858.        AAA = ASCII adjust for add
  3859.          none
  3860.        
  3861.        AAD = ASCII adjust for divide
  3862.          none
  3863.        
  3864.        AAM = ASCII adjust for multiply
  3865.          none
  3866.        
  3867.        AAS =  ASCII adjust for subtract
  3868.          none
  3869.        
  3870.        ADC = add with carry
  3871.          reg/mem, reg
  3872.          reg, reg/mem
  3873.          reg/mem, immed
  3874.        
  3875.        ADD = add
  3876.          reg/mem, reg
  3877.          reg, reg/mem
  3878.          reg/mem, immed
  3879.        
  3880.        CBW = convert byte to word
  3881.          none
  3882.        
  3883.        CWD = convert word to double word
  3884.          none
  3885.        
  3886.        DAA = decimal adjust for add
  3887.          none
  3888.        
  3889.        DAS = decimal adjust for subtract
  3890.          none
  3891.        
  3892.        DEC = decrement
  3893.          reg/mem
  3894.        
  3895.        DIV = divide, unsigned
  3896.          [accum,] reg/mem = accum implicit
  3897.        
  3898.        IDIV = integer divide, signed
  3899.          [accum,] reg/mem = accum implicit
  3900.        
  3901.        IMUL = integer multiply, signed
  3902.          [accum,] reg/mem = accum implicit
  3903.        
  3904.        INC = increment
  3905.          reg/mem
  3906.        
  3907.  
  3908.        Instruction Set                                                 83
  3909.        
  3910.        MUL = multiply, unsigned
  3911.          [accum,] reg/mem = accum implicit
  3912.        
  3913.        NEG = decrement
  3914.          reg/mem
  3915.        
  3916.        SBB = subtract with borrow
  3917.          reg/mem, reg
  3918.          reg, reg/mem
  3919.          reg/mem, immed
  3920.        
  3921.        SUB = subtract
  3922.          reg/mem, reg
  3923.          reg, reg/mem,
  3924.          reg/mem, immed
  3925.        
  3926.        
  3927.        ******************************************************************
  3928.        
  3929.                                       Logic
  3930.        
  3931.        AND = and
  3932.          reg/mem, reg
  3933.          reg, reg/mem
  3934.          reg/mem, immed
  3935.        
  3936.        NOT = not
  3937.          reg/mem
  3938.        
  3939.        OR = or
  3940.          reg/mem, reg
  3941.          reg, reg/mem
  3942.          reg/mem, immed
  3943.        
  3944.        RCL = rotate through carry left
  3945.          reg/mem = one time
  3946.          reg/mem, CL = CL times
  3947.        
  3948.        RCR = rotate through carry right
  3949.          reg/mem = one time
  3950.          reg/mem, CL = CL times
  3951.        
  3952.        ROL = rotate left
  3953.          reg/mem = one time
  3954.          reg/mem, CL = CL times
  3955.        
  3956.        ROR = rotate right
  3957.          reg/mem = one time
  3958.          reg/mem, CL = CL times
  3959.        
  3960.        SAL = shift arithmetic left
  3961.          reg/mem = one time
  3962.          reg/mem, CL = CL times
  3963.        
  3964.  
  3965.        84                                                 Instruction Set
  3966.        
  3967.        SAR = shift arithmetic right
  3968.          reg/mem = one time
  3969.          reg/mem, CL = CL times
  3970.        
  3971.        SHL = shift logical left
  3972.          reg/mem = one time
  3973.          reg/mem, CL = CL times
  3974.        
  3975.        SHR = shift logical right
  3976.          reg/mem = one time
  3977.          reg/mem, CL = CL times
  3978.        
  3979.        XOR = xor
  3980.          reg/mem, reg
  3981.          reg, reg/mem
  3982.          reg/mem, immed
  3983.        
  3984.        ******************************************************************
  3985.        
  3986.                                   Flag Setting
  3987.        
  3988.        CLC = clear carry
  3989.          none
  3990.        
  3991.        CLD = clear direction
  3992.          none
  3993.        
  3994.        CLI = clear interrupt
  3995.          none
  3996.        
  3997.        CMC = clear complement carry
  3998.          none
  3999.        
  4000.        CMP = compare
  4001.          reg/mem, reg
  4002.          reg, reg/mem
  4003.          reg/mem, immed
  4004.        
  4005.        STC = set carry
  4006.          none
  4007.        
  4008.        STD = set direction
  4009.          none
  4010.        
  4011.        STI = set interrupt
  4012.          none
  4013.        
  4014.        TEST = test
  4015.          reg/mem, reg
  4016.          reg, reg/mem
  4017.          reg/mem, immed
  4018.        
  4019.  
  4020.        Instruction Set                                                 85
  4021.        
  4022.        ******************************************************************
  4023.        
  4024.                                 Control Transfer
  4025.        
  4026.        CALL = call
  4027.          near = direct within segment
  4028.          immed (offset), immed (segment) = direct intersegment
  4029.          reg/mem = indirect within segment (16)
  4030.          mem = indirect intersegment (32)
  4031.        
  4032.        INT = interrupt
  4033.          immed(8)
  4034.        
  4035.        INT3 = type 3 interrupt
  4036.          none
  4037.        
  4038.        INTO = interrupt on overflow
  4039.          none
  4040.        
  4041.        IRET =interrupt return
  4042.          none
  4043.        
  4044.        JA = jump if above
  4045.          near
  4046.        
  4047.        JAE = jump if above or equal
  4048.          near
  4049.        
  4050.        JB = jump if below
  4051.          near
  4052.        
  4053.        JBE = jump if below or equal
  4054.          near
  4055.        
  4056.        JC = jump if carry
  4057.          near
  4058.        
  4059.        JCXZ = jump if CX equal to zero
  4060.          near
  4061.        
  4062.        JE = jump if equal
  4063.          near
  4064.        
  4065.        JG = jump if greater
  4066.          near
  4067.        
  4068.        JGE = jump if greater or equal
  4069.          near
  4070.        
  4071.        JL = jump if less
  4072.          near
  4073.        
  4074.        JLE = jump if less or equal
  4075.          near
  4076.        
  4077.  
  4078.        86                                                 Instruction Set
  4079.        
  4080.        JMP = unconditional jump
  4081.          near = direct within segment
  4082.          immed (offset), immed (segment) = direct intersegment
  4083.          reg/mem = indirect within segment (16)
  4084.          mem = indirect intersegment (32)
  4085.        
  4086.        JMPS = unconditional short jump
  4087.          near
  4088.        
  4089.        JNA = jump if not above
  4090.          near
  4091.        
  4092.        JNAE = jump if not above or equal
  4093.          near
  4094.        
  4095.        JNB = jump if not below
  4096.          near
  4097.        
  4098.        JNBE = jump if not below or equal
  4099.          near
  4100.        
  4101.        JNC = jump if no carry
  4102.          near
  4103.        
  4104.        JNE = jump if not equal
  4105.          near
  4106.        
  4107.        JNG = jump if not greater
  4108.          near
  4109.        
  4110.        JNGE = jump if not greater or equal
  4111.          near
  4112.        
  4113.        JNL = jump if not less
  4114.          near
  4115.        
  4116.        JNLE = jump if not less or equal
  4117.          near
  4118.        
  4119.        JNO = jump if not overflow
  4120.          near
  4121.        
  4122.        JNP = jump if not parity
  4123.          near
  4124.        
  4125.        JNS = jump if not sign
  4126.          near
  4127.        
  4128.        JNZ = jump if not zero
  4129.          near
  4130.        
  4131.        JO = jump if overflow
  4132.          near
  4133.        
  4134.  
  4135.        Instruction Set                                                 87
  4136.        
  4137.        JP = jump if parity
  4138.          near
  4139.        
  4140.        JPE = jump if parity even
  4141.          near
  4142.        
  4143.        JPO = jump if parity odd
  4144.          near
  4145.        
  4146.        JS = jump if sign
  4147.          near
  4148.        
  4149.        JZ = jump if zero
  4150.          near
  4151.        
  4152.        LOOP = loop CX times
  4153.          near
  4154.        
  4155.        LOOPE = loop while equal
  4156.          near
  4157.        
  4158.        LOOPNE = loop while not equal
  4159.          near
  4160.        
  4161.        LOOPNZ = loop while not zero
  4162.          near
  4163.        
  4164.        LOOPZ = loop while zero
  4165.          near
  4166.        
  4167.        RET = return, type determined by procedure
  4168.          none
  4169.          immed = add immed to stack
  4170.        
  4171.        RETF = within segment return
  4172.          none
  4173.          immed = add immed to stack
  4174.        
  4175.        RETN = intersegment return
  4176.          none
  4177.          immed = add immed to stack
  4178.        
  4179.        ******************************************************************
  4180.        
  4181.                                String Manipulation
  4182.        
  4183.        CMPSB = compare string byte
  4184.          none
  4185.        
  4186.        CMPSW = compare string word
  4187.          none
  4188.        
  4189.        LODSB = load string byte
  4190.          none
  4191.        
  4192.  
  4193.        88                                                 Instruction Set
  4194.        
  4195.        LODSW = load string word
  4196.          none
  4197.        
  4198.        MOVSB = move string byte
  4199.          none
  4200.        
  4201.        MOVSW = move string word
  4202.          none
  4203.        
  4204.        REP = repeat CX times
  4205.          none
  4206.        
  4207.        REPE = repeat while equal
  4208.          none
  4209.        
  4210.        REPNE = repeat while not equal
  4211.          none
  4212.        
  4213.        REPNZ = repeat while not zero
  4214.          none
  4215.        
  4216.        REPZ = repeat while zero
  4217.          none
  4218.        
  4219.        SCASB = scan string byte
  4220.          none
  4221.        
  4222.        SCASW = scan string word
  4223.          none
  4224.        
  4225.        STOSB = store string byte
  4226.          none
  4227.        
  4228.        STOSW = store string word
  4229.          none
  4230.        
  4231.        ******************************************************************
  4232.        
  4233.                                 Processor Control
  4234.        
  4235.        CS: = code segment override prefix
  4236.          none
  4237.        
  4238.        DS: = data segment override prefix
  4239.          none
  4240.        
  4241.        ES: = extra segment override prefix
  4242.          none
  4243.        
  4244.        HLT = halt
  4245.          none
  4246.        
  4247.  
  4248.        Instruction Set                                                 89
  4249.        
  4250.        LOCK = bus lock prefix
  4251.          none
  4252.        
  4253.        NOP = no operation
  4254.          none
  4255.        
  4256.        SEG = segment override prefix (same effect as CS:, DS:, etc.)
  4257.          seg
  4258.        
  4259.        SS: = stack segment override prefix
  4260.          none
  4261.        
  4262.        WAIT = wait
  4263.          none
  4264.        
  4265.        ******************************************************************
  4266.        
  4267.  
  4268.        90                                            External Subroutines
  4269.        
  4270.                               External Subroutines
  4271.        
  4272.        Programs assembled by WASM may be used as external subroutines by
  4273.        other programs.  A programming language that can call pure binary
  4274.        image, external, machine language subroutines should be able to
  4275.        call programs assembled with WASM.  BASIC and Turbo Pascal are two
  4276.        languages that can do this.  Refer to the BASIC or Pascal manual
  4277.        for the specific implementation.
  4278.        
  4279.        BASIC expects the external machine language subroutine to be in
  4280.        the BLOAD format.  This is easily done adding the proper header to
  4281.        the file, which is as follows:
  4282.        
  4283.          ;this is a BLOAD header, it should
  4284.          ;be the first code in the program
  4285.           Db 0fdh    ;BLOAD marker
  4286.           Dw 0f000H  ;segment to load it at
  4287.           Dw 0       ;offset to load it at
  4288.           Dw $Size   ;size of program
  4289.        
  4290.        The segment and offset of the load can be any number, since it
  4291.        should be specified by the programmer when loading it from BASIC.
  4292.        Making load address F000:0000 (which is read only memory) will
  4293.        prevent loading it over something important if the address is not
  4294.        specified.
  4295.        
  4296.        Turbo Pascal external subroutines do not require any special
  4297.        format.
  4298.        
  4299.        The code within Turbol Pascal subroutines must be relocatable.
  4300.        This means that no references to the location counter should be
  4301.        made (the location is undefined).  Since memory labels cannot be
  4302.        used, there is no good way to access declared local data; its
  4303.        probably better to just do without such data.  BASIC subroutines
  4304.        may or may not have to be relocatable, depending upon where they
  4305.        are stored.  If the address is known beforehand (in an unused
  4306.        screen buffer for instance), the code need not be relocatable and
  4307.        the starting offset will be known and can be set with ORG.  If the
  4308.        BASIC subroutine is stored in a variable's data space or a file
  4309.        buffer, then the code must be relocatable.
  4310.        
  4311.        Machine language subroutines may be debugged by placing an INT3
  4312.        instruction within the code and then running the entire program
  4313.        (BASIC or Pascal) under DEBUG.  When the subroutine is executed,
  4314.        the INT3 will give control to the DEBUG program and allow you to
  4315.        step through your code.  Make sure to remove the INT3 and
  4316.        reassemble the code when you are through debugging.
  4317.        
  4318.        Programs that are assembled as subroutines are not directly
  4319.        executable, thus it may be a wise idea to name them with an
  4320.        extension other than .COM (which implies that a program is
  4321.        executable).
  4322.        
  4323.  
  4324.        Source Code Clarification                                       91
  4325.        
  4326.                             Source Code Clarification
  4327.        
  4328.        Many of the conventions used by WASM are also used by other
  4329.        assemblers and debuggers.  This section compares WASM to other
  4330.        assemblers and the DEBUG program provided with DOS.  This section
  4331.        also points out a few particulars of WASM syntax.
  4332.        
  4333.        Some assemblers add a suffix to the mnemonic to indicate the size
  4334.        of the operation, whether immediate data is involved, and the type
  4335.        of calls, jumps, and returns that are being used.  WASM identifies
  4336.        the type and size of the instruction mainly on the basis of the
  4337.        operands, in accordance with the DOS DEBUG program.
  4338.        
  4339.        WASM allows the programmer to define the size of the operand
  4340.        through the use of a functional operand (BYTE, WORD, etc.).  This
  4341.        is very similar to the structure used by the DEBUG program and the
  4342.        IBM Macro Assembler.
  4343.        
  4344.          ;the following statement in WASM...
  4345.           Mov WOrD [5+sI+  10 +Bp+5], not 1111111111111111B
  4346.        
  4347.          ; ...is disassembled as the following in DEBUG
  4348.          ; MOV     W,[BP+SI+14],0000          ;DOS 1.1 DEBUG
  4349.          ; MOV     WORD PTR [BP+SI+14],0000   ;DOS 2.0 DEBUG
  4350.        
  4351.        Near and far indirect branching may be implemented by specifying
  4352.        the size of the operand or actually using the NEAR and FAR
  4353.        functions.  Debug uses FAR for far branching and nothing for near
  4354.        branching.
  4355.        
  4356.           Call Near [Bx]  ;
  4357.           Call Word [Bx]  ;these two are the same thing to WASM
  4358.          ;Call [Bx]       ;debug format
  4359.        
  4360.           Call Far [Bx]    ;
  4361.           Call Dword [Bx]  ;these two are the same thing to WASM
  4362.          ;Call Far [Bx]    ;debug format
  4363.        
  4364.        The size of the string manipulation instructions are specified by
  4365.        a B or W suffix added to the mnemonic.  This is the same as the
  4366.        DEBUG program.
  4367.        
  4368.           Movsb  ;move string byte
  4369.           Movsw  ;move string word
  4370.        
  4371.        JMPS is the mnemonic that WASM uses to specify a short
  4372.        unconditional jump to a near label.  JMP always means a long jump.
  4373.        The (DOS 2.0) DEBUG program uses JMP for both long and short
  4374.        jumps.
  4375.        
  4376.           Jmps Location1    ;short unconditional jump
  4377.           Jmp Location1     ;long unconditional jump
  4378.        
  4379.  
  4380.        92                                       Source Code Clarification
  4381.        
  4382.        WASM sets the type of return for a RET based on the procedure
  4383.        type.  A near (within segment) or far (intersegment) return may be
  4384.        encoded without using a PROC through the use of RETN and RETF
  4385.        respectively.  The DEBUG program uses RET to indicate a near
  4386.        return and a RETF to indicate a far return.
  4387.        
  4388.           Proc  Far               ;<---
  4389.           Ret         ;far return     ; far routine
  4390.           Retn        ;near return    ;
  4391.           Retf        ;far return     ;
  4392.                                       ;
  4393.           Proc  Near                  ; <---
  4394.           Ret         ;near return    ;    ; near routine
  4395.           Retn        ;near return    ;    ;
  4396.           Retf        ;far return     ;    ;
  4397.           Endp                        ; <---
  4398.                                       ;
  4399.           Ret         ;far return     ;
  4400.           Endp                    ;<---
  4401.        
  4402.        The bit shifting instructions (SHL, SHR, ROL, etc.) are
  4403.        interpreted to be a single shift by WASM if there is only one
  4404.        operand (the operand to be shifted).  Shifts using the CL register
  4405.        as a counter are implemented by specifying CL as the second
  4406.        operand.  The DEBUG program requires a "1" as a second operand to
  4407.        specify a single shift.
  4408.        
  4409.            Rol Ax      ;roll AX left by one
  4410.          ; Rol Ax,1    ;roll AX left by one, DEBUG format
  4411.            Shr Byte [Bx],Cl   ;shift 8 bits at [BX] CL times
  4412.        
  4413.        Some assemblers leave out an operand if the operand is implicit in
  4414.        the instruction.  AX is implicit in the following instructions:
  4415.        IN, OUT, MUL, IMUL, DIV, and IDIV.  WASM requires the AX (or AL)
  4416.        register in the IN and OUT instructions but allows the others with
  4417.        or without it.  The DEBUG program leaves out the AX or AL register
  4418.        on multiply or divide instructions, but does not on the others.
  4419.        
  4420.           In    Ax,Dx   ;AX receives input word from port in DX
  4421.        
  4422.          ;both of the following are: AX = DX.AX x CX
  4423.           Mul   Ax,Cx   ;WASM allows this
  4424.           Mul   Cx      ;WASM and DEBUG allow this
  4425.        
  4426.        WASM and DEBUG implement instruction prefixes as a separate
  4427.        instruction, i.e. they appear on the line above the instruction to
  4428.        modify.  The prefixes are: LOCK, REP, REPE, REPNE, REPNZ, REPZ,
  4429.        and SEG.
  4430.        
  4431.           Rep
  4432.           Stosb       ;store byte CX times
  4433.        
  4434.           Seg Ss
  4435.           Mov Ax,[Bx] ;[Bx] is in the stack segment (SS)
  4436.        
  4437.  
  4438.        Source Code Clarification                                       93
  4439.        
  4440.        Individual segment overrides may also be specified as CS:, DS:,
  4441.        ES:, and SS:, which is how segment overrides are implemented by
  4442.        DEBUG.
  4443.        
  4444.          ;this is assembled properly by WASM and DEBUG
  4445.           Cs:           ;to WASM, this is the same as SEG CS
  4446.           Mov [500], Dl  ;[500] is in the code segment (CS)
  4447.        
  4448.        WASM and DEBUG both specify indirect memory operands by putting
  4449.        all values and registers inside the brackets.
  4450.        
  4451.          ;this in WASM ...
  4452.            Sub [Bx+10],Ax
  4453.            Sub [BX+Data],Ax
  4454.          ;... may be implemented by others like one of these
  4455.          ; Sub [Bx]+10,Ax
  4456.          ; Sub 10[Bx],Ax
  4457.          ; Sub Data[Bx],Ax
  4458.        
  4459.          Data Label Word
  4460.        
  4461.        The mnemonic for an optimized type 3 interrupt is INT3.
  4462.        
  4463.          ;both of statements these cause type 3 interrupts,
  4464.          ;but the first uses only one byte of code
  4465.           Int3
  4466.           Int 3
  4467.        
  4468.        WASM assumes the entire program and all data are in the same
  4469.        segment, so there are no segment definitions.  The location
  4470.        counter is automatically started at 100H, in accordance with COM
  4471.        file format.  Though WASM doesn't allow segment definitions, a
  4472.        program may, of course, set up and maintain its own segments
  4473.        during execution.
  4474.        
  4475.        The implementation and usage of assembly directives vary among
  4476.        assemblers.  The general format of procedure, macro, and data
  4477.        declarations are similar, but mostly incompatible among
  4478.        assemblers.  WASM uses a fairly simplified set of directives, most
  4479.        of which are comparable, though not compatible, to other
  4480.        assemblers.
  4481.        
  4482.        Several 8086 instructions mean the same thing as other
  4483.        instructions and produce identical object code.  The DEBUG program
  4484.        always disassembles these instructions using one particular
  4485.        mnemonic.  One example is JNLE (jump not less or equal) and JG
  4486.        (jump greater).  The DEBUG program disassembles both of these
  4487.        instructions as JG.
  4488.        
  4489.  
  4490.        94                                       Source Code Clarification
  4491.        
  4492.        Symbols that are declared within skipped source code should be
  4493.        undefined.  These symbols, though, are placed in the symbol table
  4494.        anyway and still subject to duplicate definition and other symbol
  4495.        declaration errors.  This will hopefully be corrected in future
  4496.        versions of WASM.
  4497.        
  4498.          ;in theory the second two symbols don't really
  4499.          ;exist, since they are in source code that is
  4500.          ;skipped because of the false IF directive; in
  4501.          ;spite of "not existing," the second declaration
  4502.          ;of SYMBOL2 causes a duplicate definition
  4503.        
  4504.          Symbol2
  4505.           If 0
  4506.          Symbol1  ;considered undefined
  4507.          Symbol2  ;duplicate definition
  4508.           Endif
  4509.        
  4510.        There is an uncaught error for certain registers as operands.
  4511.        When the operand DX is used in IN's and OUT's, and CL is used for
  4512.        shifts and rolls, WASM only looks for a register type, not those
  4513.        particular registers.  This means that in those cases any register
  4514.        will work in place of a DX or CL (except a segment register).
  4515.        Also WASM does not search for extra operands, they do not cause
  4516.        errors if they exist.
  4517.        
  4518.          ;some uncaught errors
  4519.           In  Ax,Bx
  4520.           Shl Ax,Bx
  4521.           Mov Ax,Bx,Cx,Dx
  4522.        
  4523.  
  4524.        Memory Limitations                                              95
  4525.        
  4526.                                Memory Limitations
  4527.        
  4528.        WASM requires a about 100 kilobytes (K) of free RAM for execution.
  4529.        The only aspect of WASM that varies with the amount of available
  4530.        memory is the macro storage capacity.  With a minimum amount of
  4531.        memory (100K), less than a 1000 bytes of macro storage is
  4532.        available.  Every free byte after that, up to 64K, is used for
  4533.        macro storage.  With 164K bytes available, the maximum usable
  4534.        amount of memory, about 1600 lines at 40 characters apiece can be
  4535.        stored.  The length of the macro lines is significant, i.e. the
  4536.        shorter the lines, the more lines that can be stored.
  4537.        
  4538.        The symbol table has room for about 2000 symbols at 10 bytes
  4539.        apiece.  Like macro lines, the shorter the symbols, the more
  4540.        symbols that can be stored.  An internal code table (which saves a
  4541.        partial tokenized assembly of the program) has room for 10800
  4542.        entries.  Every source line creates an entry in the code table,
  4543.        except blank lines and lines resulting from a macro expansion.
  4544.        Lines that are skipped due to conditional assembly and the
  4545.        conditional directives themselves DO take up room in the code
  4546.        table, even though they do not show up in the assembly.  The
  4547.        symbol table size and code table size do not change, even if the
  4548.        memory is available.
  4549.        
  4550.  
  4551.        96                                                    Bibliography
  4552.        
  4553.                                   Bibliography
  4554.        
  4555.        These books were used as references in the development of WASM
  4556.        and the writing of this documentation.  In addition to this list,
  4557.        there are many other excellent sources of information on the 8086
  4558.        microprocessor and assembly language programming.
  4559.        
  4560.        "BASIC Version 1.10." 2st ed. Boca Raton, FL: International
  4561.          Business Machines Corp., 1981 and 1982.
  4562.        
  4563.        Duncan, Ray. "Advanced MS DOS." Redmond, WA: Microsoft Press,
  4564.          1986.
  4565.        
  4566.        "iAPX 86/88, 186/188 User's Manual." Santa Clara, CA: Intel
  4567.          Corp., 1985.
  4568.        
  4569.        King, Richard A. "The IBM PC-DOS Handbook." Berkeley, CA: SYBEX
  4570.          Inc., 1983.
  4571.        
  4572.        Morgan, Christopher L., and Mitchell Waite. "8086/8088 16-Bit
  4573.          Microprocessor Primer."  Peterborough, NH: BYTE/McGraw-Hill,
  4574.          1982.
  4575.        
  4576.        "Technical Reference." Rev. ed. Boca Raton, FL: International
  4577.          Business Machines Corp., 1981, 1982, 1983, and 1984.
  4578.        
  4579.        "Turbo Pascal Reference Manual Version 3.0." Scotts Valley, CA:
  4580.          Borland International Inc., 1983, 1984, and 1985.
  4581.        
  4582.  
  4583.        Index                                                           97
  4584.        
  4585.                                       Index
  4586.        
  4587.        $                           60      DB directive            34, 36
  4588.        '                           10      DEBUG program               91
  4589.        ()                          13      Declaring data,             34
  4590.        ,                            5        byte                      34
  4591.        ;                            6        examples                  34
  4592.        ?                           10        location                  34
  4593.        []                          10        storage                   34
  4594.        $CHKSUM constant            60        string                    34
  4595.        $COUNT constant             60        word                      34
  4596.        $DATE1 constant             61      Default file name            3
  4597.        $DATE2 constant             61      Delimiter                    5
  4598.        $LOC constant               61      Directive,               5, 36
  4599.        $SIZE constant              61        compatibility             93
  4600.        $SUM constant               61        conditional               18
  4601.        $TIME1 constant             62        list of                   78
  4602.        $TIME2 constant             62        syntax                     8
  4603.        $VERSION constant           62      Distribution policy          2
  4604.        Addressing,                         Dollar sign                 60
  4605.          direct                    10      DS directive            34, 37
  4606.          indirect                  10      DW directive            34, 37
  4607.          registers                 10      DWORD function          55, 91
  4608.        ANYSIZE function            54      EDLIN program                5
  4609.        ASM filename extension       3      ELSE directive  18, 19, 20, 37
  4610.        Assembling programs          3      ELSEIF directive    18, 19, 20
  4611.        BASIC subroutines           90                                  38
  4612.        Basic syntax                 5      End of file                  5
  4613.        Blank line                   6      ENDIF directive     18, 20, 38
  4614.        Bload,                              ENDM directive          27, 39
  4615.          address                   90      ENDP directive          16, 39
  4616.          format                    90      EQU directive               39
  4617.        Brackets                    10      Equates                      7
  4618.        Bug, in WASM                94      Error,                   4, 67
  4619.        BYTE function           54, 91        AND                       13
  4620.        CALL instruction            16        count                     67
  4621.        COM filename extension       3        critical                  67
  4622.        Comma                        5        description of messages   68
  4623.        Comment,                              flagging                  67
  4624.          description of messages   68        macro                     33
  4625.          message                   67        message                   67
  4626.          source                     6        MOD                       13
  4627.        Compatibility of                      multiple                  67
  4628.          source code               91        OR                        13
  4629.        CON device                   3        XOR                       13
  4630.        Conditional assembly,       17      Error code,
  4631.          directive                 18        upon termination           4
  4632.          nested                    21      ERROR directive          0, 67
  4633.          operand                   18      ERRORLEVEL batch command     4
  4634.          operand testing           24      ERRORMAX directive      41, 67
  4635.          operator                  23      EXPAND+ directive   33, 41, 64
  4636.        Constant                    60      EXPAND- directive   33, 41, 64
  4637.        Control characters           5      Expression,                 13
  4638.        Data declaration            34        examples                  13
  4639.        
  4640.  
  4641.        98                                                           Index
  4642.        
  4643.        Expression (cont.),                 Macro (cont.),
  4644.          operators                 13        in conditional code       29
  4645.          signed                    13        invocation                29
  4646.        False                       23        listing                   33
  4647.        FAR function            55, 91        memory limitation         95
  4648.        Field,                       5        nested                    31
  4649.          interpretation             5        parameter             27, 29
  4650.        File name, default           3        recursive                 31
  4651.        FLAGALL+ directive      42, 67        symbol                    27
  4652.        FLAGALL- directive      42, 67      MACRO directive         27, 46
  4653.        IF directive    18, 20, 21, 42      MACROC directive        32, 46
  4654.        IFN directive   18, 20, 21, 42      Memory,
  4655.        Immediate data,              9        code table                95
  4656.          characters                 9        label                      7
  4657.          in expressions            13        limitation                95
  4658.          size                      10        minimum                   95
  4659.        INCLUDE directive           43        segments                  93
  4660.        Instruction,          5, 8, 36        symbol table              95
  4661.          bit shifting              92      Memory operand,             10
  4662.          disassembly               93        addressing registers      10
  4663.          list of                   78        direct addressing         10
  4664.          prefix and override       92        indirect addressing       10
  4665.          string                    91        size                      11
  4666.          syntax                     5      Message,
  4667.        Interrupt, type 3           90        descriptions              68
  4668.        JMP instruction             91        during assembly           67
  4669.        JUMP+ directive         43, 67      NEAR function           55, 91
  4670.        JUMP- directive         43, 67      NEG function                56
  4671.        Label,                       7      NEXTIF directive    18, 20, 47
  4672.          in expressions            13      NOT function                56
  4673.          memory                 7, 34      Number,                      9
  4674.          near                       7        binary                     9
  4675.        LABEL directive         34, 44        decimal                    9
  4676.        Line,                                 hexadecimal                9
  4677.          blank                      6        signed                     9
  4678.          syntax                     5        size                      10
  4679.        LINESIZE directive          45      Object file                  3
  4680.        List,                    3, 64      OFFSET function             57
  4681.          columnar headings         65      Operand,                  5, 9
  4682.          header                    64        conditional               18
  4683.          line                      65        constants                 60
  4684.          page number               64        examples                  11
  4685.          paging                    64        expressions               13
  4686.          subtitle                  64        functional                54
  4687.          symbol table              66        implicit                  92
  4688.          title                     64        required                   9
  4689.        List file                    3        size                  10, 24
  4690.        LIST+ directive         45, 64        syntax                     5
  4691.        LIST- directive         45, 64        type                   9, 24
  4692.        LST filename extension       3        value                     24
  4693.        Macro,                   7, 26      Operator,                   13
  4694.          conditional               32        conditional               23
  4695.          defining                  27      ORG directive               48
  4696.          error                     33      Origin,                     48
  4697.        
  4698.  
  4699.        Index                                                           99
  4700.        
  4701.        Origin (cont.),             48      Subroutine (cont.),
  4702.          default                   93        naming                    90
  4703.        PAGE directive          48, 64        Pascal                    90
  4704.        Page number                 64        relocation                90
  4705.        PAGE+ directive         49, 64      SUBTITLE directive      51, 64
  4706.        PAGE- directive         49, 64      Symbol,                   5, 7
  4707.        PAGESIZE directive      49, 64        as instructions            7
  4708.        Parameter,                            as operands                7
  4709.          command line               3        declaration                7
  4710.          command line examples      4        declaration syntax         5
  4711.          macro                 27, 29        label                      7
  4712.          procedural                16        location of declaration    7
  4713.        Parenthesis,                13        macro                     27
  4714.          signed                    13        required declaration       5
  4715.        Pascal subroutines          90        reserved                  63
  4716.        Printer                      3        table                      7
  4717.        PRN device                   3        type                       7
  4718.        PROC directive          16, 50        type determination         7
  4719.        Procedure,                  16        undefined                 94
  4720.          declaration               16        uniqueness         7, 63, 94
  4721.          far                       16      Symbol table,                7
  4722.          local data                16        list                      66
  4723.          near                      16        memory limitation         95
  4724.          nested                    16      SYMDUMP+ directive  51, 64, 66
  4725.        Program structure           15      SYMDUMP- directive          51
  4726.        Question mark               10      System requirements          1
  4727.        Quotation mark              10      TBYTE function              58
  4728.        QWORD function              57      Termination of assembly     67
  4729.        Register,                    9      TITLE directive         52, 64
  4730.          16 bit                    10      True                        23
  4731.          8 bit                      9      TYPE function               58
  4732.          segment                   10      UNUSED+ directive       52, 67
  4733.          size                      11      UNUSED- directive       52, 67
  4734.        Registration                 2      VALUE function              58
  4735.        RESETC directive            50      WORD function           58, 91
  4736.        RET instruction         16, 92
  4737.        Semi-colon                   6
  4738.        SIZE function               57
  4739.        Source code,
  4740.          clarification             91
  4741.          compatibility             91
  4742.          external                  43
  4743.        Source file,                 3
  4744.          external                  43
  4745.          type                       5
  4746.        Spaces                       5
  4747.        Statistics, assembly         4
  4748.        String,                     10
  4749.          declaration               34
  4750.        Structured programing       15
  4751.        Subroutine,                 90
  4752.          BASIC                     90
  4753.          debugging                 90
  4754.          location counter          90
  4755.        
  4756.