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

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