Professional Documents
Culture Documents
• Machine language:
• Machine language is a binary program (or binary code).
• Natural language of a particular computer system.
• Strings of numbers or binary codes (0 or 1).
• Machine-dependant.
• Program written in any other language must be translated to binary
representation of instruction before they can be executed by
computer.
• Programmers need to know specifically the architecture of CPU.
Machine language
The program is
difficult to
The program is slow
understand
to key-in to the
computer due to the
input one bit by one
bit at a time
6
b) Assembly language
• Assembly language:
• Assembly language is a symbolic representation of a machine language
of specific processor.
• Using english-like abbreviations (MUL).
• Assembler as translator.
• 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 (regis
transfer languages) RTL
• High-level language:
• Using everyday English and common mathematical notation. (x = I + j)
• Overcome problems : assembly language require many instruction to
accomplish a simple task.
• Single instruction in HLL = several AL instructions.
• Compiler as translator.
• Programmers do not need to know the architecture of CPU.
Three Different Levels Of Language
Comparison Of Instructions Of Three
Different Languages
Comparison Of Instructions Of Three
Different Languages
Microprocessor overview
The term microprocessor typically refers to the central processing
unit (CPU) of a microcomputer, containing the arithmetic logic
unit (ALU) and the control units (CU).
Performs the main tasks for the computer system
• data transfer between (registers) and memory or I/O
• arithmetic and logic operations. Example: ADD, SUB, AND, OR, etc
• program flow via simple decisions. Example: Zero, Sign, Carry,
etc
8
3.1.2 DEMONSTRATE SIMPLE PROGRAM
IN ASSEMBLY LANGUAGE ARITHMETIC
OPERATION AND LOGIC OPERATION
a) INSTRUCTION FORMAT
• 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
$3000 32
$3001 43
• Example 3: $3002 98
• MOVE.B $3000,D1
• Before : D1 = $00200500
• 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 , A1 = $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 = $00204466
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
$3000 32
• Example 22:
$3001 43
• ADD.W $3000,D1
$3002 98
• Before : D1 = $00200500
• After : D1 = $00203743
B. 2 ARITHMETIC
• 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
Example 25: : D6 = $AB206541 , A2 = $56EDB775 , C = 1
ADDX.B D2,D3
Before : D2 = $AB206541 , D3 = $ABCD1234 , X = 1
After : D2 = $AB206541 , D3 = $AB206576 , X = 1
B. 2 ARITHMETIC
• Example 26:
• ADDQ.B #$04,D3 (ADDQ #XXX,Dn)
• Before : D3 = $AB206541
• After : D3 = $AB206545
b. 2 ARITHMETIC
@ menunjukkan
nombor octal
% menunjukkan
Example 27: nombor binari
SUB.W #$80,D3
Before : D3 = $AB206541
After : D3 = $AB2064C1
Example 28:
SUB.W #$02,D1
Before : D1 = $12345678
After : D1 = $12345676
b. 2 ARITHMETIC
Example 29:
SUB.W D0,D1
Before : D0 = $12345678 , D1 = $98745432
After : D0 = $12345676 , D1 = $98760246
b. 2 ARITHMETIC
b. 2 ARITHMETIC
b. 2 ARITHMETIC
• Example 30:
• MULU #2,D2 ;16 bit x 16 bit = 32 bit
• Before : D2 = $AB206541
• After : D2 = $0000CA82
@ menunjukkan nombor
• Example 31: octal
% menunjukkan nombor
• MULU #2,D2
binari
• Before : D2 = $AB20FFFF
• After : D2 = $0001FFFE
• Example 32:
• DIVU #2,D3 ;32 bit / 16 bit = 16 bit lower (result)
16 bit upper ( remainder)
• Before : D3 = $00006541 6541F = 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
B.3 LOGICAL OPERATION
• Example 34:
• OR.B D0,D1
• Before : D1 = $1234563E , D0 = $98765474
• After : D1 = $1234567E , D0 = $98765474
B.3 LOGICAL OPERATION
• Example 35:
• NOT.B D1
• Before : D1 = $12345655
• After : D1 = $123456AA
B.3 LOGICAL OPERATION
• Example 36:
• EOR.B D0,D1
• Before : D0 = $ 98765474 , D1 = $1234563E
• After : D0 = $98765474 , D1 = $1234364A
c) Addressing modes
c) Addressing modes
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
• 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
+3 = longword
c.2 REGISTER INDIRECT ADDRESSING
+1 = byte
+2 = word
+3 = 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