home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource5
/
338_01
/
as68.doc
< prev
next >
Wrap
Text File
|
1990-09-25
|
24KB
|
595 lines
as68 - 68000 Assembler, version 1.02
(c) copyright 1982 Steve Passe all rights reserved
Modified to support CC68K C Compiler by Brian Brown, Nov 1989
TABLE OF CONTENTS
Chapter 1 Introduction 1
Chapter 2 Usage 6
Chapter 3 Pseudo-ops 8
Chapter 4 Mnemonics 11
Chapter 5 Expressions 13
Chapter 6 S File Format 15
Chapter 7 Error Messages 16
Chapter 8 Differences 18
CHAPTER 1
INTRODUCTION
The as68 assembler is a disk to disk assembler for the Motorola 68000
microprocessor chip. Written in the c programming language, it may be used as
a cross assembler on any machine supporting c, or as a native assembler if
compiled with a c that produces 68000 output. It's directives and mnemonic set
closely follow that of the Motorola Resident Structured Assembler. It has been
altered to accept assembler output from the 68000 C Compiler. This
modification was performed by B Brown at the Central Institute of Technology,
Heretaunga, New Zealand in 1989.
SOURCE PROGRAM
The input to the assembler is an ascii text file, consisting of a series of
statements written in the assembly language. Each statement consists of one or
more fields within a line.
The assembler is free format within each line, i.e. there is no need to start
a specific field of a statement in a particular column. Fields are separated
from one another with whitespace (tabs or spaces).
STATEMENTS
There are 3 basic statement types. The most common is an assembly language
instruction or mnemonic. It is a command to the assembler to produce a machine
operation code to carry out a specific action.
The second type of statement is called an assembly directive or pseudo-op.
Pseudo-ops tell the assembler how to assemble the program.
The third statement type is called a comment. It is ignored by the assembler,
it's purpose being to allow the programmer to insert descriptions of what the
code is doing within the text of the source program. Comments may exist as the
final field of the other two statement types.
INSTRUCTION STATEMENTS
An instruction statement consists of from one to four fields:
[label] <mnemonic> [operand] [comment]
LABEL FIELD
The first field, the label field, is optional. It is used to create a symbolic
name for the address of the code generated by the following assembler
mnemonic. This label is stored in the symbol table and any references to it
evaluate to the associated address.
The label field may be the only field of a statement and multiple, label only
fields may follow one another. In all cases the label(s) will evaluate to the
address of the first mnemonic to be assembled after the label(s) is specified.
Labels are composed of alphanumeric characters and may be up to 30 characters
long. All characters of a label are significant, as is the case of alphabetic
characters (i.e. "Foo" is different than "foo").
The first character of a label must be either alphabetic or the character '.'
(period). Following characters may also include the underscore (_), dollarsign
($), and the digits '0' thru '9'.
Labels starting in any other than the first column must be terminated with a
colon (:). Certain symbols are reserved for the use of the assembler and thus
may not be used as labels. These include "SP", "USP", "SR", "CCR", "A0"
through "A7" and "D0"
through "D7".
MNEMONIC FIELD
The second field is the mnemonic or assembly instruction field. It will always
be present in a statement except in the case of a label only statement (label
only statements might more properly be described as assembler directives). If
the line is unlabeled the mnemonic field must be preceeded by whitespace.
A mnemonic will consist of from 3 to 5 ascii characters, the case of which is
not significant. This assembler recognizes the standard Motorola instruction
set. The complete mnemonic instruction set is described in chapter 4,
"Mnemonics". Many 68000 instructions may work on different data sizes.
The desired data size is specified by appending a length modifier or data size
code to the mnemonic. A '.b' extension specifies a data size of byte (8 bits)
while '.l' will cause the data size to be a long word (32 bits). No extension
will cause the data size to be a word (16 bits). A '.w' extension may be used
for data sizes of word, although this size is the default and as such the '.w'
modifier is unnecessary.
OPERAND FIELD
The operand field is necessary only for those statements whose mnemonic
requires an operand(s). It will contain one or two operands. When two operands
are present they must be separated with a comma (no whitespace allowed between
operands).
The first of two operands is refered to as the source operand while the second
is the destination operand.
COMMENT FIELD
The comment field is optional and consists of all text following the above
fields.
DIRECTIVES
Label Field - Labels used with directive statements follow the general rules
of those used in assembly statements with one important
exception: they may only be used with the following directives:
1. EQU
2. SET
3. DC
4. DS
Directive Field - The directive field contains an instruction to the assembler
as to how the program should be assembled. This includes such
things as the base address of the program, setting of symbol
values, allocation of program memory storage, conditional
assembly, etc. The complete list of available assembly
directions is given in chapter 3, "Pseudo-ops".
Operand Field - The operand field of a directive statement will consist of
zero or more operands, as needed by the pseudo-op in question.
Multiple operands are separated with a comma (,). No whitespace
may exist between operands.
Comment Field - The comment field is identical to that used in instruction
statements and is optional.
Comments - Comments may exist alone as separate statements. In such cases
an asterisk, (*), must be the first character on the line.
CHAPTER 2
USAGE
Command Line Format - The command line format is:
as68 <sourcefile>[.ext] [option[ option]]
where:
sourcefile is the source file name.
ext is an optional file extension identifier. By default the
assembler expects source files to have an ext of ".asm".
option is one of several possible options in assembly. Whitespace
must separate multiple options when they occur. Individual
options are described below.
OPTIONS
The following options are available:
e, destination of error messages. If absent all error messages will go
to the console by default. If present, one or more of the following
destinations may be specified:
c error messages to the console.
e error messages to a file named "sourcefile.err".
f errors reported in listing.
l destination of assembly listing. If absent no listing is made. One or
more of the following option extensions are available:
c listing to console.
f listing to a file named "sourcefile.ls"
o type and destination of object file. If not present the object file
will be in Motorola 'S' FILE format.
s object to a file named "sourcefile.s19"
x no object file to be made.
s set the symbol table size. The symbol table requires 8 bytes plus
the length of the symbol for each entry. The argument should be in
decimal bytes. The symbol table defaults to 2000 bytes (decimal). To
reserve 3500 bytes the option would be: 's3500'.
t truncate source code lines in listing. This