ASM8

A two-pass absolute DOS cross-assembler for the 68HC08/68HCS08

 

 

Quick Reference Guide

ASM8 - Copyright © 2001-2005 by Tony Papadimitriou <tonyp@acm.org>

Last Update: September 2005 for ASM8 v1.12


Command-Line Syntax and Options

 

ASM8 [-option [...]] [[@]filespec [...]] [>errfile]

 

·             option(s) may appear before, in between or after filespec(s).

·             option(s) specified apply to all files assembled, regardless of command line placement.

·             Text file(s) containing list(s) of files to be processed may be specified by naming the text file on the command line, prefixed with a «@» character.  These text files may not contain command line options.

·             filespec(s) may include wildcard characters (?,*).  Wildcards are not allowed in filespec(s) that are prefixed with a «@» but are allowed in filespecs inside @files.

·             If the file extension for a source filespec is omitted, the extension «.ASM» is assumed (see description of the –R.ext option below).

·             Assembler errors may be redirected to errfile using standard DOS output redirection syntax.  This capability may be used in conjunction with, or as an alternative to the –E+ option.

·             The assembler will set the DOS ERRORLEVEL variable when it terminates as indicated:
0               No error, assembly of last file was successful
1               System error (hardware I/O failure, out of disk space, etc.), or
-W option failure
2               Error(s) generated (or Escape pressed) during assembly of last file
3               Warning(s) generated during assembly of last file
4               Assembler was not started (help screen displayed,
-W option used with success)

 

Option

Default

Description

 

 

 

-C[±]

-C-

Label case sensitivity: + = case sensitive (See also #CASEON/#CASEOFF)

-Dlabel [:expr]

 

Use up to ten times to define symbols for use with conditional assembly (IFDEF and IFNDEF directives).  Symbols are always uppercase (regardless of -C option).  If they are not followed by a value (or expression) they assume the value zero.  Expression is limited to 19 characters.  Character constants should not contain spaces, and they are converted to uppercase.  Cannot be saved with -W.

-E[±]

-E-

Generate *.ERR file (one for each file assembled).  *.ERR files are not generated for file(s) that do not contain errors.

-EH[±]

-EH+

If –E+ is in effect, hide (do not display) error messages on screen.

-EXP[±]

-EXP-

When on, a .EXP file is created containing all symbols defined with an EXP rather than an EQU pseudo-opcode.  The resulting file can be used as an #INCLUDE file for other programs.  This allows for automatic creation of include files with global exported symbols.

-HCS[±]

-HCS-

When on, the assembler understands the extended HCS08 instruction set.  The cycle counts in the listing also reflect the HCS08 core.  To check the current status of this switch look at the help screen’s second line from top.  The software will say it’s either a MC68HC08 or a MC68HCS08 assembler based on this setting.  See also the directives #HCSON, #HCSOFF, #IFHCS, and #IFNHCS

-Ix

 

Define default INCLUDE directory root.  Relative path files not found relative to the main file, will be tried next relative to this directory.  Absolute path file definitions are not affected by this switch.  Affects both the INCLUDE and the IF(N)EXISTS directives.

-L[±]

-L+

Create a *.LST file (one for each file assembled).

-LC[±]

-LC+

List any conditional directives fully (the directives only, not the contents in between), even when they are False.

-LS[±]

-LS-

Create a *.SYM symbol list (one for each file assembled).  May be useful for debuggers that do not support the P&E map file format.

-LSx

-LSS

x may be either S (default) for simple SYM file, E for EM11/Shadow11 SYM compatible format (possibly not useful for HC08), or N for NoICE SYM format.

-M[±]

-M+

Create a *.MAP (one for each file assembled).  *.MAP files created may be used with debuggers that support the P&E source-level map file format.

-MTx

-MTP

Specifies type of MAP file to be generated (if –M+ in effect):

-MTA : Generate parsable ASCII map file

-MTP : Generate P&E-style map file

-O[±]

-O+

Enables two warnings:  S19 overlap, and Violation of MEMORY directive.

-P[±]

-P+

When on it tells the assembler to stop after Pass 1 if there were any errors.  Provides for faster overall assembly process and less confusion by irrelevant side errors of Pass 2.  Warnings do not affect this.

-Q[±]

-Q-

Specifies quiet run (no output) when redirecting to an error file.  Useful for IDEs that call ASM8 and don’t want to have their display messed up.

-Rn

-R74

Specifies maximum length of S-record files.  The length count n includes all characters in an S-record, including the leading «S» and record type, but not the CR/LF line terminator.  Minimum value is 12 while maximum is 250.

-R.ext

-R.ASM

Specifies the default extension to assume for source files specified on the command line which do not directly specify an extension.

-REL[±]

-REL+

Allows generation of  «BRA/BSR instead of JMP/JSR» optimization warnings when enabled.  (See also OPTRELON/OPTRELOFF)

-RTS[±]

-RTS-

Allows generation of  «JSR followed by RTS» subroutine call optimization warnings when enabled. (See also OPTRTSON/OPTRTSOFF)

-S[±]

-S+

Generate *.S19 object file (one for each file assembled).

-SH[±]

-SH-

Include dummy «S0» record (header) in object file (only if –S+).

-SP[±]

-SP-

When enabled, the operand part of an instruction is stripped of spaces before parsing.  In this case, possible comments must begin with semi-colon.  (See also SPACESON/SPACESOFF)

-T[±]

-T-

Makes redirected errors look like Turbo Pascal errors (useful to fool certain IDEs).

-Tn

-T8

Specifies tab field width to use in *.LST files.   Tab characters embedded in the source file are converted to spaces in the listing file such that columns are aligned to 1 + every nth character.

-X[±]

-X+

Allow recognition of extra, non-68HC08-standard mnemonics in source files. (See also EXTRAON/EXTRAOFF)

-WRN[±]

-WRN+

Enables or disables the display of all warnings.  When enabled, only warnings that aren’t disabled individually will be generated. When disabled, it overrides local warning options (such as -REL and -RTS).

-W

(none)

Write options specified on command line to the ASM8 executable.  The user-specified options become the default values used by ASM8 in subsequent invocations.  Filespec(s) on the command line are ignored.  Assembly of source files does not take place if this option is specified.

 

 


Source File Pseudo-Opcodes

 

Pseudo-Op

Description

 

 

DB string|expr[,...]

Define Byte(s).  expr may be a constant numeric, a label reference, an expression, or a string.  DB  encodes a single byte in the object file at the current location counter for each expr  encountered (using the LSB of the result) or one byte for each character in  strings.

DS blocksize

Define Storage.  The assembler’s location counter is incremented by blocksize. Forward references not allowed.  No code is generated.

DW expr[,...]

Define Word(s).  expr may be a constant numeric, a label or an expression.  expr is always interpreted as a word (16-bit) quantity, and is stored in the object file at the current location counter, high byte followed by low byte.

END [expr]

Provided for compatibility.  The END directive cannot be used to terminate assembly; ASM8 always processes the source file to the end of file.  If expr is specified, the word result is encoded in the S9 record of the object file.

label EQU expr

Assigns the value of expr to label. See also EXP

label EXP expr

Assigns the value of expr to label.  This is identical to EQU but with the following difference: Labels defined thus will be included in the .EXP file as regular EQUs. This effectively allows to export symbols for use from other source files.  It makes it possible to give only object code to others along with the produced .EXP file so that they can «link» the object to their source.

FCB string|expr[,...]

Form Constant Byte(s).  Same as DB.

FCC string|expr[,...]

Form Constant Character(s).  Same as DB.

FCS string|expr[,...]

Form Constant String.  Similar to  FCC, but automatically adds a terminating null (0) byte to the end of the string defined (for ASCIZ strings).

FDB expr[,...]

Form Double Byte(s).  Same as DW.

ORG expr

Sets the assembler’s location counter for the active segment.  Code generated after this directive will be assembled starting at the location specified by expr.

RMB blocksize

Reserve Memory Byte(s).  Same as DS.


Source File Processing Directives

 

·             All processing directives must be prefixed with a $ or # character.  ASM8 will recognize either character as the start of a processing directive.

·             If a directive has a corresponding command-line option, the directive in the source file will override the command line directive at the point in which the source file directive is encountered.

·             [text] will be trimmed of duplicate spaces.  To have more than one consecutive spaces display, use the Alt-255 character, as many times as needed.

 

Directive

Description

 

 

#CASEOFF

When #CASEOFF is in effect, all symbol references that follow are converted to uppercase internally before they are searched for or placed in the symbol table.

Equivalent to the –C- command line option.

#CASEON

When #CASEON is in effect, symbol references are NOT internally converted to uppercase before they are searched for or placed in the symbol table.

Equivalent to the –C+ command line option.

#DATA

Activation of the DATA segment.  Default starting value is $FE00.

#EEPROM

Activation of the EEPROM segment.  Default starting value is $0000.

#EJECT

See #PAGE

#ELSE

When used in conjunction with conditional assembly directives (#IF, #IF[N]DEF, $IF[N]Z, #IFMAIN, #IFINCLUDED, etc.), code following the #ELSE directive is assembled if the conditional it is paired with evaluates to a not-true result.

#ENDIF

Marks the end of a conditional-assembly block.

Conditional assembly statements may be nested if