Download Cross Assembler - Lecture Slides | ECSE 2610 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!
Cross Cross--AssemblerAssembler
Assembler operations
Assembler directives
Assembly language basics
M6811 Cross M6811 Cross--AssemblerAssembler
Program assembles on one machine (host) and runs on another (target) Program assembles on one machine (host) and runs on another (target)
ASSEMBLER
DOS instruction "asm prog"
DOS instruction "asm prog" Assembler Outputs Assembler Outputs
Load File <prog.s19>
"text" "text"
Listing File <prog.lst>
"text" "text"
Script File
"batch" "batch"
Source Code <prog.asm>
Assembly Language Assembly Language
Source Statement Content
NumbersNumbers
Decimal (default) 10, -
Hexadecimal $2C
Binary %
SymbolsSymbols
1..6 Alphanumeric characters
1 character symbols not allowed: A, B, D, X, or Y
Avoid symbols that are identical to opcode mnemonics
ExpressionsExpressions
Symbols and numbers separated by arithmetic operators
Arithmetic operators are +, -, *, and /
No embedded spaces are allowedNo embedded spaces are allowed
Good for humans Good for humans
Good for addresses Good for addresses
Good for bit patterns Good for bit patterns
The assembler does the math -- in any base!!
The assembler does the math -- in any base!!
Source Statement Format Source Statement Format
Label Label OperationOperation OperandOperand CommentComment
Statement fields are separated by blanksโ
Label Label a symbol whose first
character is in column 1
OperationOperation instruction mnemonic for
Opcode
Operand Operand can be empty, a symbol, a
number, or an expression
CommentComment the remainder of the line,
may be blank
Example:
START LDAA $C200 This is the beginning of the program
What about a blank
in column 1?
What about a blank
in column 1?
โ Actually,tabs are
allowed too.
โ Actually,tabs are
allowed too.
Lec Lec. Exercise 1. Exercise 1
Program starts at $D100:
L1: $0B โโโโ ACCA;
L2: ACCA - 1 โโโโ ACCA;
if (ACCA = $05) then go to L1 else go to L2;
1. Write this program in assembly language.
2. Hand code this program in machine code.
Answer Answer
Exercise 1 Answer Exercise 1 Answer
$D100 86 L1: LDAA #$0B $0B โโโโ ACCA
$D101 0B
$D102 4A L2: DECA ACCA - 1 โโโโ ACCA
$D103 81 CMPA #$05 if (ACCA = $05) $D104 05 $D105 27 BEQ L1 then go to L $D106 F $D107 20 BRA L2 else go to L $D108 F