Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

199 lines
10 KiB
Plaintext

as68 - assembler for the Motorola 68000 The REGULUS assembler
'as' is designed to be used in conjunction with the other RE-
GULUS standard language processing tools: c68 and lo68. The
language implemented is primarily as is described in any of the
standard 68000 assembler manuals, with a few enhancements to
make it accept some of the more standard assembler mnemonics.
It will attempt to optimize instructions to take advantage of
certain 68000 instructions (for example the add quick instruc-
tion).
The following instructions are recoginized to aid the assembly
language programmer by making the assembly language more regu-
lar: clr.x An (where x is l,b, or w) is allowed and will actual-
ly generate a suba.x An,An instruction; add, sub, cmp with an A
register source/destination are allowed and generate adda, suba,
cmpa; add, and, cmp, eor, or, sub are allowed with immediate
first operands and actually generate addi, andi, cmpi, eori,
ori, subi instructions if the second operand is not register
direct; any shift instruction with no shift count specified as-
sumes a shift count of one (ie. "asl r1" is equivalent to "asl
#1,r1"); the mnemonics 'inc' and 'dec' are also recognized and
are functionally equivilent to "addq 1" or "subq 1". Several
mnemonics have been added to the standard set of condition code
instructions: 'bt' maps to 'bra', 'bhs' maps to 'bhis', 'bnz'
maps to 'bne', 'bze' maps to 'beq', 'dbhs' maps to 'dbhi',
'dblo' maps to 'dbcs', 'dbnz' maps to 'dbne', 'dbze' maps to
'dbeq', 'shs' maps to 'scc', 'slo' maps to 'scc', 'snz' maps to
'sne', and 'sze' maps to 'seq'.
Several optimizations take place. All branch instructions gen-
erate short relative branches where possible, including forward
references. 'jsr' instructions are changed to 'bsr' instruc-
tions if the resulting 'bsr' is shorter than the 'jsr'. 'move',
'add', 'sub' mnemonics will actually generate 'moveq', 'addq',
and 'suba' instructions where possible. If a 'move' instruction
rather than a 'moveq' instruction is desired (affecting only
lower byte or word of D register), the size attribute must be
explicitly coded ie. move.b or move.w. The assembler will
change any move or move.l to moveq if possible.
All labels must terminate with a ':', unless they start in
column 1. Registers may be referenced as r0 - r15, R0 - R15, D0
- D7, d0 - d7, A0 - A7, or a0-a7. Registers R8 - R15 are the
same as A0 - A7. Numbers are interpreted as decimal. Hexide-
cimal may be specified by preceding the number by a dollar sign
($) and numbers which begin with a preceeding zero (0) are as-
sumed to be octal.
REGULUS assembler directives can be specified in upper and/or
lower case characters and may be preceded by an optional dot
(.). The following directives have been implemented:
text
data
bss
These three directives instruct the assembler to
change the assembler base segment to the text, data,
or bss segment respectively. Each assembly starts in
the text segment. It is illegal to assemble instruc-
tions or data into the bss segment. Symbols may be
defined and storage may be reserved using the .ds
directive in the bss segment.
section #
This directive is used to define a base segment like
the .bss, .data and .text directives discussed above.
The sections can be numbered 0 to 15 inclusive. Sec-
tion 14 maps to data, section 15 is bss and all the
others are text sections.
globl name[,name...]
xdef name[,name...]
xref name[,name...]
These directives make the name(s) external. If they
are defined in the current assembly, this statement
makes these names available to other routines during a
load by lo68. If these names are not defined in the
current assembly, they become undefined external
references and lo68 will link them to external values
of the same name in other routines. Specifying the -u
flag will force the assembler to make all undefined
names external.
comm name,expression
This directive defines a named block common area.
When several routines are linked together with lo68,
all block common areas with the same name are loaded
at the same address. The size of this block common
storage area is the largest value of the expression
part of all 'comm' directives with the same name. No
error message is produced if the areas are of dif-
ferent sizes.
even
If the location counter is odd, it is incremented by
one so that the next instruction or data field will
begin on an even memory boundary.
The relocation counter may be manipulated with a
statement like:
*=expr
Care should be exercised when using this facility.
The expression may only move the relocation counter
forward. The unused space is filled with zeroes in
the text or data segments and is simply not assigned
in the bss segment. This facility requires the assem-
bler to not allow comment lines which begin with "*=".
Comments beginning with "* =" are allowed.
org expression
This directive is used to change the program counter
to the specified address. The expression must not
contain any external references and must be computable
at the time of assembly.
ds[.x] operand
This is the directive used to define storage. Storage
can be defined in bytes, words or long words depending
upon the extension specified ('b', 'w', 'l' where word
is the default). The memory is not initialized, just
reserved. Word or long defined storage will be
aligned on a word boundary.
comline expression
This directive is identical to the 'ds.b' instruction.
The specified argument must be a constant expression.
equ expression
set expression
Currently 'set' and 'equ' are implemented exactly the
same. These directives are used to assign a value to
the specified label. This non-optional label may not
be redefined elsewhere in the program. It can then be
used anywhere that a constant is required and will be
evaluated to the specified value.
end
The 'end' directive specifies the end of the assembler
text. It is not required for appropriate assembly.
If it is not at the end of the text an error will be
reported.
offset expression
This directive creates a dummy storage section using
the 'ds' directive. No code generating instructions
may occur. It is terminated by a 'section', 'data',
'bss', 'text' or 'end'. The offset table begins at
the address specified in the expression. The 'set',
'equ', 'reg', 'xref', 'xdef', 'globl', 'offset', and
any conditional directive may appear inside.
dcb[.x] size,value
Just like the dc.b command. Defines a constant block
of the specified size of bytes, words or longs.
reg reglist
This directive builds a register mask which can be
used by the movem instruction. One or more registers
can be listed in increasing order of the form : 'R?[-
R?[/R?[-R?...]...]]'. Where R? can be replaced by
A0-A7, D0-D7 and R0-R15. The register list might look
like : A2-A4/A7/D1/D3-D5. The registers may also be
designated separated by commas (eg. A1,A2,D5,D7).
Conditional assembly directives can have any level of nesting.
The following conditional assembler directives have been imple-
mented:
ifeq expression
ifne expression
ifle expression
iflt expression
ifge expression
ifgt expression
The expression is tested against zero (with ifeq:
equal, ifne: not equal, ifle: less or equal, iflt:
less than, ifge: greater or equal, ifgt: greater) and
if it is evaluated true then the code enclosed is as-
sembled, otherwise the code is ignored until the
matching endc is found.
ifc 'string1','string2'
ifnc 'string1','string2'
The two strings are compared. The 'c' condition is
true if they are exactly the same, the 'nc' condition
is true if they do not match.
endc
Signifies the end of the code to be conditionally as-
sembled.
ASCII string constants may be enclosed in single quotes (ie.
'ABCD') or in double quotes (ie. "ac14").
Several directives are recognized, but ignored: 'mask2', 'idnt',
'ttl', 'opt', and 'page'.
as68(cmnd)