home *** CD-ROM | disk | FTP | other *** search
- QUICK REFERENCE FOR SPASM (SINGLE PASS ASSEMBLER) UNDER CP/M-80
-
- Written by: Harris Landsberg (C) Copyright 1986,1987,1988
-
- This documentation will aquaint you with the basics of the
- SPASM software package. It has been extracted from the more
- detail documentation previously written. Please refer to the
- SPL Language Manual for more detail about module interfacing in
- object libraries. SPASM.COM requires CP/M-80 Version 2.2 or
- higher. The cross-assembler SPASM80.EXE requires MS-DOS Version
- 2.0 or higher. SLINK.COM (or SLINK80.EXE) is required to link
- the object files that are created with SPASM.
-
- SPASM is a single pass assembler which means it only makes
- one pass through the source to produce the object code file. In
- most other assembler require two or more passes. The code that
- is generated is fully relocatable containg the necessary symbol
- imformation to produce a command file from multiple object code
- files and use common libraries to extract only imported modules
- that are necessary for the load module.
-
- An optional Librarian, SLIB, can optimize a object file to
- remove symbol references that should not be global. It can also
- create library files by combining one or more modules from one
- or more object code files. This is similar to having multiple
- modules within an assembler source.
-
- A: INSTRUCTION SET
-
- SPASM uses the standard INTEL 8080 mnemonics with no extra
- modifications for the Z-80 opcodes. It does not contain a macro
- facility. All labels defined or used are global. It does not
- use EXTRN or ENTRY instructions, but implies it. Most assembler
- source written for the standard CP/M ASM.COM program will run
- without requiring modifications.
-
- SPASM statement format is:
-
- Label Operation Operand ;Comment
-
- where any or all fields may be absent. A ':' (colon) may follow
- a label, but is not required. Only one operation is allowed per
- line. Only addition, subtaction, multiplication, division can
- be done on operands that are not registers. Numeric constants
- may be decimal or hexidecimal if followed by a 'H'. All symbols
- are changed to uppercase and significant to 31 characters.
-
- The '$' by itself implies the current CODE counter and can
- be used in word sized operands. SLINK defines ?CODE ?DATA ?HEAP
- so they should not be defined, but can be referenced.
-
- B: PSEUDO-MNEMONICS
-
- The following, in alphabetic order, are the pseudo-ops for
- SPASM. There are two segments: CODE and DATA. CODE contains all
- the relocatable and absolute text segments while DATA contains
- the uninitilized main storage section. All opcodes are implied
- to the CODE segment, if they generate code or use space, except
- the VAR opcode which is for variables and defines the usage of
- the DATA segment. SLINK combines the segments.
-
- DB <byte>[,<byte>...]
-
- Defines a byte storage area for constants. Can be a single
- or multi-character string. Strings begin and end with a ' only.
-
- <label> DL <value>
-
- Defines a value to the assembler. The DL statement does
- not this symbol into the object code and therefore local to the
- source that is being assembled. See EQU.
-
- DS <size>
-
- Defines space in memory that will be reserved. SLINK will
- initilize it to 00H.
-
- DW <word>[,<word>...]
-
- Defines a word storage area for constants. Can be a string
- of up to two characters.
-
- ELSE
-
- Allows alternate code generation in a conditional when the
- condition fails. May not be used with a link conditional. It
- must be within
- an IF and ENDIF statement.
-
- END
-
- Defines the end of a source assembler program. SPASM stops
- here if not within a conditional.
-
- ENDIF
-
- Signifies the end of a conditional block. A termination of
- a conditional is required and cannot be nested.
-
- <label> EQU <value>
-
- Defines a value to the assembler. The EQU statement passes
- this symbol into the object code and can be used by a different
- module. See DL.
-
- IF <symbol>
-
- Allows assembly of a section of code if a symbol is not a
- value of zero. The symbol may be a label or a constant and must
- be defined prior if it is a label. See XIF.
-
- IMPORT <name>[,<name>...]
-
- Defines the modules that are required to complete all code
- references. It is used by SLINK to combine code and extract the
- necessary modules from a library.
-
- INCLUDE <name>
-
- The include file is opened and assembled into the current
- source file. Only one level is allowed. <name> can have a drive
- and/or user designator in front and should have an extension of
- .ASM to include a .ASM file.
-
- LIBRARY <name>[,<name>...]
-
- Defines a name for an object code file to be searched for
- module references. <name> may have a drive and/or user in front
- of it. A library file is a standard object code file with one
- or more modules in it.
-
- ORG <value>
-
- For compatibility with other assemblers. Will start the
- assembly listing at the specified value, but has no effect on
- the code generated. The MODULE statement will set the counter
- back to 0 when starting a module.
-
- MODULE <name>
-
- Defines the beginning of a module and assigns it a name. A
- module is unit of code with a unique name that can be imported
- while being search for. It is a collection of code that cannot
- be subdivided to complete a single task. This task may be need
- other support module which are imported. Module end is implied
- by end of file or start of another module. The beginning of the
- source implies a module which defaults to the source file name
- unless a MODULE statement is first opcode in file.
-
- <label> VAR <value>
-
- Defines a variable for the program. <value> is the size in
- bytes that the variable requires. <label> is a required field,
- but can be removed with SLIB (Librarian) if you want to make a
- variable local. The VAR statement defines the unitilized space
- after the CODE segment known as the DATA segment.
-
- XIF <label>
-
- Allows assembly of a section of code with the conditional
- being resolved at link time. It allows special modifications or
- routines to be included or excluded according to a condition
- that will be not be fully known until link time. This is known
- as a LINK CONDITIONAL structure and SLINK supports it.
-
- C: ERROR CODES
-
- Besides file errors, the following errors will be flagged
- by the assembler. A single uppercase character is placed at the
- first first position of the line.
-
- C - invalid operation code
- F - file not found (INCLUDE statement)
- L - invalid label
- M - multi-defined symbol
- P - pseudo-operation error
- R - Invalid register
- S - syntax error / invalid operand
-
- D: COMMAND LINE
-
- To run SPASM, type at the command line:
-
- SPASM [[d][u]:]<filename> [/switch]
-
- where <filename> is the only required parameter. The optional
- drive and/or user area may proceed a valid filename. The output
- file placed on the same drive (and user area). The source must
- have the extension .ASM and the output will have the extension
- of .OBJ appended to it. An object file will only be created if
- there are no errors in the source.
-
- The following are the optional /switch options:
-
- /F - create a listing with extension .LST
- /L - send the listing to the printer
- /S - send the listing to the screen
-
- the default is not to list the source. If an error occurrs in
- the source, the line is displayed at the console along with the
- error message.
-
- E: COMMENTS
-
- If you have any comments about theses products, feel free
- to write to address below. If you find any problems or bugs, it
- would be appreciated to send along a copy of the problem so it
- can be duplicated and corrected.
-
- Also, don't forget to say which program such as:
-
- SPASM.COM - CP/M-80 Version of SPASM (8080)
- SPASM80.EXE - MS-DOS Version of SPASM (8080) Cross Assembler
- SPASM86.EXE - MS-DOS Version of SPASM (8086/8087)
- SLINK.COM - CP/M-80 Version of SLINK
- SLINK80.EXE - MS-DOS Version of SLINK (Cross Development)
- SLINK86.EXE - MS-DOS Version of SLINK (.EXE creator)
-
- Send Comments To: Harris Landsberg
- 1350 East 5th Street
- Suite 1-J
- Brooklyn, New York 11230
-
-