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

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