151 lines
4.9 KiB
Groff
151 lines
4.9 KiB
Groff
.\" $Header$
|
|
.TH 6809_AS 6 "$Revision$"
|
|
.ad
|
|
.SH NAME
|
|
6809_as \- assembler for 6809
|
|
.SH SYNOPSIS
|
|
~em/lib.bin/6809/as [options] argument ...
|
|
.SH DESCRIPTION
|
|
This assembler is made with the general framework
|
|
described in \fIuni_ass\fP(6). It is an assembler generating relocatable
|
|
object code in \fIack.out\fP(5) format.
|
|
.SH SYNTAX
|
|
.IP registers
|
|
The 6809 contains four 8-bit registers registers:
|
|
two accumulators (a and b),
|
|
a direct page register (dp),
|
|
and a condition code register (cc),
|
|
and five 16-bit registers:
|
|
two index registers (x and y),
|
|
a user an a hardware stack pointer (u resp. s),
|
|
and a program counter (pc).
|
|
The index registers and the stack pointers are indexable.
|
|
Accumulators a and b can be concatenated to form
|
|
the double accumulator d,
|
|
of which a is the high and b is the low byte.
|
|
An instruction that refers to accumulator a
|
|
has an "a" as last character.
|
|
In the same way a "b" means that the instruction
|
|
uses b as accumulator.
|
|
.IP "pseudo instructions"
|
|
The 6809 assembler recognizes one additional instruction
|
|
that is not translated into a machine instruction: setdp.
|
|
It expects an expression as argument.
|
|
This is used for efficient address encoding of some addressing
|
|
mode (see below).
|
|
.IP "addressing modes"
|
|
.nf
|
|
.ta 8n 16n 24n 32n 40n 48n
|
|
syntax meaning (name)
|
|
|
|
reg The operand of the instruction is in \fIreg\fP.
|
|
|
|
reglist \fIreglist\fP is a either list of registers, seperated
|
|
by ','s, or the word "all". It encodes in a register
|
|
save mask, where "all" means all registers, that can
|
|
be used by the push-pull instructions pshs, pshu,
|
|
puls, and pulu.
|
|
|
|
<expr The one-byte value of \fIexpr\fP is an address within
|
|
a 256-byte page. The particular page in use is
|
|
indicated by the contents of dp, so \fIexpr\fP is the
|
|
low byte of the effective address of the operand,
|
|
and dp the high byte. (direct)
|
|
|
|
>expr The two-byte value of \fIexpr\fP is the exact memory
|
|
address. Not that this mode always requires one
|
|
byte more than "<expr". (extended)
|
|
|
|
expr The value of \fIexpr\fP is an address.
|
|
Except for long branches, this value is examined
|
|
first to see if a short encoding is possible.
|
|
When the instruction is a short branch, the value
|
|
is checked to see if the address is not too remote,
|
|
because in that case this branch is automatically
|
|
replaced by a long branch. When the instruction is
|
|
not a branch, the high byte of the value is compared
|
|
with the value of the argument of the last setdp
|
|
pseudo. If they are equal, this mode is replaced by
|
|
"<expr", else by ">expr".
|
|
(relative for branch-instructions)
|
|
|
|
#expr The value of \fIexpr\fP is one- or two-byte immediate
|
|
data. (immediate)
|
|
|
|
(expr) The value of \fIexpr\fP is a pointer to the address
|
|
of the operand. (indirect)
|
|
|
|
expr, reg The value of \fIexpr\fP added to the contents of \fIreg\fP
|
|
(which must be a 16-bit register) yields the
|
|
effective address of the operand.
|
|
(constant-offset indexed)
|
|
|
|
, ireg The contents of \fIireg\fP (which must be indexable)
|
|
yields the effective address of the operand.
|
|
(constant-offset indexed)
|
|
|
|
(expr, reg) The value of \fIexpr\fP added to the contents of \fIreg\fP
|
|
(which must be a 16-bit register) yields a pointer
|
|
to the effective address of the operand.
|
|
(constant-offset indexed indirect)
|
|
|
|
(, ireg) The contents of \fIireg\fP (which must be indexable)
|
|
yields a pointer to the effective address of the
|
|
operand. (constant-offset indexed indirect)
|
|
|
|
ac, ireg The contents of \fIac\fP (which must be an accumulator)
|
|
added to the contents of \fIireg\fP (which must be
|
|
indexable) yields the effective address of the
|
|
operand. (accumulator indexed)
|
|
|
|
(ac, ireg) The contents of \fIac\fP (which must be an accumulator)
|
|
added to the contents of \fIireg\fP (which must be
|
|
indexable) yields a pointer to the effective address
|
|
of the operand. (accumulator indexed indirect)
|
|
|
|
,ireg+
|
|
,ireg++ The contents of \fIireg\fP (which must be indexable) is
|
|
used as effective address of the operand. After that
|
|
it is incremented by 1 (+) or 2 (++).
|
|
(auto-increment)
|
|
|
|
(,ireg++) The contents of \fIireg\fP (which must be indexable) is
|
|
used as a pointer to the effective address of the
|
|
operand. After that it is incremented by 2.
|
|
(auto-increment indirect)
|
|
|
|
,-ireg
|
|
,--ireg \fIireg\fP (which must be indexable) is decremented
|
|
by 1 (-) or 2 (--). After that, its contents is used
|
|
as effective address of the operand.
|
|
(auto-decrement)
|
|
|
|
(,--ireg) \fIireg\fP (which must be indexable) is decremented by 2.
|
|
After that, its contents is used as a pointer to the
|
|
effective address of the operand.
|
|
(auto-decrement indirect)
|
|
|
|
.fi
|
|
.SH "SEE ALSO"
|
|
uni_ass(6),
|
|
ack(1),
|
|
ack.out(5),
|
|
.br
|
|
MC6809 preliminary programming manual, Motorola Inc., First Edition, 1979
|
|
.SH EXAMPLE
|
|
An example of 6809 assembly code.
|
|
.nf
|
|
.ta 8n 16n 24n 32n 40n 48n
|
|
.sect .text
|
|
contby = 80
|
|
|
|
compgo: lda #contby
|
|
ldx #table - 2 !start of table
|
|
|
|
clrb
|
|
co1: addb #2
|
|
lsra
|
|
bcc co1
|
|
jmp (b, x) !accumulator offset indirect
|
|
.fi
|