home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 242_01 / a611.doc < prev    next >
Encoding:
Text File  |  1989-01-13  |  43.5 KB  |  1,230 lines

  1. /*
  2.     HEADER:        CUG242;
  3.     TITLE:        68HC11 Cross-Assembler (Portable);
  4.     FILENAME:    A611.DOC;
  5.     VERSION:    0.1;
  6.     DATE:        08/27/1988;
  7.     SEE-ALSO:    A611.H
  8.     AUTHORS:    William C. Colley III;
  9. */
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                         68HC11 Cross-Assembler (Portable)
  25.  
  26.  
  27.                                    Version 0.1
  28.  
  29.  
  30.                  Copyright (c) 1985, 1987 William C. Colley, III
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                             The manual such as it is.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.         Legal Note:    This package may be used for any commercial or 
  50.                        non-commercial purpose.  It may be copied and 
  51.                        distributed freely provided that any fee charged 
  52.                        by the distributor of the copy does not exceed the 
  53.                        sum of:  1) the cost of the media the copy is 
  54.                        written on,  2) any required costs of shipping the 
  55.                        copy, and  3) a nominal handling fee.  Any other 
  56.                        distribution requires the written permission of 
  57.                        the author.  Also, the author's copyright notices 
  58.                        shall not be removed from the program source, the 
  59.                        program object, or the program documentation.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.                                 Table of Contents
  75.  
  76.         1.0  How to Use the Cross-Assembler Package ..................  3
  77.         2.0  Format of Cross-Assembler Source Lines ..................  4
  78.              2.1  Labels .............................................  5
  79.              2.2  Numeric Constants ..................................  5
  80.              2.3  String Constants ...................................  6
  81.              2.4  Expressions ........................................  6
  82.         3.0  Machine Opcodes .........................................  7
  83.              3.1  Opcodes -- No Arguments ............................  7
  84.              3.2  Opcodes -- Branch Instructions .....................  8
  85.              3.3  Opcodes -- Bit Manipulation Instructions ...........  8
  86.              3.4  Opcodes -- Read-Modify-Write Instructions ..........  8
  87.              3.5  Opcodes -- Register/Memory Instructions ............  9
  88.              3.6  Opcodes -- Direct Addressing .......................  9
  89.         4.0  Pseudo Opcodes .......................................... 10
  90.              4.1  Pseudo-ops -- END .................................. 10
  91.              4.2  Pseudo-ops -- EQU .................................. 10
  92.              4.3  Pseudo-ops -- FCB .................................. 10
  93.              4.4  Pseudo-ops -- FCC .................................. 11
  94.              4.5  Pseudo-ops -- FDB .................................. 11
  95.              4.6  Pseudo-ops -- IF, ELSE, ENDIF ...................... 11
  96.              4.7  Pseudo-ops -- INCL ................................. 12
  97.              4.8  Pseudo-ops -- ORG .................................. 12
  98.              4.9  Pseudo-ops -- PAGE ................................. 13
  99.              4.10 Pseudo-ops -- RMB .................................. 13
  100.              4.11 Pseudo-ops -- SET .................................. 13
  101.              4.12 Pseudo-ops -- TITLE ................................ 13
  102.         5.0  Assembly Errors ......................................... 14
  103.              5.1  Error * -- Illegal or Missing Statement ............ 14
  104.              5.2  Error ( -- Parenthesis Imbalance ................... 14
  105.              5.3  Error " -- Missing Quotation Mark .................. 14
  106.              5.4  Error B -- Branch Target Too Distant ............... 14
  107.              5.5  Error D -- Illegal Digit ........................... 15
  108.              5.6  Error E -- Illegal Expression ...................... 15
  109.              5.7  Error I -- IF-ENDIF Imbalance ...................... 15
  110.              5.8  Error L -- Illegal Label ........................... 15
  111.              5.9  Error M -- Multiply Defined Label .................. 15
  112.              5.10 Error O -- Illegal Opcode .......................... 16
  113.              5.11 Error P -- Phasing Error ........................... 16
  114.              5.12 Error S -- Illegal Syntax .......................... 16
  115.              5.13 Error T -- Too Many Arguments ...................... 16
  116.              5.14 Error U -- Undefined Label ......................... 16
  117.              5.15 Error V -- Illegal Value ........................... 16
  118.         6.0  Warning Messages ........................................ 17
  119.              6.1  Warning -- Illegal Option Ignored .................. 17
  120.              6.2  Warning -- -l Option Ignored -- No File Name ....... 17
  121.              6.3  Warning -- -o Option Ignored -- No File Name ....... 17
  122.              6.4  Warning -- Extra Source File Ignored ............... 17
  123.              6.5  Warning -- Extra Listing File Ignored .............. 17
  124.              6.6  Warning -- Extra Object File Ignored ............... 17
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                                         1
  132.  
  133.  
  134.  
  135.         7.0  Fatal Error Messages .................................... 17
  136.              7.1  Fatal Error -- No Source File Specified ............ 18
  137.              7.2  Fatal Error -- Source File Did Not Open ............ 18
  138.              7.3  Fatal Error -- Listing File Did Not Open ........... 18
  139.              7.4  Fatal Error -- Object File Did Not Open ............ 18
  140.              7.5  Fatal Error -- Error Reading Source File ........... 18
  141.              7.6  Fatal Error -- Disk or Directory Full .............. 18
  142.              7.7  Fatal Error -- File Stack Overflow ................. 18
  143.              7.8  Fatal Error -- If Stack Overflow ................... 18
  144.              7.9  Fatal Error -- Too Many Symbols .................... 18
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                                         2
  193.  
  194.  
  195.  
  196.         1.0  How to Use the Cross-Assembler Package
  197.  
  198.              First, the question, "What does a cross-assembler do?" needs 
  199.         to be addressed as there is considerable confusion on this point.  
  200.         A cross-assembler is just like any other assembler except that it 
  201.         runs on some CPU other than the one for which it assembles code.  
  202.         For example, this package assembles 68HC11 source code into 
  203.         68HC11 object code, but it runs on an 8080, a Z-80, an 8088, or 
  204.         whatever other CPU you happen to have a C compiler for.  The 
  205.         reason that cross-assemblers are useful is that you probably 
  206.         already have a CPU with memory, disk drives, a text editor, an 
  207.         operating system, and all sorts of hard-to-build or expensive 
  208.         facilities on hand.  A cross-assembler allows you to use these 
  209.         facilites to develop code for an 68HC11.
  210.  
  211.         This program requires one input file (your 68HC11 source code) 
  212.         and zero to two output files (the listing and the object).  The 
  213.         input file MUST be specified, or the assembler will bomb on a 
  214.         fatal error.  The listing and object files are optional.  If no 
  215.         listing file is specified, no listing is generated, and if no 
  216.         object file is specified, no object is generated.  If the object 
  217.         file is specified, the object is written to this file in "Intel 
  218.         hexadecimal" format.
  219.  
  220.              The command line for the cross-assembler looks like this:
  221.  
  222.                   A611 source_file { -l list_file } { -o object_file }
  223.  
  224.         where the { } indicates that the specified item is optional.
  225.  
  226.              Some examples are in order:
  227.  
  228.              a611 test611.asm                   source:   test611.asm
  229.                                                 listing:  none
  230.                                                 object:   none
  231.  
  232.              a611 test611.asm -l test611.prn    source:   test611.asm
  233.                                                 listing:  test611.prn
  234.                                                 object:   none
  235.  
  236.              a611 test611.asm -o test611.hex    source:   test611.asm
  237.                                                 listing:  none
  238.                                                 object:   test611.hex
  239.  
  240.              a611 test611.asm -l test611.prn -o test611.hex
  241.                                                 source:   test611.asm
  242.                                                 listing:  test611.prn
  243.                                                 object:   test611.hex
  244.  
  245.              The order in which the source, listing, and object files are 
  246.         specified does not matter.  Note that no default file name exten-
  247.         sions are supplied by the assembler as this gives rise to porta-
  248.         bility problems.
  249.  
  250.  
  251.  
  252.  
  253.                                         3
  254.  
  255.  
  256.  
  257.         2.0  Format of Cross-Assembler Source Lines
  258.  
  259.              The source file that the cross-assembler processes into a 
  260.         listing and an object is an ASCII text file that you can prepare 
  261.         with whatever editor you have at hand.  The most-significant 
  262.         (parity) bit of each character is cleared as the character is 
  263.         read from disk by the cross-assembler, so editors that set this 
  264.         bit (such as WordStar's document mode) should not bother this 
  265.         program.  All printing characters, the ASCII TAB character ($09), 
  266.         and newline character(s) are processed by the assembler.  All 
  267.         other characters are passed through to the listing file, but are 
  268.         otherwise ignored.
  269.  
  270.              The source file is divided into lines by newline char-
  271.         acter(s).  The internal buffers of the cross-assembler will 
  272.         accommodate lines of up to 255 characters which should be more 
  273.         than ample for almost any job.  If you must use longer lines, 
  274.         change the constant MAXLINE in file A611.H and recompile the 
  275.         cross-assembler.  Otherwise, you will overflow the buffers, and 
  276.         the program will mysteriously crash.
  277.  
  278.              Each source line is made up of three fields:  the label 
  279.         field, the opcode field, and the argument field.  The label field 
  280.         is optional, but if it is present, it must begin in column 1.  
  281.         The opcode field is optional, but if it is present, it must not 
  282.         begin in column 1.  If both a label and an opcode are present, 
  283.         one or more spaces and/or TAB characters must separate the two.  
  284.         If the opcode requires arguments, they are placed in the argument 
  285.         field which is separated from the opcode field by one or more 
  286.         spaces and/or TAB characters.  Finally, an optional comment can 
  287.         be added to the end of the line.  This comment must begin with a 
  288.         semicolon which signals the assembler to pass the rest of the 
  289.         line to the listing and otherwise ignore it.  Thus, the source 
  290.         line looks like this:
  291.  
  292.              {label}{ opcode{ arguments}}{;commentary}
  293.  
  294.         where the { } indicates that the specified item is optional.
  295.  
  296.              Some examples are in order:
  297.  
  298.           column 1
  299.              |
  300.              v
  301.              GRONK   LDAA  OFFSET, X       ; This line has everything.
  302.                      STAA  MAILBOX         ; This line has no label.
  303.              BEEP                          ; This line has no opcode.
  304.              ; This line has no label and no opcode.
  305.  
  306.              ; The previous line has nothing at all.
  307.                      END                   ; This line has no argument.
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.                                         4
  315.  
  316.  
  317.  
  318.         2.1  Labels
  319.  
  320.              A label is any sequence of alphabetic or numeric characters 
  321.         starting with an alphabetic.  The legal alphabetics are:
  322.  
  323.                     ! & . : ? [ \ ] ^ _  ` { | }  ~  A-Z  a-z
  324.  
  325.         The numeric characters are the digits 0-9.  Note that "A" is not 
  326.         the same as "a" in a label.  This can explain mysterious U 
  327.         (undefined label) errors occurring when a label appears to be 
  328.         defined.
  329.  
  330.              A label is permitted on any line except a line where the 
  331.         opcode is IF, ELSE, or ENDIF.  The label is assigned the value of 
  332.         the assembly program counter before any of the rest of the line 
  333.         is processed except when the opcode is EQU, ORG, or SET.
  334.  
  335.              Labels can have the same name as opcodes, but they cannot
  336.         have the same name as operators or registers.  The reserved 
  337.         (operator and register) names are:
  338.  
  339.              AND       EQ        GE        GT        HIGH      LE
  340.              LT        LOW       MOD       NE        NOT       OR
  341.              SHL       SHR       X         XOR       Y
  342.  
  343.              If a label is used in an expression before it is assigned a 
  344.         value, the label is said to be "forward-referenced."  For 
  345.         example:
  346.  
  347.              L1   EQU  L2 + 1   ; L2 is forward-referenced here.
  348.              L2
  349.              L3   EQU  L2 + 1   ; L2 is not forward-referenced here.
  350.  
  351.  
  352.         2.2  Numeric Constants
  353.  
  354.              Numeric constants can be formed in two ways:  the Intel 
  355.         convention or the Motorola convention.  The cross-assembler 
  356.         supports both.
  357.  
  358.              An Intel-type numeric constant starts with a numeric 
  359.         character (0-9), continues with zero or more digits (0-9, A-F), 
  360.         and ends with an optional base designator.  The base designators 
  361.         are H for hexadecimal, none or D for decimal, O or Q for octal, 
  362.         and B for binary.  The hex digits a-f are converted to upper case 
  363.         by the assembler.  Note that an Intel-type numeric constant 
  364.         cannot begin with A-F as it would be indistinguishable from a 
  365.         label.  Thus, all of the following evaluate to 255 (decimal):
  366.  
  367.                    0ffH   255   255D   377O   377Q   11111111B
  368.  
  369.              A Motorola-type numeric constant starts with a base 
  370.         designator and continues with a string of one or more digits.  
  371.         The base designators are $ for hexadecimal, none for decimal, @ 
  372.         for octal, and % for binary.  As with Intel-type numeric 
  373.  
  374.  
  375.                                         5
  376.  
  377.  
  378.  
  379.         constants, a-f are converted to upper case by the assembler.  
  380.         Thus, all of the following evaluate to 255 (decimal):
  381.  
  382.                           $ff   255   @377   %11111111
  383.  
  384.              If a numeric constant has a value that is too large to fit 
  385.         into a 16-bit word, it will be truncated on the left to make it 
  386.         fit.  Thus, for example, $123456 is truncated to $3456.
  387.  
  388.  
  389.         2.3  String Constants
  390.  
  391.              A string constant is zero or more characters enclosed in 
  392.         either single quotes (' ') or double quotes (" ").  Single quotes 
  393.         only match single quotes, and double quotes only match double 
  394.         quotes, so if you want to put a single quote in a string, you can 
  395.         do it like this:  "'".  In all contexts except the FCC statement, 
  396.         the first character or two of the string constant are all that 
  397.         are used.  The rest is ignored.  Noting that the ASCII codes for 
  398.         "A" and "B" are $41 and $42, respectively, will explain the 
  399.         following examples:
  400.  
  401.                   "" and ''           evaluate to $0000
  402.                   "A" and 'A'         evaluate to $0041
  403.                   "AB"                evaluates to $4142
  404.  
  405.         Note that the null string "" is legal and evaluates to $0000.
  406.  
  407.  
  408.         2.4  Expressions
  409.  
  410.              An expression is made up of labels, numeric constants, and 
  411.         string constants glued together with arithmetic operators, 
  412.         logical operators, and parentheses in the usual way that 
  413.         algebraic expressions are made.  Operators have the following 
  414.         fairly natural order of precedence:
  415.  
  416.              Highest        anything in parentheses
  417.                             unary +, unary -
  418.                             *, /, MOD, SHL, SHR
  419.                             binary +, binary -
  420.                             LT, LE, EQ, GE, GT, NE
  421.                             NOT
  422.                             AND
  423.                             OR, XOR
  424.              Lowest         HIGH, LOW
  425.  
  426.              A few notes about the various operators are in order:
  427.  
  428.              1)   The remainder operator MOD yields the remainder from 
  429.                   dividing its left operand by its right operand.
  430.  
  431.              2)   The shifting operators SHL and SHR shift their left 
  432.                   operand to the left or right the number of bits 
  433.                   specified by their right operand.
  434.  
  435.  
  436.                                         6
  437.  
  438.  
  439.  
  440.  
  441.              3)   The relational operators LT, LE, EQ, GE, GT, and NE can 
  442.                   also be written as <, <= or =<, =, >= or =>, and <> or 
  443.                   ><, respectively.  They evaluate to $FFFF if the 
  444.                   statement is true, 0 otherwise.
  445.  
  446.              4)   The logical opeators NOT, AND, OR, and XOR do bitwise 
  447.                   operations on their operand(s).
  448.  
  449.              5)   HIGH and LOW extract the high or low byte, of an 
  450.                   expression.
  451.  
  452.              6)   The special symbol * can be used in place of a label or 
  453.                   constant to represent the value of the program counter 
  454.                   before any of the current line has been processed.
  455.  
  456.              Some examples are in order at this point:
  457.  
  458.              2 + 3 * 4                          evaluates to 14
  459.              (2 + 3) * 4                        evaluates to 20
  460.              NOT %11110000 XOR %00001010        evaluates to %00000101
  461.              HIGH $1234 SHL 1                   evaluates to $0024
  462.              @001 EQ 0                          evaluates to 0
  463.              @001 = 2 SHR 1                     evaluates to $FFFF
  464.  
  465.              All arithmetic is unsigned with overflow from the 16-bit 
  466.         word ignored.  Thus:
  467.  
  468.              32768 * 2                          evaluates to 0
  469.  
  470.  
  471.         3.0  Machine Opcodes
  472.  
  473.              The opcodes of the 68HC11 processor are divided into groups 
  474.         below by the type of arguments required in the argument field of 
  475.         the source line.  Opcodes that are peculiar to certain processors 
  476.         in the family are noted in their sections.  A few notes on the 
  477.         source line syntax are in order at this point:
  478.  
  479.              1)   Multiple arguments must be separated from one another 
  480.                   by commas.
  481.  
  482.              2)   In the indexed addressing mode, the expression giving 
  483.                   the offset may be omitted.  The default offset is 0.
  484.  
  485.  
  486.         3.1  Opcodes -- No Arguments
  487.  
  488.              The following opcodes allow no arguments at all in their 
  489.         argument fields:
  490.  
  491.              ABA       ABX       ABY       ASLA      ASLB      ASLD
  492.              ASRA      ASRB      CBA       CLC       CLI       CLRA
  493.              CLRB      CLV       COMA      COMB      DAA       DECA
  494.              DECB      DES       DES       DEX       DEY       FDIV
  495.  
  496.  
  497.                                         7
  498.  
  499.  
  500.  
  501.              IDIV      INCA      INCB      INS       INX       INY
  502.              LSLA      LSLB      LSLD      LSRA      LSRB      LSRD
  503.              MUL       NEGA      NEGB      NOP       PSHA      PSHB
  504.              PSHX      PSHY      PULA      PULB      PULX      PULY
  505.              ROLA      ROLB      RORA      RORB      RTI       RTS
  506.              SBA       SEC       SEI       SEV       STOP      SWI
  507.              TAB       TAP       TBA       TEST      TPA       TSTA
  508.              TSTB      TSX       TSY       TXS       TYS       WAI
  509.              XGDX      XGDY
  510.  
  511.  
  512.         3.2  Opcodes -- Branch Instructions
  513.  
  514.              The opcodes in this group require one argument that is an 
  515.         expression whose value is in the range *-126 thru *+129.  The 
  516.         opcodes are:
  517.  
  518.              BCC       BCS       BEQ       BGE       BGT       BHI
  519.              BHS       BLE       BLO       BLS       BLT       BMI
  520.              BNE       BPL       BRA       BRN       BSR       BVC
  521.              BVS
  522.  
  523.  
  524.         3.3  Opcodes -- Bit Manipulation Instructions
  525.  
  526.              The opcodes in this group require two or three arguments in 
  527.         the following order:
  528.  
  529.              1)   expression     one of these five arguments where
  530.                   expression, X  expression is in the range 0 thru 255,
  531.                   expression, Y  and
  532.                   X
  533.                   Y
  534.  
  535.              2)   expression     where expression is 0-255, and
  536.  
  537.              3)   expression     where expression is in the range -128 
  538.                                  thru +127 from the beginning of the NEXT 
  539.                                  instruction (BRCLR and BRSET only).
  540.  
  541.         The opcodes are:
  542.  
  543.              BRCLR     BRSET     BCLR      BSET
  544.  
  545.  
  546.         3.4  Opcodes -- Read-Modify-Write Instructions
  547.  
  548.              The opcodes in this group require one argument from the 
  549.         following list:
  550.  
  551.              1)   expression     where expression is arbitrary, or
  552.  
  553.              2)   expression, X  where expression is 0-255, or
  554.  
  555.              3)   expression, Y  where expression is 0-255.
  556.  
  557.  
  558.                                         8
  559.  
  560.  
  561.  
  562.  
  563.         The opcodes are:
  564.  
  565.              ASL       ASR       CLR       COM       DEC       INC
  566.              LSL       LSR       NEG       ROL       ROR       TST
  567.  
  568.  
  569.         3.5  Opcodes -- Register/Memory Instructions
  570.  
  571.              The opcodes in this group require one argument from the 
  572.         following list:
  573.  
  574.              1)   #expression    where expression is -128 thru 255, or
  575.  
  576.              2)   expression     where expression is arbitrary, or
  577.  
  578.              3)   expression, X  where expression is 0 thru 255, or
  579.  
  580.              4)   expression, Y  where expression is 0 thru 255.
  581.  
  582.         The opcodes are:
  583.  
  584.              ADCA      ADCB      ADDA      ADDB      ADDD **   ANDA
  585.              ANDB      BITA      BITB      CMPA      CMPB      CPD **
  586.              CPX **    CPY **    EORA      EORB      JMP *     JSR *
  587.              LDAA      LDAB      LDD **    LDS  **   LDX **    LDY **
  588.              ORAA      ORAB      SBCA      SBCB      STAA *    STAB *
  589.              STD *     STS *     STX *     STY *     SUBA      SUBB
  590.              SUBD **
  591.  
  592.                   *    Immediate addressing (#expression) not allowed.
  593.                   **   Immediate expressions (#expression) are not 
  594.                             restricted to -128 thru 255.
  595.  
  596.  
  597.         3.6  Opcodes -- Direct Addressing
  598.  
  599.              The register/memory instructions of the 68HC11 CPU allow 
  600.         both one-byte direct (or zero-page) addressing and two-byte 
  601.         extended addressing.  There is no way to explicitly call for one 
  602.         form of addressing over the other.  The assembler will choose 
  603.         direct addressing if BOTH of the following conditions are met:
  604.  
  605.              1)   the required expression contains no forward references, 
  606.                   and
  607.  
  608.              2)   the expression evaluates to 0-255.
  609.  
  610.         Otherwise, the assembler will choose extended addressing.  Note 
  611.         that this makes it desireable to declare your zero-page RAM 
  612.         locations at the top of the program so that these locations will 
  613.         not generate forward references and foil the assembler's attempts 
  614.         to use direct addressing and shrink the object program.
  615.  
  616.  
  617.  
  618.  
  619.                                         9
  620.  
  621.  
  622.  
  623.         4.0  Pseudo Opcodes
  624.  
  625.              Unlike 68HC11 opcodes, pseudo opcodes (pseudo ops) do not 
  626.         represent machine instructions.  They are, rather, directives to 
  627.         the assembler.  These directives require various numbers and 
  628.         types of arguments.  They will be listed individually below.
  629.  
  630.  
  631.         4.1  Pseudo-ops -- END
  632.  
  633.              The END pseudo-op tells the assembler that the source 
  634.         program is over.  Any further lines of the source file are 
  635.         ignored and not passed on to the listing.  If an argument is 
  636.         added to the END statement, the value of the argument will be 
  637.         placed in the execution address slot in the Intel hex object 
  638.         file.  The execution address defaults to the program counter 
  639.         value at the point where the END was encountered.  Thus, to 
  640.         specify that the program starts at label START, the END statement 
  641.         would be:
  642.  
  643.                        END       START
  644.  
  645.              If end-of-file is encountered on the source file before an 
  646.         END statement is reached, the assembler will add an END statement 
  647.         to the listing and flag it with a * (missing statement) error.
  648.  
  649.  
  650.         4.2  Pseudo-ops -- EQU
  651.  
  652.              The EQU pseudo-op is used to assign a specific value to a 
  653.         label, thus the label on this line is REQUIRED.  Once the value 
  654.         is assigned, it cannot be reassigned by writing the label in 
  655.         column 1, by another EQU statement, or by a SET statement.  Thus, 
  656.         for example, the following statement assigns the value 2 to the 
  657.         label TWO:
  658.  
  659.              TWO       EQU       1 + 1
  660.  
  661.              The expression in the argument field must contain no forward 
  662.         references.
  663.  
  664.  
  665.         4.3  Pseudo-ops -- FCB
  666.  
  667.              The FCB (Form Constant Bytes) pseudo-op allows arbitrary 
  668.         bytes to be spliced into the object code.  Its argument is a 
  669.         chain of zero or more expressions that evaluate to -128 thru 255 
  670.         separated by commas.  If a comma occurs with no preceding 
  671.         expression, a $00 byte is spliced into the object code.  The 
  672.         sequence of bytes $FE $FF, $00, $01, $02 could be spliced into 
  673.         the code with the following statement:
  674.  
  675.                        FCB       -2, -1, , 1, 2
  676.  
  677.  
  678.  
  679.  
  680.                                        10
  681.  
  682.  
  683.  
  684.         4.4  Pseudo-ops -- FCC
  685.  
  686.              The FCC (Form Constant Characters) pseudo-op allows 
  687.         character strings to be spliced into the object code.  Its 
  688.         argument is a chain of zero or more string constants separated by 
  689.         blanks, tabs, or commas.  If a comma occurs with no preceding 
  690.         string constant, an S (syntax) error results.  The string 
  691.         contants are not truncated to two bytes, but are instead copied 
  692.         verbatim into the object code.  Null strings result in no bytes 
  693.         of code.  The message "Kaboom!!" could be spliced into the code 
  694.         with the following statement:
  695.  
  696.                        FCC       "Kaboom!!"     ;This is 8 bytes of code.
  697.  
  698.  
  699.         4.5  Pseudo-ops -- FDB
  700.  
  701.              The FDB (Form Double Bytes) pseudo-op allows 16-bit words to 
  702.         be spliced into the object code.  Its argument is a chain of zero 
  703.         or more expressions separated by commas.  If a comma occurs with 
  704.         no preceding expression, a word of $0000 is spliced into the 
  705.         code.  The word is placed into memory high byte in low address, 
  706.         low byte in high address as per standard Motorola order.  The 
  707.         sequence of bytes $FE $FF $00 $00 $01 $02 could be spliced into 
  708.         the code with the following statement:
  709.  
  710.                        FDB       $FEFF, , $0102
  711.  
  712.  
  713.         4.6  Pseudo-ops -- IF, ELSE, ENDIF
  714.  
  715.              These three pseudo-ops allow the assembler to choose whether 
  716.         or not to assemble certain blocks of code based on the result of 
  717.         an expression.  Code that is not assembled is passed through to 
  718.         the listing but otherwise ignored by the assembler.  The IF 
  719.         pseudo-op signals the beginning of a conditionally assembled 
  720.         block.  It requires one argument that may contain no forward 
  721.         references.  If the value of the argument is non-zero, the block 
  722.         is assembled.  Otherwise, the block is ignored.  The ENDIF 
  723.         pseudo-op signals the end of the conditionally assembled block.  
  724.         For example:
  725.  
  726.                        IF   EXPRESSION     ;This whole thing generates
  727.                        FCB  $01, $02, $03  ;  no code whatsoever if
  728.                        ENDIF               ;  EXPRESSION is zero.
  729.  
  730.         The ELSE pseudo-op allows the assembly of either one of two 
  731.         blocks, but not both.  The following two sequences are 
  732.         equivalent:
  733.  
  734.                        IF   EXPRESSION
  735.                        ... some stuff ...
  736.                        ELSE
  737.                        ... some more stuff ...
  738.                        ENDIF
  739.  
  740.  
  741.                                        11
  742.  
  743.  
  744.  
  745.  
  746.              TEMP_LAB  SET  EXPRESSION
  747.                        IF   TEMP_LAB NE 0
  748.                        ... some stuff ...
  749.                        ENDIF
  750.                        IF   TEMP_LAB EQ 0
  751.                        ... some more stuff ...
  752.                        ENDIF
  753.  
  754.              The pseudo-ops in this group do NOT permit labels to exist 
  755.         on the same line as the status of the label (ignored or not) 
  756.         would be ambiguous.
  757.  
  758.              All IF statements (even those in ignored conditionally 
  759.         assembled blocks) must have corresponding ENDIF statements and 
  760.         all ELSE and ENDIF statements must have a corresponding IF 
  761.         statement.
  762.  
  763.              IF blocks can be nested up to 16 levels deep before the 
  764.         assembler dies of a fatal error.  This should be adequate for any 
  765.         conceivable job, but if you need more, change the constant 
  766.         IFDEPTH in file A611.H and recompile the assembler.
  767.  
  768.  
  769.         4.7  Pseudo-ops -- INCL
  770.  
  771.              The INCL pseudo-op is used to splice the contents of another 
  772.         file into the current file at assembly time.  The name of the 
  773.         file to be INCLuded is specified as a normal string constant, so 
  774.         the following line would splice the contents of file "const.def" 
  775.         into the source code stream:
  776.  
  777.                        INCL      "const.def"
  778.  
  779.              INCLuded files may, in turn, INCLude other files until four 
  780.         files are open simultaneously.  This limit should be enough for 
  781.         any conceivable job, but if you need more, change the constant 
  782.         FILES in file A611.H and recompile the assembler.  
  783.  
  784.  
  785.         4.8  Pseudo-ops -- ORG
  786.  
  787.              The ORG pseudo-op is used to set the assembly program 
  788.         counter to a particular value.  The expression that defines this 
  789.         value may contain no forward references.  The default initial 
  790.         value of the assembly program counter is $0000.  The following 
  791.         statement would change the assembly program counter to $F000:
  792.  
  793.                        ORG       $F000
  794.  
  795.              If a label is present on the same line as an ORG statement, 
  796.         it is assigned the new value of the assembly program counter.
  797.  
  798.  
  799.  
  800.  
  801.  
  802.                                        12
  803.  
  804.  
  805.  
  806.         4.9  Pseudo-ops -- PAGE
  807.  
  808.              The PAGE pseudo-op always causes an immediate page ejection 
  809.         in the listing by inserting a form feed ('\f') character before 
  810.         the next line.  If an argument is specified, the argument 
  811.         expression specifies the number of lines per page in the listing.  
  812.         Legal values for the expression are any number except 1 and 2.  A 
  813.         value of 0 turns the listing pagination off.  Thus, the following 
  814.         statement cause a page ejection and would divide the listing into 
  815.         60-line pages:
  816.  
  817.                        PAGE      60
  818.  
  819.  
  820.         4.10 Pseudo-ops -- RMB
  821.  
  822.              The RMB (Reserve Memory Bytes) pseudo-op is used to reserve 
  823.         a block of storage for program variables, or whatever.  This 
  824.         storage is not initialized in any way, so its value at run time 
  825.         will usually be random.  The argument expression (which may
  826.         contain no forward references) is added to the assembly program 
  827.         counter.  The following statement would reserve 10 bytes of 
  828.         storage called "STORAGE":
  829.  
  830.              STORAGE   RMB       10
  831.  
  832.  
  833.         4.11 Pseudo-ops -- SET
  834.  
  835.              The SET pseudo-op functions like the EQU pseudo-op except 
  836.         that the SET statement can reassign the value of a label that has 
  837.         already been assigned by another SET statement.  Like the EQU 
  838.         statement, the argument expression may contain no forward 
  839.         references.  A label defined by a SET statement cannot be 
  840.         redefined by writing it in column 1 or with an EQU statement.  
  841.         The following series of statements would set the value of label 
  842.         "COUNT" to 1, 2, then 3:
  843.  
  844.              COUNT     SET       1
  845.              COUNT     SET       2
  846.              COUNT     SET       3
  847.  
  848.  
  849.         4.12 Pseudo-ops -- TITLE
  850.  
  851.              The TITLE pseudo-op sets the running title for the listing.  
  852.         The argument field is required and must be a string constant, 
  853.         though the null string ("") is legal.  This title is printed 
  854.         after every page ejection in the listing, therefore, if page 
  855.         ejections have not been forced by the PAGE pseudo-op, the title 
  856.         will never be printed.  The following statement would print the 
  857.         title "Random Bug Generator -- Ver 3.14159" at the top of every 
  858.         page of the listing:
  859.  
  860.                        TITLE     "Random Bug Generator -- Ver 3.14159"
  861.  
  862.  
  863.                                        13
  864.  
  865.  
  866.  
  867.  
  868.  
  869.         5.0  Assembly Errors
  870.  
  871.              When a source line contains an illegal construct, the line 
  872.         is flagged in the listing with a single-letter code describing 
  873.         the error.  The meaning of each code is listed below.  In 
  874.         addition, a count of the number of lines with errors is kept and 
  875.         printed on the C "stderr" device (by default, the console) after 
  876.         the END statement is processed.  If more than one error occurs in 
  877.         a given line, only the first is reported.  For example, the 
  878.         illegal label "=$#*'(" would generate the following listing line:
  879.  
  880.              L  0000   FF 00 00      =$#*'(     CPX       #0
  881.  
  882.  
  883.         5.1  Error * -- Illegal or Missing Statement
  884.  
  885.              This error occurs when either:
  886.  
  887.              1)   the assembler reaches the end of the source file 
  888.                   without seeing an END statement, or
  889.  
  890.              2)   an END statement is encountered in an INCLude file.
  891.  
  892.              If you are "sure" that the END statement is present when the 
  893.         assembler thinks that it is missing, it probably is in the 
  894.         ignored section of an IF block.  If the END statement is missing, 
  895.         supply it.  If the END statement is in an INCLude file, delete 
  896.         it.
  897.  
  898.  
  899.         5.2  Error ( -- Parenthesis Imbalance
  900.  
  901.              For every left parenthesis, there must be a right paren-
  902.         thesis.  Count them.
  903.  
  904.  
  905.         5.3  Error " -- Missing Quotation Mark
  906.  
  907.              Strings have to begin and end with either " or '.  Remember 
  908.         that " only matches " while ' only matches '.
  909.  
  910.  
  911.         5.4  Error B -- Branch Target Too Distant
  912.  
  913.              The 68HC11 relative branch instructions will only reach -128 
  914.         to +127 bytes from the first byte of the next instruction.  If 
  915.         this error occurs, the source code will have to be rearranged to 
  916.         shorten the distance to the branch target address or a long 
  917.         branch instruction that will reach anywhere (JMP or JSR) will 
  918.         have to be used.
  919.  
  920.  
  921.  
  922.  
  923.  
  924.                                        14
  925.  
  926.  
  927.  
  928.         5.5  Error D -- Illegal Digit
  929.  
  930.              This error occurs if a digit greater than or equal to the 
  931.         base of a numeric constant is found.  For example, a 2 in a 
  932.         binary number would cause a D error.  Especially, watch for 8 or 
  933.         9 in an octal number.
  934.  
  935.  
  936.         5.6  Error E -- Illegal Expression
  937.  
  938.              This error occurs because of:
  939.  
  940.              1)   a missing expression where one is required
  941.  
  942.              2)   a unary operator used as a binary operator or vice-
  943.                   versa
  944.  
  945.              3)   a missing binary operator
  946.  
  947.              4)   a SHL or SHR count that is not 0 thru 15
  948.  
  949.  
  950.         5.7  Error I -- IF-ENDIF Imbalance
  951.  
  952.              For every IF there must be a corresponding ENDIF.  If this 
  953.         error occurs on an ELSE or ENDIF statement, the corresponding IF 
  954.         is missing.  If this error occurs on an END statement, one or 
  955.         more ENDIF statements are missing.
  956.  
  957.  
  958.         5.8  Error L -- Illegal Label
  959.  
  960.              This error occurs because of:
  961.  
  962.              1)   a non-alphabetic in column 1
  963.  
  964.              2)   a reserved word used as a label
  965.  
  966.              3)   a missing label on an EQU or SET statement
  967.  
  968.              4)   a label on an IF, ELSE, or ENDIF statement
  969.  
  970.  
  971.         5.9  Error M -- Multiply Defined Label
  972.  
  973.              This error occurs because of:
  974.  
  975.              1)   a label defined in column 1 or with the EQU statement 
  976.                   being redefined
  977.  
  978.              2)   a label defined by a SET statement being redefined 
  979.                   either in column 1 or with the EQU statement
  980.  
  981.              3)   the value of the label changing between assembly passes
  982.  
  983.  
  984.  
  985.                                        15
  986.  
  987.  
  988.  
  989.  
  990.         5.10 Error O -- Illegal Opcode
  991.  
  992.              The opcode field of a source line may contain only a valid 
  993.         machine opcode, a valid pseudo-op, or nothing at all.  Anything 
  994.         else causes this error.
  995.  
  996.  
  997.         5.11 Error P -- Phasing Error
  998.  
  999.              This error occurs because of:
  1000.  
  1001.              1)   a forward reference in a EQU, ORG, RMB, or SET 
  1002.                   statement
  1003.  
  1004.              2)   a label disappearing between assembly passes
  1005.  
  1006.  
  1007.         5.12 Error S -- Illegal Syntax
  1008.  
  1009.              This error means that an argument field is scrambled.  Sort 
  1010.         the mess out and reassemble.
  1011.  
  1012.  
  1013.         5.13 Error T -- Too Many Arguments
  1014.  
  1015.              This error occurs if there are more items (expressions, 
  1016.         register designators, etc.) in the argument field than the opcode 
  1017.         or pseudo-op requires.  The assembler ignores the extra items but 
  1018.         issues this error in case something is really mangled.
  1019.  
  1020.  
  1021.         5.14 Error U -- Undefined Label
  1022.  
  1023.              This error occurs if a label is referenced in an expression 
  1024.         but not defined anywhere in the source program.  If you are 
  1025.         "sure" you have defined the label, note that upper and lower case 
  1026.         letters in labels are different.  Defining "LABEL" does not 
  1027.         define "Label."
  1028.  
  1029.  
  1030.         5.15 Error V -- Illegal Value
  1031.  
  1032.              This error occurs because:
  1033.  
  1034.              1)   the first argument (unless the optional number in front 
  1035.                   of X or Y has been omitted) of a bit manipulation 
  1036.                   instruction instruction is not 0 thru 255, or
  1037.  
  1038.              2)   the second argument of a bit manipulation instruction is 
  1039.                   not 0 thru 255, or
  1040.  
  1041.              3)   an immediate value is not -128 thru 255, or
  1042.  
  1043.              4)   an FCB argument is not -128 thru 255, or
  1044.  
  1045.  
  1046.                                        16
  1047.  
  1048.  
  1049.  
  1050.  
  1051.              5)   an INCL argument refers to a file that does not exist.
  1052.  
  1053.  
  1054.         6.0  Warning Messages
  1055.  
  1056.              Some errors that occur during the parsing of the cross-
  1057.         assembler command line are non-fatal.  The cross-assembler flags 
  1058.         these with a message on the C "stdout" device (by default, the 
  1059.         console) beginning with the word "Warning."  The messages are 
  1060.         listed below:
  1061.  
  1062.  
  1063.         6.1  Warning -- Illegal Option Ignored
  1064.  
  1065.              The only options that the cross-assembler knows are -l and  
  1066.         -o.  Any other command line argument beginning with - will draw 
  1067.         this error.
  1068.  
  1069.  
  1070.         6.2  Warning -- -l Option Ignored -- No File Name
  1071.         6.3  Warning -- -o Option Ignored -- No File Name
  1072.  
  1073.              The -l and -o options require a file name to tell the 
  1074.         assembler where to put the listing file or object file.  If this 
  1075.         file name is missing, the option is ignored.
  1076.  
  1077.  
  1078.         6.4  Warning -- Extra Source File Ignored
  1079.  
  1080.              The cross-assembler will only assemble one file at a time, 
  1081.         so source file names after the first are ignored.  To assemble a 
  1082.         second file, invoke the assembler again.  Note that under CP/M-
  1083.         80, the old trick of reexecuting a core image will NOT work as 
  1084.         the initialized data areas are not reinitialized prior to the 
  1085.         second run.
  1086.  
  1087.  
  1088.         6.5  Warning -- Extra Listing File Ignored
  1089.         6.6  Warning -- Extra Object File Ignored
  1090.  
  1091.              The cross-assembler will only generate one listing and one 
  1092.         object file per assembly run, so -l and -o options after the 
  1093.         first are ignored.
  1094.  
  1095.  
  1096.         7.0  Fatal Error Messages
  1097.  
  1098.              Several errors that occur during the parsing of the cross-
  1099.         assembler command line or during the assembly run are fatal.  The 
  1100.         cross-assembler flags these with a message on the C "stdout" 
  1101.         device (by default, the console) beginning with the words "Fatal 
  1102.         Error."  The messages are explained below:
  1103.  
  1104.  
  1105.  
  1106.  
  1107.                                        17
  1108.  
  1109.  
  1110.  
  1111.         7.1  Fatal Error -- No Source File Specified
  1112.  
  1113.              This one is self-explanatory.  The assembler does not know 
  1114.         what to assemble.
  1115.  
  1116.  
  1117.         7.2  Fatal Error -- Source File Did Not Open
  1118.  
  1119.              The assembler could not open the source file.  The most 
  1120.         likely cause is that the source file as specified on the command 
  1121.         line does not exist.  On larger systems, there could also be 
  1122.         priviledge violations.  Rarely, a read error in the disk 
  1123.         directory could cause this error.
  1124.  
  1125.  
  1126.         7.3  Fatal Error -- Listing File Did Not Open
  1127.         7.4  Fatal Error -- Object File Did Not Open
  1128.  
  1129.              This error indicates either a defective listing or object 
  1130.         file name or a full disk directory.  Correct the file name or 
  1131.         make more room on the disk.
  1132.  
  1133.  
  1134.         7.5  Fatal Error -- Error Reading Source File
  1135.  
  1136.              This error generally indicates a read error in the disk data 
  1137.         space.  Use your backup copy of the source file (You do have one, 
  1138.         don't you?) to recreate the mangled file and reassemble.
  1139.  
  1140.  
  1141.         7.6  Fatal Error -- Disk or Directory Full
  1142.  
  1143.              This one is self-explanatory.  Some more space must be found 
  1144.         either by deleting files or by using a disk with more room on it.
  1145.  
  1146.  
  1147.         7.7  Fatal Error -- File Stack Overflow
  1148.  
  1149.              This error occurs if you exceed the INCLude file limit of 
  1150.         four files open simultaneously.  This limit can be increased by 
  1151.         increasing the constant FILES in file A611.H and recompiling the 
  1152.         cross-assembler.
  1153.  
  1154.  
  1155.         7.8  Fatal Error -- If Stack Overflow
  1156.  
  1157.              This error occurs if you exceed the nesting limit of 16 IF 
  1158.         blocks.  This limit can be increased by increasing the constant 
  1159.         IFDEPTH in file A611.H and recompiling the cross-assembler.
  1160.  
  1161.  
  1162.         7.9  Fatal Error -- Too Many Symbols
  1163.  
  1164.              Congratulations!  You have run out of memory.  The space for 
  1165.         the cross-assembler's symbol table is allocated at run-time using 
  1166.  
  1167.  
  1168.                                        18
  1169.  
  1170.  
  1171.  
  1172.         the C library function alloc(), so the cross-assembler will use 
  1173.         all available memory.  The only solutions to this problem are to 
  1174.         lessen the number of labels in the source program, to use a 
  1175.         larger memory model (MSDOS/PCDOS systems only), or to add more 
  1176.         memory to your machine.
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.                                        19
  1230.