                Assembler documentation for PASM.SEQ    by Tom Zimmer

  PASM Overview


          PASM.SEQ is an assembler which is based on an assembler
        published in DDJ, February 1982 by Ray Duncan. That assembler
        was subsequently modified by Robert L. Smith to repair bugs, and
        support the Prefix assembler notation. I (Tom Zimmer) have made
        additional modifications to allow switching syntaxes, and to
        increase compatibility in POSTFIX mode with the F83 assembler.


  PREFIX or POSTFIX ?


          PASM supports dual syntaxes. The words PREFIX and POSTFIX
        switch between the two supported modes. The POSTFIX mode
        is VERY similar to F83's CPU8086 assembler. PREFIX mode which is
        the default mode, allows a syntax which is much closed to MASM.


  Macros in PASM


          Another area of interest is macros, here is the definition of
        the NEXT macro:

                : NEXT  >PRE    JMP >NEXT A;    PRE> ;

          The macro itself is simply the sequence JMP >NEXT. The
        surrounding words are used for support. Since PASM supports both
        Sufix as well as Prefix notation, It is not known on entry to a
        macro what mode is selected. The words >PRE and PRE> select
        Prefix, and restore the previous mode so macros will always be
        in Prefix notation. The A; after >NEXT, forces the assembly of
        the JMP instruction before the mode switch.


  Why Dual Syntax


          The assembler supports Prefix syntax, in an attempt to provide
        a syntax which is more readable to programmers of other
        languages. It supports Postfix syntax to prevent alienating the
        established base of F83 users.

          The prefix notation is I think more readable, and certainly
        will be more familiar to programmers of other languages. Please
        consider writting any new assembly code you need in the Prefix
        mode.





  An Important NOTE:

          All code definitions should be started with CODE or LABEL, and
        they should be terminated with END-CODE or C;.  PASM changes the
        defered word RUN, to cause assembly to be done at the end of each
        line loaded, so it needs to have a proper setup and completion
        for a good assembly to be done.  There are many examples of
        assembly in the system for you to examine.  Particularly
        interesting to the experienced programmer will the the interupt
        handlers for Control Break, and Divide by zero.


  Syntax Comparison


        PREFIX                  POSTFIX                 MASM

        AAA                     AAA                     AAA
        ADC AX, SI              SI AX ADC               ADC AX,SI
        ADC DX, 0 [SI]          0 [SI] DX ADC           ADC DX,0[SI]
        ADC 2 [BX+SI], DI       DI 2 [BX+SI] ADC        ADC 2[BX][SI],DI
        ADC MEM BX              BX MEM #) ADC           ADC MEM,BX
        ADC AL, # 5             5 # AL ADC              ADC AL,5
        AND AX, BX              BX AX AND               AND AX,BX
        AND CX, MEM             CX MEM #) AND           AND CX,MEM
        AND DL, # 3             3 # DL AND              AND DL,3
        CALL NAME               NAME #) CALL            CALL NAME
        CALL FAR [] NAME        FAR [] NAME #) CALL     ?????
        CLC                     CLC                     CLC
        CLD                     CLD                     CLD
        CLI                     CLI                     CLI
        CMC                     CMC                     CMC
        CMP DX, BX              BX DX CMP               CMP DX,BX
        CMP 2 [BP], SI          SI 2 [BP] CMP           CMP [BP+2],SI
        CMPSW                   AX CMPS                 CMPS WORD
        CMPSB                   AL CMPS                 CMPS
        CWD                     CWD                     CWD
        DAA                     DAA                     DAA
        DAS                     DAS                     DAS
        DEC CX                  CX DEC                  DEC CX
        DEC BP                  BP DEC                  DEC BP
        DEC MEM                 MEM DEC                 DEC MEM
        DEC 3 [SI]              3 [SI] DEC              DEC 3[SI]
        DIV CL                  CL DIV                  DIV CL
        DIV BX                  BX DIV                  DIV BX
        DIV MEM                 MEM DIV                 DIV MEM
        IDIV CX                 CX IDIV                 IDIV CX
        IMUL BX                 BX IMUL                 IMUL BX
        IN AX, # PORT#          WORD PORT# IN           IN AX,PORT#
        IN AL, # PORT#          PORT# IN                IN AL,PORT#
        IN AX, DX               DX AX IN                IN AX,DX
        IN AL, DX               DX AL IN                IN AL,DX
        INC AX                  AX INC                  INC AX
        INC CL                  CL INC                  INC CL
        INC MEM                 BYTE MEM INC            INC MEM BYTE
        INC MEM WORD            MEM #) INC              INC MEM WORD
        INT 16                  16 INT                  INT 16
        IRET                    IRET                    IRET
        JA NAME                 NAME JA                 JA NAME
        JNBE NAME               NAME #) JNBE            JNBE NAME
        JMP NAME                NAME #) JMP             JMP OFFSET NAME
        LODSW                   AX LODS                 LODS WORD
        LODSB                   AL LODS                 LODS BYTE
        LOOP NAME               NAME #) LOOP            LOOP NAME
        MOV AX, BX              BX AX MOV               MOV AX,BX
        MOV AH, AL              AL AH MOV               MOV AH,AL
        MOV BP, 0 [BX]          0 [BX] BP MOV           MOV BP,0[BX]
        MOV ES: BP, SI          ES: BP SI MOV           MOV ES:BP,SI
        MOVSW                   AX MOVS                 MOVS WORD
        MUL CL                  CL MUL                  MUL CL
        MUL BX                  BX MUL                  MUL BX
        NEG AL                  AL NEG                  NEG AL
        NEG MEM                 MEM #) NEG              NEG MEM
        NOP                     NOP                     NOP
        NOT AX                  AX NOT                  NOT AX
        OR AL, # 32             # 32 AL OR              OR AL,32
        OR AX, BX               BX AX OR                OR AX,BX
        OR CL, 0 [BX]           0 [BX] CL OR            OR CL,0[BX]
        OUT # PORT# AX          WORD PORT# OUT          OUT PORT#,AX
        OUT # PORT# AL          PORT# OUT               OUT PORT#,AL
        OUT DX, AX              AX DX OUT               OUT DX,AX
        OUT DX, AL              AL DX OUT               OUT DX,AL
        POP DX                  DX POP                  POP DX
        POPF                    POPF                    POPF
        PUSH SI                 SI PUSH                 PUSH SI
        RCL CX, # 1             CX RCL                  RCL CX,1
        RCL MEM # 1             CX MEM #) RCL           RCL MEM,1
        REP                     REP                     REP
        RET                     RET                     RET
        ROL AX, # 1             AX ROL                  ROL AX,1
        ROL AX, CL              AX CL ROL               ROL AX,CL
        SBB BX, CX              CX BX SBB               SBB BX,CX
        SCASW                   AX SCAS                 SCAS WORD
        SCASB                   AL SCAS                 SCAS
        SHR AX, # 1             AX SHR                  SHR AX,1
        STC                     STC                     STC
        STD                     STD                     STD
        STI                     STI                     STI
        STOSW                   AX STOS                 STOS WORD
        STOSB                   AL STOS                 STOS
        XCHG AX, BP             BP AX XCHG              XCHG AX,BP
        XOR CX, DX              DX, CX XOR              XOR CX,DX


