home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / beehive / program / xasm.arc / XASM09.HLP < prev    next >
Encoding:
Text File  |  1990-08-26  |  19.3 KB  |  533 lines

  1. Introduction to XASM09.COM
  2. Running the Cross-Assembler
  3. Source file syntax
  4. Pseudo-Operations
  5. Errors
  6. Listing format
  7. Error messages
  8. Object file format
  9. :XASM0╣  i≤  ß  cross-assemble≥ designeΣ t∩ ruε oε  an∙  CP/═  8░ ì
  10. machine«áá   I⌠á   generate≤á  codσá  fo≥á  thσá  Motorolßá  680╣ ì
  11. microprocessor¼á i⌠á accept≤á standarΣá Motorolßá mnemonic≤á  anΣ ì
  12. syntax.
  13.  
  14. XASM09 accepts its input from a CP/M text file,  and generates as 
  15. output  an  object  code  file,   an  assembly  listing,  and  an 
  16. alphabetized listing of all symbols defined in the assembly.  The 
  17. object  file may be in Intel HEX format or Motorola S1 format  or 
  18. may be omitted altogether, at the user's discretion. The listings 
  19. are  normally  sent  to  the system's LIST  device,  but  may  be 
  20. directed to the console or to a disk file.
  21.  
  22.  
  23. :Invoking the 6809 cross-assembler.
  24.  
  25.      XASM09 {d:}filename{.ext} {d:} {switches}
  26.  
  27. Where  the  d:'s  are optional  drive  specifiers,  the  filename
  28. extension is optional and if omitted defaults to .ASM. The second
  29. drive  name  specifies  the destination of any  output  from  the
  30. cross-assembler if omitted the output files will be placed on the
  31. default  drive.  The  switches are (optional)  single  characters
  32. which control the output of the assmbler, as described below.
  33. XASM09 Switches
  34.  
  35. The switches following the filename, if supplied, control various
  36. options as follows:
  37.  
  38. C    Send listing, if any,  to console instead of LST:
  39. D    Send listing, if any,  to disk file with same name as source
  40.      file but with an extension of `.PRN'.
  41. K    Generate object code in Motorola S1 format rather than Intel
  42.      he°á format¼á thσá objec⌠á filσá tha⌠ i≤á generateΣá ha≤á aε ì
  43.      extension of `.MIK'.
  44. L    Listing only; i.e. no object file.
  45. O    Object only; equivalent to XY
  46. X    No assembly listing.
  47. Y    No symbol-table listing
  48.  
  49. An∙á combinatioε oµ thσ switche≤ ma∙ bσ useΣ t∩ achivσ ßá desireΣ ì
  50. output.
  51. Clarification
  52. -------------
  53. Whilσ thi≤ ma∙ bσ misseΣ oε ß cursor∙ readinτ oµ thσ manual¼á thσ ì
  54. defaul⌠ destinatioε fo≥ thσ assembl∙ listinτ i≤ thσ PRINTER«á  Iµ ì
  55. thσ printe≥ i≤ no⌠ ready¼ o≥ n∩ printe≥ i≤ present¼ thσ assemble≥ ì
  56. wil∞ appea≥ t∩ "hanτ up"«á  Notσ tha⌠ line≤ containinτ error≤ arσ ì
  57. alway≤á listed¼á eveεá iµá thσá "Oó o≥á "Xóá switche≤á havσá beeε ì
  58. specified.
  59.  
  60. Listing output can be diverted to the console or to a PRN file by
  61. using the "C" and "D" switches, respectively, in the command line.
  62.  
  63. :Syntax of Assembler Source Files
  64.  
  65. Statements
  66.  
  67. Source  files  consist of a sequence of statements of one of  the
  68. forms:
  69.  
  70.      {label:}  operator  {arguments}    {;comment}
  71.  
  72.      symbol    operator  {arguments}    {;comment}
  73.  
  74.      {;comment}
  75.  
  76. If  a  label or a leading symbol is present,  it  must  begin  in
  77. column  1.  Labels must be followed by a colon.  Blank lines  are
  78. treated as comments.  Elements of a statement may be separated by
  79. blanks or tabs.
  80. Symbols
  81.  
  82. Symbols may be up to 8 characters in length,  and may include any
  83. of the following characters:
  84.  
  85.     A..Z      0..9      $    .
  86.  
  87. The first character of a symbol must be a letter or a period.
  88. Numeric Constants
  89.  
  90. Numeric  constants  consist of a sequence of  digits,  optionally
  91. preceeded or followed by a radix specifier.  The first  character
  92. must  be  either a leading radix specifier or  a  decimal  number
  93. (0..9). The default radix is ten. For compatibility with existing
  94. assemblers,  other  bases may be denoted by either a leading or a
  95. trailing specifier. The radix specifiers are:
  96.  
  97.      % (binary)     @ (octal)      $ (hex)
  98.  
  99. The trailing specifiers are:
  100.  
  101.      B (binary)     Q (octal)      H (hex)
  102. Character Constants
  103.  
  104. Character  constants  may  be used whenever a  numeric  value  is
  105. allowed.  A character constant consists of one or two  characters
  106. enclosed  in single or double quotes (' or ").  The single  quote
  107. may be used as a character between double quotes, and vice-versa.
  108.  
  109. Thus, the following are equivalent:
  110.  
  111.           'A'  "A"  and  41H
  112.  
  113.           'AB' "AB" and  4142H
  114.  
  115. Location-Counter Reference
  116.  
  117. The  character "$" may be usd as an element in  expressions.  Its
  118. value  is the value of the location counter at the  beginning  of
  119. the current statement.
  120. Expressions
  121.  
  122. Arithmetic   expressions   are  composed  of   symbols,   numeric
  123. constants,  character  constants,  and operators.  All  operators
  124. execpt +, -, *, and / must be separated from thier operands by at
  125. least one space.  Symbols which are operators are  reserved,  and
  126. may not be redefined as user symbols.
  127. Arithmetic Operators
  128.  
  129. These  treat  their operands as 16-bit unsigned  quantities,  and
  130. return 16-bit results. No overflow checking is performed.
  131.  
  132. + and -        Sum and Difference. Operands and results may be
  133.                thought of  as  unsigned or  as twos-complement
  134.                quantities.
  135.  
  136. unary +        +x is defined as 0+x
  137.  
  138. unary -        -x is defined as 0-x
  139.  
  140. * /            Product and Quotient (unsigned)
  141.  
  142. MOD            Remainder;
  143.                x MOD y gives the remainder of x/y
  144. Shift Operators
  145.  
  146. SHL            Binary left shift.  x SHL y yields x shifted left
  147.                y places (ie. x multiplied by 2**y).
  148.  
  149. SHR            Binary right shift,  logical.  x  SHR  y yields x
  150.                shifted right y places (ie. x multiplied by 2**y).
  151.  
  152. The direction of shift is reversed if the argument is negative.
  153.  
  154. Byte-Extraction Operators
  155.  
  156. HIGH           Returns the value of the most significant byte  of
  157.                its argument.
  158.  
  159. LOW            Returns the value of the least significant byte of
  160.                its argument.
  161.  
  162. These are unary operators,  taking an argument on the right.  For
  163. example:  HIGH 1122H is 11H, and LOW 1122H is 22H.
  164. Boolean Operators
  165.  
  166. NOT            Unary logical negation.  Complements all the  bits
  167.                in its argument.
  168.  
  169. AND            Logical product;   ie.  each bit of the result  is
  170.                obtained by ANDing together the corresponding  bit
  171.                in the arguments.
  172.  
  173. OR             Logical sum.
  174.  
  175. XOR            Exclusive-OR.
  176. These are all bitwise operators;  that is,  the same operation is
  177. performed  on each operand bit position,  with no carry from  one
  178. bit position to the next.
  179.  
  180. For example:   NOT 0 is 0FFFFH
  181.                101B AND 010B is  
  182.                101B OR  010B is 111B
  183.                101B XOR 010B is 111B
  184.                101B XOR 100B is 001B
  185. Relational Operators
  186.  
  187. These  perform  unsigned  16-bit comparison  of  their  operands,
  188. returning 1 for TRUE and 0 for FALSE.
  189.  
  190. For  comparison  x R y,  where R is a  relational  operator,  the
  191. results are as follows:
  192.  
  193. EQ        TRUE iff x and y are equal
  194. NE        TRUE iff x and y are not equal
  195. LE        TRUE iff x is less than or equal to y
  196. LT        TRUE iff x is strictly less than y
  197. GE        TRUE iff x is greater than or equal to y
  198. GT        TRUE iff x is strictly greater than y
  199. Evaluation of Expressions
  200.  
  201. Parentheses  may  be used to specify the order of  evaluation  of
  202. subexpressions.  In  the  absence of parentheses,  this order  is
  203. determined  by operator precedence;  higher-precedence  operators
  204. are  evaluated  first.  In  the  case  of  operators  with  equal
  205. precedence, evaluation proceeds from left to right. The operators
  206. are lited below in groups according to precedence.  Operators  in
  207. the same horizontal group have the same precedence:
  208.  
  209.      unary +, unary -                   (Highest precedence)
  210.      HIGH  LOW
  211.      * / MOD SHR SHL
  212.      + -
  213.      EQ NE LT LE GT GE
  214.      NOT
  215.      AND
  216.      OR XOR                             (Lowest precedence)
  217. :Pseudo-Operations
  218.  
  219. Storage Definition
  220.  
  221. DB   arg{,arg...}
  222.  
  223.      Define  bytes.  Each  arg may be either an expression  or  a 
  224.      string. Expressions must evaluate to 8-bit values (high byte 
  225.      either  0  or 255).  Strings may be delimited by  single  or 
  226.      double quotes, as for character constants.
  227.           Fo≥á eacΦá expression¼á  ßá singlσ bytσ oµá storagσá i≤  ì
  228.      reserved¼á initializeΣ  t∩ thσ lo≈ bytσ oµ thσá expression'≤ ì
  229.      value«  Fo≥ eacΦ  string¼  thσ  character≤ oµ thσ strinτ arσ  ì
  230.      storeΣ  iε sequentia∞ reserveΣ bytes.
  231.      If a compound expression beginning with a character constant
  232.      is  used in a DB,  then the expression must be  enclosed  in 
  233.      parentheses  to  keep it from being incorrectly parsed as  a 
  234.      string. For example,
  235.  
  236.           DB ('A'+1)     will give the expected result, while
  237.  
  238.           DB 'A'+1       would be in error.
  239.  
  240. DW   expression{,expression}
  241.  
  242.      Each expression reserves one word (2 bytes),  initialized to 
  243.      the  value of the expression.  The value is placed in memory 
  244.      with the high-order byte first.
  245.  
  246. DS   expression
  247.  
  248.      Reserves  n bytes,  where n is the value of the  expression. 
  249.      The bytes are not initialized.
  250. ORG and END
  251.  
  252. ORG expression
  253.  
  254.      Set  program  origin.  This should precede the  first  code-
  255.      generating statement in the souce file.  It sets the program 
  256.      counter initial value to the value of the  expression,  thus 
  257.      setting  the location of code which follows.  Additional ORG 
  258.      statements which will load at different locations.
  259.  
  260. END {expression}
  261.  
  262.      The  last  statement  of  the source file  must  be  an  END 
  263.      statement.  An  optional  argument is allowed;  if  this  is 
  264.      supplied,  its value becomes the start address specified  in 
  265.      the last record of the HEX object file.
  266. Symbol Definition
  267.  
  268. EQU and SET
  269.  
  270.      These take the form:
  271.  
  272.           symbol    EQU  expression
  273.           symbol    SET  expression
  274.  
  275.      They  cause the symbol to be defined and given the value  of 
  276.      the  argument expresson.  Symbols defined with EQU serve  as 
  277.      symbolic  constants,  and may not have their values changed. 
  278.      Symbols  defined with SET are treated  as  variables;  their 
  279.      values may be changed by additional SET's
  280. Conditional Assembly
  281.  
  282. IF, ELSE, and ENDIF
  283.  
  284. The construct
  285.  
  286.      IF expression
  287.      statement
  288.      .
  289.      .
  290.      .
  291.      ENDIF
  292.  
  293. causes  the  first sequence of statements to be processed if  the 
  294. expression  is  TRUE (non-zero),  and the second sequence  to  be 
  295. processed otherwise.
  296.  
  297. Conditionals  may be nested to a depth of 10.  The value  of  the 
  298. expression if the IF statement must be known in Pass 1.
  299. Listing Control
  300.  
  301. PAGE {expression}
  302.  
  303.      If  the argument is omitted,  then this causes an  immediate 
  304.      page eject (ie.  a skip to the top of the next page).  If an 
  305.      argument  is supplied occurs only if there are less  than  n 
  306.      lines remaining on the current page.
  307.  
  308. WIDTH expression
  309.  
  310.      Sets the assumed width of the listing page. The value of the 
  311.      argument may be between 32 and 132, and defaults to 132.
  312.  
  313. PGLEN expression
  314.  
  315.      Sets  the number of lines which will be printed on each page 
  316.      of  the listing.  Note that the page heading takes up  7  of 
  317.      these lines.  The value of the argument may be between 8 and 
  318.      255, and defaults to 58.
  319. TITLE dtextd
  320.  
  321.      Cause  the specified text to become the listing page  title, 
  322.      beginning with the next page header printed. The delimiter d 
  323.      may be any printing character.
  324.  
  325.      If  no  TITLE  statement is used,  then  XASM09  supplies  a 
  326.      default  title consisting of the text "SOURCE FILE  NAME:  " 
  327.      followed by the name and extension of the input file.
  328.  
  329. SBTTL dtextd
  330.  
  331.      Just like TITLE,  but sets the listing page subtitle,  which 
  332.      is printed on the line after the title line.
  333.  
  334. LIST and NOLIST
  335.  
  336.      These  allowselective  listing  of portions  of  a  program. 
  337.      NOLIST  turns  off the assembly listing,  and LIST turns  it 
  338.      back on. If listing has bee turned off with NOLIST, then the 
  339.      next  LIST encountered will begin a  new  page.  Commnd-line 
  340.      switches  which  disable  listing (ie.  X and O)  will  take 
  341.      precedence  over LIST.  NOLIST does not turn off listing  of 
  342.      the symbol table.
  343. External Source File
  344.  
  345. INCLUD d:name.ext
  346.  
  347.      This  pseudo-op causes the specified file to be included  as 
  348.      if  it  were  present  at this point  in  the  source  file. 
  349.      INCLUD's  may  not  be nested;  that is,  the file  read  by 
  350.      INCLUD  may not contain another INCLUD statement.  The  file 
  351.      must end with an END statement.
  352. Operator Synonyms
  353.  
  354. The Statement
  355.  
  356.      symbol    OPSYN     operator
  357.  
  358. causes  the  given  symbol to be defined as  a  synonym  for  the 
  359. operator or pseudo-op specified as argument. This is particularly 
  360. useful when assembling source file written for another assembler. 
  361. For example,  if a program uses .BYTE instead of DB,  it could be 
  362. correctly assembled by including the statement
  363.  
  364.      .BYTE     OPSYN     DB
  365. :Errors
  366.  
  367. Fatal  errors  result in the printing of an error message on  the
  368. console and immediate return to CP/M.  Fatal errors may be caused
  369. by missing source files,  inadequate disk space for output files,
  370. or overflow of the symbol table or various stacks.
  371.  
  372. Non-fatal errors are flagged with a character in the first column
  373. of  the  assembly listing.  Lines containing  errors  are  always
  374. listed,  even if listing is turned off.  A count is maintained of
  375. lines  containing errors;  if the count is non-zero at the end of
  376. the assembly, it is printed on the console in the message:
  377.  
  378.      ***** nnn LINES CONTAINED ERRORS *****
  379.  
  380. Only  one error is listed per line;  hence,  if a  line  contains
  381. multiple errors some may not be caught until successive assembler
  382. runs«á Thσá  fata∞ erro≥ message≤ anΣ non-fata∞ erro≥á flag≤á arσ ì
  383. describeΣ later.
  384. :Format of Listings
  385.  
  386. Page Headings
  387.  
  388. All listings begin with a heading consisting of seven lines:
  389.  
  390.                           (blank line)
  391.      (blank line)
  392.      (assembler name and version)
  393.      (blank line)
  394.      (title and page number)
  395.      (subtitle)
  396.      (blank line)
  397. If no title is supplied in the source program, then the assembler
  398. provides a default title consisting of the message
  399.  
  400.      SOURCE FILE NAME:
  401.  
  402. followed by the name of the input file in the form name.ext. The
  403. page  number  is listed at the right-hand end of this same  line,
  404. always within the specified page width.
  405.  
  406. If no subtitle is supplied, the subtitle line is left blank. Both
  407. title and subtitle will be truncated,  if necessary,  to  satisfy
  408. page width constraints.
  409. Line Headings
  410.  
  411. Each  code-generating  line of the listin begins with  the  error
  412. flag (blank if no error) and the 4-digit hexadecimal value of the
  413. location counter as of the start of the line. This is followed by
  414. up to four bytes of generated code,  also in hexadecimal with two
  415. digits per byte. Statements which generate more than 4 bytes will
  416. be  assembled  correctly,  but only the first four bytes will  be
  417. listed.  Lines  which do not generate code but which evaluate  an
  418. operand  (such as EQU or WIDTH) list the operand value  in  their
  419. headers, in place of the location counter.
  420. Symbol-Table Listing
  421.  
  422. The symbol-table listing shows all symbols defined in the current
  423. assembly,   with  their  hexadecimal  values.  Only  user-defined
  424. symbols  are  listed.  Symbols are in  vertical  columns,  sorted
  425. alphabetically  according  to the ASCII collating  sequence.  The
  426. number  of  columns  is  adjusted automatically  to  fit  in  the
  427. specified page width.  All pages of the symbol-table listing  are
  428. automatically subtitled.
  429.  
  430.      ---- SYMBOL TABLE ----
  431.  
  432. Because  the sorting scheme used is strictly  lexicographic,  the
  433. way it orders numbers may be counterintuitive. A typical sequence
  434. of labels might be listed as follows:
  435.  
  436.      SYM19, SYM2, SYM21, SYM3, SYM4
  437. :Error Messages and Flags
  438.  
  439. Non-Fatal Error Flags
  440.  
  441.      C    Conditional Err     Unmatched IF, ELSE, or, ENDIF; or
  442.                               conditionals nested too deeply.
  443.  
  444.      I    Includ Err          File not found, or nested INCLUD's.
  445.  
  446.      L    Label Err           Label too long. (>8 characters)
  447.  
  448.      M    Multipule Defn      Symbol already defined.
  449.  
  450.      O    Operator Err        Undefined or illegal operator
  451.  
  452.      P    Phase Err           Symbol has different value on pass
  453.                               2 than on pass 1
  454.  
  455.      R    Range Err           Argument out of bounds, branch out
  456.                               out of range, or illegal register
  457.  
  458.      S    Syntax Err          Ill-formed argument or expression
  459.  
  460. Fatal Error Messages
  461.  
  462.  
  463. SOURCE FILE NOT FOUND              The specified source file
  464.                                    doesn't exist.
  465.  
  466. UNABLE TO CREATE OUTPUT FILE       The directory is full on the
  467.                                    disk specified for output
  468.  
  469. OUTPUT FILE WRITE ERROR            The output disk is full
  470.  
  471. EVALUATION STACK IS FULL           An arithmetic expression was
  472.                                    encountered which had too many
  473.                                    levels of parentheses or of
  474.                                    precedence nesting
  475.  
  476. SYMBOL TABLE FULL                  Not enough memory remains to
  477.                                    to create a table entry for a
  478.                                    symbol being defined.
  479. Non-Fatal Error Messages
  480.  
  481. NO ROOM FOR SYMBOL-TABLE SORT      Not enough memory is available
  482.                                    to sort the symbol table.
  483.                                    Symbol-table listing is
  484.                                    therefore omitted.
  485. :Object File Format
  486.  
  487. Objec⌠ file≤ caε bσ iε onσ oµ tw∩ formats« Thesσ arσ eithe≥ Inte∞ ì
  488. HE╪ forma⌠ o≥ Motorolß S▒ format«á Thσ extensioε fo≥ aε Inte∞ HE╪ ì
  489. forma⌠á filσá i≤á `.HEXº anΣ thσ extensioε fo≥á thσá Motorolßá S▒ ì
  490. format file is `.MIK'. (See option switch K in section B)
  491.      Inte∞ HE╪ format¼ whicΦ represent≤ binar∙ datß byte≤ a≤ two-ì
  492. digi⌠á ASCI╔á hexadecima∞ numbers«á Aε objec⌠ filσ consist≤ oµá ß ì
  493. sequencσ oµ datß records¼ followeΣ b∙ ß singlσ enΣ record.
  494.      Thσá  checksuφá i≤ thσ two'╙ complemen⌠ oµ thσá 8-bi⌠á  sum¼  ì
  495. withou⌠á carry¼á  oµ al∞ thσ datß bytes¼á thσ tw∩ byte≤á oµá loaΣ ì
  496. address¼ anΣ thσ bytσ count.
  497. The record formats are:
  498.  
  499.      Data Record:
  500.  
  501.      Byte 1         Colon (:)
  502.           2..3      Number of binary data bytes in this record.
  503.           4..5      Load address for this record, high byte.
  504.           6..7      Load address  "   "     "     low byte
  505.           8..9      Unused, should be "00".
  506.           10..X     Data bytes, two characters each.
  507.           X+1..X+2  Checksum  (2 characters).
  508.           X+3..X+4  CR/LF
  509.      End Record:
  510.  
  511.      Like data record,  but number of data bytes is zero and the
  512.      load address field contains the program starting address.
  513. Motorolßá S▒ format¼á whicΦ represent≤ binar∙ datß byte≤ a≤á two-ì
  514. digi⌠á ASCI╔ hexadecima∞ numbers«á Aε objec⌠ filσ consist≤á oµá ß ì
  515. sequencσ oµ datß records¼ followeΣ b∙ 'S9º t∩ indicatσ thσ enΣ oµ ì
  516. the data block.
  517.  
  518. The record formats are:
  519.  
  520.      Data Record:
  521.  
  522.      Byte 1         'S'
  523.           2         '1'
  524.           3..4      Number of binary data bytes in this record.
  525.           5..6      Load address for this record, high byte.
  526.           7..8      Load address  "   "     "     low byte
  527.           9..X      Data bytes, two characters each.
  528.           X+1..X+2  Checksum  (2 characters).
  529.           X+3..X+4  CR/LF
  530.  
  531. The  checksum is the two'S complement of the 8-bit  sum,  without
  532. carry,  of all the data bytes, the two bytes of load address, and
  533. the byte count.