You are on page 1of 25

‫ني فَهْما‬

ِ ْ
‫ق‬ ُ
‫ز‬ ْ‫ر‬ ‫و‬
َ ً ‫ا‬‫م‬ ْ
‫ل‬ ِ ‫ب ز ْد‬
‫ني ِع‬ ِّ ‫َر‬
My Lord! Advance me in
Knowledge and true understanding

MICROPROCESSOR BASED
SYSTEM Lecture8
Dr. Shahrul Naim Sidek
snaim@iium.edu.my
Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07
Software Architecture

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction: Memory Allocation
How is the machine program codes stored in physical
memory?

1 2 3 4

1. Address 3. Source Line


2. Machine Codes 4. Assembly Codes
Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07
Instruction: Machine Code Translation

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Addressing Modes: Summary

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction: Memory Organization

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction: Instruction Set
• Assembler directives (the most important ones)
ORG, EQU, END, DC, DS, EXTERN/PUBLIC
• Instructions
Data movement
Integer arithmetic
Boolean
Shift and rotate
Bit manipulation
Binary Coded Decimal
Program flow
System control
Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07
Instruction Set: Assembler Directives
• Assembler directives
are instructions to the assembler program
and they appear in the mnemonic (opcode) field of the source code
are not instructions to the microprocessor
and they have no direct effect on the contents of memory (except DC)
• They cover a number of functions, including
defining symbols and assigning them values
controlling the flow of execution of the assembler
setting format and content of the object and listing files

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Assembler Directives (cont)

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Assembler Directives (cont)
FUNCTION (ORIGIN)
Sets the starting address in memory for the instructions or data constants
that follow
EXAMPLE

NOTES
Hex address $1000 is set as the starting address for the following
instruction
The opcode for MOVE.L goes in address $1000 … and so on

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Assembler Directives (cont)
FUNCTION (EQUATE)
Assigns a value to a symbol. The symbol is used later in the program in
place of the value
EXAMPLE

NOTES
The value of $100 replaces the symbol in the binary code
The use of EQU directives is encouraged because
makes program more readable
Rev 1.0 makes programs easier to
Microprocessor maintain
Based System (MCT 2219) SBAH Jul’07
Instruction Set: Assembler Directives (cont)
FUNCTION (END)
Used at the end of the source program
Statements following the END directive are not processed by the assembler
EXAMPLE

NOTES
The label of the END directive (optional) represents the entry point for the
program
The address of the entry point is used by debuggers, loaders, conversion
utilities, and so on, to identify the starting address of the program
Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07
Instruction Set: Assembler Directives (cont)
FUNCTION (DEFINE CONSTANT)
Place data constants WITHIN A PROGRAM
EXAMPLE

NOTES
For words and longwords, the assembler adjusts the address of the
constant to ensure proper alignment.
ASCII characters defined
Rev 1.0 as words
Microprocessor are left-justified
Based System (MCTwithin
2219) the word SBAH Jul’07
Instruction Set: Assembler Directives (cont)
FUNCTION (DEFINE STORAGE)
Reserves RAM storage for use during execution of the program.
EXAMPLE

NOTES
if the memory locations reserved for buffer are not initialized, they will
contain garbage data
Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07
Instruction Set: Categories
• Data movement
Move operands (data) among memory locations or registers
• Integer arithmetic
Addition, subtraction, multiply, divide, ...
• Boolean
AND, OR, XOR, NOT, ...
• Shift and rotate
Arithmetic-shift, logical-shift, rotate

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Categories
• Bit manipulation
Bit test, bit set, bit clear, ...
• Binary Coded Decimal
Add, subtract and negate in BCD notation
• Program flow
Branch, jump and return
• System control
Miscellaneous: trap, reset, SR/CCR manipulation, ...

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Data Movement

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Integer Arithmetic

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Boolean

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Shift & Rotate

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Bit Manipulation

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Binary Coded Decimal

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: Program Flow

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Instruction Set: System Control

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07


Assignment #3
Show the usage of each M68000 instruction below by showing the result of each operation. (i.e. use
TRAP function to display)

Data Movement Int. arithmetic Boolean Shift rotate Bit Binary coded
Manipulation decimal

MOVE ADD AND ASL BSET ABCD


MOVEA SUBI OR LSL BCLR SBCD
MOVEQ MULU NOT ROL BCHG NBCD
MOVEM DIVS TST SWAP BTST
CLR
NEG
EXT

Rev 1.0 Microprocessor Based System (MCT 2219) SBAH Jul’07

You might also like