SSASM Users Manual-mc68000_eng.pdf

(75 KB) Pobierz
M68000 Assembler
SSASM Users Manual
Version 1.032
August, 1993
Applix 1616 microcomputer project
Applix pty ltd
SSASM Users Manual
M68000 Assembler
Applix 1616 project
Even though Applix has tested the software and reviewed the documentation, Applix makes no
warranty or representation, either express or implied, with respect to software, its quality,
performance, merchantability, or fitness for a particular purpose. As a result this software is
sold "as is," and you the purchaser are assuming the entire risk as to its quality and performance.
In no event will Applix be liable for direct, indirect, special, incidental, or consequential damages
resulting from any defect in the software or its documentation.
The original version of this manual was written by Andrew Morton, based on David Farb’s
68000 assembler.
Additional introductory and tutorial material by Eric Lindsay
Editorial and design consultant: Jean Hollis Weber
Comments about this manual or the software it describes should be sent to:
Applix Pty Limited
Lot 1, Kent Street,
Yerrinbool, 2575
N.S.W. Australia
(048) 839 372
Private BBS systems (ringback) on (02) 554 3114 and (02) 540 3595
©
Copyright 1983 by David Farb, farbware. All Rights Reserved.
©
Copyright 1986 Applix Pty Limited. All Rights Reserved.
Revised material
©
Copyright 1990 Eric Lindsay
ISBN 0 947341 ?? ?
MC68000®™ is a trademark of Motorola Inc.
1
Introduction
SSASM
is an assembler for the Motorola 68000 series of 16/32 bit microprocessors. It accepts
a file containing standard Motorola assembler mnemonics and directly produces executable
transient programs. That is, it produces
.exec
files for the Applix 1616.
SSASM
executes as either a built-in command, or as a normal transient program, under the 1616/OS
operating system on an Applix 1616 computer system. Versions of 1616/OS later than 3.2b
have
SSASM
, version 2.2, built into the operating system eproms. This is often very convenient,
because you can edit and assemble programs without using a disk drive, if you wish.
SSASM
supports all the instructions of the 68000 microprocessor, but does not support (at this
time) the special instructions for the 68010 and 68020. These opcodes may be implemented as
macro instructions. In addition,
SSASM
supports a variety of listing and pagination controls of
use when examining the list file, data declaration statements for initialising constants, file
inclusion and conditional assembly controls.
Two of the more interesting features of
SSASM
are
structured programming constructs (which don’t quite work)
macro processing capability (which do work)
The structured programming constructs should include
IF/THEN/ELSE
FOR/ENDF
WHILE/DO/ENDW
REPEAT/UNTIL
all of which would be very pleasant, if they worked correctly under all circumstances. However
you can easily get along without them, so don’t pay much attention to the chapter on how they
should work.
Macro processing permits conditional assembly inside macros, parameters to macros, automatic
generation of unique labels and other features, all detailed in the chapter on macros. Very handy
stuff, and essential once you get more familiar with the assembler.
1.1 References
The principle reference for the instructions on the 68000 is published by Prentice-Hall, Inc. of
Englewood Cliffs NJ, 07632, titled
M68000 16/32 Bit Microprocessor Programmer’s Reference
Manual,
written by the staff of Motorola. Prentice-Hall, about 200 pages. This lists all the
68000 instructions, and is an essential reference tool, but will not tell you how to use the
instructions, nor how to program in assembler. The current version is the fifth edition, and we
recommend not bothering with the first, second or third editions.
The
SSASM
manual does not duplicate the content of the
Reference Manual,
but should be used
in conjunction with it. The
Reference Manual
is available from Applix, and is recommended.
Other references which you may find helpful are the following:
Introduction
SSASM Assembler
1-1
The 68000: Principles and Programming,
by Leo J. Scanlon, published by Howard W. Sams,
238 pages. The 1981 edition is now somewhat dated, but still includes much excellent intro-
ductory material (and I picked it up cheap). Like most other assembler manuals, it assumes you
are familiar with the concept of assembler language, and merely want to add yet another version
to your repertoire. This is historically naive, since everyone has to start somewhere.
68000 Microprocessor Handbook,
by Gerry Kane, published by Wayne Green Books.
68000 Assembler Language Programming,
by Gerry Kane, published by Wayne Green Books.
I am not certain that Wayne Green Books are still available in Australia. A possible alternative,
by the same author, is below.
68000 Assembly Language Programming
by Gerry Kane, Doug Hawkins and Lance Leventhal,
published by Osborne McGraw-Hill, about 300 pages covering concepts, simple problems at
about the level of the Scanlon book, including over 50 program examples. Advanced topics
cover parameter passing, subroutines, I/O and interrupts, and there is a useful major coverage
of problem definition, program design, documentation, debugging and testing and so on. There
are also about 150 pages of appendix on the instruction set, a summary, and object code formats.
680x0 Programming by Example
by Stan Kelly-Bootle, published by Howard W. Sams, 482
pages. This one is a good introduction for those who have done minor work in another assembler.
It contains brief, but very clear, summaries of 680x0 differences, addressing modes, and
instructions, and then goes on to a number of commented code examples. The major example
is a 68000 version of the Kermit file transfer protocol, which is a fairly involved piece of work.
The beginner would be better served by the same author’s
68000, 68010, 68020 Primer
(but
since I don’t have a copy, I can’t review it).
68000 Assembly Language Techniques for Building Programs,
by Donald Krantz and James
Stanley, published by Addison-Wesley, 400 pages. After a brief overview of the 68000
instruction set (which contains some interesting viewpoints), this gets down to the main contents,
namely implementing a text editor in 68000 assembler. Lots of commented code, with expla-
nations of why things were done certain ways. While this is fine for the more experienced
assembler language programmer, the beginner may have problems coming to grips with such a
large project.
1.2 File Naming Conventions
SSASM
uses the following file naming conventions
filename.s
source file (must include
.s
).
filename.exec
executable code.
filename.lst
listing output.
filename.xrel
relocatable code.
Although the source file must have a
.s
extension, you should not type the
.s
when invoking
the assembler, or the
makexrel.shell
program for making
.xrel
files.
SSASM
will automatically supply the
.exec
extension when it produces the final executable file,
by removing the
.s
extension, and substituting the
.exec
extension. If you use the
-o
command
line switch, you will override this automatic
.exec
naming feature.
To produce standard Applix 1616 relocatable programs (the
.xrel
files), you actually run the
assembler twice, by using the
makexrel.shell
shell program that is explained later. This step
is usually only done when you have a complete working program, with all the bugs and problems
removed.
1-2
SSASM Assembler
Introduction
The listing file produced by the
-l
switch is an ASCII text file produced by the assembler. It
includes the text of your
.s
source file, plus the expansion of any macros or include files, so
you can see what was actually in them. It also contains a hexadecimal representation of the
actual Motorola 68000 object code produced, and the location in memory they occupy. This
lets you see the actual code produced by the assembler. The listing switches or options such as
-f -h -t
let you alter the page length and appearance of the listing, to more easily suit it to
your printer or output device.
1.3 Invoking the Assembler
SSASM
is a command executed under 1616/OS. You invoke it by typing the name of the command,
followed by any switches (or parameters). For example
SSASM testcode
will assemble a file called
testcode.s
from the current directory.
The file
testcode.s
is a simple ASCII text file, usually produced using the
edit
inbuilt
command. It contains lines of text, each usually a single Motorola 68000 command. The details
of this are discussed in section 2.
Switches are specified by a leading dash
-,
immediately followed by a letter (upper or lower
case), sometimes followed by a file name or other parameters. There must be at least one blank
between the switch and the file name, but no blanks between the switch and parameters (see
below).
The general form to invoke
SSASM
(where [ ] enclose optional switches) is
ssasm sourcefile [-flnprv] [-h pagelen] [-o objfile] [-t tabs]
The complete list of switches you may specify is
-f
use form feed between pages of the listing output.
-h[nn]
set listing page length to
nn
lines in total.
-l
produces listing output, to standard output. The
-h -f
and
-t
options
vary the format of the listing file.
-n
no output of an executable file. Assemble only. Use to test your syntax,
and so on.
-o
[filename] specifies the object filename for output. The default output file’s name
now ends with
.exec
. The
-o
option overrides this. If no
-o
option is
specified, the object file’s name is that of the source file, with the
.s
extension stripped off and
.exec
added.
-p
not working yet. Should produce an output ready for linking to a relo-
catable form directly, without needing to use
makexrel.shell
.
-t[nn]
set tab stops every
nn
columns
-v
verbose mode, prints sign on message, version number and status infor-
mation as assembly proceeds.
Switches may be specified in any order, but file names must immediately follow their respective
switches. Switches and file names may be entered in any combination of upper and lower case.
All file names are translated to upper case for use by 1616/OS.
A sample command such as
-r
ssasm testcode -o objout -l
Introduction
SSASM Assembler
1-3
Zgłoś jeśli naruszono regulamin