DFC10093 Chapter 3
DFC10093 Chapter 3
DFC10093 Chapter 3
Instruction Set :
The program
is long and
arduous
To overcome these problems, the use
of easily remembered code (mnemonic)
was introduced. It is apply with the use
of Assembly Language
6
B) ASSEMBLY LANGUAGE
Assembly language:
• Assembly language is a symbolic representation of a machine
language of specific processor. Assembly language is a form that is
very dependent on the underlying architecture.
• Using english-like abbreviations (MUL).
• Assembler as translator.
• Assembler - Translate ordinary mnemonics such as MOVE Data,
Acc, into their corresponding machine language (the only form of
instruction that computer can executed)
• Assembly Process - Process of translating an assembly language
programs into a machine language programs. The assembly
process is straightforward (one-to-one mapping of assembly
languages statements to their machine language counterpart) and
rather simple
• Programmer need to know the basic architecture.
Why assembly language study is important?
• It clarifies the execution of instruction.
• It shows how the data represent in memory.
• It show how a program interacts with the operating system (OS),
processor and, input and output (I/O) system.
• It clarify how a program access external devices
• Sometimes difficult to access hardware drive and system tool if using
(register transfer languages) RTL
8
3.1.2 DESCRIBE ADDRESSING
MODES USING PROPER
INSTRUCTION FORMAT
A) INSTRUCTION FORMAT
There are many MC68000 instructions. However, theses
instructions comply to a standard instruction format:
A) INSTRUCTION FORMAT
LABEL – A user-defined symbol representing the address associated with the
instruction. Up to 8 alphanumeric, begin with letter, terminated by a space.
OPERATOR - A mnemonic code for MC68000 instructions. An assembler
directive / pseudo-instruction / pseudo-operation. Macro call (repetitive
instructions in a program which are
codified only once and can be used as many times as necessary)
OPERAND – Depends on the operator, may has more than one operand.
COMMENT – Explanation about the execution of instruction.
Data format - Byte | Word | Longword | Sign-extended
DATA FORMAT
The physical operation of an instruction is manipulating data contained in the
internal register and memory locations. Thus it is essential to familiarize the
data format. In the operator field (column-2), we may see the mnemonics are
postfixed with symbol “.B”, “.W”, “.L”. This is actually specifying the data size of
operand (column-3) which is to be working on. In other words, how many bits
of the data cells are to be involved.
One digit of hexadecimal is represented by 4 bits, 2n = 24 = 16. If 1 digit of
hexadecimal is labelled “H”, thus:
Example 1:
• MOVE.W #$72,D1
• Before : D1 = $00200500
• After : D1 = $00200072
B.1 DATA TRANSFER / MOVE GROUP
Example 2:
• MOVE.B D0,D1
• Before : D1 = $00200500 , D0 = $00002222
• After : D1 = $00200522 , D0 = $00002222
B.1 DATA TRANSFER / MOVE GROUP
Example 3:
$3000 32
• MOVE.B $3000,D1
$3001 43
• Before : D1 = $00200500
$3002 98
• After : D1 = $00200532
Example 4:
• MOVE.W D6,$4000
• Before: D6 = $AB206541
• After : D6 = $AB206541
B.1 DATA TRANSFER / MOVE GROUP
Example 5:
• MOVEA.W D6,A2
• Before : D6 = $AB206541 , A2 = $ABCD1234
• After : D6 = $AB206541 , A2 = $00006541
Example 6:
• MOVEA.W D6,A2
• Before : D6 = $AB20A541 , A2 = $ABCD1234
• After : D6 = $AB20A541 , A2 = $FFFFA541
Example 7:
• MOVEA.L D6,A2
• Before : D6 = $AB206541 , A2 = $ABCD1234
• After : D6 = $AB206541 , A2 = $AB206541
B.1 DATA TRANSFER / MOVE GROUP
Example 8:
• MOVEA.L A0,A1
• Before : A0 = $12345678 , A1 = $00000000
• After : A0 = $12345678, A1 = $12345678
B.1 DATA TRANSFER / MOVE GROUP
Example 9:
• MOVEA.W D1,A1
• Before : D1 = $12345678, A1 = $11111111
• After : D1 = $12345678, A1 = $00005678
B.1 DATA TRANSFER / MOVE GROUP
Example 10:
• MOVEA.L #$7000,A1
• Before : A1 = $12122030 , A1 = $00007000
Example 11:
• MOVEA.L #$8000,A4
• Before : A4 = $12122030 , A4 = $FFFF8000
B.1 DATA TRANSFER / MOVE GROUP
Example 17:
SWAP D1
Before : D1 = $11223344
After : D1 = $33441122
Example 18:
CLR.B D1
Before : D1 = $11223344
After : D1 = $ 11223300
B. 2 ARITHMETIC OPERATION
B. 2 ARITHMETIC
Example 19:
• ADD.B D0, D1
• Before : D0 = $00002222 , D1 = $00004444
• After : D0 = $00002222 , D1 = $00004466
B. 2 ARITHMETIC
Example 20:
• ADDI.W #$72,D1
• Before : D1 = $00200500
• After : D1 = $00200572
Example 21:
• ADD.L D0,D1
• Before : D1 = $00200500 , D0 = $00002222
• After : D1 = $00202722 , D0 = $00002222
Example 23:
• ADDA.W D6,A2
• Before : D6 = $AB206541 , A2 = $ABCD1234
• After : D6 = $AB206541 , A2 = $ABCD7775
Example 24:
• ADDA.L D6,A2
• Before : D6 = $AB20A541 , A2 = $ABCD1234
• After : D6 = $AB206541 , A2 = $56EDB775 , C = 1
Example 25:
ADDX.B D2,D3
Before : D2 = $AB206541 , D3 = $ABCD1234 , X = 1
After : D2 = $AB206541 , D3 = $AB206576 , X = 1
B. 2 ARITHMETIC
Example 28:
SUB.W #$02,D1
Before : D1 = $12345678
After : D1 = $12345676
B. 2 ARITHMETIC
Example 29:
SUB.W D1,D0
Before : D0 = $12345678 , D1 = $98745432
After : D0 = $12340246, D1 = $98745432
B. 2 ARITHMETIC
B. 2 ARITHMETIC
B. 2 ARITHMETIC
Example 30:
• MULU #2,D2 ;16 bit x 16 bit = 32 bit
• Before : D2 = $AB206541
@ menunjukkan
• After : D2 = $0000CA82 nombor octal
% menunjukkan
Example 31: nombor binari
• MULU #2,D2
• Before : D2 = $AB20FFFF
FFFF16 = 6553510
• After : D2 = $0001FFFE 1FFFE16 = 13107010
Example 32:
• DIVU #2,D3 ;32 bit / 16 bit = 16 bit lower (result)
16 bit upper ( remainder)
• Before : D3 = $00006541
654116 = 25921
• After : D3 = $000132A0 32A016 = 1296010
B.3 LOGICAL OPERATION
B.3 LOGICAL OPERATION
Example 33:
• AND.B #$3E,D1
• Before : D1 = $12345674
• After : D1 = $12345634
MC68000 : 14
different
addressing
modes divided
into 6 groups.
By understanding
the addressing
modes, we have
EA (effective
address).
EA will help us
identifies the
location of an
operand.
C) ADDRESSING MODES
C.1REGISTER DIRECT ADDRESSING
Dn – Data register direct addressing. (D1,D2,D3,D4,D5,D6,D7)
An – Address register direct addressing. (A1,A2,A3,A4,A5,A6,A7)
Fastest and most compact because no reference to memory .
C.2 REGISTER INDIRECT ADDRESSING
p/s: Using () for those address register which represented the register indirect addressing
C.2 REGISTER INDIRECT ADDRESSING
C.2 REGISTER INDIRECT ADDRESSING
+1 = byte
+2 = word
+4 = longword
C.2 REGISTER INDIRECT ADDRESSING
- 1 = byte
- 2 = word
- 4 = longword
C.2 REGISTER INDIRECT ADDRESSING
C.2 REGISTER INDIRECT ADDRESSING
C.3 ABSOLUTE DATA ADDRESING
C.3 ABSOLUTE DATA ADDRESING
C.3 ABSOLUTE DATA ADDRESING
C.4 IMMEDIATE DATA ADDRESSING
C.4 IMMEDIATE DATA ADDRESSING
C.4 IMMEDIATE DATA ADDRESSING
C.4 IMPLIED ADDRESSING
INCORRECT INSTRUCTIONS
EASY68K