home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 148_01 / xasm99.doc < prev    next >
Text File  |  1987-09-28  |  39KB  |  1,022 lines

  1. .pl 70
  2. .op
  3.  
  4. .he        TMS9900/99105 Cross-assembler  Rev. 1.0                    Page #
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                   TMS9900/99105 Cross-assembler
  13.  
  14.  
  15.                             Rev. 1.0
  16.  
  17.         Derived from the original William C. Colley, III.
  18.                       M6800 Cross Assembler
  19.  
  20.                                by
  21.  
  22.  
  23.                         Alexander Cameron 
  24.  
  25.              Written and modified during June 1984.
  26.  
  27.  
  28.  
  29.  
  30.                     The Manual Such As It Is.
  31.  
  32.  
  33. .pa
  34. .pn 1
  35. .op
  36. ...COLUMNWIDTH 65
  37. ...MARGINWIDTH 6
  38. ...T1
  39.         1.1       Format of Cross-assembler Commands
  40. ...T2
  41.         1.1.1     Command Strings
  42.  
  43.                   To   run  the 9900 cross-assembler,   type  the 
  44.                   following command line:
  45.  
  46.                   A>a99 filename options
  47.  
  48.                   filename: 
  49.                   The   name   of  the  source  input   file   is 
  50.                   filename.a99,  the list can go to filename.l99, 
  51.                   and the hex file can go to filename.h99.
  52.  
  53.                   options:   See next section.
  54.  
  55. ...T2                 
  56.         1.1.2     Options
  57.  
  58.                   The   source  file  comes  from  the  currently  
  59.                   logged  disk drive  unless  it is redirected by 
  60.                   putting  the  string "sd" in the options field.  
  61.                   s  specifies the source file and d is a  device 
  62.                   code from the following list:
  63.  
  64.                   a, b, c, d   Disk drives.
  65.                   -            The currently logged in disk drive.
  66.  
  67.                   Lines   of input containing errors will  always 
  68.                   be  output to the console device.   If the full 
  69.                   listing  is desired,  it must be called for  by 
  70.                   putting  the string "ld" in the options  field.  
  71.                   l specifies list file and d is a device code as 
  72.                   per the source file,  or one of the  following: 
  73.                  
  74.                   x              Console device.
  75.                   y              List device.
  76.  
  77.                   The   hex file will not be output unless called  
  78.                   for  as per the list file.
  79.  
  80.                   Options   must  be run together into  a  single 
  81.                   string with no embedded blanks.
  82.  
  83. ...T2
  84.         1.1.3     Examples
  85.  
  86.                   A>a99 barf       source -- a:barf.a99
  87.                                       list   -- none.
  88.                                       hex    -- none.
  89.  
  90.                   A>a99 barf sblxha source -- b:barf.a99
  91.                                       list   -- con:
  92.                                       hex    -- a:barf.h99
  93.  
  94.                   A>a99 barf ly    source -- a:barf.a99
  95.                                       list   -- lst:
  96.                                       hex    -- none.
  97.  
  98.  
  99.                   A>b:a99 barf sbh-  source -- b:barf.a99
  100.                                       list   -- none.
  101.                                       hex    -- a:barf.h99
  102.  
  103.  
  104. ...T1
  105.         1.2       Format of TMS9900 Cross-assembler Source Files
  106.  
  107.                   Lines of source input are terminated with CR/LF  
  108.                   pairs.  Internally, the character before the LF 
  109.                   is discarded, so if the CR is missing, the last 
  110.                   character  of the line will be eaten  up.   The 
  111.                   internal line buffer will hold a 120  character 
  112.                   line.    This  may be changed by  altering  the  
  113.                   "#define  LINLEN  120" statement in  xasm99.gbl 
  114.                   and  recompiling the cross-assembler.    Excess 
  115.                   characters in the line are thrown out.
  116.  
  117.                   Lower   case   letters are converted  to  upper 
  118.                   case in  as few places as possible.  They are:
  119.  
  120.                        1)  In opcodes,
  121.  
  122.                        2)  In checking for keywords such as NOT, and
  123.  
  124.                        3)  In command strings.
  125.  
  126.                   This  means that "not",   "NOT",   "Not",  etc.  
  127.                   are   all  possible  spellings of  the  logical 
  128.                   inversion   operator.  This  also   means  that 
  129.                   "foo"   and   "FOO"   are   different  symbols.  
  130.                   Watch  this if you start encountering U  errors 
  131.                   of symbols that you "know" you defined.
  132.  
  133. ...T2
  134.         1.2.1     Statements
  135.  
  136.                   Source files input to the 9900  Cross-assembler  
  137.                   consist of statements of the form:
  138.  
  139.                   [label] [opcode] [arguments] [;comments.]
  140.  
  141.                   Labels   are  recognized by their beginning  in 
  142.                   column  1. If  it  doesn't  begin there,  it is 
  143.                   assumed  to   be   an  opcode.     Labels   are  
  144.                   assigned  the  current  program counter   value  
  145.                   unless  the line's opcode is  "EQU"  or "SET".
  146.  
  147.                   Opcodes    may   be  either  9900   instruction  
  148.                   mnemonics  or pseudo-ops.
  149.  
  150.                   The   arguments following the opcode will  vary 
  151.                   with  the opcode.   In the case of opcodes such 
  152.                   as "NOP", they may be absent entirely.
  153.  
  154.                   Lines  terminate with either a CR/LF pair or  a 
  155.                   semicolon  that  is  not embedded in a   quoted  
  156.                   string.   Anything after a semicolon is ignored 
  157.                   by  the  assembler,  but  will  appear  in  the 
  158.                   listing.   Note  that  a semicolon in column  1 
  159.                   will make the entire line a comment.
  160. ...T2
  161.         1.2.2     Symbols
  162.  
  163.                   Symbols  may  be of any length,   but only  the  
  164.                   first   8 characters  are  significant.    This 
  165.                   may  be  changed   by  changing   the  "#define 
  166.                   SYMLEN   8"   statement    in    a68.gbl    and   
  167.                   recompiling   the   assembler.      Note   that   
  168.                   this  increases   the storage required  by  the 
  169.                   symbol  table   as each  entry  in  the  symbol 
  170.                   table  is  SYMLEN+2  bytes   in  length.    The  
  171.                   following    characters   are   legal   in    a 
  172.                   symbol:
  173.  
  174.                        A-Z  a-z  !  &  .  :  ?  [  \  ]  ^  _  `
  175.                                  {  |  }  ~  0-9
  176.  
  177.                   Note   that  symbols may not begin with 0-9  as 
  178.                   this would make  them impossible to distinguish 
  179.                   from Intel  format numbers.
  180.  
  181.                   A   special   symbol $ is always equal  to  the 
  182.                   address  of the first byte of code generated by 
  183.                   a given line.
  184.  
  185. ...T2
  186.         1.2.3     Numeric Constants
  187.  
  188.                   Numbers  begin  with  0-9,%.  %  leading   base  
  189.                   designator  represent  binary.  If  the  number 
  190.                   begins with 0-9,  the  assembler  looks for one 
  191.                   of the trailing  base designators B,  O,  Q, D, 
  192.                   or  H.   If the number does not end with one of 
  193.                   these,  it is assumed to be decimal.  B is  the  
  194.                   base designator for binary,   O and Q  are  for 
  195.                   octal,   D   is  for decimal,   and H  is   for  
  196.                   hexidecimal.  Trailing base designators and the 
  197.                   hex digits A-F can be in  either upper or lower 
  198.                   case.    Note  that  hex numbers  that    start  
  199.                   with   A-F   and   are   specified   with   the 
  200.                   designator   H  must have a leading zero  added  
  201.                   to  keep them from being mistaken for  symbols.  
  202.                   For example:
  203.  
  204.                   0ff80h            evaluate to ff80 hex.
  205.                   128 and 128d             evaluate to 80 hex.
  206.                   35o, and 35q             evaluate to 1d hex.
  207.                   %0111000 and 0111000b    evaluate to 39 hex.
  208.  
  209.                   A  character  constant is a string composed  of 
  210.                   zero,  one, or two ASCII characters,  delimited 
  211.                   by  either single or double  quotes ('  or  ").   
  212.                   Note  that  single quotes only  balance  single 
  213.                   quotes,  and double quotes only  balance double 
  214.                   quotes.   Thus  a character constant of 22  hex 
  215.                   can be specified by '"'.  For example:
  216.  
  217.                        "ab"           evaluates to 6162 hex.
  218.                        ""             evaluates to 0000 hex.
  219.                        "'"            evaluates to 0027 hex.
  220.                        'A'            evaluates to 0041 hex.
  221.  
  222.  
  223.  
  224.                   Note   that  in  the  two-character   character 
  225.                   constant,   the left-hand character will appear 
  226.                   in  the  upper-order byte and   the  right-hand 
  227.                   character will appear in the lower-order byte.
  228.  
  229. ...T2
  230.         1.2.4     Strings
  231.  
  232.                   Strings   are   formed  in  the  same  way   as  
  233.                   character constants  except that they may be of 
  234.                   any length up  to and including 255 characters.  
  235.                   The  first  character  will be  placed  in  the 
  236.                   lowest-order   memory   byte.     A   line-feed 
  237.                   character  may  not  be  embedded in  a  string  
  238.                   as   it terminates  the line and will  yield  a  
  239.                   quote   imbalance error.    Note  that  strings  
  240.                   are  only  valid  in  the arguement field of an 
  241.                   "TEXT" pseudo-op.
  242.  
  243. ...T1
  244.         1.3       Expression Evaluation
  245.  
  246.                   The   following   operators  are  allowed    in  
  247.                   expressions.  The operators are listed in order 
  248.                   of precedence.
  249.  
  250.                        Unary Plus, Unary Minus
  251.  
  252.                        *, /, MOD, SHL, SHR
  253.  
  254.                        +, -
  255.  
  256.                        >, >=, <, <=, <>, =
  257.                                  (These can also be written as
  258.                                       GT, GE, LT, LE, NE, EQ.)
  259.  
  260.                        NOT       (1's complement)
  261.  
  262.                        AND       (Bitwise logical AND)
  263.  
  264.                        OR, XOR   (Bitwise logical OR and Exclusive 
  265.                                   OR)
  266.  
  267.                        HIGH, LOW
  268.                   Parentheses  are  used to change the  order  of 
  269.                   precedence.     During     evaluation   of   an 
  270.                   expression,   as  soon as a  new  operator   is 
  271.                   encountered  that has precedence less  than  or   
  272.                   equal   to   the  last  operator   encountered,   
  273.                   all  operations  up  to the  new  operator  are 
  274.                   performed.      That    is,      subexpressions  
  275.                   involving   operators  of    higher  precedence 
  276.                   are computed first.
  277.  
  278.                   All operators except +,   -,  *,  /, =, <>, >=, 
  279.                   <=, >, < must  be separated from their operands 
  280.                   by at least  one space or tab.
  281.  
  282.                   The  "HIGH mumble" is equivalent to "mumble SHR 
  283.                   8"   and "LOW mumble" is equivalent to  "mumble 
  284.                   AND 0ffH".
  285.  
  286.                   The relational operators (=,  >, etc.) evaluate 
  287.                   to 0ffffh if the relationship is true,  0 if it 
  288.                   is false.
  289.  
  290.                   Expressions     are   terminated   by   commas,  
  291.                   semicolons,  or CR/LF pairs.
  292.  
  293. ...T1
  294.         1.4       990 Family Instructions
  295.  
  296.                   The     instructions    of    the    9900/99105 
  297.                   microprocessor  fall  into several  catagories.   
  298.                   Each requires a certain  set  of arguments  and 
  299.                   disallows  other arguments.   Arguments may  be  
  300.                   specified  in  any order and are  separated  by  
  301.                   commas    Blanks    may    be    used    freely  
  302.                   throughout   the argument field (except  within 
  303.                   symbols  or operators such as  NOT) to  enhance 
  304.                   the readability of the source code.  
  305.                   The basic syntax is as follows:
  306.  
  307.                   [label]   LI  R1,expression   ;The expression 
  308.                                                 ;is evaluated 
  309.                         ;from left to 
  310.                                                 ;right.
  311.  
  312.                   The  type  of  addressing each  instruction  is 
  313.                   allowed  along with the number of operands  the 
  314.                   assembler  expects the instruction to have,  is 
  315.                   carried in the ATTRIB byte which is returned by 
  316.                   the  GETOPC  function.    The  ATTRIB  byte  is 
  317.                   is  made  up  of two 4 bit  nibbles  the  least 
  318.                   significat  describing operand 1 and  the  most 
  319.                   significant  describing  operand  2.  (See  the 
  320.                   heading comments of GETOPC which is part of the 
  321.                   file A99TBLS.CSM).    The ATTRIB byte will also 
  322.                   tell  the  assembler which one of the  7  basic 
  323.                   instruction  formats a particulare  instruction 
  324.                   falls into.   Thes formats/groups are discussed 
  325.                   in the following sections.
  326.  
  327. ...T2
  328.         1.4.1     Addressing Modes 
  329.  
  330.                   The  9900/99105 instruction set allows 5  basic 
  331.                   addressing  modes.  These are:
  332.  
  333.                    Mode                          Example  
  334.                    ----                          -------
  335.  
  336.                    Workspace register            MOV R1,R3
  337.                    Workspace register indirect   A *R1,R2
  338.                    Symbolic                      CLR @expr
  339.                    Indexed                       A @expr(R1),R2
  340.                    Workspace register indirect   DEC *R7+
  341.                    (auto increment)
  342.  
  343.                    These modes will in general be written in  the 
  344.                    form:
  345.  
  346.                          R, *R, *R+, @X, @X(R)
  347.  
  348.                   where  R  refers  to  a Register and  X  to  an 
  349.                   address.
  350.  
  351.  
  352. ...T2
  353.         1.4.2     Instruction Formats
  354.  
  355.                   The  assembler will properly evaluate  7  basic 
  356.                   instrucion formats; these are:
  357.  
  358.                          Format 0  -  No operands at all (N)
  359.                          Format 1  -  R,*R,*R+,@X,@X(R)
  360.                          Format 2  -  Displacement (Disp)
  361.                          Format 3  -  Destination Field only (D)
  362.                          Format 4  -  Signed Displacement (SD)
  363.                          Format 5  -  Workspace Register (W or C)
  364.                          Format 6  -  Immediate Operands (IOP)
  365.                          Format 7  -  Bit Manipulation Instrucions
  366.                                       (TMS99105 only)  
  367.  
  368.                   Depending  on the instruction these formats may 
  369.                   lie  within  either the source  or  destination 
  370.                   fields.
  371. ...T2
  372.         1.4.3     Group 1 Instructions 
  373.  
  374.                   This group contains the following opcodes:
  375.                    
  376.                        NOP 
  377.                        RSET IDLE CKOF CKON LREX
  378.                        RTWP      
  379.  
  380.                   These  opcodes permit no arguments,  and  hence 
  381.                   are of format 0.
  382.  
  383. ...T2
  384.         1.4.4     Group 2 Instructions
  385.                     
  386.                   This group of instructions are of Format type 1 
  387.                   and are Dual Operand Instructions with Multiple 
  388.                   Addressing  Modes  for Source  and  Destination 
  389.                   Operand. 
  390.  
  391.                   This group contains the following opcodes:
  392.  
  393.                           A  AB C CB S SB SOC SOCB 
  394.                           SZC  SZCB  MOV MOVB
  395.                          
  396.                   Instruction format:  [opcode|format1|format1]
  397.  
  398.                   Example:             A *R1+,R2
  399.  
  400. ...T2
  401.         1.4.5     Group 3 Instructions
  402.  
  403.                   This  group  of instructions are  Dual  Operand 
  404.                   Instructions with Multiple Addressing Modes for 
  405.                   the  Source  Operand  and  Workspace   Register 
  406.                   Addressifng for the Destination.
  407.  
  408.                   This group contains the following opcodes:
  409.                          
  410.                          COC CZC XOR MPY DIV XOP LDCR STCR
  411.  
  412.                   Instruction format:  [opcode|format3|format1]
  413.  
  414.                   Example:              XOP @LABEL,3  
  415.  
  416. ...T2
  417.         1.4.6     Group 4 Instructions
  418.  
  419.                   This   group  of  instructions  allow  Multiple 
  420.                   Addressing  modes for the source  Operand,  and 
  421.                   thus a single operand instructions.
  422.  
  423.                   This  following  instructions  belong  to  this 
  424.                   group:
  425.  
  426.                          B BL BLWP CLR SETO INV NEG ABS SWPB
  427.                          INC INCT DEC DECT X
  428.                          BIND(a TMS99105 instruction)
  429.  
  430.                   Instruction format:  [opcode|format1]
  431.  
  432.                   Example:             INC @LABEL(R3)
  433.  
  434. ...T2
  435.         1.4.7     Group 5 Instructions
  436.  
  437.                   This  group of instructions are CRU  Single-Bit 
  438.                   Instructions.
  439.  
  440.                   The  following  instructions  belong  to   this 
  441.                   group:                           
  442.  
  443.                          SBO SBZ TB
  444.  
  445.                   Instruction format:  [opcode|format4]
  446.  
  447.                   Example:             SBO 25
  448.  
  449.  
  450.         1.4.8     Group 6 Instructions
  451.  
  452.                   This   group   covers  the   Conditional   Jump 
  453.                   instrucions.     Note    that    the    maximum 
  454.                   displacement range is +127 to -128 words.
  455.  
  456.                   The   following  instructions  belong  to  this 
  457.                   group:
  458.                     
  459.                          JEQ JGT JH JHE JL JLE JLT JMP JNC JNE
  460.                          JNO JOC JOP
  461.  
  462.                   Instruction format:  [opcode|format2]
  463.  
  464.                   Example:             JEQ LABEL
  465.  
  466.  
  467. ...T2
  468.         1.4.9     Group 7 Instructions
  469.  
  470.                   This  group  have an Immediate  Source  Operand 
  471.                   with  an Workspace Register as the  Destination 
  472.                   Operand.
  473.  
  474.                   The   following  instructions  belong  to  this 
  475.                   group:
  476.  
  477.                          AI ANDI CI LI ORI
  478.                          BLSK (a TMS99105 instruction)
  479.  
  480.                   Instruction format:   [opcode|format5]
  481.                                         [    format6   ]         
  482.  
  483.                   Example:              AI R3,128
  484.  
  485.  
  486. ...T2
  487.         1.4.10    Group 8 Instructions
  488.  
  489.                   This  group  covers the Internal Register  Load 
  490.                   Immediate  Instructions and have  an  Immediate 
  491.                   Source Operand only.
  492.  
  493.                   The  following  instructions  belong  to   this 
  494.                   group:
  495.                          
  496.                          LWPI LIMI
  497.  
  498.                   Instruction format:   [ opcode  ]
  499.                                         [ format6 ]
  500.  
  501.                   Example:              LIMI 3
  502.  
  503.  
  504. ...T2    
  505.         1.4.11    Group 9 Instructions
  506.  
  507.                   This  group covers the Internal Register  Store 
  508.                   Instructions  and  have  Destination  Workspace 
  509.                   Register Addressing only.
  510.  
  511.                   The   following  instructions  belong  to  this 
  512.                   group:
  513.  
  514.                          STST STWP
  515.                          LST  LWP ( TMS99105 instructions )  
  516.  
  517.                   Instruction format:   [opcode|format5]
  518.                     
  519.                   Example:              STST R3
  520.  
  521. ...T2
  522.         1.4.12    Group 10 (TMS99105 only)
  523.           
  524.                   This group covers the Bit-Manipulation instruc-
  525.                   tions peculiar to the TMS99105.  This group has 
  526.                   a  different instruction format than the  basic 
  527.                   9900  set  insofar as the format fields lie  in 
  528.                   the 2nd word.   The instructions in this  group 
  529.                   are:
  530.                          TMB TCMB TSMC
  531.  
  532.                   Instruction format:   [     opcode     ]
  533.                                         [ format3|format1]
  534.                            
  535.                   Example:              TMB @BITMAP(R3),8
  536.  
  537. ...T1
  538.         1.5       Pseudo-operations
  539. ...T2
  540.         1.5.1     END
  541.  
  542.                   When   this  statement  is   encountered,   the  
  543.                   assembler  decides   that   the   end  of   the  
  544.                   source   file  has  been reached.     If   this  
  545.                   statement   is  missing  or  in  a  conditional 
  546.                   assembly block that is not being assembled, the  
  547.                   assembler  will  encounter end-of-file  on  the 
  548.                   source  file.    In this case,   the  assembler 
  549.                   will  attach an END statement  and will flag an 
  550.                   error.   The syntax  is  as follows:
  551.  
  552.                   [label]   END
  553.  
  554.                   If  any IF statement is not closed with an ENDI 
  555.                   at this point, an error will be flagged.
  556.  
  557.                   This statement permits no arguments.
  558.  
  559. ...T2
  560.         1.5.2     EQU
  561.  
  562.                   This  statement is used to assign  a  permenant 
  563.                   value  to  a symbol.    This value may  not  be 
  564.                   subsequently changed by a SET,  another EQU, or 
  565.                   by  writing the symbol in column 1 as a  label.  
  566.                   The syntax is as follows:
  567.  
  568.                   label     EQU  expression
  569.  
  570.                   A   phasing  (P)  error  will  result  if   any   
  571.                   forward  references   are  encountered  in  the 
  572.                   evaluation  of  the expression.
  573.  
  574. ...T2
  575.         1.5.3     BYTE
  576.  
  577.                   This  statement  is  used  to  place  bytes  in 
  578.                   memory.     Each   byte    is  defined  by   an 
  579.                   expression.    Multiple bytes can be defined by 
  580.                   expressions  separated  by  commas.     If   an 
  581.                   expression  evaluates to a quantity outside the 
  582.                   range -128  to 255,  an error is flagged.   The 
  583.                   syntax  is  as follows:
  584.  
  585.                   [label]   BYTE  [expr1][,epxr2].....
  586.  
  587. ...T2
  588.         1.5.4     TEXT
  589.  
  590.                   This  statement  is used to  place  strings  in 
  591.                   memory.   Its  arguments  may only be  strings.  
  592.                   Multiple strings may be placed  in  memory   if  
  593.                   the  strings  are  separated  by  commas.   The 
  594.                   syntax is as follows:
  595.  
  596.                   [label]   TEXT  [string][,string].....
  597.  
  598.  
  599. ...T2
  600.         1.5.5     WORD
  601.  
  602.                   This  statement  is  used  to  place  words  in 
  603.                   memory.     Each   word    is  defined  by   an 
  604.                   expression.    Multiple words may be defined by 
  605.                   expressions separated by  commas.    Words  are  
  606.                   placed  in memory with their high-order byte in 
  607.                   the low-order memory location and the low-order 
  608.                   byte  in the high-order memory  location.   The 
  609.                   syntax is as follows:
  610.  
  611.                   [label]   WORD  [expr1][,expr2].....
  612.  
  613. ...T2
  614.         1.5.6     BSS (Block Starting with Symbol)
  615.  
  616.                   This  statement is used to reserve a  block  of 
  617.                   memory   for  working   storage,    etc.     It 
  618.                   requires one argument that gives the number  of 
  619.                   bytes  of storage to  reserve.    The syntax is 
  620.                   as follows:
  621.  
  622.                   [label]   BSS  expression
  623.  
  624. ...T2
  625.         1.5.7     EVEN
  626.  
  627.                   This  statement  is used to force the assembler 
  628.                   to  align code on an even word boundary if  the 
  629.                   present  programme  counter  is  odd.   If  the 
  630.                   programme counter is odd a zero byte is  output 
  631.                   if   even  the  statement  is   ignored.    The 
  632.                   assembler will also flag an error is an attempt 
  633.                   is made to output code to an odd address.   The 
  634.                   syntax is as follows:
  635.                     
  636.                   [label]   EVEN 
  637.  
  638. ...T2
  639.         1.5.8     DXOP
  640.  
  641.                   This statement allows the programmer to  define 
  642.                   their   own   macro  instructions  around   the 
  643.                   Extended  Operation  Instruction  (XOP).    The 
  644.                   assemble  will  substitute the XOP code  for  a 
  645.                   given instruction in place of the name assigned 
  646.                   to the XOP.  The syntax is as follows:
  647.  
  648.                          DXOP PUSH,3    ;assign the name PUSH to
  649.                                         ;XOP number 3
  650.                   
  651.                   For  example if PUSH is a previously coded  XOP 
  652.                   which  pushes  registers  onto the  stack  then 
  653.                   instead  of coding this XOP instruction as  XOP 
  654.                   R3,3  you can code PUSH R3 - this will  produce 
  655.                   the  same code as XOP R3,3 but will   generally 
  656.                   make  the  programme far more easy  to  follow.  
  657.                   The 990 CPU's allow up to 15 XOP's.
  658.                     
  659.                     
  660. ...T2
  661.         1.5.9     Conditional Assembly
  662.  
  663.                   Blocks   of  code  can  be  assembled  or   not 
  664.                   assembled    based  on   the  value   of   some 
  665.                   expression.   The basic syntax is as follows:
  666.  
  667.                             IF   expression
  668.  
  669.                        (lines of code)
  670.  
  671.                             ENDI
  672.  
  673.                   If  the  expression evaluates to 0,   the  code 
  674.                   will not be assembled.    The source lines will 
  675.                   be  transfered  to the  listing,   but  no  hex 
  676.                   output will be generated.    It  is recommended  
  677.                   that   a  value  of $ffff be used for  a   true 
  678.                   value  since it turns into a false value  under  
  679.                   bitwise inversion.
  680.  
  681.                   In    addition,     the   ELSE   directive   is  
  682.                   supported  as follows:
  683.  
  684.                             IF   expression
  685.  
  686.                        (lines of code)
  687.  
  688.                             ELSE
  689.  
  690.                        (more lines of code)
  691.  
  692.                             ENDI
  693.  
  694.                   This is equivalent to:
  695.  
  696.                             IF   expression
  697.  
  698.                        (lines of code)
  699.  
  700.                             ENDI
  701.                             IF   NOT expression
  702.  
  703.                        (more lines of code)
  704.  
  705.                             ENDI
  706.  
  707.                   Note   that   labels  are  not   permitted   on  
  708.                   conditional  assembly directives.    Also  note 
  709.                   that   an  END   statement  can   fail   to  be 
  710.                   recognized if it is in  a  conditional assembly 
  711.                   block with a false expression.
  712.  
  713.                   A  phasing  (P) error will be flagged if  there 
  714.                   are  any forward references in the expression.
  715.  
  716. ...T2
  717.         1.5.10    AORG
  718.  
  719.                   This   statement   is  used  to load  a   value  
  720.                   into  the assembly program counter.   The value 
  721.                   is  obtained  from the  expression.    If   the 
  722.                   expression  contains   forward  references,   a 
  723.                   phasing  (P) error will result.  If a label  is 
  724.                   present,  it  will be EQUed to the new  program 
  725.                   counter value.  The syntax is:
  726.  
  727.                   [label]   AORG  expression
  728.  
  729. ...T2
  730.         1.5.11    SET
  731.  
  732.                   This  statement is used to assign  a  temporary 
  733.                   value  to  a symbol.    The  symbol may not  be 
  734.                   redefined by an EQU or by  writing it in column 
  735.                   1  as a label,   but it  may  be  redefined  by 
  736.                   another  SET  statement.    The value  for  the 
  737.                   symbol is obtained from the expression.   If it 
  738.                   contains  forward  references,   a phasing  (P) 
  739.                   error will  result.  
  740.                   The syntax is:
  741.  
  742.                   label     SET  expression
  743.  
  744. ...T1
  745.         1.6       Error Messages
  746.  
  747.                   Error   messages   are flagged with  a   single  
  748.                   letter   in column  1  of the offending line in 
  749.                   the   listing.    The  meaning of  each  letter 
  750.                   follows.
  751.  
  752.                        A    Presently not implemented.
  753.  
  754.                        B    Distance  on  a  branch   instruction  
  755.                             is    too   great.     Use   a   jump 
  756.                             instruction  with a branch around it,  
  757.                             or rearrange your code to shorten the 
  758.                             distance.
  759.  
  760.                        D    Digit  too  large for  the  base  was 
  761.                             encountered.   In particular,   watch 
  762.                             for 8 or 9 in an  octal number and a-
  763.                             f in a decimal number.
  764.  
  765.                        E    Expression ill-formed.   Look for non 
  766.                             arithmetic   characters  in   indexed 
  767.                             addressing modes.
  768.  
  769.                        I    If  stack imbalance.    Look for ELSE 
  770.                             or   ENDI  without   an IF or  an  IF 
  771.                             still open at the end of the file.
  772.  
  773.                        L    Invalid  label.    Label may  contain  
  774.                             invalid characters  or  be equal to a  
  775.                             reserved  word like NOT.    Label may 
  776.                             be present on  a conditional assembly 
  777.                             directive.
  778.  
  779.                        M    Label   multiply   defined.     Label 
  780.                             defined   more  than  once  and   all 
  781.                             definitions are not SET statements.
  782.  
  783.                        O    Invalid     opcode.       Look    for  
  784.                             misspellings,  missing semicolons, or 
  785.                             opcodes in column 1.
  786.  
  787.                        P    Phasing error.   Look for expressions 
  788.                             in   ORG,    EQU,    SET,    or    IF  
  789.                             directives    that   contain  forward 
  790.                             references.  If none exist, something 
  791.                             wierd is going on as a label that was 
  792.                             defined   in  pass   1   mysteriously 
  793.                             vanished in pass 2.
  794.  
  795.                        R    Register value too large.   Registers 
  796.                             values  between  0  and 15  only  are 
  797.                             allowed.  This error will most likely 
  798.                             occur  if a register value  is  being 
  799.                             evaluated  from  an expression  which 
  800.                             overflows.
  801.  
  802.                        S    Syntax  error.    Check  your  syntax 
  803.                             against  my samples.
  804.  
  805.                        T    Too     many   arguments   on    this  
  806.                             line.     WORD  directives  may  only 
  807.                             define  127  words,   while TEXT  and  
  808.                             BYTE directives may only define   255 
  809.                             bytes.      On    other   statements,   
  810.                             you    put  superfluous arguments  on 
  811.                             the line.
  812.  
  813.                        U    Undefined     symbol      encountered     
  814.                             during expression evaluation.
  815.  
  816.                        V    Value     out    of   bounds.      In  
  817.                             particular,   FCB expressions  and 8-
  818.                             bit  immediate values  must  evaluate  
  819.                             to -128 to 255,   while index  values 
  820.                             must evaluate to 0 to 255.
  821.  
  822.                        *    This   statement  generated  by   the  
  823.                             assembler.   Right   now,   this only 
  824.                             happens   if   you   drop   an    END   
  825.                             statement      or      remove      it    
  826.                             through conditional assembly.
  827.  
  828.                        "    Quote   imbalance  error.    Bear  in 
  829.                             mind  that  ' will  not  terminate  a 
  830.                             string  started   with  "  and  vice-
  831.                             versa.
  832.  
  833.                        (    Parenthesis  imbalance error.   Count 
  834.                             them!
  835.  
  836. ...T1
  837.         1.7       Assembler Abort Conditions
  838.  
  839.                   Under  certain circumstances,   this  assembler 
  840.                   will  just give up and quit in the middle of an 
  841.                   assembly.    If you don't  get the error  count 
  842.                   diagnostic on  the  console, read  your  screen 
  843.                   for sure!   The  following  messages occur:
  844.  
  845.                        1)   Can't open source.
  846.  
  847.                             The    source  file  does  not  exist  
  848.                             on  the specified disk drive.
  849.  
  850.                        2)   Can't open list.
  851.                             Can't open hex.
  852.  
  853.                             No   directory  entries left  on  the 
  854.                             disk  drive in question.
  855.  
  856.                        3)   Illegal command line.
  857.  
  858.                             Bone up on command lines.
  859.  
  860.                        4)   No file info supplied.
  861.  
  862.                             Bone up on command lines.
  863.  
  864.                        5)   If stack overflow.
  865.  
  866.                             IF   directives  may only  be  nested  
  867.                             16   deep.    Rebuild   your   source  
  868.                             code  to  reduce  your nesting depth, 
  869.                             or  change  the "#define IFDEPTH  16"  
  870.                             statement in xasm99.gbl and recompile 
  871.                             the assembler.
  872.  
  873.                        6)   Disk read error.
  874.  
  875.                             Source   file   has  a  bad  CRC   or  
  876.                             some  other difficulty.
  877.  
  878.                        7)   Disk write error.
  879.  
  880.                             Out of disk or directory space on the 
  881.                             list or hex file.
  882.  
  883.                        8)   Error closing file.
  884.  
  885.                             Problem    closing   list   or    hex  
  886.                             file.    You shouldn't get this one.
  887.  
  888.                        9)   Symbol Table Overflow.
  889.  
  890.                             Your  source program defines too many 
  891.                             symbols.   The  current limit is 500.   
  892.                             If  you have more memory than  I  do, 
  893.                             you  can change the "#define  SYMBOLS    
  894.                             500" line in a99.gbl  and   recompile 
  895.                             the    assembler.    Otherwise,   you 
  896.                             must work on your source code.
  897.  
  898. ...T1
  899.         1.8       Compiling the Assembler
  900.  
  901.                   To   compile the assembler as it  stands,   you 
  902.                   will  need the following items:
  903.  
  904.                        1)   40K of RAM.
  905.  
  906.                        2)   The BDS C Compiler Version 1.5
  907.                             (good box, Leor!!).
  908.  
  909.                        3)   Digital   Research's   ASM   or   MAC 
  910.                             assembler.   (Note:   Only  needed if 
  911.                             you want to play  with the  functions  
  912.                             in  a99tbls.mac as they  exist in   a  
  913.                             form  digestible  by  CLINK  in   the  
  914.                             file xasm99.crl.)
  915.  
  916.                   To  get  a99tbls.crl  up  from  scratch,    you  
  917.                   do   the  following.    I   assume   all  files 
  918.                   including ASM or MAC live on drive A.
  919.  
  920.                        A>casm a99tbls        ;source a99tbls.csm
  921.  
  922.                   This should yield a file a99tbls.asm on drive A.
  923.  
  924.                        A>mac  a99tbls $pz -s  ;may use asm fn.aaz 
  925.  
  926.                A>cload  a99tbls       ;produce CRL file 
  927.  
  928.                  You  should  now have a99tbls.crl on  drive  A.
  929.  
  930.                   Now  you  are ready to compile the rest of  the 
  931.                   beast.
  932.  
  933.                        A>cc a99
  934.                        A>cc a99asmlnc
  935.                        A>cc a99evalc
  936.                        A>cc a99getc
  937.                        A>cc a99putc
  938.                        A>cc a99symbc
  939.  
  940.                   Now you can link it all together.
  941.  
  942.                        A>clink a99 -s
  943.  
  944.                        *a99asmln
  945.                        *a99eval
  946.                        *a99get
  947.                        *a99put
  948.                        *a99symb
  949.                        *a99tbls
  950.  
  951.                   And, as if by magic, you've got a99.com!
  952.  
  953.                   Note  that  the linkage can all be done on  one 
  954.                   line,   but my paper isn't wide enough here  to 
  955.                   do  it  that way.  Note  that if you have  more 
  956.                   than 40K of  RAM,   you  may want  to  increase 
  957.                   your symbol table size.    Symbols are 10 bytes 
  958.                   each, so plan accordingly.
  959.  
  960.  
  961. ...T1
  962.         1.9       Final Comments
  963.                   Happy   assembling!    If you have questions or 
  964.                   note   any bugs,    I'd   appreciate  a   shout  
  965.                   at    (617)258-1204,  (617)266-3179  or on  the 
  966.                   Boston CBBS at  (617)963-8310.   The  questions 
  967.                   will  point up weaknesses in the   manual,  and 
  968.                   the bugs need to be stamped upon unmercifully.
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.