You are on page 1of 38

ASSEMBLY LANGUAGE

(MODE PENGALAMATAN)

TK-KB06
COMPUTER
ARCHITECTURE II
PEMROGRAMAN
ASSEMBLY (REVIEW)

2
PENGAKSESAN DATA DAN
INFORMASI
CPU IA32

3
PROSESOR IA32

4
FORMAT DATA

5
REGISTER INTEGER

6
INSTRUKSI
PERPINDAHAN DATA

7
INSTRUKSI
PERPINDAHAN DATA

8
KOMBINASI OPERAND
INSTRUKSI MOVL

9
PRACTICE
Find the kind of data movements instruction
1. movl $0x4050, %eax  Immediate -
register
2. movl %ebp, %esp  ..
3. movl (%edi, %ecx), %eax  ..
4. mov1 $-17, (%esp)  ..
5. mov1 %eax, -12(%ebp)  ..

10
KOMBINASI OPERAND
INSTRUKSI MOV1(CONT)

11
PRACTICE PROBLEM 3.1
Assume the following values are stored at the indicated memory
addresses an registers
Address Value Address Value
0x100 0xFF %eax 0x100
0x104 0xAB %ecx 0x1
0x108 0x13 %edx 0x3
0x10c 0x11

Fill in the following table showing the values for the indicated operands:

Operand Value
%eax ..
0x104 ..
$0x108 ..

12
MODE PENGALAMATAN

1. Mode pengalamatan sederhana


2. Mode pengalamatan berindeks

13
MODE PENGALAMATAN
SEDERHANA (1/10)

14
MODE PENGALAMATAN
SEDERHANA (2/10)

15
PROGRAM SWAP
(3/10)

16
PROGRAM SWAP
(4/10)

17
PROGRAM SWAP
(5/10)

18
PROGRAM SWAP
(6/10)

19
PROGRAM SWAP
(7/10)

20
PROGRAM SWAP
(8/10)

21
PROGRAM SWAP
(9/10)

22
PROGRAM SWAP
(10/10))

23
MODE PENGALAMATAN
BERINDEKS (1/3)

24
CONTOH PERHITUNGAN
ALAMAT (2/3)

25
PRACTICE PROBLEM 3.1
Assume the following values are stored at the indicated memory
addresses and registers
Address Value Address Value
0x100 0xFF %eax 0x100
0x104 0xAB %ecx 0x1
0x108 0x13 %edx 0x3
0x10c 0x11

Fill in the following table showing the values for the indicated
operands: Operand Value
4 (%eax) ..
9 (%eax, %edx) ..
260 (%ecx, %edx) ..
0xFC( ,%ecx,4) ..

26
(%eax, %edx,4) ..
INSTRUKSI
PERHITUNGAN ALAMAT
(3/3)

27
EKSPRESI
ARITMATIKA LEAL*

*lea =load effective address

28
PRACTICE PROBLEM 3.3
Suppose register %eax holds value x and %ecx holds value y. Fill
in the table below with formulas indicating the value that will be
stored in register %edx for each of the following assembly code
instructions.
Expression Result
leal 6(%eax), %edx %edx = ..
leal (%eax,%ecx), %edx
leal (%eax, %ecx,4), %edx
leal 7(%eax,%eax,8), %edx
leal 0xA ( ,%ecx,4),%edx
leal 9(%eax,%ecx,2)%edx)

29
OPERASI ARITMATIKA
(1/2)

30
OPERASI ARITMATIKA
(2/2)

31
OPERASI ARITMATIKA
KHUSUS

32
PRACTICE PROBLEM 3.4
Assume the following values are stored at the indicated memory addresses and
registers
Address Value
Address Value
0x100 0xFF
%eax 0x100
0x104 0xAB
%ecx 0x1
0x108 0x13
%edx 0x3
0x10c 0x11

Fill in the following table showing the affects of the following instructions, both in
term of the register or memory location that will be updated and the resulting
value.

Instruksi Nilai
add1 %ecx, (%eax)
sub1 %edx, 4(%eax)
imul1 $16,(%eax,%edx,4)
incl 8(%eax)
decl (%ecx)

33
subl %edx,%eax
FUNGSI ARITH (1/2)

34
FUNGSI ARITH (2/2)

35
RINGKASAN

36
TASK
1. Practice problem 3.2
2. Practice problem 3.31

37
REFERENCE
Randal E. Bradayant and David O’Hallaron, Computer Systems; A
Programmers Perspective, Prentice Hall
Mutijarsa, K., Assembly Language, Lecture Notes in Organisasi
Sistem Komputer, Institut Teknologi Bandung

38

You might also like