0% found this document useful (0 votes)
9 views18 pages

Motorola 6809 Assembler Overview

The document describes the architecture of the Motorola 6809 processor, including its registers, buses, and general operation. It contains detailed information about this popular 8-bit processor from the 1970s-1980s.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

Motorola 6809 Assembler Overview

The document describes the architecture of the Motorola 6809 processor, including its registers, buses, and general operation. It contains detailed information about this popular 8-bit processor from the 1970s-1980s.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

National Institute of Statistics and Applied Economics

Assembler
Module: Computer Architecture

Course 1erayear S1

2019 - 2020

PLAN

° Presentation of the processor: Motorola 6809


° Assembler: Motorola 6809

2
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
PLAN

° Processor presentation: Motorola 6809


° Assembler: Motorola 6809

3
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809

° The 6800 is an 8-bit microprocessor produced by Motorola and


released shortly after the Intel 8080.

° It has 78 instructions. It is the first microprocessor with a


index register.

° It usually comes in the form of a 40-pin case.


and contains 7000 transistors.

° He has several descendants: 6809, many microcontrollers.


starting from the architecture of the 6800: 6805, the 6807, the 68HC11 and the
68HC12.

4
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809
The Motorola 6809 contains:
° An 8-bit Data bus
° A 16-bit address bus allowing for memory addressing of
64 Kilobits.
° Two 8-bit accumulators 'A' and 'B' convertible into 1
16-bit accumulator 'D'
° Two 16-bit index registers 'X' and 'Y'
° Two stack pointer registers "U" and "S"
° A 8-bit page pointer 'DP' used for direct addressing of the
memory
° A status register "CC" on 8 bits
° The 16-bit program counter "PC" (CO) always pointing
on the address that the microprocessor must execute.

5
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809: THE PINOUT

The pins of the processor

6
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809: THE PINOUT

7
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809 : THE PINOUT

The microprocessor has 40 pins and is powered by 5V.


only.

He has 3 independent buses:

° Data bus of 8 bits (D0 to D7).


° Address bus on 16 bits (A0 to A15).
° 10-bit control bus.

8
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809: THE PINOUT - Command example
The read/write signal R/W (read/write) determines the
meaning of data transfer.
° When R/W = 1, the 6809 performs a read.
° When R/W = 0, the 6809 performs a write on the bus.
of data.
The status lines of bus BA (Bus Available) and BS (Bus)
State) informs the peripherals of the 6809 about the
availability of data and address buses.
° BA = BS = 0: the data and address buses are
available
° BA = 0, BS = 1 : the 6809 has just received a
interruption.
° BA = 1, BS = 0: the 6809 just encountered in the
program the SYNC instruction.
° BA = BS = 1: Interruption by the HALT signal on 6809

9
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017

MOTOROLA 6809 : THE PINOUT

The complete meaning of the different pins is


detailed in the PDF files on the TP CD

10
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809 : THE REGISTERS

11
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809: THE BASE REGISTERS

° The 6809 has several registers used for manipulation and the
data processing:
° 2 8-bit accumulators A and B transformable into 1 accumulator of
16 bits, D.
° They are used for arithmetic, logical, and instructions
loading 8-bit (or 16-bit) data into memory. They are for
they are completely identical.
° The accumulator D is actually the concatenation of A and B, register A
representing the high weights (bits 8 to 15) and B the low weights (bits 0 to)
7).

12
Arch.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017
MOTOROLA 6809 : THE INDEX REGISTERS

° 2 index registers X and Y, on 16 bits. They allow addressing everything.


the memory space with the additional capability of being pre-decremented or
post-incremented to facilitate the processing of variables in tables.

13
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809: THE STACK REGISTERS

° 2 stack pointer registers U and S.


° U (User) is used only by the programmer.
° S (System) by the system for backup operations in case
of interruption or jump to a subroutine (Return address).

° The stack is a location where the microprocessor saves the content.


of its internal records for a while.

° They operate on a last in-first out (LIFO) basis.


Out).

° The stack pointer points to the last effective entry of the stack.
14
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017
MOTOROLA 6809 : THE PAGE REGISTER

° A 'memory page' register DP (Direct Page), 8 bits, is used.


to address pages in memory.

° A page is a block of 256 bits. Also, the memory locations 0 to


255 forms page 0 of the memory. The 6809 has an address bus.
from 16 bits, this results in 256 pages.

° The DP register allows for faster execution of programs. It is


automatically reset to 00 by a RESET.

15
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017

MOTOROLA 6809: THE PROGRAM COUNTER PC

THE CO REGISTER

° A PC (Program Counter), 16 bits, points


the memory address at which the 6809 must execute an instruction.

16
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809: THE CC REGISTERS

° A 'conditions codes' register CC, constantly displaying the status of


6809 resulting from an instruction. The content of the status register is
essentially conditioned by the UAL.

17
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

MOTOROLA 6809: THE REGISTERS

° Two accumulators A and B


° Two registers indexed X,Y
° Two stack registers: U, S
° An ordinal counter PC
° A CC state register and a
DP (8bits)

18
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
MOTOROLA 6809: INTERFACES

19
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

° Processor Presentation: Motorola 6809


° Assembler: Motorola 6809

20
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Assembler: Motorola 6809

° Introduction
° Structure of an assembly instruction
° The main instructions
° The addressing modes in assembly language
° Loops in assembly
° A first example

21
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017

Motorola 6809 Assembler: INTRODUCTION

° The programmer has a choice between different languages (assembly,


Ada, Java, C, etc.). The machine only understands machine language.
(i.e., binary instructions) !
° The assembler (i.e., assembly language) is the first language
non-binary accessible to the programmer
° Mnemonic codes and symbols
° Allows to maximize the resources of the machine
° Depends on the machine: Each manufacturer, even each processor has
his own assembler

22
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Motorola 6809 Assembler: INTRODUCTION

° Used by specialists⇒ optimization


° To highlight the specific architecture of the machine
° Error diagnosis (i.e., examination of memory content)
° The assembler is a symbolic variant of machine language.⇒
same set of instructions
° Specific to each type of machine
° Allows access to the machine's resources (i.e., registers)

23
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: INTRODUCTION

C Language M6809 Assembler Machine Language: M6809 Circuits


var1=var2+1 LDA var2 1011 0110 0010 0000 0000 0000
ADDA # 1 1011 1011 0000 0001
Printf ("Result=%d", var1) STA var1 This text appears to be a binary representation.

JSR impression 1011 0011 0000 0000 0000 0000


(identified impression
a subprogram)

24
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Motorola 6809 Assembler: STRUCTURE OF AN INSTRUCTION

° An instruction is composed of two distinct parts and


consecutive:

° An operator (mandatory);
° One or more operands (optional).

Operator Operands

25
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: MAIN INSTRUCTIONS

Loading register: LDA, LDB


Example: LDA $0043 => load the accumulator A with the content of
memory address $0043. The symbol $ indicates that it is in
hexadecimal.

Loading memory: STA, STB


Example: STA $0043 => load the memory address $0043 by the
content of accumulator A

Exchange the contents of the registers: EXG R1, R2


Example: EXG A,B => Exchange the contents of the two accumulators A and B
B

Transfer the content of a register: TFR R1, R2


Example: TFR A,B => Transfer the content of accumulator A to
the accumulator B.
26
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Motorola 6809 Assembler: MAIN INSTRUCTIONS

Addition Operation: ADDA, ADDB


ADD $0034 => Add the content of accumulator A with
content of the memory address cell $0034.
Subtraction operation: SUBA, SUBB
Example: SUBA $0043 => subtract the contents of accumulator A from
content of the address memory box $0034
Comparison: CMPA, CMPB
Example: CMPA $0043 => Compare the content of the accumulator A
with the content of the memory address
Multiplication Operation: MUL
Example: MUL => Multiply the content of A and B. The result is stored.
in D.

27
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: MAIN INSTRUCTIONS

LDX, LDY => load the X or Y registers with the contents of the address
mentioned memory

STX/STY => Load the content of the mentioned memory address


in the X or Y registers

ABX => Add the content of accumulator B to X

CMPX, CMPY => Compare X or Y with the contents of memory

See the complete list in the PDF files

28
ArchEitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017
Motorola 6809 Assembler: ADDRESSING MODES

Inherent addressing: The operational code contains all the information.


necessary for the execution of the instruction.
CLRAClear the contents of accumulator A.
–ABX Add the content of accumulator B to X

Immediate addressing: The operand (1 or 2 bytes) being manipulated is located


directly after the operator (symbol #) and is not specified by
the intermediary of an address
Load Accumulator with #$12 The accumulator is loaded with the data

corresponds to 12 in hexadecimal.
--ADDB#%10001001 Addition of the binary value 10001001 to B

29
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: ADDRESSING MODES

Direct Addressing: It allows in collaboration with the DP register to


charge a battery with the contents of any
memory address.

Ex: With DP = 00
LDA < $00=> load A with the content of address $0000
CMPX < $35 => compare X with the content of addresses $0035 and
$0036

With DP = 24
LDA < $00=> load A with the contents of address $2400
CMPX < $35 => compare X with the content of addresses $2435 and
$2436

30
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Motorola 6809 Assembler: ADDRESSING MODES

Extended addressing: It allows access to all memory but with


a 2-byte operand (the symbol # is absent).

– LDA $0035 => The accumulator A receives the content of the address
35.

–STA $0035 The content of A is loaded at address $35.

–ADD $0035 The content of $35 is added to that of A and the


The result is placed in A.

31
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: ADDRESSING MODES


Indexed addressing: This mode is somewhat close to addressing
extended. However, it uses a 16-bit index register (X or Y) which
specify a base to which a signed displacement of 5, 8 or is added
16 bits. Everything therefore depends on the content of this index.

-LDX #$0010 the register X receives the hexadecimal value 10


immediate addressing.
-LDA, X=>load A with the content of the address pointed by the
value of X.
-LDA, X+ => Charge A with the content of the address pointed to by X,
but increment the content of X after the end of the instruction (By
analogy: LDA, -X).
Load Accumulator with Memory at Address $05 plus XThe accumulator is loaded with a value located at
the address is equal to the sum of the indicated displacement (namely $5) and the
content of X (let it be $10) => LDA $15
32
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017
Motorola 6809 Assembler: MAIN INSTRUCTIONS - Branching

33
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

Motorola 6809 Assembler: MAIN INSTRUCTIONS

BEQ: Branch if equal to zero


BNE: Branching if different from zero
BMI: Negative connection
BPL: Connection if positive
BCS: Connection if retention
BCC: Connection if no retention
BVS: Connection if capacity is exceeded
Connection still
Signed names: Unsigned names:
BGT : >0 ; BGE: >=0 BHI : >0 ; BHS: >=0
BLT : <0 ; BLE: <=0 BLO: <0 ; BLS: <=0
……
34
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6Computers - Assembler 2016 - 2017
Motorola 6809 Assembler: LOOPS
To facilitate the writing of the program in such a case, one does not specify
not explicitly the address to which the PC must go but a
label.
Example: Load the value from memory address AA

Return:
DECB
BNE Return
In this example, the first line loads B with the content of
the address $AA, then we decrement the content of B to the third
line and the fourth line means that if this content does not become
equal to zero, then the μP must return to the line indicated by the label
Return
Note: A label can be any string of
character starting with an alphabet letter
35
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6computers - Assembler 2016 - 2017

Questions and Exercises

36
ArcKh.EitLeHcAtRuIr2e01d5e-s20o1r6dinateurs - Assembler 2016 - 2017

You might also like