home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / spasm201.lbr / SPASM.DZC / SPASM.DOC
Encoding:
Text File  |  1988-09-02  |  8.5 KB  |  224 lines

  1. QUICK REFERENCE FOR SPASM (SINGLE PASS ASSEMBLER) UNDER CP/M-80
  2.  
  3. Written by: Harris Landsberg       (C) Copyright 1986,1987,1988
  4.  
  5.      This documentation will aquaint you with the basics of the
  6. SPASM  software  package.  It has been extracted  from the more
  7. detail documentation  previously  written.  Please refer to the
  8. SPL Language Manual for more detail about module interfacing in
  9. object libraries. SPASM.COM  requires  CP/M-80  Version 2.2  or
  10. higher. The cross-assembler SPASM80.EXE requires MS-DOS Version
  11. 2.0 or higher.  SLINK.COM  (or SLINK80.EXE) is required to link
  12. the object files that are created with SPASM.
  13.  
  14.      SPASM is a single pass assembler which means it only makes
  15. one pass through the source to produce the object code file. In
  16. most other assembler require two or more passes.  The code that
  17. is generated is fully relocatable containg the necessary symbol
  18. imformation to produce a command file from multiple object code
  19. files and use common libraries to extract only imported modules
  20. that are necessary for the load module.
  21.  
  22.      An optional Librarian, SLIB, can optimize a object file to
  23. remove symbol references that should not be global. It can also
  24. create library files  by combining one or more modules from one
  25. or more object code files.  This is similar to having  multiple
  26. modules within an assembler source.
  27.  
  28. A: INSTRUCTION SET
  29.  
  30.      SPASM uses the standard INTEL 8080 mnemonics with no extra
  31. modifications for the Z-80 opcodes. It does not contain a macro
  32. facility.  All labels defined  or used are global.  It does not
  33. use EXTRN or ENTRY instructions, but implies it. Most assembler
  34. source written for the  standard CP/M  ASM.COM program will run
  35. without requiring modifications.
  36.  
  37.      SPASM statement format is:
  38.  
  39.      Label     Operation    Operand    ;Comment
  40.  
  41. where any or all fields may be absent. A ':' (colon) may follow
  42. a label, but is not required. Only one operation is allowed per
  43. line.  Only addition, subtaction, multiplication, division  can
  44. be done on operands  that are not registers.  Numeric constants
  45. may be decimal or hexidecimal if followed by a 'H'. All symbols
  46. are changed to uppercase and significant to 31 characters.
  47.      
  48.      The '$' by itself implies the current CODE counter and can
  49. be used in word sized operands. SLINK defines ?CODE ?DATA ?HEAP
  50. so they should not be defined, but can be referenced.
  51.  
  52. B: PSEUDO-MNEMONICS
  53.  
  54.      The following, in alphabetic order, are the pseudo-ops for
  55. SPASM. There are two segments: CODE and DATA. CODE contains all
  56. the relocatable and absolute text segments  while DATA contains
  57. the uninitilized main storage section.  All opcodes are implied
  58. to the CODE segment, if they generate code or use space, except
  59. the VAR opcode which is for  variables and defines the usage of
  60. the DATA segment. SLINK combines the segments.
  61.  
  62.      DB        <byte>[,<byte>...]
  63.  
  64.      Defines a byte storage area for constants. Can be a single
  65. or multi-character string. Strings begin and end with a ' only.
  66.  
  67. <label>    DL      <value>
  68.  
  69.      Defines a value to the assembler.  The  DL  statement does
  70. not this symbol into the object code and therefore local to the
  71. source that is being assembled. See EQU.
  72.  
  73.      DS        <size>
  74.  
  75.      Defines space in memory that will be reserved.  SLINK will
  76. initilize it to 00H.
  77.  
  78.      DW        <word>[,<word>...]
  79.  
  80.      Defines a word storage area for constants. Can be a string
  81. of up to two characters.
  82.  
  83.      ELSE
  84.  
  85.      Allows alternate code generation in a conditional when the
  86. condition fails.  May not be  used with a link conditional.  It
  87. must be within
  88. an IF and ENDIF statement.
  89.  
  90.      END
  91.  
  92.      Defines the end of a source assembler program. SPASM stops
  93. here if not within a conditional.
  94.  
  95.      ENDIF
  96.  
  97.      Signifies the end of a conditional block. A termination of
  98. a conditional is required and cannot be nested.
  99.  
  100. <label>    EQU     <value>
  101.  
  102.      Defines a value to the assembler. The EQU statement passes
  103. this symbol into the object code and can be used by a different
  104. module. See DL.
  105.  
  106.      IF        <symbol>
  107.  
  108.      Allows assembly of a section of code  if a symbol is not a
  109. value of zero. The symbol may be a label or a constant and must
  110. be defined prior if it is a label. See XIF.
  111.  
  112.      IMPORT    <name>[,<name>...]
  113.  
  114.      Defines the modules that are required to complete all code
  115. references. It is used by SLINK to combine code and extract the
  116. necessary modules from a library.
  117.  
  118.      INCLUDE   <name>
  119.  
  120.      The include file is opened and  assembled into the current
  121. source file. Only one level is allowed. <name> can have a drive
  122. and/or user designator in front and should have an extension of
  123. .ASM to include a .ASM file.
  124.  
  125.      LIBRARY   <name>[,<name>...]
  126.  
  127.      Defines a name for an object code file to be  searched for
  128. module references. <name> may have a drive and/or user in front
  129. of it.  A library file is a standard object code  file with one
  130. or more modules in it.
  131.  
  132.      ORG       <value>
  133.  
  134.      For compatibility  with other  assemblers.  Will start the
  135. assembly listing  at the specified value,  but has no effect on
  136. the  code generated.  The MODULE statement will set the counter
  137. back to 0 when starting a module.
  138.  
  139.      MODULE    <name>
  140.  
  141.      Defines the beginning of a module and assigns it a name. A
  142. module is unit of code with a unique  name that can be imported
  143. while being search for.  It is a collection of code that cannot
  144. be subdivided to complete a single task.  This task may be need
  145. other support module which are imported.  Module end is implied
  146. by end of file or start of another module. The beginning of the
  147. source implies a module which defaults to  the source file name
  148. unless a MODULE statement is first opcode in file.
  149.  
  150. <label>    VAR     <value>
  151.  
  152.      Defines a variable for the program. <value> is the size in
  153. bytes that the variable requires.  <label> is a required field,
  154. but can be removed with SLIB  (Librarian) if you want to make a
  155. variable local.  The VAR statement defines the unitilized space
  156. after the CODE segment known as the DATA segment.
  157.  
  158.      XIF       <label>
  159.  
  160.      Allows assembly of a section of code  with the conditional
  161. being resolved at link time. It allows special modifications or
  162. routines to be  included or excluded  according to a  condition
  163. that will be not be fully known until link time.  This is known
  164. as a LINK CONDITIONAL structure and SLINK supports it.
  165.  
  166. C: ERROR CODES
  167.  
  168.      Besides file errors,  the following errors will be flagged
  169. by the assembler. A single uppercase character is placed at the
  170. first first position of the line.
  171.  
  172.      C - invalid operation code
  173.      F - file not found (INCLUDE statement)
  174.      L - invalid label
  175.      M - multi-defined symbol
  176.      P - pseudo-operation error
  177.      R - Invalid register
  178.      S - syntax error / invalid operand
  179.  
  180. D: COMMAND LINE
  181.  
  182.      To run SPASM, type at the command line:
  183.  
  184.      SPASM [[d][u]:]<filename>  [/switch]
  185.  
  186. where  <filename>  is the only required parameter. The optional
  187. drive and/or user area may proceed a valid filename. The output
  188. file placed on the same drive (and user area).  The source must
  189. have the extension .ASM  and the output will have the extension
  190. of .OBJ appended to it.  An object file will only be created if
  191. there are no errors in the source.
  192.  
  193.      The following are the optional /switch options:
  194.  
  195.      /F - create a listing with extension .LST
  196.      /L - send the listing to the printer
  197.      /S - send the listing to the screen
  198.  
  199. the default is not to list the  source.  If an error occurrs in
  200. the source, the line is displayed at the console along with the
  201. error message.
  202.     
  203. E: COMMENTS
  204.  
  205.      If you have any comments about theses products,  feel free
  206. to write to address below. If you find any problems or bugs, it
  207. would be appreciated to send along a copy  of the problem so it
  208. can be duplicated and corrected.
  209.  
  210.      Also, don't forget to say which program such as:
  211.  
  212.      SPASM.COM     - CP/M-80 Version of SPASM (8080)
  213.      SPASM80.EXE   - MS-DOS  Version of SPASM (8080) Cross Assembler
  214.      SPASM86.EXE   - MS-DOS  Version of SPASM (8086/8087)
  215.      SLINK.COM     - CP/M-80 Version of SLINK
  216.      SLINK80.EXE   - MS-DOS  Version of SLINK (Cross Development)
  217.      SLINK86.EXE   - MS-DOS  Version of SLINK (.EXE creator)
  218.  
  219.      Send Comments To:      Harris Landsberg
  220.                           1350 East 5th Street
  221.                                Suite 1-J
  222.                         Brooklyn, New York 11230
  223. 
  224.