6809_AS(1)

NAME
6809_as - assembler for 6809

SYNOPSIS
/usr/em/lib/6809_as [options] argument ...

DESCRIPTION
This assembler is made with the general framework described in uni_ass(6).

SYNTAX

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.

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).

addressing modes
    syntax		meaning (name)
    reg		The operand of the instruction is in reg.
    reglist		reglist 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 expr is an address within
    		a 256-byte page. The particular page in use is
    		indicated by the contents of dp, so expr is the
    		low byte of the effective address of the operand,
    		and dp the high byte. (direct)
    >expr		The two-byte value of expr is the exact memory
    		address. Not that this mode always requires one
    		byte more than "<expr". (extended)
    expr		The value of expr 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 expr is one- or two-byte immediate
    		data. (immediate)
    (expr)		The value of expr is a pointer to the address
    		of the operand. (indirect)
    expr, reg	The value of expr added to the contents of reg
    		(which must be a 16-bit register) yields the
    		effective address of the operand.
    		(constant-offset indexed)
    , ireg		The contents of ireg (which must be indexable)
    		yields the effective address of the operand.
    		(constant-offset indexed)
    (expr, reg)	The value of expr added to the contents of reg
    		(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 ireg (which must be indexable)
    		yields a pointer to the effective address of the
    		operand. (constant-offset indexed indirect)
    ac, ireg	The contents of ac (which must be an accumulator)
    		added to the contents of ireg (which must be
    		indexable) yields the effective address of the
    		operand. (accumulator indexed)
    (ac, ireg)	The contents of ac (which must be an accumulator)
    		added to the contents of ireg (which must be
    		indexable) yields a pointer to the effective address
    		of the operand. (accumulator indexed indirect)
    ,ireg+
    ,ireg++		The contents of ireg (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 ireg (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		ireg (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)	ireg (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)

SEE ALSO
uni_ass(6), ack(1),
MC6809 preliminary programming manual, Motorola Inc., First Edition, 1979

EXAMPLE
An example of 6809 assembly code.
	contby = 80
	compgo:	lda	#contby
		ldx	#table - 2	!start of table
		clrb
	co1:	addb	#2
		lsra
		bcc	co1
		jmp	(b, x)		!accumulator offset indirect