home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / PASM386C.ZIP / FPC-9.PRN < prev    next >
Encoding:
Text File  |  1989-10-01  |  107.1 KB  |  1,513 lines

  1.  
  2.  
  3.  
  4.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  5.  
  6.  
  7.          Section 9:  The F-PC Assembler         Section 9:  The F-PC Assembler         ______________________________
  8.                                                              Updated 01 Oct 89                                                             Updated 01 Oct 89                                                             _________________
  9.  
  10.  
  11.  
  12.               PASM, The F-PC Assembler ____________________________ 2
  13.                   PREFIX or POSTFIX ? _____________________________ 2
  14.                   The 80386 and 80386SX ___________________________ 3
  15.                   PASM386.SEQ _____________________________________ 3
  16.                   Disassembler ____________________________________ 3
  17.  
  18.               PASM Glossary _______________________________________ 4
  19.  
  20.               Addressing Modes ____________________________________ 5
  21.                   Register Mode ___________________________________ 5
  22.                       386 Registers _______________________________ 6
  23.                       X87 Registers _______________________________ 6
  24.                   Immediate Mode __________________________________ 6
  25.                   Direct Mode _____________________________________ 7
  26.                   Index Mode ______________________________________ 7
  27.                   Implied Mode and Segment Override _______________ 8
  28.                   x87 Operand Types _______________________________ 9
  29.  
  30.               Macros ______________________________________________ 9
  31.  
  32.               INLINE Code ________________________________________ 10
  33.  
  34.               Local Labels _______________________________________ 10
  35.                   Example ________________________________________ 11
  36.                   Long Jump ______________________________________ 11
  37.  
  38.               Supported Instructions _____________________________ 11
  39.                   Hawkins Mnemonic Jumps _________________________ 11
  40.                   Some Structure Constructs ______________________ 12
  41.                   x86 and x87 Instructions _______________________ 12
  42.  
  43.               Register Usage _____________________________________ 19
  44.  
  45.               Assembler Internals ________________________________ 20
  46.                   PostFix ________________________________________ 21
  47.                   PreFix _________________________________________ 21
  48.  
  49.               PASM Syntax Comparison _____________________________ 22
  50.  
  51.               CODE Structure _____________________________________ 24
  52.                   Regular Next ___________________________________ 24
  53.                   Inline  NEXT ___________________________________ 24
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.                                                                    9-1                                                                   9-1
  65.  
  66.  
  67.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  68.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  69.  
  70.                                              The assembler supports prefix
  71.                                              syntax in an attempt to provide
  72.          PASM, The F-PC Assembler         PASM, The F-PC Assembler         ________________________            a syntax which is more readable
  73.                                              to programmers of other
  74.          PASM.SEQ is an assembler which      languages. The use of sequential
  75.          is based on an 8086 assembler       text file for source code
  76.          published in Dr. Dobb's Journal,    encourages the programmer to
  77.          February 1982, by Ray Duncan.       write programs in the vertical
  78.          This assembler was subsequently     code style with one statement
  79.          modified by Robert L. Smith to      per line.  This style is what
  80.          repair bugs, and support the        traditional assembler requires.
  81.          prefix assembler notation.  Bob     F-PC works well in this style,
  82.          discovered a very simple method     if you choose to do so. However,
  83.          to let a postfix assembler to       F-PC does not prevent you to
  84.          assemble prefix code, by            write in the horizontal code
  85.          deferring assembly until the        style, by which you can squeeze
  86.          next assembler command or the       many statements into one line
  87.          end of line, when all the           and make you own life miserable.
  88.          arguments for the previous          It supports postfix syntax to
  89.          assembler command are piled on      prevent alienating the
  90.          the top of the data stack.  Tom     established base of F83 users.
  91.          Zimmer has made additional
  92.          modifications to allow syntax       The prefix notation is close to
  93.          switching, and to increase          the original Intel assembly
  94.          compatibility in postfix mode       syntax, and certainly will be
  95.          with the F83 Assembler.             more familiar to programmers of
  96.                                              other languages.  All the code
  97.                                              words defined in F-PC are coded
  98.          PREFIX or POSTFIX ?         PREFIX or POSTFIX ?         ___________________                 in the prefix notation.  Please
  99.                                              consider writing any new
  100.          PASM supports dual syntaxes.        assembly code you need in the
  101.          The words PREFIX and POSTFIX        prefix mode for distribution and
  102.          switch between the two supported    assimilation.
  103.          modes.  The postfix mode is very
  104.          similar to F83's CPU8086
  105.          Assembler.  Prefix mode, which
  106.          is the default mode, allows a
  107.          syntax which is much closer to
  108.          MASM used by Intel and
  109.          MicroSoft.
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                                                    9-2                                                                   9-2
  128.  
  129.  
  130.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  131.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  132.  
  133.          The assembly of a machine                - 286/386 unique
  134.          instruction is generally                   instructions.
  135.          deferred to the following three          - Extended (32 bit) size
  136.          events: when the next assembly             registers and memory.
  137.          mnemonic is encountered, at the          - Extra segment registers.
  138.          end of a line, or when the
  139.          command END-CODE or A; is           Not Supported:
  140.          executed.  Therefore, a good
  141.          style in writing code words in           - ENTER, LEAVE.
  142.          F-PC is to put one assembly              - Long (2 byte) offset
  143.          instruction in one line,                   conditional jumps.
  144.          followed by the parameter                - Extended (32 bit)
  145.          specification or the arguments.            addressing.
  146.          Multiple assembly instructions           - MOV with CRx or DRx
  147.          are allowed in the same line,              registers.
  148.          except the assembly directives           - Protected mode
  149.          which build control structures             instructions in general.
  150.          in a code word, such as IF,
  151.          ELSE, THEN, BEGIN, WHILE, AGAIN,
  152.          etc.  These directives must be      Disassembler                                             Disassembler                                             ____________
  153.          the first or the only
  154.          instruction in a line because       In order to facilitate writing
  155.          they act immediately, not           assembler language (CODE)
  156.          waiting for the next assembly       definitions, DASM386.SEQ is a                                             definitions, DASM386.SEQ is a                                                          ___________
  157.          instruction.  It is a good ideal    full disassembler for the 80386
  158.          to put these structure words in     and the 80387 (numeric
  159.          separate lines with proper          processor).  Beheading is used
  160.          indentation so that the nested      to minimize clutter but some
  161.          structures in a code definition     extra defitions are placed into
  162.          can be perceived more readily.      the DASM386 vocabulary.  In                                             the DASM386 vocabulary.  In
  163.                                              addition, the following words
  164.                                              are defined in the FORTH                                             are defined in the FORTH
  165.          The 80386 and 80386SX         The 80386 and 80386SX         _____________________               vocabulary:
  166.  
  167.          The Intel 80286 offers little       DM   ( addr -- )                                             DM   ( addr -- )
  168.          extra capability which is useful         Display memory starting at
  169.          in a Forth system.  The                  address addr in DUMP                                                          ____
  170.          386/386SX (and 486 when it is            format.
  171.          available) is a big step and
  172.          does add capabilities which         DIS  ( addr -- )                                             DIS  ( addr -- )
  173.          could be useful in FORTH - the           Disassembler instructions
  174.          least of which is 32 bit                 starting at address addr.                                                                      ____
  175.          registers and operations which
  176.          can be used to extend F-PC (F-      IDIS ( n -- )                                             IDIS ( n -- )
  177.          TZ, etc.) into a 32 bit world.           Disassemble the interrupt
  178.                                                   procedure whose interrupt
  179.                                                   number is n.                                                            _
  180.          PASM386.SEQ         PASM386.SEQ         ___________
  181.                                              SEEN ( addr -- )                                             SEEN ( addr -- )
  182.          This documentation reflects              Disassembler F-PC CODE
  183.          Version 1.0 of the 80386         Version 1.0 of the 80386                 definitions starting at
  184.          instruction implementation -             address addr.  If addr does                                                          ____
  185.          PASM386.SEQ.                             not point to a CODE
  186.                                                   definition, then control is
  187.          Supported                                passed to the regular
  188.                                                   routine (SEE).                                                          _____
  189.  
  190.                                                                    9-3                                                                   9-3
  191.  
  192.  
  193.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  194.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  195.  
  196.          SEE  ( | name )         SEE  ( | name )                     CODE                                             CODE
  197.               This replaces the regular           Define "name" as a new code
  198.               SEE.  It invokes SEEN to              ___              ____               definition. Assembly
  199.               perform disassembly.                language follows,
  200.                                                   terminated by END-CODE.                                                                ________
  201.          The display and be paused by                            ______
  202.          entering a space or stopped by      END-CODE                                             END-CODE
  203.          entering an escape.                      Terminates CODE                                                             ____
  204.                                                   definitions, checks error
  205.                                                   conditions, and makes the
  206.                                                   code definition available
  207.          PASM Glossary         PASM Glossary         _____________                            for searching and
  208.                                                   execution.
  209.          Here we will only give a small
  210.          list of PASM words in this          A;                                             A;
  211.          glossary.  All assembly                  Completes the assembly of
  212.          mnemonics are identical to those         the previous instruction.
  213.          defined in F83 8086 Assembler.
  214.          All the structure directives and    LOCAL_REF                                             LOCAL_REF
  215.          test conditions are also                 This functions sets the
  216.          identical to those in F83.  Only         mode so that local labels
  217.          the most important FORTH words           will NOT cross CODE word                                                  will NOT cross CODE word
  218.          controlling the assembler are            boundaries.  The local
  219.          listed here.                             label mechanism is cleared
  220.                                                   each time a new CODE word
  221.          PREFIX         PREFIX                                   is started.  This is the
  222.               Assert prefix mode for the          default mode.
  223.               following code definitions.
  224.                                              GLOBAL_REF                                             GLOBAL_REF
  225.          POSTFIX         POSTFIX                                  This function sets the mode
  226.               Assert postfix mode for the         so that local labels can
  227.               following code definitions.         cross CODE definition
  228.                                                   boundaries.  All local
  229.          ASM.8086         ASM.8086                                 label definitions will be
  230.               Assert 8086 mode for the            available and the mechanism
  231.               following code definitions          is NOT reset at the                                                  is NOT reset at the
  232.               - this is the default.              beginning of a CODE
  233.               This mode limits the                definition.  The local
  234.               assembler to the (original)         label mechanism must be
  235.               8086 limits, registers,             reset with the CLEAR_LABELS                                                                 ____________
  236.               etc.                                function before using
  237.                                                   global referencing mode.
  238.          ASM.386         ASM.386
  239.               Assert 386 mode for the        CLEAR_LABELS                                             CLEAR_LABELS
  240.               following code definitions.         Clear the local label
  241.               This mode permits 386 32bit         mechanism to a clean or
  242.               registers, 386 extra                unused state in preparation
  243.               segment registers, unique           for using local labels.
  244.               386 instructions, and 386           This word need only be used
  245.               extensions to existing              if in the GLOBAL_REFS mode.                                                            ___________
  246.               instructions to be used.            In the LOCAL_REFS mode,                                                         __________
  247.                                                   CLEAR_LABELS is performed                                                  ____________
  248.                                                   automatically.
  249.  
  250.  
  251.  
  252.  
  253.                                                                    9-4                                                                   9-4
  254.  
  255.  
  256.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  257.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  258.  
  259.          BYTE         BYTE                                #                                             #
  260.               Assemble current and                indicates an immediate
  261.               subsequent code using byte          number.
  262.               arguments, if register size
  263.               is not explicitly              #)                                             #)
  264.               specified.                          indicates swapping source
  265.                                                   and destination registers
  266.          WORD         WORD                                     and/or memory addresses.
  267.               Assemble current and
  268.               subsequent code using 16
  269.               bit arguments, if register
  270.               size is not explicitly         Addressing Modes                                             Addressing Modes                                             ________________
  271.               specified.
  272.                                              The most difficult problem in
  273.          LABEL         LABEL                               using 8086 assembler is to
  274.               Start an assembly              figure out the correct
  275.               subroutine or mark the         addressing mode and code it into
  276.               current code address to be     an instruction. You can get a
  277.               referenced later.              good ideal and probably figure
  278.                                              out most of the addressing mode
  279.          >PRE         >PRE                                syntax from the above table.
  280.               save the current prefix /      However, there are cases the
  281.               postfix setting and set        table fells short.  Here we will
  282.               prefix.                        try to summarize the addressing
  283.                                              syntax more systematically to
  284.          PRE>         PRE>                                show you how F-PC handles
  285.               restore the previous prefix    addresses in the prefix mode.
  286.               / postfix setting.
  287.  
  288.          INLINE         INLINE                              Register Mode                                             Register Mode                                             _____________
  289.               begin assembly code inside
  290.               of a colon definition.         Source or destination is a
  291.                                              register in the CPU.  The source
  292.          END-INLINE         END-INLINE                          registers specifications are:
  293.               terminate assembly code
  294.               inside of a colon
  295.               definition and revert to          AL    BL    CL    DL                                                AL    BL    CL    DL
  296.               normal colon compilation.         AH    BH    CH    DH                                                AH    BH    CH    DH
  297.                                                 AX    BX    CX    DX                                                AX    BX    CX    DX
  298.          INLINEON         INLINEON                               SP    BP    SI    DI                                                SP    BP    SI    DI
  299.               turns generation of inline        IP    RP                                                IP    RP
  300.               NEXT on.              ____                              CS    DS    SS    ES                                                CS    DS    SS    ES
  301.  
  302.          INLINEOFF         INLINEOFF                           Destination register
  303.               turns generation of inline     specifications are:
  304.               NEXT off.              ____
  305.  
  306.          FAR         FAR                                    AL,   BL,   CL,   DL,                                                AL,   BL,   CL,   DL,
  307.               is used to designate an           AH,   BH,   CH,   DH,                                                AH,   BH,   CH,   DH,
  308.               external segment jump.            AX,   BX,   CX,   DX,                                                AX,   BX,   CX,   DX,
  309.                                                 SP,   BP,   SI,   DI,                                                SP,   BP,   SI,   DI,
  310.          []         []                                     IP,   RP,                                                IP,   RP,
  311.               is used with FAR for long                           ___                  CS,   DS,   SS,   ES,                                                CS,   DS,   SS,   ES,
  312.               labels.
  313.  
  314.  
  315.  
  316.                                                                    9-5                                                                   9-5
  317.  
  318.  
  319.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  320.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  321.  
  322.          Note that IP is the same as the         Note that IP is the same as the                   __                        The destination register
  323.          SI register and that RP is the         __                   __             specifications are:
  324.          same as the BP register.  This                     __
  325.          additional register names are
  326.          provided for compatibility with        ST(0),     ST(1),                                                ST(0),     ST(1),
  327.          most Forth systems.                    ST(2),     ST(3),                                                ST(2),     ST(3),
  328.                                                 ST(4),     ST(5),                                                ST(4),     ST(5),
  329.                                                 ST(6),     ST(7),                                                ST(6),     ST(7),
  330.          386 Registers         386 Registers         _____________
  331.                                              In addition, the register
  332.          The 32bit source registers          specifications ST and ST, are                                             specifications ST and ST, are
  333.          specifications are:                 used in some instructions to
  334.                                              specify an implied ST(0).                                             specify an implied ST(0).                                                        _______
  335.  
  336.             EAX   EBX   ECX   EDX            EAX   EBX   ECX   EDX
  337.             ESP   EBP   ESI   EDI            ESP   EBP   ESI   EDI            Immediate Mode                                             Immediate Mode                                             ______________
  338.  
  339.          The 16bit source segment            The argument is assembled as a
  340.          registers specifications are:       literal in the instruction.  The
  341.                                              immediate value must be preceded
  342.                                              by the symbol #, which is a word                                                           _
  343.             CS    DS    SS    ES            CS    DS    SS    ES             and must be delimited by spaces:
  344.             FS    GS            FS    GS
  345.  
  346.          The 32bit destination registers        MOV  AX, # 1234                                                MOV  AX, # 1234
  347.          specifications are:                    ADD  CL, # 32                                                ADD  CL, # 32
  348.                                                 ROL  AX, # 3                                                ROL  AX, # 3
  349.  
  350.             EAX,  EBX,  ECX,  EDX,            EAX,  EBX,  ECX,  EDX,           For some 386 instructions, 32-
  351.             ESP,  EBP,  ESI,  EDI,            ESP,  EBP,  ESI,  EDI,           bit immediate data is expected
  352.                                              and must be specified.  This can
  353.          The 16bit destination segment       be specified and two successive
  354.          registers specifications are:       16-bit values or a single
  355.                                              double-value.    For example:
  356.  
  357.             CS,   DS,   SS,   ES,            CS,   DS,   SS,   ES,
  358.             FS,   GS,            FS,   GS,                           MOV   EAX,  # $1234 $5678                                                MOV   EAX,  # $1234 $5678
  359.  
  360.                                                 MOV   EAX,  # $5678.1234                                                MOV   EAX,  # $5678.1234
  361.          X87 Registers         X87 Registers         _____________
  362.                                              If a double value is specified,
  363.          The support for the (floating       note that it is stored in
  364.          point) numeric processor such as    reverse order on the stack.
  365.          the 8087 and the 80387 add a
  366.          number of register definitions
  367.          to the assembler.
  368.  
  369.          The source register
  370.          specifications are:
  371.  
  372.  
  373.             ST(0)      ST(1)            ST(0)      ST(1)
  374.             ST(2)      ST(3)            ST(2)      ST(3)
  375.             ST(4)      ST(5)            ST(4)      ST(5)
  376.             ST(6)      ST(7)            ST(6)      ST(7)
  377.  
  378.  
  379.                                                                    9-6                                                                   9-6
  380.  
  381.  
  382.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  383.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  384.  
  385.          Direct Mode         Direct Mode         ___________                         Examples are:
  386.  
  387.          An address is assembled into the
  388.          instruction.  This is used to           CMP  2 [BP], SI                                                 CMP  2 [BP], SI
  389.          specify an address to be jumped         DEC  3 [SI]                                                 DEC  3 [SI]
  390.          to or a memory location for data        MOV  BP, 0 [BX]                                                 MOV  BP, 0 [BX]
  391.          reference.  The address is used
  392.          directly as a 16 bit number.        The following register index
  393.          Depending on the instruction,       specifications are allowed in F-
  394.          the address may be assembled        PC for source register
  395.          unmodified or assembled as an       designations:
  396.          eight bit offset in the branch
  397.          instructions.  To jump or call
  398.          beyond a 64K byte segment, the          [SI]      [IP]                                                 [SI]      [IP]
  399.          address must be preceded by             [BP]      [RP]                                                 [BP]      [RP]
  400.          FAR [].         ______                                  [DI]                                                 [DI]
  401.                                                  [BX]                                                 [BX]
  402.          Examples are:
  403.                                                  [BX+SI]   [SI+BX]                                                 [BX+SI]   [SI+BX]
  404.                                                  [BX+IP]   [IP+BX]                                                 [BX+IP]   [IP+BX]
  405.             CALL FAR [] <label>            CALL FAR [] <label>
  406.             JMP  <dest>            JMP  <dest>                          [BX+DI]   [DI+BX]                                                 [BX+DI]   [DI+BX]
  407.             MOV  BX, <source>            MOV  BX, <source>
  408.             INC  <dest> WORD            INC  <dest> WORD                     [BP+SI]   [SI+BP]                                                 [BP+SI]   [SI+BP]
  409.             JZ   <label>            JZ   <label>                         [BP+IP]   [IP+BP]                                                 [BP+IP]   [IP+BP]
  410.                                                  [RP+IP]   [IP+RP]                                                 [RP+IP]   [IP+RP]
  411.          The destination address may be
  412.          taken from the data stack               [BP+DI]   [DI+BP]                                                 [BP+DI]   [DI+BP]
  413.          directly:                               [RP+DI]   [DI+RP]                                                 [RP+DI]   [DI+RP]
  414.  
  415.                                              Destination registers are
  416.             MOV  CX, # 16            MOV  CX, # 16                    specified in a similar manner
  417.             HERE ( save current code            HERE ( save current code         by:
  418.          address on stack)         address on stack)
  419.                  ...                 ...
  420.                  ...                 ...                             [SI],     [IP],                                                 [SI],     [IP],
  421.             LOOPZ ( loop back to HERE if            LOOPZ ( loop back to HERE if         [BP],     [RP],                                                 [BP],     [RP],
  422.          condition fails)         condition fails)                        [DI],                                                 [DI],
  423.                                                  [BX],                                                 [BX],
  424.  
  425.          Index Mode         Index Mode         __________                              [BX+SI],  [SI+BX],                                                 [BX+SI],  [SI+BX],
  426.                                                  [BX+IP],  [IP+BX],                                                 [BX+IP],  [IP+BX],
  427.          One or two registers can be used
  428.          as index registers to scan              [BX+DI],  [DI+BX],                                                 [BX+DI],  [DI+BX],
  429.          through data arrays.  The
  430.          contents of the index register          [BP+SI],  [SI+BP],                                                 [BP+SI],  [SI+BP],
  431.          or the sum of the contents of           [BP+IP],  [IP+BP],                                                 [BP+IP],  [IP+BP],
  432.          two index registers are added to
  433.          form a base address, an offset          [BP+DI],  [DI+BP],                                                 [BP+DI],  [DI+BP],
  434.          is added to the base address to
  435.          form the true address for data      Note that the available
  436.          reference.                          specifications are NOT
  437.                                              symmetric.
  438.  
  439.  
  440.  
  441.  
  442.                                                                    9-7                                                                   9-7
  443.  
  444.  
  445.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  446.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  447.  
  448.          There must be an offset number      If you need to specify an
  449.          preceding the index register        address with a segment register
  450.          specification, even if the          other than the default implied
  451.          offset is 0.  This offset must         offset is 0.  This offset must                       ________________      register, use a segment override
  452.          be specified even if the         be specified even if the         ________________________            instruction before the address
  453.          instruction does not use it         instruction does not use it         ___________________________         specification:
  454.          (e.g., the push and pop                    ____     ___
  455.          instructions can push/pop values
  456.          indirectly or indexed but do not         indirectly or indexed but do not        CS:   DS:  ES:  SS:                                                 CS:   DS:  ES:  SS:
  457.          use the offset).
  458.                                              The 386 adds two more segment                                             The 386 adds two more segment
  459.          When the index register is used     registers.  These are similar to
  460.          as destination, a comma must be     the ES register and can be used                                             the ES register and can be used                                                 __
  461.          appended immediately:               in similar ways.  The extra 386
  462.                                              segment over-rides are:
  463.  
  464.              MOV  0 [BX+IP], AX             MOV  0 [BX+IP], AX
  465.                                                  FS:   GS:                                                 FS:   GS:
  466.          32-bit index registers require
  467.          support of 32-bit addressing.       Examples are:
  468.          This is not currently supported.
  469.  
  470.                                                  MOV  ES: BP, SI                                                 MOV  ES: BP, SI
  471.          Implied Mode and Segment         Implied Mode and Segment         ________________________                CMP  CS: 2 [BP], AX                                                 CMP  CS: 2 [BP], AX
  472.          Override         Override         ________                                ADD  AX, ES: 10 [BX+DI]                                                 ADD  AX, ES: 10 [BX+DI]
  473.  
  474.          The implied mode is where           The 8086 addressing modes are so
  475.          mistakes are most likely to         confusing that even experienced
  476.          occur because you will have to      programmer needs a good Intel
  477.          be keenly aware of which segment    8086 manual to find the right
  478.          register is used by the             addressing mode and the F-PC
  479.          instruction at any instance.        assembler syntax table to
  480.          Since the segment register is       determine the correct argument
  481.          implied and not stated              list.
  482.          explicitly, the bug generally
  483.          can hide very securely              The best way to write assembly
  484.          underneath laughing at you.  The    code is still keeping the code
  485.          code works when you test it but     short and simple.  It is very
  486.          fails when the segment register     easy in F-PC to break a long
  487.          is modified.                        CODE definition into many small                                             ____
  488.                                              fragments which are initially
  489.          -- Branch and jump instructions     defined as separate CODE                                                                 ____
  490.          use CS segment register.            definitions.  After verifying
  491.                                              that each fragment works, you
  492.          -- Data movement instructions       can edit out the CODE, NEXT, and                                                              ____  ____
  493.          use DS segment register.            END-CODE lines to combine the                                             ________
  494.                                              fragments into a single CODE                                                                     ____
  495.          -- Stack instructions use SS        definition.
  496.          segment.
  497.  
  498.          -- String instructions use DS:SI
  499.          as source and ES:DI as
  500.          destination.
  501.  
  502.  
  503.  
  504.  
  505.                                                                    9-8                                                                   9-8
  506.  
  507.  
  508.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  509.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  510.  
  511.          Charles Curley kindly               Macros                                             Macros                                             ______
  512.          contributes an 8086 disassembler
  513.          with a single step debugger.  It    Another area of interest is the
  514.          is helpful to disassemble the       macros.  Here is the definition
  515.          CODE word you defined and see         ____                                of the NEXT macro:
  516.          what the computer thinks of what
  517.          you mean. There is always this
  518.          'Do what I mean, not what I say'        : NEXT  >PRE    JMP >NEXT A;                                                 : NEXT  >PRE    JMP >NEXT A;
  519.          syndrome. Stepping through a        PRE> ;                                             PRE> ;
  520.          piece of code one instruction at
  521.          a time is the last thing you        The macro itself is simply the
  522.          have to do if everything else       sequence JMP >NEXT. The                                                      _________
  523.          failed.                             surrounding words are used for
  524.                                              support. Since PASM supports
  525.                                              both postfix as well as prefix
  526.          x87 Operand Types         x87 Operand Types         _________________                   notation, it is not known on
  527.                                              entry to a macro what mode is
  528.          Many x87 instructions require       selected. The words >PRE and                                                                 ____
  529.          specifying a operand type           PRE> select prefix, and restore                                             ____
  530.          designation.  The valid one are:    the previous mode so macros will
  531.                                              always be in prefix notation.
  532.                                              The A; after >NEXT, forces the                                                 __       _____
  533.             REAL*4            REAL*4                           assembly of the JMP instruction                                                             ___
  534.             REAL*8            REAL*8                           before the mode switch.
  535.             INTEGER*2            INTEGER*2
  536.             INTEGER*4            INTEGER*4                        The standard predefined macros
  537.             INTEGER*8            INTEGER*8                        in PASM include NEXT (a JMP or                                                             ____
  538.             BCD            BCD                              inline next function), 1PUSH                                                                    _____
  539.             REAL_TEMP            REAL_TEMP                        (pushes AX on the stack and then                                             (pushes AX on the stack and then
  540.                                              does NEXT), and 2PUSH (pushes                                                  ____       _____
  541.          If one is not specified but it      DX, AX and then does NEXT).                                             DX, AX and then does NEXT).                                                                  ____
  542.          is needed, REAL*4 is assumed.         is needed, REAL*4 is assumed.
  543.          Normally, these are needed for
  544.          instructions referencing memory
  545.          - those with a floating point
  546.          stack register specification do
  547.          not need this (it is ignored).
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.                                                                    9-9                                                                   9-9
  569.  
  570.  
  571.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  572.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  573.  
  574.          INLINE Code         INLINE Code         ___________                         Local Labels                                             Local Labels                                             ____________
  575.  
  576.          INLINE allows us to include         ______                              To support large code
  577.          machine code inside a high level    definitions, Bob Smith
  578.          colon definition.  This is          introduced 'local labels' to F-
  579.          easily done in F-PC because it      PC.  The local labels are place
  580.          is built on direct threaded         markers $: preceded by a number.
  581.          code.  Every word is compiled as    They are used to mark locations
  582.          a code address in the colon         in a large code definition for
  583.          definition.  The code in the        forward and backward jumps and
  584.          code field pointed to by the        branches.  They can be used
  585.          code address is executed            quite freely in a range of code
  586.          directly because it is genuine      words and reused to save head
  587.          8086 machine code.  Whether the     space by replacing LABELs which                                                                _____
  588.          code belongs to a colon             have global names and cannot be
  589.          definition or a code definition     reused.
  590.          does not make any difference.
  591.          INLINE only has to compile the      The use of local labels is best
  592.          address pointing to the top of      demonstrated by an example taken
  593.          the dictionary in the code          from the software floating point
  594.          segment.  The assembler can then    package SFLOAT.SEQ by Bob Smith.
  595.          be invoked to compile machine       Up to 32 local labels can be
  596.          code.  If the code is terminated    used to mark addresses of
  597.          by NEXT or one of its            ____                             assembly code.  They can be
  598.          derivatives, the next word          referred to before or after
  599.          compiled in the colon definition    their placements.  They can be
  600.          will be executed after the          referenced across code word
  601.          assembly code is done.  END-                                 ____        boundaries.  The command LLAB-                                                                      _____
  602.          INLINE only has to clean up the         ______                              INIT defines the boundary where                                             ____
  603.          assembly environment and return     the local label referencing
  604.          the control back to the colon       cannot cross.  Between two
  605.          compiler.                           consecutive LLAB-INIT, local                                                         _________
  606.                                              labels can be freely placed and
  607.          Here is an example on how to use    referenced.  The LLAB-INIT                                                              _________
  608.          INLINE and END-INLINE to add        function is from George Hawkins
  609.          assembly code in the middle of a    enhancement to PASM.  It is
  610.          colon definition:                   similar to the CLEAR-LABELS                                                            ____________
  611.                                              function in the original PASM.
  612.  
  613.              : TEST ( -- )             : TEST ( -- )                   This technique is especially
  614.                5 0 DO               5 0 DO                        useful where the one-entry-one-
  615.                    I             \ Get                   I             \ Get       exit dogma is very awkward when
  616.          loop index         loop index                          a piece of code has multiple
  617.                    INLINE                   INLINE                    entry points and can be shared
  618.                      pop ax       \ pop I                     pop ax       \ pop I    among many code word
  619.                      add ax, # 23 \ add                     add ax, # 23 \ add      definitions.  It allows us to
  620.          23         23                                  construct structured spaghetti
  621.                      1push        \ push                     1push        \ push     code, if there were such thing.
  622.          sum         sum
  623.                    END-INLINE                   END-INLINE
  624.                    .              \ print                   .              \ print
  625.          results         results
  626.                LOOP               LOOP
  627.              ;             ;
  628.  
  629.  
  630.  
  631.                                                                   9-10                                                                  9-10
  632.  
  633.  
  634.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  635.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  636.  
  637.          The implementation of local         Supported Instructions                                             Supported Instructions                                             ______________________
  638.          labels in PASM has been enhanced
  639.          by George Hawkins to correct
  640.          some bugs as well as to add some
  641.          features.  For example, it is no    Hawkins Mnemonic Jumps                                             Hawkins Mnemonic Jumps                                             ______________________
  642.          longer necessary to use LLAB-                                 _____
  643.          INIT (or CLEAR-LABELS) to         ____     ____________               George Hawkins has added a
  644.          initialize since this will be       number of mnemonic functions for
  645.          done automatically by CODE.                               ____          jumping in assembler CODE                                                                  ____
  646.                                              definitions.  These additional
  647.                                              definitions are:
  648.          Example         Example         _______
  649.                                                   J    JMP                                                  J    JMP
  650.          Short jump labels:
  651.                                                   J0<> JNE                                                  J0<> JNE
  652.                                                   J0=  JZ                                                  J0=  JZ
  653.                SUB  AX, AX               SUB  AX, AX                        J0>= JNS                                                  J0>= JNS
  654.                JNE  2  $               JNE  2  $                          J0<  JS                                                  J0<  JS
  655.               ....  up to 127 bytes of              ....  up to 127 bytes of
  656.          code         code                                     J<>  JNE                                                  J<>  JNE
  657.          2  $:  MOV  AX,  BX         2  $:  MOV  AX,  BX                      J=   JZ                                                  J=   JZ
  658.                  \ destination of short                 \ destination of short           J>=  JNL                                                  J>=  JNL
  659.          jump         jump                                     J<   JNGE                                                  J<   JNGE
  660.                                                   J>   JNLE                                                  J>   JNLE
  661.                                                   J<=  JNG                                                  J<=  JNG
  662.          Long Jump         Long Jump         _________
  663.                                                   JU>= JNC                                                  JU>= JNC
  664.          A single long label (more than           JU<  JNAE                                                  JU<  JNAE
  665.          127 bytes of code) is supported          JU>  JNBE                                                  JU>  JNBE
  666.          in each CODE definition.  This                 ____                             JU<= JNA                                                  JU<= JNA
  667.          long jump label can only be used
  668.          for forward addressing!  An             ___________________             These mnemonic jumps are very
  669.          example is:                         useful with local labels.
  670.  
  671.  
  672.                JMP  L$               JMP  L$
  673.              .....   any length             .....   any length
  674.           L$:  MOV  x, x          L$:  MOV  x, x
  675.                    \ destination of long                   \ destination of long
  676.          jump         jump
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.                                                                   9-11                                                                  9-11
  695.  
  696.  
  697.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  698.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  699.  
  700.          Some Structure Constructs         Some Structure Constructs         _________________________           DS:     8086 Segment (prefix)                                             DS:     8086 Segment (prefix)
  701.                                                      Override - points to the
  702.          PASM supports a number of                   standard (default) data
  703.          constructs for structured                   segment - normally the
  704.          programming.  These constructs              same as CS: in F-PC and
  705.          are similar to those available              points to the beginning
  706.          for colon definitions and                   of the CODE space.
  707.          include the following:
  708.                                              FS:     386                                             FS:     386
  709.               IF                                     Segment (prefix)
  710.               THEN                                   Override
  711.               ELSE
  712.                                              GS:     386                                             GS:     386
  713.               BEGIN                                  Segment (prefix)
  714.               UNTIL                                  Override
  715.               AGAIN
  716.               WHILE                          AAA     ASCII Adjust after                                             AAA     ASCII Adjust after
  717.               REPEAT                                 Addition
  718.  
  719.          There is also some shorthand for    AAD     ASCII Adjust after                                             AAD     ASCII Adjust after
  720.          comparison:                                 Division
  721.  
  722.                                              AAM     ASCII Adjust after                                             AAM     ASCII Adjust after
  723.             0=    0<>   0<    0>=            0=    0<>   0<    0>=                    Multiplication
  724.             <     >=    <=    >            <     >=    <=    >
  725.             U<    U>=   U<=   U>            U<    U>=   U<=   U>             AAS     ASCII Adjust after                                             AAS     ASCII Adjust after
  726.             OV            OV                                       Subtraction
  727.             CX<>0            CX<>0
  728.                                              ADC     Arithmetic (integer) Add                                             ADC     Arithmetic (integer) Add
  729.                                                      with Carry
  730.  
  731.          x86 and x87 Instructions         x86 and x87 Instructions         ________________________            ADD     Arithmetic (integer)                                             ADD     Arithmetic (integer)
  732.                                                      Addition
  733.          The following gives a list of
  734.          the 8086, 80286, 80386, 8087,       AND     (logical) and                                             AND     (logical) and
  735.          80287, and 80387 instructions
  736.          supported by the F-PC assembler.    BSF     386                                             BSF     386
  737.                                                      Scan Bit Forward
  738.          ES:     8086 Segment (prefix)         ES:     8086 Segment (prefix)
  739.                  Override                    BSR     386                                             BSR     386
  740.                                                      Scan Bit Reverse
  741.          CS:     8086 Segment (prefix)         CS:     8086 Segment (prefix)
  742.                  Override - Code Segment     BT      386                                             BT      386
  743.                  - points to F-PC's CODE             Bit Test
  744.                  space.
  745.                                              BTC     386                                             BTC     386
  746.          SS:     8086 Segment (prefix)         SS:     8086 Segment (prefix)               Bit Test and Complement
  747.                  Override - points to the
  748.                  Stack segment               BTR     386                                             BTR     386
  749.                                                      Bit Test and Reset
  750.  
  751.                                              BTS     386                                             BTS     386
  752.                                                      Bit Test and Set
  753.  
  754.                                              CALL    Call Procedure                                             CALL    Call Procedure
  755.  
  756.  
  757.                                                                   9-12                                                                  9-12
  758.  
  759.  
  760.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  761.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  762.  
  763.          CBW     Convert Byte to Word         CBW     Convert Byte to Word        FCOMP   x87 Compare                                             FCOMP   x87 Compare
  764.                                                      (real/integer and pop
  765.          CLC     Clear Carry Flag         CLC     Clear Carry Flag
  766.                                              FCOMPP  x87 Compare Real and Pop                                             FCOMPP  x87 Compare Real and Pop
  767.          CLD     Clear Direction Flag         CLD     Clear Direction Flag                twice
  768.                  (increasing)
  769.                                              FCOS    387                                             FCOS    387
  770.          CLI     Clear Interrupt Flag         CLI     Clear Interrupt Flag                Cosine of ST(0)
  771.                  (Disable)
  772.                                              FDECSTP x87 Decrement stack                                             FDECSTP x87 Decrement stack
  773.          CLTS    386         CLTS    386                                 pointer
  774.                  Clear Task Switched Flag
  775.                                              FDISI   8087                                             FDISI   8087
  776.          CMC     Complement Carry Flag         CMC     Complement Carry Flag               DISABLE interrupts
  777.  
  778.          CMP     Compare Register/Memory         CMP     Compare Register/Memory     FDIV    x87 Divide                                             FDIV    x87 Divide
  779.                  with memory or                      (real/integer)
  780.                  Immediate.
  781.                                              FDIVP   x87 Divide Real and Pop                                             FDIVP   x87 Divide Real and Pop
  782.          CMPS    Compare String         CMPS    Compare String
  783.                                              FDIVR   x87 Divide                                             FDIVR   x87 Divide
  784.          CMPSB   Compare (byte) String         CMPSB   Compare (byte) String               (real/integer) REVERSE
  785.  
  786.          CMPSD   Compare (Dword) String         CMPSD   Compare (Dword) String      FDIVRP  x87 Divide Real Reverse                                             FDIVRP  x87 Divide Real Reverse
  787.                                                      and Pop
  788.          CMPSW   Compare (word) String         CMPSW   Compare (word) String
  789.                                              FENI    8087                                             FENI    8087
  790.          CWD     Convert Word to Dword         CWD     Convert Word to Dword               ENABLE interrupts
  791.  
  792.          DAA     Decimal Adjust after         DAA     Decimal Adjust after        FFREE   x87 Free Register                                             FFREE   x87 Free Register
  793.                  Addition
  794.                                              FINCSTP x87 Increment Stack                                             FINCSTP x87 Increment Stack
  795.          DAS     Decimal Adjust after         DAS     Decimal Adjust after                pointer
  796.                  Subtraction
  797.                                              FINIT   x87 Initialize Processor                                             FINIT   x87 Initialize Processor
  798.          DEC     Decrement         DEC     Decrement
  799.                                              FLD     x87 Load                                             FLD     x87 Load
  800.          DIV     Unsigned divide         DIV     Unsigned divide                     (real/integer/bcd/temp_r
  801.                                                      eal)
  802.          F2XM1   x87 (2**x)-1         F2XM1   x87 (2**x)-1
  803.                                              FLD1    x87 Load +1.0                                             FLD1    x87 Load +1.0
  804.          FABS    x87 absolute value         FABS    x87 absolute value
  805.                                              FLDCW   x87 Load control word                                             FLDCW   x87 Load control word
  806.          FABS,   x87 - for compatability         FABS,   x87 - for compatability
  807.                                              FLDENV  x87 Load environment                                             FLDENV  x87 Load environment
  808.          FADD    x87 Add (real/integer)         FADD    x87 Add (real/integer)
  809.                                              FLDL2E  x87 Load LOG2(e)                                             FLDL2E  x87 Load LOG2(e)
  810.          FADDP   x87 Add Real and Pop         FADDP   x87 Add Real and Pop
  811.                                              FLDL2T  x87 Load LOG2(10)                                             FLDL2T  x87 Load LOG2(10)
  812.          FCHS    x87 Change Sign         FCHS    x87 Change Sign
  813.                                              FLDLG2  x87 Load LOG10(2)                                             FLDLG2  x87 Load LOG10(2)
  814.          FCLEX   x87 Clear Exceptions         FCLEX   x87 Clear Exceptions
  815.                                              FLDLN2  x87 Load LOGe(2)                                             FLDLN2  x87 Load LOGe(2)
  816.          FCOM    x87 Compare         FCOM    x87 Compare
  817.                  (real/integer)              FLDPI   x87 Load pi                                             FLDPI   x87 Load pi
  818.  
  819.  
  820.                                                                   9-13                                                                  9-13
  821.  
  822.  
  823.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  824.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  825.  
  826.          FLDZ    x87 Load +0.0         FLDZ    x87 Load +0.0               FSUBR   x87 Subtract                                             FSUBR   x87 Subtract
  827.                                                      (real/integer) REVERSE
  828.          FMUL    x87 Multiply         FMUL    x87 Multiply
  829.                  (real/integer)              FSUBRP  x87 Subtract real                                             FSUBRP  x87 Subtract real
  830.                                                      reverse and Pop
  831.          FMULP   x87 Multiply Real and         FMULP   x87 Multiply Real and
  832.                  Pop                         FTST    x87 Test stack top                                             FTST    x87 Test stack top
  833.                                                      against +0.0
  834.          FNOP    x87 no-operation         FNOP    x87 no-operation
  835.                                              FUCOM   387                                             FUCOM   387
  836.          FPATAN  x87 Partial Arctangent         FPATAN  x87 Partial Arctangent              unordered compare
  837.  
  838.          FPREM   x87 Partial Remainder         FPREM   x87 Partial Remainder       FUCOMP  387                                             FUCOMP  387
  839.                                                      unordered compare and
  840.          FPREM1  387         FPREM1  387                                 pop
  841.                  Partial Remainder
  842.                                              FUCOMPP 387                                             FUCOMPP 387
  843.          FPTAN   x87 Partial Tangent         FPTAN   x87 Partial Tangent                 unordered Compare and
  844.                                                      Pop Twice
  845.          FRNDINT x87 Round to Integer         FRNDINT x87 Round to Integer
  846.                                              FXAM    x87 Examine stack top                                             FXAM    x87 Examine stack top
  847.          FRSTOR  x87 Restore saved state         FRSTOR  x87 Restore saved state
  848.                                              FXCH    x87 Exchange registers                                             FXCH    x87 Exchange registers
  849.          FSAVE   x87 Save state         FSAVE   x87 Save state
  850.                                              FXTRACT x87 Extract exponent and                                             FXTRACT x87 Extract exponent and
  851.          FSCALE  x87 Scale         FSCALE  x87 Scale                           significant
  852.  
  853.          FSIN    387         FSIN    387                         FYL2X   x87 Y*(LOG2(X))                                             FYL2X   x87 Y*(LOG2(X))
  854.                  Sine of ST(0)
  855.                                              FYL2XP1 x87 Y*(LOG2(X+1))                                             FYL2XP1 x87 Y*(LOG2(X+1))
  856.          FSINCOS 387         FSINCOS 387
  857.                  Sine and Cosine of ST(0)    HLT     Halt Processor !                                             HLT     Halt Processor !
  858.  
  859.          FSQRT   x87 Square root         FSQRT   x87 Square root             IDIV    (integer) Signed Divide                                             IDIV    (integer) Signed Divide
  860.  
  861.          FSQRT,  x87 -- for compat.         FSQRT,  x87 -- for compat.          IMUL    (integer) Signed                                             IMUL    (integer) Signed
  862.                                                      Multiply
  863.          FST     x87 Store (real/integer)         FST     x87 Store (real/integer)
  864.                                              IN      Input from an I/O Port                                             IN      Input from an I/O Port
  865.          FSTCW   x87 Store control word         FSTCW   x87 Store control word
  866.                                              INC     Increment                                             INC     Increment
  867.          FSTENV  x87 Store environment         FSTENV  x87 Store environment
  868.                                              INS     386                                             INS     386
  869.          FSTP    x87 Store         FSTP    x87 Store                           Input String - DX port
  870.                  (real/integer/BCD/temp_r
  871.                  eal) and Pop                INSB    386                                             INSB    386
  872.                                                      Input (byte) String - DX
  873.          FSTSW   x87 Store status word         FSTSW   x87 Store status word               port
  874.  
  875.          FSUB    x87 Subtract         FSUB    x87 Subtract                INSD    386                                             INSD    386
  876.                  (real/integer)                      Input (Dword) String -
  877.                                                      DX port
  878.          FSUBP   x87 Subtract real and         FSUBP   x87 Subtract real and
  879.                  pop                         INSW    386                                             INSW    386
  880.                                                      Input (word) String - DX
  881.                                                      port
  882.  
  883.                                                                   9-14                                                                  9-14
  884.  
  885.  
  886.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  887.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  888.  
  889.          INT     Call to Software-         INT     Call to Software-           JNB     Jump if Not Below                                             JNB     Jump if Not Below
  890.                  Interrupt Procedure                 (CF=0)
  891.  
  892.          INTO    On Overflow, call         INTO    On Overflow, call           JNBE    Jump if Not Below or                                             JNBE    Jump if Not Below or
  893.                  interrupt procedure                 Equal
  894.                                                      (CF=0 and ZF=0)
  895.          IRET    Interrupt Return -         IRET    Interrupt Return -
  896.                  restore 16 bit regs         JNC     Jump if Not Carry                                             JNC     Jump if Not Carry
  897.                                                      (CF=0)
  898.          IRETD   386         IRETD   386
  899.                  Interrupt Return -          JNE     Jump if Not Equal                                             JNE     Jump if Not Equal
  900.                  restore 32 bit regs                 (ZF=0)
  901.                  (protected mode)
  902.                                              JNG     Jump if Not Greater                                             JNG     Jump if Not Greater
  903.          JA      Jump if Above         JA      Jump if Above                       (ZF=1 or SF<>OF)
  904.                  (CF=0 and ZF=0)
  905.                                              JNGE    Jump if Not Greater or                                             JNGE    Jump if Not Greater or
  906.          JAE     Jump if Above or Equal         JAE     Jump if Above or Equal              Equal
  907.                  (CF=0)                              (SF<>OF)
  908.  
  909.          JB      Jump if Below         JB      Jump if Below               JNL     Jump if Not Less                                             JNL     Jump if Not Less
  910.                  (CF=1)                              (SF=OF)
  911.  
  912.          JBE     Jump if Below or Equal         JBE     Jump if Below or Equal      JNLE    Jump if Not Less or                                             JNLE    Jump if Not Less or
  913.                  (CF=1 or ZF=1)                      Equal
  914.                                                      (ZF=0 and SF=OF)
  915.          JC      Jump if Carry         JC      Jump if Carry
  916.                  (CF=1)                      JNO     Jump if Not Overflow                                             JNO     Jump if Not Overflow
  917.                                                      (OF=0)
  918.          JCXZ    Jump if CX Register is         JCXZ    Jump if CX Register is
  919.                  Zero                        JNP     Jump if Not Parity                                             JNP     Jump if Not Parity
  920.                                                      (PF=0)
  921.          JE      Jump if Equal         JE      Jump if Equal
  922.                  (ZF=1)                      JNS     Jump if Not Sign                                             JNS     Jump if Not Sign
  923.                                                      (SF=0)
  924.          JG      Jump if Greater         JG      Jump if Greater
  925.                  (ZF=0 and SF=OF)            JNZ     Jump if Not Zero                                             JNZ     Jump if Not Zero
  926.                                                      (ZF=0)
  927.          JGE     Jump if Greater of Equal         JGE     Jump if Greater of Equal
  928.                  (SF=OF)                     JO      Jump if Overflow                                             JO      Jump if Overflow
  929.                                                      (OF=1)
  930.          JL      Jump if Less         JL      Jump if Less
  931.                  (SF<>OF)                    JP      Jump if Parity                                             JP      Jump if Parity
  932.                                                      (PF=1)
  933.          JLE     Jump if Less or Equal         JLE     Jump if Less or Equal
  934.                  (ZF=1 or SF<>OF)            JPE     Jump if Parity Even                                             JPE     Jump if Parity Even
  935.                                                      (PF=1)
  936.          JMP     Unconditional JUMP         JMP     Unconditional JUMP
  937.                                              JPO     Jump if Parity Odd                                             JPO     Jump if Parity Odd
  938.          JNA     Jump if Not Above         JNA     Jump if Not Above                   (PF=0)
  939.                  (CF=1 and ZF=1)
  940.                                              JS      Jump if Sign                                             JS      Jump if Sign
  941.          JNAE    Jump if Not Above or         JNAE    Jump if Not Above or                (SF=1)
  942.                  Equal
  943.                  (CF=1)                      JZ      Jump if Zero                                             JZ      Jump if Zero
  944.                                                      (ZF=1)
  945.  
  946.                                                                   9-15                                                                  9-15
  947.  
  948.  
  949.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  950.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  951.  
  952.          LAHF    Load Flags into AH         LAHF    Load Flags into AH          MOVSX   386                                             MOVSX   386
  953.                  register                            move to reg with Sign
  954.                                                      Extension
  955.          LDS     Load pointer into DS         LDS     Load pointer into DS
  956.                  register                    MOVZX   386                                             MOVZX   386
  957.                                                      move to reg with Zero
  958.          LEA     Load Effective Address         LEA     Load Effective Address              Extension
  959.  
  960.          LES     Load pointer into ES         LES     Load pointer into ES        MUL     Unsigned Multiply                                             MUL     Unsigned Multiply
  961.                  register
  962.                                              NEG     Negate                                             NEG     Negate
  963.          LFS     386         LFS     386
  964.                  Segment Register Load       NOP     No Operation                                             NOP     No Operation
  965.  
  966.          LGS     386         LGS     386                         NOT     (Logical) Not                                             NOT     (Logical) Not
  967.                  Segment Register Load
  968.                                              OR      (logical) Or                                             OR      (logical) Or
  969.          LOCK    Bus Lock         LOCK    Bus Lock
  970.                                              OUT     Write to I/O Port                                             OUT     Write to I/O Port
  971.          LODS    Load String         LODS    Load String
  972.                                              OUTS    386                                             OUTS    386
  973.          LODSB   Load (byte) String         LODSB   Load (byte) String                  Output String - DX port
  974.  
  975.          LODSD   Load (Dword) String         LODSD   Load (Dword) String         OUTSB   386                                             OUTSB   386
  976.                                                      Output (byte) String -
  977.          LODSW   Load (word) String         LODSW   Load (word) String                  DX port
  978.  
  979.          LOOP    Loop with CX as counter         LOOP    Loop with CX as counter     OUTSD   386                                             OUTSD   386
  980.                                                      Output (Dword) String -
  981.          LOOPE   Loop with CX as counter         LOOPE   Loop with CX as counter             DX port
  982.                  and Equal
  983.                                              OUTSW   386                                             OUTSW   386
  984.          LOOPNE  Loop with CX as Counter         LOOPNE  Loop with CX as Counter             Output (word) String -
  985.                  and NOT Equal                       DX port
  986.  
  987.          LOOPNZ  Loop with CX as Counter         LOOPNZ  Loop with CX as Counter     POP     Pop off Stack                                             POP     Pop off Stack
  988.                  and NOT Zero
  989.                                              POPA    386                                             POPA    386
  990.          LOOPZ   Loop with CX as Counter         LOOPZ   Loop with CX as Counter             Pop All 16 bit Registers
  991.                  and Zero
  992.                                              POPAD   386                                             POPAD   386
  993.          LSS     386         LSS     386                                 Pop All 32 bit Registers
  994.                  Segment Register Load
  995.                                              POPF    Pop Flags off Stack                                             POPF    Pop Flags off Stack
  996.          MOV     Move         MOV     Move
  997.                                              POPFD   386                                             POPFD   386
  998.          MOVS    Move String         MOVS    Move String                         Pop 32 bit Flags off
  999.                                                      Stack
  1000.          MOVSB   Move (byte) String         MOVSB   Move (byte) String
  1001.                                              PUSH    Push onto Stack                                             PUSH    Push onto Stack
  1002.          MOVSD   Move (Dword) String         MOVSD   Move (Dword) String
  1003.                                              PUSHA   386                                             PUSHA   386
  1004.          MOVSW   Move (word) String         MOVSW   Move (word) String                  Push All 16 bit
  1005.                                                      Registers
  1006.  
  1007.  
  1008.  
  1009.                                                                   9-16                                                                  9-16
  1010.  
  1011.  
  1012.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1013.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  1014.  
  1015.          PUSHAD  386         PUSHAD  386                         SETAE   386                                             SETAE   386
  1016.                  Push All 16 bit                     SET if Above or Equal
  1017.                  Registers                           (CF=0)
  1018.  
  1019.          PUSHF   Push Flags onto Stack         PUSHF   Push Flags onto Stack       SETB    386                                             SETB    386
  1020.                                                      SET if Below
  1021.          PUSHFD  386         PUSHFD  386                                 (CF=1)
  1022.                  Push 32 bit Flags onto
  1023.                  Stack                       SETBE   386                                             SETBE   386
  1024.                                                      SET if Below or Equal
  1025.          RCL     Rotate through Carry         RCL     Rotate through Carry                (CF=1 or ZF=1)
  1026.                  Left
  1027.                                              SETC    386                                             SETC    386
  1028.          RCR     Rotate through Carry         RCR     Rotate through Carry                SET if Carry
  1029.                  Right                               (CF=1)
  1030.  
  1031.          REP     Repeat         REP     Repeat                      SETE    386                                             SETE    386
  1032.                                                      SET if Equal
  1033.          REPE    Repeat while Equal         REPE    Repeat while Equal                  (ZF=1)
  1034.  
  1035.          REPNE   Repeat while Not Equal         REPNE   Repeat while Not Equal      SETG    386                                             SETG    386
  1036.                                                      SET if Greater
  1037.          REPNZ   Repeat while Not Zero         REPNZ   Repeat while Not Zero               (ZF=0 and SF=OF)
  1038.  
  1039.          REPZ    Repeat while Zero         REPZ    Repeat while Zero           SETGE   386                                             SETGE   386
  1040.                                                      SET if Greater of Equal
  1041.          RET     Return from Procedure         RET     Return from Procedure               (SF=OF)
  1042.  
  1043.          RETF    Return from Inter-         RETF    Return from Inter-          SETL    386                                             SETL    386
  1044.                  Segment Procedure                   SET if Less
  1045.                                                      (SF<>OF)
  1046.          ROL     Rotate Left         ROL     Rotate Left
  1047.                                              SETLE   386                                             SETLE   386
  1048.          ROR     Rotate Right         ROR     Rotate Right                        SET if Less or Equal
  1049.                                                      (ZF=1 or SF<>OF)
  1050.          SAHF    Store AH into Flags         SAHF    Store AH into Flags
  1051.                                              SETNA   386                                             SETNA   386
  1052.          SAL     Shift Arithmetic Left         SAL     Shift Arithmetic Left               SET if Not Above
  1053.                                                      (CF=1 and ZF=1)
  1054.          SAR     Shift Arithmetic Right         SAR     Shift Arithmetic Right
  1055.                                              SETNAE  386                                             SETNAE  386
  1056.          SBB     Subtract with Borrow         SBB     Subtract with Borrow                SET if Not Above or
  1057.                                                      Equal
  1058.          SCAS    Scan String         SCAS    Scan String                         (CF=1)
  1059.  
  1060.          SCASB   Scan (byte) String         SCASB   Scan (byte) String          SETNB   386                                             SETNB   386
  1061.                                                      SET if Not Below
  1062.          SCASD   Scan (Dword) String         SCASD   Scan (Dword) String                 (CF=0)
  1063.  
  1064.          SCASW   Scan (word) String         SCASW   Scan (word) String          SETNBE  386                                             SETNBE  386
  1065.                                                      SET if Not Below or
  1066.          SETA    386         SETA    386                                 Equal
  1067.                  SET if Above                        (CF=0 and ZF=0)
  1068.                  (CF=0 and ZF=0)
  1069.  
  1070.  
  1071.  
  1072.                                                                   9-17                                                                  9-17
  1073.  
  1074.  
  1075.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1076.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  1077.  
  1078.          SETNC   386         SETNC   386                         SETS    386                                             SETS    386
  1079.                  SET if Not Carry                    SET if Sign
  1080.                  (CF=0)                              (SF=1)
  1081.  
  1082.          SETNE   386         SETNE   386                         SETZ    386                                             SETZ    386
  1083.                  SET if Not Equal                    SET if Zero
  1084.                  (ZF=0)                              (ZF=1)
  1085.  
  1086.          SETNG   386         SETNG   386                         SHL     Shift (logical) Left                                             SHL     Shift (logical) Left
  1087.                  SET if Not Greater
  1088.                  (ZF=1 or SF<>OF)            SHLD    386                                             SHLD    386
  1089.                                                      Shift Left Double
  1090.          SETNGE  386         SETNGE  386
  1091.                  SET if Not Greater or       SHR     Shift (logical) Right                                             SHR     Shift (logical) Right
  1092.                  Equal
  1093.                  (SF<>OF)                    SHRD    386                                             SHRD    386
  1094.                                                      Shift Right Double
  1095.          SETNL   386         SETNL   386
  1096.                  SET if Not Less             STC     Set Carry Flag                                             STC     Set Carry Flag
  1097.                  (SF=OF)
  1098.                                              STD     Set Direction Flag                                             STD     Set Direction Flag
  1099.          SETNLE  386         SETNLE  386                                 (decreasing)
  1100.                  SET if Not Less or Equal
  1101.                  (ZF=0 and SF=OF)            STI     Set Interrupt Flag                                             STI     Set Interrupt Flag
  1102.                                                      (enable)
  1103.          SETNO   386         SETNO   386
  1104.                  SET if Not Overflow         STOS    Store String                                             STOS    Store String
  1105.                  (OF=0)
  1106.                                              STOSB   Store (byte) String                                             STOSB   Store (byte) String
  1107.          SETNP   386         SETNP   386
  1108.                  SET if Not Parity           STOSD   Store (Dword) String                                             STOSD   Store (Dword) String
  1109.                  (PF=0)
  1110.                                              STOSW   Store (word) String                                             STOSW   Store (word) String
  1111.          SETNS   386         SETNS   386
  1112.                  SET if Not Sign             SUB     Subtract                                             SUB     Subtract
  1113.                  (SF=0)
  1114.                                              TEST    Logical Compare                                             TEST    Logical Compare
  1115.          SETNZ   386         SETNZ   386
  1116.                  SET if Not Zero             WAIT    Wait for Coprocessor                                             WAIT    Wait for Coprocessor
  1117.                  (ZF=0)
  1118.                                              XCHG    Exchange register with                                             XCHG    Exchange register with
  1119.          SETO    386         SETO    386                                 register/memory.
  1120.                  SET if Overflow
  1121.                  (OF=1)                      XLAT    Table Lookup Translation                                             XLAT    Table Lookup Translation
  1122.  
  1123.          SETP    386         SETP    386                         XOR     (logical) Exclusive Or.                                             XOR     (logical) Exclusive Or.
  1124.                  SET if Parity
  1125.                  (PF=1)
  1126.  
  1127.          SETPE   386         SETPE   386
  1128.                  SET if Parity Even
  1129.                  (PF=1)
  1130.  
  1131.          SETPO   386         SETPO   386
  1132.                  SET if Parity Odd
  1133.                  (PF=0)
  1134.  
  1135.                                                                   9-18                                                                  9-18
  1136.  
  1137.  
  1138.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1139.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  1140.  
  1141.          Register Usage         Register Usage         ______________                      ES        The extra segment                                             ES        The extra segment
  1142.                                                   register - this is used in
  1143.          F-PC implements a virtual                conjunction with the SI                                                  conjunction with the SI
  1144.          machine which uses the more or           register to define the
  1145.          less standard set of                     current instruction.
  1146.          "registers":                             Therefore, it points
  1147.                                                   somewhere within the LIST
  1148.          SP   data stack pointer         SP   data stack pointer                  or X segment.  This must be                                                  or X segment.  This must be                                                                 ____________
  1149.                                                   preserved by any code                                                  _____________________
  1150.          RP   return stack pointer         RP   return stack pointer                words.                                                  ______
  1151.  
  1152.          IP   next word pointer         IP   next word pointer              FS        Another extra segment                                             FS        Another extra segment
  1153.                                                   register valid only on the                                                  register valid only on the
  1154.          W    current word pointer         W    current word pointer                80386.                                                  80386.
  1155.  
  1156.          UP   user area pointer -         UP   user area pointer -            GS        Another extra segment                                             GS        Another extra segment
  1157.               implemented as a VARIABLE.          register valid only on the                                                  register valid only on the
  1158.                                                   80386.                                                  80386.
  1159.          The following 80x8x register
  1160.          usage is made in F-PC:              SP        the SP or data stack                                             SP        the SP or data stack
  1161.                                                   pointer -- used as SS:SP.                                                  pointer -- used as SS:SP.
  1162.          CS        The code segment         CS        The code segment
  1163.               register used for any code     BP        the RP or return stack                                             BP        the RP or return stack
  1164.               definitions.  This must be              definitions.  This must be                            ____________          pointer -- used as SS:BP.                                                  pointer -- used as SS:BP.
  1165.               preserved by any code              _____________________
  1166.               words.  F-PC primitives and              ______                         ES:SI          the IP or                                             ES:SI          the IP or
  1167.               basic operation depends on          instruction pointer -
  1168.               both CS and DS having the              both CS and DS having the           points within the LIST or X
  1169.               same value.                         segment.  Both the ES and                                                  segment.  Both the ES and                                                            _______________
  1170.                                                   SI registers must be                                                  SI registers must be                                                  ____________________
  1171.          DS        The data segment         DS        The data segment               preserved by a code                                                  ___________________
  1172.               register used for any data          definition.                                                  ___________
  1173.               other than ." or ""              other than ." or ""
  1174.               strings.  This must be              strings.  This must be                        ____________         BX  CX  DX  DI                                             BX  CX  DX  DI
  1175.               preserved by any code              _____________________               scratch registers - can be
  1176.               words.  F-PC primitives and              ______                              used without preserving in
  1177.               basic operation depends on          a code definition - not
  1178.               both CS and DS having the              both CS and DS having the           assumptions are made about
  1179.               same value.                         their contents.
  1180.  
  1181.          SS        The stack segment         SS        The stack segment         EBX  ECX  EDX  EDI                                             EBX  ECX  EDX  EDI
  1182.               register used with SP and              register used with SP and           32-bit forms of the above
  1183.               BP to define the location              BP to define the location           scratch registers.
  1184.               of the F-PC stacks.  This                                   ____
  1185.               must be preserved by any              must be preserved by any              ________________________       AX        W or current word                                             AX        W or current word
  1186.               code words.  Currently, F-              ___________                         pointer -- CS:AX points to                                                  pointer -- CS:AX points to
  1187.               PC sets this to the same            the current machine code
  1188.               value as DS.              value as DS.                        word on entry -- can be
  1189.                                                   used as a scratch register
  1190.                                                   since no assumptions are
  1191.                                                   made about its contents.
  1192.  
  1193.                                              EAX       the 32-bit form of the                                             EAX       the 32-bit form of the
  1194.                                                   above register.
  1195.  
  1196.  
  1197.  
  1198.                                                                   9-19                                                                  9-19
  1199.  
  1200.  
  1201.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1202.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  1203.  
  1204.          DF        The Direction Flag         DF        The Direction Flag        Although this was originally
  1205.               (used by string related        based on Duncan's 8086
  1206.               functions) -- assumed to be                            _____________    assembler, Robert L. Smith and
  1207.               0 or increment.  If the              0 or increment.  If the              _______________                Tom Zimmer have modified this
  1208.               direction flag is changed      assembler to handle PREFIX
  1209.               in a code definition           notation.  This version is
  1210.               (through the use of the STD    highly dependent in Zimmer's
  1211.               instruction), then it must     Forth (F-PC, F-TZ, etc.). It is
  1212.               be reset (by the CLD           interesting to note how much of
  1213.               instruction) before the end    Duncan's original assembler
  1214.               (e.g., NEXT) of the code       still exists in this package.
  1215.               definition.  Since NEXT        In fact, this assembler seems to
  1216.               uses the string instruction    be closer to Duncan's original
  1217.               LODSW, disaster will result    than assembler in Laxon&Perry's
  1218.               if the direction flag is       F83.
  1219.               not set to 0.
  1220.                                              This assembler depends on the
  1221.          In general, CX is used for         In general, CX is used for          Kernel functions:
  1222.          counts, AX and DX are used for         counts, AX and DX are used for
  1223.          data, and BX is used for         data, and BX is used for                 RUN,
  1224.          addresses.  For string                   DEFER,
  1225.          operations, DS:SI is used for         operations, DS:SI is used for            CREATE,
  1226.          the source and ES:DI is used for         the source and ES:DI is used for    and
  1227.          the destination.  While                  DOES>
  1228.          following such conventions, be
  1229.          sure to restore such registers      for its functioning.  DEFER is                                                                   _____
  1230.          as are needed to preserve the       used (among other things) to
  1231.          virtual FORTH machine               provide the hooks for the meta-
  1232.          implemented by F-PC.                compilation process. CREATE and                                                                  ______
  1233.                                              DOES> provide the capability to                                             _____
  1234.          Caution should be used when         _______                             create the defining words which
  1235.          using the extended (32 bit)         define the instructions as well
  1236.          forms of register or the 386        as the register notations.  RUN                                                                         ___
  1237.          extra segment registers.  DOS       and DEFER are used to create the                                                 _____
  1238.          does not support these extended     capability to handle the PREFIX                                             capability to handle the PREFIX
  1239.          forms although everything should    notation.
  1240.          work properly.
  1241.                                              The register operand functions
  1242.          F-PC currently uses a single        define a set of words which use
  1243.          code segment of 64k bytes.  The     the register names as the
  1244.          CS, DS, and SS registers all         CS, DS, and SS registers all        definition names.  At run-time,
  1245.          point to this single segment        these definitions store values
  1246.          with the stacks being located at    into a set of variables to
  1247.          the top (high addresses) of the     indicate what registers have
  1248.          segment.                            been specified and what their
  1249.                                              order was.  These information is
  1250.                                              used to complete the instruction
  1251.                                              at "instruction build" time.
  1252.          Assembler Internals         Assembler Internals         ___________________
  1253.  
  1254.          The bulk of the assembler in F-
  1255.          PC is contained in the file
  1256.          PASM.SEQ -- there are some
  1257.          primitives to support the
  1258.          assembler in the Kernel.
  1259.  
  1260.  
  1261.                                                                   9-20                                                                  9-20
  1262.  
  1263.  
  1264.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1265.                        !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~                       !"#$%&'()*+,-./0123456789:;<=>?@A...Z[\]^_`{|}~
  1266.  
  1267.          The basic process of the            PreFix                                             PreFix                                             ______
  1268.          assembler uses the CREATE DOES>
  1269.          construct to create the code to     The new PREFIX format modifies                                             The new PREFIX format modifies
  1270.          handle both the register            the process slightly - the
  1271.          definitions and the instruction     instruction-word now occurs
  1272.          definitions.  Each set of           BEFORE the operand information.
  1273.          registers or instructions are       To accommodate this format, the
  1274.          grouped into categories and a       instruction-word saves the
  1275.          defining word is created for        address of passed data and the
  1276.          each category.  These defining      address of a subroutine to build
  1277.          words create the definitions        the instruction into a special
  1278.          (one for each register              (internal) variable: APRIOR.                                             (internal) variable: APRIOR.                                                                  ______
  1279.          specification or instruction)       Execution of the save
  1280.          which (at run-time) creates the     information is executed at a
  1281.          code which is the equivalent        deferred time - this time can be
  1282.          instruction.  My, how powerful      when the next assembly
  1283.          this is in that the whole           instruction mnemonic occurs,
  1284.          assembler is created using only     when the END-CODE function is                                                      ________
  1285.          FORTH (no CODE definitions).         FORTH (no CODE definitions).        executed or at the end of a
  1286.                                              physical line.  At the "deferred
  1287.                                              time", the instruction has all
  1288.          PostFix         PostFix         _______                             of the information necessary to
  1289.                                              build the correct code.
  1290.          The original POSTFIX format         The original POSTFIX format
  1291.          process is fairly easy to
  1292.          understand. A defining word is
  1293.          created for each instruction
  1294.          category.  This word contains
  1295.          the fixed (e.g., opcode) portion
  1296.          of the instruction as data in
  1297.          the CREATE part of the defining             ______
  1298.          word (the address of this data
  1299.          is passed to the run-time or
  1300.          DOES> code).  Immediate data or         _____
  1301.          the addresses of VARIABLEs are
  1302.          placed on the stack.  The
  1303.          register functions set other
  1304.          (internal) variables to values
  1305.          which indicate the register,
  1306.          register size, etc.  The
  1307.          register specifications,
  1308.          immediate data, addresses, etc.
  1309.          must be place before the
  1310.          instruction. When the
  1311.          instruction-word is executed, it
  1312.          uses the data from the stack or
  1313.          internal variables together with
  1314.          the pre-compiled "opcode" data
  1315.          to assemble the instruction into
  1316.          memory.
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                                                   9-21                                                                  9-21
  1325.  
  1326.  
  1327.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1328.  
  1329.  
  1330.  
  1331.  
  1332.          PASM Syntax Comparison         PASM Syntax Comparison         ______________________
  1333.  
  1334.  
  1335.          The differences among the F-PC prefix mode, the F83 postfix
  1336.          mode, and the Intel MASM notation are best illustrated by
  1337.          the following table.  Although the table is not exhaustive,
  1338.          it covers most of the cases useful in doing PASM
  1339.          programming.
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                                                                   9-22                                                                  9-22
  1388.  
  1389.  
  1390.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1391.  
  1392.  
  1393.                    PREFIX               POSTFIX              MASM                   PREFIX               POSTFIX              MASM
  1394.  
  1395.                    AAA                  AAA                  AAA
  1396.                    ADC AX, SI           SI AX ADC            ADC AX,SI
  1397.                    ADC DX, 0 [SI]       0 [SI] DX ADC        ADC DX,0[SI]
  1398.                    ADC 2 [BX+SI], DI    DI 2 [BX+SI] ADC     ADC 2[BX][SI],DI
  1399.                    ADC MEM BX           BX MEM #) ADC        ADC MEM,BX
  1400.                    ADC AL, # 5          5 # AL ADC           ADC AL,5
  1401.                    AND AX, BX           BX AX AND            AND AX,BX
  1402.                    AND CX, MEM          CX MEM #) AND        AND CX,MEM
  1403.                    AND DL, # 3          3 # DL AND           AND DL,3
  1404.                    CALL NAME            NAME #) CALL         CALL NAME
  1405.                    CALL FAR [] NAME     FAR [] NAME #) CALL  ?????
  1406.                    CMP DX, BX           BX DX CMP            CMP DX,BX
  1407.                    CMP 2 [BP], SI       SI 2 [BP] CMP        CMP [BP+2],SI
  1408.                    DEC BP               BP DEC               DEC BP
  1409.                    DEC MEM              MEM DEC              DEC MEM
  1410.                    DEC 3 [SI]           3 [SI] DEC           DEC 3[SI]
  1411.                    DIV CL               CL DIV               DIV CL
  1412.                    DIV MEM              MEM DIV              DIV MEM
  1413.                    IN PORT# WORD        WORD PORT# IN        IN AX,PORT#
  1414.                    IN PORT#             PORT# IN             IN AL,PORT#
  1415.                    IN AX, DX            DX AX IN             IN AX,DX
  1416.                    INC MEM              BYTE MEM INC         INC MEM BYTE
  1417.                    INC MEM WORD         MEM #) INC           INC MEM WORD
  1418.                    INT 16               16 INT               INT 16
  1419.                    JA NAME              NAME JA              JA NAME
  1420.                    JNBE NAME            NAME #) JNBE         JNBE NAME
  1421.                    JMP NAME             NAME #) JMP          JMP
  1422.                    JMP FAR [] NAME      NAME [] FAR JMP      JMP [NAME]
  1423.                    JMP FAR $F000 $E987                       JMP F000:E987
  1424.                    LODSW                AX LODS              LODS WORD
  1425.                    LODSB                AL LODS              LODS BYTE
  1426.                    LOOP NAME            NAME #) LOOP         LOOP NAME
  1427.                    MOV DX, NAME         NAME #) DX MOV       MOV DX,[NAME]
  1428.                    MOV AX, BX           BX AX MOV            MOV AX,BX
  1429.                    MOV AH, AL           AL AH MOV            MOV AH,AL
  1430.                    MOV BP, 0 [BX]       0 [BX] BP MOV        MOV BP,0[BX]
  1431.                    MOV ES: BP, SI       ES: BP SI MOV        MOV ES:BP,SI
  1432.                    MOVSW                AX MOVS              MOVS WORD
  1433.                    POP DX               DX POP               POP DX
  1434.                    POPF                 POPF                 POPF
  1435.                    PUSH SI              SI PUSH              PUSH SI
  1436.                    REP                  REP                  REP
  1437.                    RET                  RET                  RET
  1438.                    ROL AX, # 1          AX ROL               ROL AX,1
  1439.                    ROL AX, CL           AX CL ROL            ROL AX,CL
  1440.                    SHL AX, # 1          AX SHL               SHL AX,1
  1441.                    XCHG AX, BP          BP AX XCHG           XCHG AX,BP
  1442.                    XOR CX, DX           DX, CX XOR           XOR CX,DX
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                                                                   9-23                                                                  9-23
  1451.  
  1452.  
  1453.                                 The  F-PC  Assembler                                The  F-PC  Assembler
  1454.  
  1455.  
  1456.          CODE Structure         CODE Structure         ______________
  1457.  
  1458.  
  1459.          This structure is used for CODE definitions.  The beginning                                    ____
  1460.          of the name field contains the length (n) of the name.         of the name field contains the length (n) of the name.
  1461.  
  1462.  
  1463.          Regular Next         Regular Next         ____________
  1464.  
  1465.  
  1466.                                          +--------------+
  1467.                        HEAD SPACE        [ VIEW offset  ] VIEW                       HEAD SPACE        [ VIEW offset  ] VIEW
  1468.                                          [ LINK pointer ] LINK
  1469.                                          [      8n      ] NAME
  1470.                                          [   .          ]
  1471.                                          [   .          ] n bytes long
  1472.                                          [   . + 80 hex ]
  1473.                     Points to CODE space [ CFA pointer  ] >-------+
  1474.                                          +--------------+         |
  1475.                                                                   |
  1476.                                          +--------------+         |
  1477.                        CODE SPACE        [   .          ] CFA <---+                       CODE SPACE        [   .          ] CFA <---+
  1478.                                          [   .          ]
  1479.                                          [   .          ] machine
  1480.                                          [   .          ] code
  1481.                                          [   .          ]
  1482.                                          [   .          ]
  1483.                                          [   JMP        ] end of CODE
  1484.                     Points to LIST space [   NEXT       ] definition
  1485.                                          +--------------+
  1486.  
  1487.  
  1488.          Inline  NEXT         Inline  NEXT         ____________
  1489.  
  1490.  
  1491.                                          +--------------+
  1492.                        HEAD SPACE        [ VIEW offset  ] VIEW                       HEAD SPACE        [ VIEW offset  ] VIEW
  1493.                                          [ LINK pointer ] LINK
  1494.                                          [      8n      ] NAME
  1495.                                          [   .          ]
  1496.                                          [   .          ] n bytes long
  1497.                                          [   . + 80 hex ]
  1498.                     Points to CODE space [ CFA pointer  ] >-------+
  1499.                                          +--------------+         |
  1500.                                                                   |
  1501.                                          +--------------+         |
  1502.                        CODE SPACE        [   .          ] CFA <---+                       CODE SPACE        [   .          ] CFA <---+
  1503.                                          [   .          ]
  1504.                                          [   .          ] machine
  1505.                                          [   .          ] code
  1506.                                          [   .          ]
  1507.                                          [   .          ]
  1508.                                          [  ES: LODSW   ] INLINE NEXT                                                          ___________
  1509.                                          [  JMP AX      ] end of definition
  1510.                                          +--------------+
  1511.  
  1512.  
  1513.                                                                   9-24                                                                  9-24