ch3 ec304.pdf
TRANSCRIPT
![Page 1: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/1.jpg)
Chapter 3 Introduction To Assembly Language (Instruction Sets)
![Page 2: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/2.jpg)
Language
LANGUAGE is a medium of communication between two or more individuals or parties.
The most important criteria in the communication is the message it brings must be effectively delivered, this is achieved only if the language is understood by the both parties.
What if the language is not compatible to both parties? Then a translator is needed. For instance, a Japanese requires a Japanese-Malays translator to communicate to a Malaysian
![Page 3: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/3.jpg)
Introduction
Microprocessor run the operation based on the program that write by the programmer
Three types of program language High Level Language – C,C++, BASIC, PASCAL, FOTRAN, JAVA
Low Level Language –Assembly Language
Machine Language
How ever microprocessor does not understand what language write by the programmer Microprocessor only understand machine language – binary
number; High Level Language - (compiler)
Low Level Language - (assembler)
![Page 4: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/4.jpg)
![Page 5: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/5.jpg)
Block Diagram
Japanese-Malay
translator
Japanese
Malay
Compiler
High-level Language
Machine Language
Assembler
Assembly Language
Machine Language
High level
Middle level
Low level
Programmers
Computer
BASIC
COMMUNICATION
COMPUTER SYSTEM
COMMUNICATION
Language
Language
Translator
![Page 6: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/6.jpg)
High level language
(Basic, Pascal and C)
Programming instructions in the
normal English words, very friendly
to programmers..
Middle level language (Assembly
language)
Low level language
(Machine language)
ASSEMBLER
COMPILERS
Implemented by computer system
Programming instructions in the
binary codes, understand directly by
computer system.
Programming instructions in the
English like abbreviation, still not so
user friendly.
Human being (Programmers)
![Page 7: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/7.jpg)
High Level Language
Programming language close to human language (such as
English) is called high-level language. Examples of high-level language such as FORTRAN, COBOL, BASIC, PASCAL, C + +, JAVA
High level language similar to English. Instruction program written using English words, such as print, and other inputs.
But every high-level language has its own rules or grammar for writing instruction program. Regulations referred to as syntax.
Program written in the levels should be translated into machine code prior to running.
Every high level language has its own translator program.
![Page 8: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/8.jpg)
Assembly Language programming
Assembly Language program consists of series of lines of Assembly language instructions.
Deals directly with the internal structure of CPU
Instruction consists of a mnemonic and two operands.
Mnemonics (abbreviations) are used for the instructions of the processor
Names for memory locations
Labels
Symbols
Design of processor must be known
![Page 9: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/9.jpg)
Sample of assembly language
program
![Page 10: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/10.jpg)
Machine Language
Programs consist of 0s and 1s are called machine language.
Assembly Languages provided mnemonics for machine code
instructions.
Mnemonics refer to codes and abbreviations to make it easier
for the users to remember.
![Page 11: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/11.jpg)
Machine language
+1300042774
+1400593419
+1200274027
Assembly Language
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
High-Level Language
grosspay = basepay +
overTimepay
Instructions are
binary codes.
Understand directly
by computer
system.
Cumbersome for
human.
Instructions are
normal English
words. Most
friendly to human
(Programmers).
Instructions are
English- like
abbreviation. More
friendly to human
(Programmers).
shows the instructions of three different
languages that perform the same task.
![Page 12: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/12.jpg)
![Page 13: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/13.jpg)
Programming in Assembler
![Page 14: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/14.jpg)
Try and translate this:
00110000001111000000000000010010
![Page 15: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/15.jpg)
Try and translate this:
00110000001111000000000000010010
MOVE.W #$12,D0
00 11 000 000 111 100 0000 0000 0001 0010
(Data register direct
addressing mode, D0)
![Page 16: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/16.jpg)
A Simple Example
Write the instructions to add 50 and 72 and
save the answer in register C. High Level - Java, C
X = 50 + 72
Assembly Language – Intel 8085
MVI A, 50
MVI B, 72
ADD B
MOV C, A
Motorola 68000
MOVE.W #$50,D0
MOVE.W #$72,D1
MULU D1,D0
![Page 17: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/17.jpg)
A Simple Example (cont)
Machine Language HEX BINARY OPERAND
3E 0011 1100 MVI A
32 0011 0010 50
06 0000 0110 MVI B
48 0100 1000 72
80 1000 0000 ADD B
4F 0100 1111 MOV C, A
76 0111 0110 HLT
![Page 18: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/18.jpg)
The Assembler
Machine Language:
00110000001111000
01100100011110000
00000000110100
Assembly Language:
MOVE.W #$12,D0
MOVE.W #$34,D1
MULU D1,D0
Assembler
![Page 19: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/19.jpg)
Data Representation Method
M68k can accept many types of data:
Binary
Octal
Hexadecimal
Decimal
Character
![Page 20: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/20.jpg)
Binary
Binary: start with %
Example:
Move binary value 10010101 to D0.
MOVE.B #%10010101,D0
D0 = 0 0 0 0 0 0 9 5
10010101B = 95H
![Page 21: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/21.jpg)
Octal
Octal: start with @
Example:
Move octal value 45 to D0.
MOVE.B #@45,D0
D0 = 0 0 0 0 0 0 2 5
45O = 25H
![Page 22: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/22.jpg)
Hexadecimal
Hexadecimal: start with $
Example:
Move hexadecimal value FE to D0.
MOVE.B #$FE,D0
D0 = 0 0 0 0 0 0 F E
![Page 23: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/23.jpg)
Decimal
Decimal: no need to put any symbols.
Example:
Move decimal value 10 to D0.
MOVE.B #10,D0
D0 = 0 0 0 0 0 0 0 A
10D = 0AH
![Page 24: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/24.jpg)
ASCII Characters
Characters: Enclose character in single
quotes (‘ ’).
Example:
Move ASCII character ‘A’ to D0.
MOVE.B #’A’,D0
D0 = 0 0 0 0 0 0 4 1
A = 41H
![Page 25: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/25.jpg)
Easy68k Interface
LABEL
INSTRUCTION
VARIABLES/PARAMETERS
ANYTHING PAST THIS IS
IGNORED, TREATED AS COMMENT.
PROGRAM DESCRIPTION
![Page 26: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/26.jpg)
![Page 27: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/27.jpg)
Programming in Easy 68k
Easy68k divides program into 4 columns: Label:
Marks memory locations using characters.
Easy reference.
Op-Code - Instruction: What instruction to execute.
Operand(s): Variables/Parameters: Usually specifies source & destination.
May specify parameters as well.
Comment: Used to describe flow of program,
![Page 28: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/28.jpg)
Simulation Window
Shows status of internal
M68k registers.
Memory address
where instruction
is stored.
Machine code generated
by assembler.
Press here to execute
programs step-by-step.
Press here to restart
program execution.
![Page 29: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/29.jpg)
MOVE.B #9,D0 instruction:
Is on line 11 in M68k source file.
Is stored in memory address $1000.
Its machine code is $103C0009 (00010000001111000000000000001001).
![Page 30: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/30.jpg)
Specify Start/End of Program
M68k needs to know where to start executing
instructions, where to stop.
Specified using ORG (Origin), END (End).
Value of ORG loaded into PC, execution
starts there.
![Page 31: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/31.jpg)
Format: Start/End Program
ORG $1000
END $1000
Program Instructions
PC loaded with $1000,
starts executing from here.
END specifies ending of program.
![Page 32: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/32.jpg)
Use Labels
Any memory location may be given labels.
Easier to refer to specific locations:
Useful in for loops, subroutines, branch
commands.
![Page 33: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/33.jpg)
Using Labels - Example
START ORG $1000
MOVE.B #$2000,A0
MOVE.B #$10, D1
CLR.B D0
LABEL1 ADD.B (A0)+, D0
SUB.B #1, D1
BNE LABEL1
END START
![Page 34: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/34.jpg)
Assembler format
![Page 35: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/35.jpg)
Concept of programming
A program is a means to perform tasks or solve problems.
Thus in the process of program building consists several essential steps:
Definition of problem (Penyelesaian Masalah)
Logical design (Pseudo code/Flow chart)
Programming.
Test run the program.
Documentation of the program.
![Page 36: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/36.jpg)
Flowchart
![Page 37: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/37.jpg)
Flowchart
Graphical method to plan flow of our
programs.
Shows program’s step-by-step operation.
Easy to understand and analyze.
Can be used to write organized programs.
![Page 38: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/38.jpg)
Flowchart
Basic shapes:
Terminator.
Process.
Decision.
Input/Output.
Connectors.
![Page 39: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/39.jpg)
Basic Shapes – Terminator
Indicates beginning and end of flowchart.
Once at beginning, once at end.
Examples:
START FINISH
![Page 40: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/40.jpg)
Basic Shapes - Process
Describes actions to be done.
Represented as rectangles.
Short description of process in rectangle.
Example:
A = A + B Reset Ports Clear D0
![Page 41: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/41.jpg)
Basic Shapes - Decision
Shows alternative program flow based on
condition.
Represented as diamond shape.
Should have 2 arrows, representing TRUE
and FALSE program flows.
Can be used in “if…else”, “while”, and “for”
situations.
![Page 42: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/42.jpg)
Basic Shapes - Decision
Examples:
D0 = 3?
TRUE FALSE
Port is active? TRUE
FALSE
![Page 43: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/43.jpg)
Basic Shapes – Input/Output
Shows the process of inputting or outputting
data.
Represented using rhombus.
Examples:
Input D0 Show calculation
results
![Page 44: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/44.jpg)
Basic Shapes - Connectors
Used to link large process flows together.
Represented using circles, with numbers
inside.
Numbers indicate connection.
Examples:
1 3
![Page 45: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/45.jpg)
Example: Connector
START
Input D0
Input D1
1
D0 = D0 x D1
1
FINISH
![Page 46: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/46.jpg)
Writing the Program
Once flowchart is complete, write code to
implement program.
Follow program flow closely.
Check and fix problems if necessary.
![Page 47: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/47.jpg)
Example: Calculate Area of Rectangle
D0
D1 START
Input D0
Input D1
1
D0 = D0 x D1
1
FINISH
![Page 48: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/48.jpg)
Translation to Assembly
START
Input D0
Input D1
D0 = D0 x D1
FINISH
ORG $1000
MOVE.W #$12,D0
MOVE.W #$34,D1
MULU D1,D0
END
![Page 49: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/49.jpg)
Complete Program
START ORG $1000
MOVE.W #$12,D0
MOVE.W #$34,D1
MULU D1,D0
END START
![Page 50: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/50.jpg)
Example: Add 10 Numbers Together
START
Input numbers
into memory
locations.
D0 = 10
Load starting
address into A0
Clear D1
FINISH
D0 = 0?
D1 = D1 + (A0)
FALSE
Go to next
memory location
D0 = D0 - 1
TRUE
![Page 51: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/51.jpg)
START
Input numbers
into memory
locations.
Load starting
address into A0
ORG $1000
MOVE.W #$11,$1100
MOVE.W #$22,$1102
MOVE.W #$33,$1104
MOVE.W #$44,$1106
MOVE.W #$55,$1108
MOVE.W #$66,$110A
MOVE.W #$77,$110C
MOVE.W #$88,$110E
MOVE.W #$99,$1110
MOVE.W #$11,$1112
MOVEA.L #$1100,A0
![Page 52: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/52.jpg)
D0 = 10
Clear D1
D0 = 0?
D1 = D1 + (A0)
FALSE
D0 = D0 - 1
MOVE.B #10,D0
CLR.B D1
Go to next
memory location
LOOP…BNE LOOP, CMP.B #$0,D0
ADD.W (A0),D1
ADDA.L #$2,A0
FINISH
SUB.B #$1,D0
END
![Page 53: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/53.jpg)
Complete Program
START ORG $1000
MOVE.W #$11,$1100
MOVE.W #$22,$1102
MOVE.W #$33,$1104
MOVE.W #$44,$1106
MOVE.W #$55,$1108
MOVE.W #$66,$110A
MOVE.W #$77,$110C
MOVE.W #$88,$110E
MOVE.W #$99,$1110
MOVE.W #$11,$1112
MOVEA.L #$1100,A0
MOVE.B #10,D0
CLR.B D1
LOOP ADD.W (A0),D1
ADDA.L #$2,A0
SUB.B #$1,D0
CMP.B #$0,D0
BNE LOOP
END START
![Page 54: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/54.jpg)
some important
terminologies
![Page 55: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/55.jpg)
Terminologies
Machine code
Mnemonic
Source File
Object Files, List File, Hex file
Assembler
Single-line assembler
Cross Assembler
Pseudo-opcode
![Page 56: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/56.jpg)
Machine code
Programming code written in a machine language that can be executed directly by a machine (computer) without any conversion or translation.
A low-level code interpreted and converted from high-level source code and understood only by the machine.
Machine code is transported to the system processor when a specific task, application or program executes even the smallest process.
![Page 57: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/57.jpg)
![Page 58: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/58.jpg)
A mnemonic (pronounced "nemonic") is a pattern that can be used as an aid for memorizing information. Most often, this pattern consists of letters or words. Mnemonic is an abbreviation of the words used in an assembly
language program to represent an instruction.
Depending on the microprocessor types, for example in Motorola mnemonic is different from Intel
Contains the machine language instructions, translated into machine code
MOV Move
MVI Move Immediate
LDA Load Accumulator Directly from Memory
Mnemonic
![Page 59: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/59.jpg)
Source code
In computer science - source code is any collection of
computer instructions (possibly with comments) written
using some human-readable computer language, usually
as text
The source code of a program is specially designed to
facilitate the work of computer programmers, who
specify the actions to be performed by a computer
mostly by writing source code.
The source code is often transformed by a compiler
program into low-level machine code understood by the
computer
![Page 60: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/60.jpg)
Object Files
Compilers and assemblers create object files
containing the generated binary code and
data for a source file.
Containing object code, meaning relocatable
format machine code that is usually not
directly executable
![Page 61: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/61.jpg)
List File
A list file is simply a text file that contains a
list of other files.
![Page 62: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/62.jpg)
Hex File
The Intel hex (ihex) generally known as hex file, is a
format used to store machine language code in
hexadecimal form.
It is widely used format to store programs to be
transferred to microcontrollers, ROM and EEPROM.
The compilers convert the programs written in assembly,
C etc into corresponding hex files, which are dumped
into the controllers using burners/programmers.
![Page 63: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/63.jpg)
Hex File…
The microcontroller understands machine
language consisting of zeroes and ones. It’s
difficult rather practically impossible for humans
to write codes in zeros and ones.
Hence we use some high level languages like C,
C++, Java, etc. And later a compiler is used to
convert these codes into machine language
which are stored in a hex file format.
A hex file is a text file with the extension .hex.
![Page 64: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/64.jpg)
Assembler
A computer program which translates from assembly
language to an object file or machine language format
A program that takes basic computer instructions and
converts them into a pattern of bits that the computer's
processor can use to perform its basic operations.
Some people call these instructions assembler language
and others use the term assembly language.
![Page 65: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/65.jpg)
Single-line assembler
single-line mean a program that doesn't
assemble an entire file but only one
statement.
That is generally called "DEBUG.EXE" WIN XP debug:
C:\>debug
-a100
117E:0100 rol eax,3
^ Error
117E:0100
-q
![Page 66: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/66.jpg)
![Page 67: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/67.jpg)
Cross assembler
An assembler that generates machine language for a
different type of computer than the one the assembler is
running in.
It is used to develop programs for computers on a chip
or microprocessors used in specialized applications that
are either too small or are otherwise incapable of
handling the development software.
Common methods involve transmitting an exact byte-by-
byte copy of the machine code or an ASCII
representation of the machine code in a portable format
(such as Motorola or Intel hexadecimal) through a
compatible interface to the target system for execution.
![Page 68: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/68.jpg)
pseudo-opcode
An assembler directive or pseudo-opcode is a command
given to an assembler "directing it to perform operations
other than assembling instructions."
Sometimes the term pseudo-opcode is reserved for
directives that generate object code
![Page 69: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/69.jpg)
![Page 70: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/70.jpg)
![Page 71: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/71.jpg)
Summary of the terminologies
![Page 72: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/72.jpg)
Assembly Language (Easy68k)
Assembler to generate machine code.
Object file (Motorola: S-file).
Contains machine code.
Linker sometimes used for big projects:
Links together multiple S-files.
Creates single S-file from combined files.
![Page 73: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/73.jpg)
Assembly
File #1
Assembly
File #2
Assembly
File #3
Assembly
File #4
ASSEMBLER
Object
File #1
Object
File #2
Object
File #3
Object
File #4
LINKER
Final Object
File
Listing File
![Page 74: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/74.jpg)
Source Code (X68)
![Page 75: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/75.jpg)
Object File (S-File)
![Page 76: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/76.jpg)
Listing File
![Page 77: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/77.jpg)
Exercise 1:
Give the term
Assembler
Source code
Object code
Cross Assembler
IDE (integrated Development Environment)
![Page 78: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/78.jpg)
ANSWER
![Page 79: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/79.jpg)
![Page 80: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/80.jpg)
![Page 81: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/81.jpg)
![Page 82: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/82.jpg)
![Page 83: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/83.jpg)
![Page 84: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/84.jpg)
![Page 85: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/85.jpg)
Exercise 2
Give the term
Label
Op-code
Operands
Comment
Linker
![Page 86: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/86.jpg)
ANSWER
Label
Op-code
Operands
Comment
Linker
![Page 87: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/87.jpg)
END
![Page 88: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/88.jpg)
MC6800 Instruction Group
![Page 89: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/89.jpg)
Addressing Mode
![Page 90: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/90.jpg)
![Page 91: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/91.jpg)
![Page 92: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/92.jpg)
![Page 93: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/93.jpg)
![Page 94: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/94.jpg)
![Page 95: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/95.jpg)
![Page 96: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/96.jpg)
![Page 97: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/97.jpg)
![Page 98: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/98.jpg)
![Page 99: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/99.jpg)
![Page 100: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/100.jpg)
![Page 101: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/101.jpg)
![Page 102: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/102.jpg)
![Page 103: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/103.jpg)
![Page 104: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/104.jpg)
![Page 105: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/105.jpg)
Machine Code Generation
![Page 106: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/106.jpg)
![Page 107: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/107.jpg)
![Page 108: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/108.jpg)
![Page 109: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/109.jpg)
![Page 110: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/110.jpg)
![Page 111: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/111.jpg)
![Page 112: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/112.jpg)
![Page 113: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/113.jpg)
![Page 114: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/114.jpg)
![Page 115: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/115.jpg)
![Page 116: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/116.jpg)
![Page 117: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/117.jpg)
![Page 118: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/118.jpg)
![Page 119: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/119.jpg)
![Page 120: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/120.jpg)
![Page 121: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/121.jpg)
![Page 122: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/122.jpg)
![Page 123: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/123.jpg)
![Page 124: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/124.jpg)
![Page 125: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/125.jpg)
![Page 126: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/126.jpg)
![Page 127: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/127.jpg)
![Page 128: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/128.jpg)
![Page 129: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/129.jpg)
![Page 130: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/130.jpg)
![Page 131: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/131.jpg)
![Page 132: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/132.jpg)
![Page 133: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/133.jpg)
![Page 134: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/134.jpg)
![Page 135: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/135.jpg)
![Page 136: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/136.jpg)
![Page 137: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/137.jpg)
![Page 138: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/138.jpg)
![Page 139: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/139.jpg)
![Page 140: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/140.jpg)
![Page 141: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/141.jpg)
![Page 142: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/142.jpg)
![Page 143: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/143.jpg)
![Page 144: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/144.jpg)
![Page 145: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/145.jpg)
![Page 146: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/146.jpg)
![Page 147: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/147.jpg)
![Page 148: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/148.jpg)
![Page 149: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/149.jpg)
END CH 3
![Page 150: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/150.jpg)
Assembler
![Page 151: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/151.jpg)
Single-line assembler
![Page 152: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/152.jpg)
Cross-assembler
![Page 153: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/153.jpg)
Pseudo-opcode
![Page 154: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/154.jpg)
Determine four fields of an
assembly language instruction.
![Page 155: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/155.jpg)
The instruction set and
addressing modes
![Page 156: CH3 EC304.pdf](https://reader030.vdocuments.site/reader030/viewer/2022033105/55cf9b37550346d033a52c70/html5/thumbnails/156.jpg)
Identify groups of instruction sets of the
68000/8086
microprocessor.