




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the 6811 programming model, focusing on branch instructions, condition code register, and comparison instructions. It includes examples of conditional and unconditional branch instructions and their differences.
Typology: Study notes
1 / 36
This page cannot be seen from the preview
Don't miss anything!





























2
8-bit Accumulators A
A & B
B
7
A
0
7
B
0
15
D
0
16-bit Accumulator D
15
PC
0
Program CounterProgram Counter
H H
N N
Z Z
V V
C C
Condition CC
Code R
Register
CC
arry/borrow (MSB)
oV
V
erflow (2s C)
Z Z
ero
NN
egative
HH
alf carry (bit 3
→
4),(BCD)
Mnemonic
Operation
Op-code
LOAD
mem
00
STORE
AC -> mem
01
ADD
AC + mem
10
BRN
IF AC<15> =1 THEN qhhh -> PC
11
16-bit Accumulator14-bit Program Counter
15
AC
0
13
PC
0
Review 4: N1 + N Review 4: N1 + N
→ →
SUM SUM
...
...
LDAA
$C
B
$C
C
$C
10
ADDA
$C
BB
$C
C
$C
11
STAA
$C
B
$C
C
$C
12
HALT
$C
3F
...
...
N
$C
12
N
$C
34
SUM
$C
FF
...
...
C
20
PC
A B
Bytes
Machine Code
Source
Form BRA
Branch Always
rr
Jump
See Special
hh ll
Operations
ff
ff
Addressing Addressing
Mode for Mode for
Operand Operand
Boolean
Expression
Operation
Opcode Operand
Relative to what?
Relative to what?
This is a new
addressing mode
Relative addressing
This is a new
addressing mode
Relative addressingRelative addressing
In this mode, addresses are specified relative to the program counter Also known as PC-relative addressing
Example:
Program branches to address (PC + $28)
Relative
Offset
Relative
Offset
To figure out this address, we need to know the value in the PC. Where is the instruction located in memory? BRA is a 2-byte instruction. After the instruction is fetched,
Therefore,
Instructions with No Operands
Instructions with No Operands
Some of the instructions that have no operand:
Translate the following pseudo-code program into M6811machine code. The programs starts at address $6000. Usethe SWI instruction to HALT the program.
if (ACCA
Answer
Answer
H H
N N
Z Z
V V
C C
Condition CC
Code R
Register
CCarry/borrow (MSB)oV
Verflow (2s C)
ZZeroNNegativeHalf carry from (bit 3H
to
4), used
for (BCD) corrections only
These CCR bits are set by
ALU operations
These CCR bits are set by
ALU operations
Source
Form
Operation
Boolean
Expression
Opcode
BRA (opr)
Branch Always
BRN (opr)
Branch Never
Signed Conditional Branches Signed Conditional Branches
Source
Form
Operation
Boolean
Expression
Opcode
BGT (opr)
Branch if > Zero
BLE (opr)
Branch if <= Zero
BGE (opr)
Branch if >= Zero
BLT (opr)
Branch if < Zero
Unsigned Conditional Branches Unsigned Conditional Branches
Source
Form
Operation
Boolean
Expression
Opcode
BHI (opr)
Branch if Higher
BLS (opr)
Branch if Lower or Same
BHS (opr)
Branch if Higher or Same
BLO (opr)
Branch if Lower
Comparison Instructions Comparison Instructions
CMPA (opr)
Compare A to Memory
CMPB (opr)
Compare B to Memory
Boolean
Expression
Addr
Mode
Operation
Opcode
Source Form
Comparison Instructions Comparison Instructions
Boolean
Expression
Addr
Mode
Operation
Opcode
Source Form
CPD (opr)
Compare D to Memory
CPX (opr)
Compare X to Memory
CPY (opr)
Compare Y to Memory