SlideShare a Scribd company logo
Tugas 3 11516 Organisasi Sistem Komputer


Machine Level Programming and Assembly Language




                          oleh :
                I Putu Agus Eka Pratama
                        23510310



                        Dosen :
               Dr. Kusprasapta Mutijarsa




     Magister Teknologi Informasi
Sekolah Teknik Elektro dan Informatika
      Institut Teknologi Bandung
                  2011
1. Soal :
Practice problem 3.1
Assume the following values are stored at the indicated memory addresses and registers :
                              Address                           Value
                               0x100                                0xFF
                               0x104                            0xAB
                               0x108                                0x13
                               0x10C                                0x11


                              Address                           Value
                                %eax                            0x100
                                %ecx                                0x1
                                %edx                                0x3


Fill the following table showing the values for the indicated operands :
                              Operand                           Value
                  %eax
                  0x104                             0xAB
                  $0x108
                  (%eax)
                  4(%eax)


                              Operand                           Value
                  9(%eax,%edx)
                  260(%ecx,%edx)
                  0xFC(, %ecx,4)
                  (%eax,%edx,4)


Jawab :


 Operand        Value                          Keterangan
%eax           0x100     Nilai dari %eax adalah 0x100 (register).
0x104          0xAB      Nilai dari register 0x104 adalah 0xAB (absolut address).
$0x108         0x108     Tanda $ menyatakan bahwa data integer konstan sehingga
                         data tetap (immediate).
(%eax)         0xFF      %eax = 0x100, sehingga value 0xFF (address 0x100).
4(%eax)        0xAB       0x104 = 0x100 + 4 dan value 0xAB (address 0x104).


    Operand             Value                       Keterangan
9(%eax,%edx)           0x11     0x10C = (0x9 + 0x3) + 0x100 = C + 0x100 , value
                                0x11 (address 0x10C).
260(%ecx,%edx) 0x13             260 = 0x104.
                                0x104 + 0x1 + 0x3 = 0x108, value 0x13 (adress
                                0x108).
0xFC(, %ecx,4)         0xFF     0xFC + (1*4).
                                0xFC + 0x4 = 0x100 (address 0x100).
(%eax,%edx,4)          0x11     (0x1 * 4) + 0x100 = 0x10C, value 0x11 (address
                                0x10C).


   2. Soal :
[Practice Problem 3.2]
You are given the following information. A function with prototype void decode1(int *xp, int *yp, int
*zp); is compiled into assembly code. The body of the code is as follows:
1. movl 8(%ebp), %edi
2. movl 12(%ebp), %ebx
3. movl 16(%ebp), %esi
4. movl (%edi), %eax
5. movl (%ebx), %edx
6. movl (%esi), %ecx
7. movl %eax, (%ebx)
8. movl %edx, (%esi)
9. movl %ecx, (%edi)
Parameters xp, yp, and zp are stored at memory locations with offsets 8, 12, and 16, respectively,
relative to the address in register %ebp.
Write C code for decode1 that will have an effect equivalent to the assembly code above.
You can test your answer by compiling your code with the –S switch.
Your compiler may generate code that differs in the usage of registers or the ordering of memory
references, but is should still be functionally equivalent.


Jawab :
Code Assembly :
movl 8(%ebp), %edi
movl 12(%ebp), %ebx
movl 16(%ebp), %esi
movl (%edi), %eax
movl (%ebx), %edx
movl (%esi), %ecx
movl %eax, (%ebx)
movl %edx, (%esi)
movl %ecx, (%edi)


void decode1(int *xp, int *yp, int *zp);


Code C :
void decode1(int *xp, int *yp, int *zp)
{
int tx = *xp;
int ty = *yp;
int tz = *zp;
*yp = tx;
*zp = ty;
*xp = tz;
}


Pembuktian :
Membuat file jawabansoalno2.c
putu-shinoda@my-machine:~$ touch jawabansoalno2.c
Mengisikan script C ke dalam file jawabansoalno2.c
putu-shinoda@my-machine:~$ nano jawabansoalno2.c
Kode C yang dimasukkan
void decode1(int *xp, int *yp, int *zp)
{
int tx = *xp;
int ty = *yp;
int tz = *zp;
*yp = tx;
*zp = ty;
*xp = tz;
}
Ditampilkan pada gambar berikut
Kemudian dilanjutkan mencompile file jawabansoalno2.c dengan opsi -S
putu-shinoda@my-machine:~$ gcc -O -S jawabansoalno2.c
Terbentuk file jawabansoalno2.s dengan isi file sebagai berikut
3. Soal :
[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
      leal (%eax, %ecx), %edx
      leal (%eax, %ecx,4)


                        Expression                             Result
      leal 7(%eax, %eax,8), %edx
      leal 0xA(,%ecx, 4), %edx
      leal 9(%eax, %ecx,2),%edx


Jawab :


          Expression                 Result                       Keterangan
leal 6(%eax), %edx              6+x           %edx = 6 + x.
leal (%eax, %ecx), %edx         X+y           %edx = x + y.
leal (%eax, %ecx,4), %edx       X + 4y        %edx = x + 4y.


          Expression                 Result                       Keterangan
leal 7(%eax, %eax,8), %edx      7 + 9x        %edx = 7 + x + (8*x) = 7 + 9x.
leal 0xA(,%ecx, 4), %edx        10 + 4y       0xA = 10.
                                              %edx = 10 + (y*4) = 10 + 4y.
leal 9(%eax, %ecx,2), %edx      9 + x + 2y    %edx = 9 + x + (2*y) = 9 + x + 2y.


   4. Soal :
[Practice Problem 3.4]
Assume the following values are stored at the indicated memory addresses and registers :
                         Address                               Value
                0x100                         0xFF
                0x104                         0xAB
                0x108                         0x13
0x10C                          0x11


                        Address                              Value
             %eax                           0x100
             %ecx                           0x1
             %edx                           0x3


Fill in the following table showing the effects of the following instructions, both in terms of the
register or memory location that will be updated and the resulting value.
            Instruksi                         Tujuan                            Nilai
add1 %ecx, (%eax)                 0x100
sub1 %edx, 4 (%eax)
Imu11 $16 (%eax, %edx, 4)
Inc1 8 (%eax)
dec1 %ecx
sub1 %edx, %eax


Jawab :
            Instruksi                         Tujuan                            Nilai
add1 %ecx, (%eax)                 0x100                              0x100
sub1 %edx, 4 (%eax)               0x104                              0xA8
Imu11 $16 (%eax, %edx, 4)         0x10C                              0x110
Inc1 8 (%eax)                     0x108                              0x14
dec1 %ecx                         %ecx                               0x0
sub1 %edx, %eax                   %eax                               0xFD


   5. Soal :
[Problem 3.31]
You are given the information that follows. A function with prototype void decode2(int x, int y, int
z); is compiled into assembly code. The body of the code is as follows:
1.movl 16(%ebp), %eax
2.movl 12(%ebp), %edx
3.sub %eax, %edx;
4.movl %edx, %eax
5.imull 8(%ebp), %edx
6.sall $31, %eax
7.sarl $31, %eax
8.xorl %edx, %eax
#C Code
int decode2(int x, int y, int z)
{
int t1 = y - z;
int t2 = x * t1;
int t3 = (t1 << 31) >> 31;
int t4 = t3 ˆ t2;
return t4;
}
Parameters x, y, and z are stored at memory locations with offsets 8, 12, and 16 relative to the
address in register %ebp. The code stores the return value in register %eax.
Write C code for decode2 that will have an effect equivalent to the assembly code. You can test your
answer by compiling your code with the –S switch. Your compiler may not generate identical code,
but it should be functionally equivalent.


Jawab :
Membuat file jawabansoalno5.c
putu-shinoda@my-machine:~$ touch jawabansoalno5.c
Mengisikan script C ke dalam file jawabansoalno5.c
putu-shinoda@my-machine:~$ nano jawabansoalno5.c
Kode C yang dimasukkan
int decode2(int x, int y, int z)
{
int t1 = y - z;
int t2 = x * t1;
int t3 = (t1 << 31) >> 31;
int t4 = t3 ˆ t2;
return t4;
}
Ditampilkan pada gambar berikut
Kemudian dilanjutkan mencompile file jawabansoalno5.c dengan opsi -S
putu-shinoda@my-machine:~$ gcc -O -S jawabansoalno5.c
Terbentuk file jawabansoalno5.s dengan isi file sebagai berikut
Tugas 3 oganisasi komputer 23510310

More Related Content

What's hot

Useful functions for arrays in php
Useful functions for arrays in phpUseful functions for arrays in php
Useful functions for arrays in php
Chetan Patel
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
Nicole Ryan
 
Ecto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii BodarevEcto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii Bodarev
Elixir Club
 
Airline reservation project using JAVA in NetBeans IDE
Airline reservation project using JAVA in NetBeans IDEAirline reservation project using JAVA in NetBeans IDE
Airline reservation project using JAVA in NetBeans IDE
HimanshiSingh71
 
RxSwift 시작하기
RxSwift 시작하기RxSwift 시작하기
RxSwift 시작하기
Suyeol Jeon
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版
Yutaka Kato
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
riue
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
aztack
 
PHP and MySQL Tips and tricks, DC 2007
PHP and MySQL Tips and tricks, DC 2007PHP and MySQL Tips and tricks, DC 2007
PHP and MySQL Tips and tricks, DC 2007
Damien Seguy
 
7li7w devcon5
7li7w devcon57li7w devcon5
7li7w devcon5
Kerry Buckley
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Suyeol Jeon
 
Begin with Python
Begin with PythonBegin with Python
Begin with Python
Narong Intiruk
 
The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212
Mahmoud Samir Fayed
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
Skills Matter
 
Fp java8
Fp java8Fp java8
Fp java8
Yanai Franchi
 
Python speleology
Python speleologyPython speleology
Python speleology
Andrés J. Díaz
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
Codecamp Romania
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
潤一 加藤
 
Using Scala Slick at FortyTwo
Using Scala Slick at FortyTwoUsing Scala Slick at FortyTwo
Using Scala Slick at FortyTwo
Eishay Smith
 
20100528
2010052820100528
20100528
byron zhao
 

What's hot (20)

Useful functions for arrays in php
Useful functions for arrays in phpUseful functions for arrays in php
Useful functions for arrays in php
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
 
Ecto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii BodarevEcto DSL Introduction - Yurii Bodarev
Ecto DSL Introduction - Yurii Bodarev
 
Airline reservation project using JAVA in NetBeans IDE
Airline reservation project using JAVA in NetBeans IDEAirline reservation project using JAVA in NetBeans IDE
Airline reservation project using JAVA in NetBeans IDE
 
RxSwift 시작하기
RxSwift 시작하기RxSwift 시작하기
RxSwift 시작하기
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
 
PHP and MySQL Tips and tricks, DC 2007
PHP and MySQL Tips and tricks, DC 2007PHP and MySQL Tips and tricks, DC 2007
PHP and MySQL Tips and tricks, DC 2007
 
7li7w devcon5
7li7w devcon57li7w devcon5
7li7w devcon5
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
 
Begin with Python
Begin with PythonBegin with Python
Begin with Python
 
The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212The Ring programming language version 1.10 book - Part 47 of 212
The Ring programming language version 1.10 book - Part 47 of 212
 
Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
 
Fp java8
Fp java8Fp java8
Fp java8
 
Python speleology
Python speleologyPython speleology
Python speleology
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
 
Using Scala Slick at FortyTwo
Using Scala Slick at FortyTwoUsing Scala Slick at FortyTwo
Using Scala Slick at FortyTwo
 
20100528
2010052820100528
20100528
 

Viewers also liked

Vega open-source-pentest-di-linux
Vega open-source-pentest-di-linuxVega open-source-pentest-di-linux
Vega open-source-pentest-di-linux
Putu Shinoda
 
ICCSN - EII 2012 English version
ICCSN - EII 2012 English versionICCSN - EII 2012 English version
ICCSN - EII 2012 English version
Putu Shinoda
 
23510310 tugas meaningful broadband
23510310   tugas meaningful broadband23510310   tugas meaningful broadband
23510310 tugas meaningful broadband
Putu Shinoda
 
Sap service engineering
Sap service engineeringSap service engineering
Sap service engineering
Putu Shinoda
 
Paper UAS PSTI - I Putu Agus Eka Pratama - Bank Danamon
Paper UAS PSTI - I Putu Agus Eka Pratama -  Bank DanamonPaper UAS PSTI - I Putu Agus Eka Pratama -  Bank Danamon
Paper UAS PSTI - I Putu Agus Eka Pratama - Bank Danamon
Putu Shinoda
 
Instalasi cms formulasi di linux
Instalasi cms formulasi di linuxInstalasi cms formulasi di linux
Instalasi cms formulasi di linux
Putu Shinoda
 
Software requirementsspecification aplikasi logistik alat tulis kantor
Software requirementsspecification aplikasi logistik alat tulis kantorSoftware requirementsspecification aplikasi logistik alat tulis kantor
Software requirementsspecification aplikasi logistik alat tulis kantor
Putu Shinoda
 
23510310 tugas essay 1
23510310   tugas essay 1 23510310   tugas essay 1
23510310 tugas essay 1
Putu Shinoda
 
Kenang - kenangan
Kenang - kenanganKenang - kenangan
Kenang - kenangan
Putu Shinoda
 
Belajar erlang-di-linux
Belajar erlang-di-linuxBelajar erlang-di-linux
Belajar erlang-di-linux
Putu Shinoda
 
Sap jaringan komputer
Sap jaringan komputerSap jaringan komputer
Sap jaringan komputer
Putu Shinoda
 
Sap jaringan komputer
Sap jaringan komputerSap jaringan komputer
Sap jaringan komputer
Putu Shinoda
 
Install eclipse-linux
Install eclipse-linuxInstall eclipse-linux
Install eclipse-linux
Putu Shinoda
 
Install Netbeans dan JDK di Linux
Install Netbeans dan JDK di LinuxInstall Netbeans dan JDK di Linux
Install Netbeans dan JDK di Linux
Putu Shinoda
 
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
Putu Shinoda
 
Paper uts 23510310_i_putuagusekapratama_bankdanamon
Paper uts 23510310_i_putuagusekapratama_bankdanamonPaper uts 23510310_i_putuagusekapratama_bankdanamon
Paper uts 23510310_i_putuagusekapratama_bankdanamon
Putu Shinoda
 
NDN SIM (Named Data Networking Simulator)
NDN SIM (Named Data Networking Simulator)NDN SIM (Named Data Networking Simulator)
NDN SIM (Named Data Networking Simulator)
Putu Shinoda
 
Report kelompok
Report kelompokReport kelompok
Report kelompok
Putu Shinoda
 
Resume eii 2012 itb
Resume eii 2012 itbResume eii 2012 itb
Resume eii 2012 itb
Putu Shinoda
 
Seminar security Smart City dan sampul buku
Seminar security Smart City dan sampul bukuSeminar security Smart City dan sampul buku
Seminar security Smart City dan sampul buku
Putu Shinoda
 

Viewers also liked (20)

Vega open-source-pentest-di-linux
Vega open-source-pentest-di-linuxVega open-source-pentest-di-linux
Vega open-source-pentest-di-linux
 
ICCSN - EII 2012 English version
ICCSN - EII 2012 English versionICCSN - EII 2012 English version
ICCSN - EII 2012 English version
 
23510310 tugas meaningful broadband
23510310   tugas meaningful broadband23510310   tugas meaningful broadband
23510310 tugas meaningful broadband
 
Sap service engineering
Sap service engineeringSap service engineering
Sap service engineering
 
Paper UAS PSTI - I Putu Agus Eka Pratama - Bank Danamon
Paper UAS PSTI - I Putu Agus Eka Pratama -  Bank DanamonPaper UAS PSTI - I Putu Agus Eka Pratama -  Bank Danamon
Paper UAS PSTI - I Putu Agus Eka Pratama - Bank Danamon
 
Instalasi cms formulasi di linux
Instalasi cms formulasi di linuxInstalasi cms formulasi di linux
Instalasi cms formulasi di linux
 
Software requirementsspecification aplikasi logistik alat tulis kantor
Software requirementsspecification aplikasi logistik alat tulis kantorSoftware requirementsspecification aplikasi logistik alat tulis kantor
Software requirementsspecification aplikasi logistik alat tulis kantor
 
23510310 tugas essay 1
23510310   tugas essay 1 23510310   tugas essay 1
23510310 tugas essay 1
 
Kenang - kenangan
Kenang - kenanganKenang - kenangan
Kenang - kenangan
 
Belajar erlang-di-linux
Belajar erlang-di-linuxBelajar erlang-di-linux
Belajar erlang-di-linux
 
Sap jaringan komputer
Sap jaringan komputerSap jaringan komputer
Sap jaringan komputer
 
Sap jaringan komputer
Sap jaringan komputerSap jaringan komputer
Sap jaringan komputer
 
Install eclipse-linux
Install eclipse-linuxInstall eclipse-linux
Install eclipse-linux
 
Install Netbeans dan JDK di Linux
Install Netbeans dan JDK di LinuxInstall Netbeans dan JDK di Linux
Install Netbeans dan JDK di Linux
 
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
Seminar Open Year With Open Source Unikom Bandung 18 Januari 2014
 
Paper uts 23510310_i_putuagusekapratama_bankdanamon
Paper uts 23510310_i_putuagusekapratama_bankdanamonPaper uts 23510310_i_putuagusekapratama_bankdanamon
Paper uts 23510310_i_putuagusekapratama_bankdanamon
 
NDN SIM (Named Data Networking Simulator)
NDN SIM (Named Data Networking Simulator)NDN SIM (Named Data Networking Simulator)
NDN SIM (Named Data Networking Simulator)
 
Report kelompok
Report kelompokReport kelompok
Report kelompok
 
Resume eii 2012 itb
Resume eii 2012 itbResume eii 2012 itb
Resume eii 2012 itb
 
Seminar security Smart City dan sampul buku
Seminar security Smart City dan sampul bukuSeminar security Smart City dan sampul buku
Seminar security Smart City dan sampul buku
 

Similar to Tugas 3 oganisasi komputer 23510310

INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
Infinity Tech Solutions
 
Basic R Data Manipulation
Basic R Data ManipulationBasic R Data Manipulation
Basic R Data Manipulation
Chu An
 
Gabriele Lana - The Magic of Elixir
Gabriele Lana - The Magic of ElixirGabriele Lana - The Magic of Elixir
Gabriele Lana - The Magic of Elixir
Codemotion
 
bobok
bobokbobok
The Magic Of Elixir
The Magic Of ElixirThe Magic Of Elixir
The Magic Of Elixir
Gabriele Lana
 
Yurii Bodarev - Ecto DSL
Yurii Bodarev - Ecto DSLYurii Bodarev - Ecto DSL
Yurii Bodarev - Ecto DSL
Elixir Club
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Presentation R basic teaching module
Presentation R basic teaching modulePresentation R basic teaching module
Presentation R basic teaching module
Sander Timmer
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
W 9 numbering systemW 9 numbering system
1.2 matlab numerical data
1.2  matlab numerical data1.2  matlab numerical data
1.2 matlab numerical data
TANVIRAHMED611926
 
Taylor and maclaurian series
Taylor and maclaurian seriesTaylor and maclaurian series
Taylor and maclaurian series
Nishant Patel
 
Elixir and OTP Apps introduction
Elixir and OTP Apps introductionElixir and OTP Apps introduction
Elixir and OTP Apps introduction
Gonzalo Gabriel Jiménez Fuentes
 
Lecture 3 and 4.pptx
Lecture 3 and 4.pptxLecture 3 and 4.pptx
Lecture 3 and 4.pptx
MAHAMASADIK
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
0.0. punto fijo
0.0. punto fijo0.0. punto fijo
0.0. punto fijo
Agua SAC
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
acteleshoppe
 
Module II Partition and Generating Function (2).ppt
Module II Partition and Generating Function (2).pptModule II Partition and Generating Function (2).ppt
Module II Partition and Generating Function (2).ppt
ssuser26e219
 
Please use the same variables and only write the TODO part #!-usr-bi.pdf
Please use the same variables and only write the TODO part   #!-usr-bi.pdfPlease use the same variables and only write the TODO part   #!-usr-bi.pdf
Please use the same variables and only write the TODO part #!-usr-bi.pdf
asenterprisestyagi
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
krishna_093
 

Similar to Tugas 3 oganisasi komputer 23510310 (20)

INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
 
Basic R Data Manipulation
Basic R Data ManipulationBasic R Data Manipulation
Basic R Data Manipulation
 
Gabriele Lana - The Magic of Elixir
Gabriele Lana - The Magic of ElixirGabriele Lana - The Magic of Elixir
Gabriele Lana - The Magic of Elixir
 
bobok
bobokbobok
bobok
 
The Magic Of Elixir
The Magic Of ElixirThe Magic Of Elixir
The Magic Of Elixir
 
Yurii Bodarev - Ecto DSL
Yurii Bodarev - Ecto DSLYurii Bodarev - Ecto DSL
Yurii Bodarev - Ecto DSL
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
 
Presentation R basic teaching module
Presentation R basic teaching modulePresentation R basic teaching module
Presentation R basic teaching module
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
1.2 matlab numerical data
1.2  matlab numerical data1.2  matlab numerical data
1.2 matlab numerical data
 
Taylor and maclaurian series
Taylor and maclaurian seriesTaylor and maclaurian series
Taylor and maclaurian series
 
Elixir and OTP Apps introduction
Elixir and OTP Apps introductionElixir and OTP Apps introduction
Elixir and OTP Apps introduction
 
Lecture 3 and 4.pptx
Lecture 3 and 4.pptxLecture 3 and 4.pptx
Lecture 3 and 4.pptx
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
0.0. punto fijo
0.0. punto fijo0.0. punto fijo
0.0. punto fijo
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
 
Module II Partition and Generating Function (2).ppt
Module II Partition and Generating Function (2).pptModule II Partition and Generating Function (2).ppt
Module II Partition and Generating Function (2).ppt
 
Please use the same variables and only write the TODO part #!-usr-bi.pdf
Please use the same variables and only write the TODO part   #!-usr-bi.pdfPlease use the same variables and only write the TODO part   #!-usr-bi.pdf
Please use the same variables and only write the TODO part #!-usr-bi.pdf
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 

More from Putu Shinoda

ipae-cybersecurityindustri40-bapeten.pdf
ipae-cybersecurityindustri40-bapeten.pdfipae-cybersecurityindustri40-bapeten.pdf
ipae-cybersecurityindustri40-bapeten.pdf
Putu Shinoda
 
Linux, Ubuntu, FOSS, dan Smart City
Linux, Ubuntu, FOSS, dan Smart CityLinux, Ubuntu, FOSS, dan Smart City
Linux, Ubuntu, FOSS, dan Smart City
Putu Shinoda
 
Seminar Intelligent Trasport System (ITS) Univ Telkom
Seminar Intelligent Trasport System (ITS) Univ TelkomSeminar Intelligent Trasport System (ITS) Univ Telkom
Seminar Intelligent Trasport System (ITS) Univ Telkom
Putu Shinoda
 
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart City
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart CitySeminar Linux Ubuntu, Pemanfaatannya, dan Smart City
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart City
Putu Shinoda
 
Web Security
Web SecurityWeb Security
Web Security
Putu Shinoda
 
Materi Kuliah Kapita Selekta 3 : OTT
Materi Kuliah Kapita Selekta 3 : OTTMateri Kuliah Kapita Selekta 3 : OTT
Materi Kuliah Kapita Selekta 3 : OTT
Putu Shinoda
 
Materi Kuliah Umum Kapita Selekta : Internet Of Things
Materi Kuliah Umum Kapita Selekta : Internet Of ThingsMateri Kuliah Umum Kapita Selekta : Internet Of Things
Materi Kuliah Umum Kapita Selekta : Internet Of Things
Putu Shinoda
 
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
Putu Shinoda
 
Seminar Linux Dan Smart City Telkom University Mei 2014
Seminar Linux Dan Smart City Telkom University Mei 2014Seminar Linux Dan Smart City Telkom University Mei 2014
Seminar Linux Dan Smart City Telkom University Mei 2014
Putu Shinoda
 
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
Putu Shinoda
 
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
Putu Shinoda
 
Putu smartcity 22 feb 2014
Putu smartcity 22 feb 2014Putu smartcity 22 feb 2014
Putu smartcity 22 feb 2014
Putu Shinoda
 
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
Putu Shinoda
 
Information and social network 1
Information and social network 1Information and social network 1
Information and social network 1
Putu Shinoda
 
Presentasi putu-unikom-180114
Presentasi putu-unikom-180114Presentasi putu-unikom-180114
Presentasi putu-unikom-180114
Putu Shinoda
 
Ist service-4
Ist service-4Ist service-4
Ist service-4
Putu Shinoda
 
Ist service-2
Ist service-2Ist service-2
Ist service-2
Putu Shinoda
 
Ist service-1
Ist service-1Ist service-1
Ist service-1
Putu Shinoda
 
Slide Jaringan Komputer ITB pertemuan 1
Slide Jaringan Komputer ITB pertemuan 1 Slide Jaringan Komputer ITB pertemuan 1
Slide Jaringan Komputer ITB pertemuan 1
Putu Shinoda
 
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
Putu Shinoda
 

More from Putu Shinoda (20)

ipae-cybersecurityindustri40-bapeten.pdf
ipae-cybersecurityindustri40-bapeten.pdfipae-cybersecurityindustri40-bapeten.pdf
ipae-cybersecurityindustri40-bapeten.pdf
 
Linux, Ubuntu, FOSS, dan Smart City
Linux, Ubuntu, FOSS, dan Smart CityLinux, Ubuntu, FOSS, dan Smart City
Linux, Ubuntu, FOSS, dan Smart City
 
Seminar Intelligent Trasport System (ITS) Univ Telkom
Seminar Intelligent Trasport System (ITS) Univ TelkomSeminar Intelligent Trasport System (ITS) Univ Telkom
Seminar Intelligent Trasport System (ITS) Univ Telkom
 
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart City
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart CitySeminar Linux Ubuntu, Pemanfaatannya, dan Smart City
Seminar Linux Ubuntu, Pemanfaatannya, dan Smart City
 
Web Security
Web SecurityWeb Security
Web Security
 
Materi Kuliah Kapita Selekta 3 : OTT
Materi Kuliah Kapita Selekta 3 : OTTMateri Kuliah Kapita Selekta 3 : OTT
Materi Kuliah Kapita Selekta 3 : OTT
 
Materi Kuliah Umum Kapita Selekta : Internet Of Things
Materi Kuliah Umum Kapita Selekta : Internet Of ThingsMateri Kuliah Umum Kapita Selekta : Internet Of Things
Materi Kuliah Umum Kapita Selekta : Internet Of Things
 
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
Kuliah Umum 1 Kapita Selekta Univ Telkom : Smart City.
 
Seminar Linux Dan Smart City Telkom University Mei 2014
Seminar Linux Dan Smart City Telkom University Mei 2014Seminar Linux Dan Smart City Telkom University Mei 2014
Seminar Linux Dan Smart City Telkom University Mei 2014
 
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (2)
 
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
Seminar Linux dan Android Legian Cafe Dago Bandung 15 Maret 2014 (1)
 
Putu smartcity 22 feb 2014
Putu smartcity 22 feb 2014Putu smartcity 22 feb 2014
Putu smartcity 22 feb 2014
 
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
Pertemuan 1 sistem operasi S1 sistem komputer univ telkom 2014
 
Information and social network 1
Information and social network 1Information and social network 1
Information and social network 1
 
Presentasi putu-unikom-180114
Presentasi putu-unikom-180114Presentasi putu-unikom-180114
Presentasi putu-unikom-180114
 
Ist service-4
Ist service-4Ist service-4
Ist service-4
 
Ist service-2
Ist service-2Ist service-2
Ist service-2
 
Ist service-1
Ist service-1Ist service-1
Ist service-1
 
Slide Jaringan Komputer ITB pertemuan 1
Slide Jaringan Komputer ITB pertemuan 1 Slide Jaringan Komputer ITB pertemuan 1
Slide Jaringan Komputer ITB pertemuan 1
 
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
Micro Teaching Mata Kuliah Jaringan Komputer IT Telkom 2013
 

Recently uploaded

inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 

Recently uploaded (20)

inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 

Tugas 3 oganisasi komputer 23510310

  • 1. Tugas 3 11516 Organisasi Sistem Komputer Machine Level Programming and Assembly Language oleh : I Putu Agus Eka Pratama 23510310 Dosen : Dr. Kusprasapta Mutijarsa Magister Teknologi Informasi Sekolah Teknik Elektro dan Informatika Institut Teknologi Bandung 2011
  • 2. 1. Soal : Practice problem 3.1 Assume the following values are stored at the indicated memory addresses and registers : Address Value 0x100 0xFF 0x104 0xAB 0x108 0x13 0x10C 0x11 Address Value %eax 0x100 %ecx 0x1 %edx 0x3 Fill the following table showing the values for the indicated operands : Operand Value %eax 0x104 0xAB $0x108 (%eax) 4(%eax) Operand Value 9(%eax,%edx) 260(%ecx,%edx) 0xFC(, %ecx,4) (%eax,%edx,4) Jawab : Operand Value Keterangan %eax 0x100 Nilai dari %eax adalah 0x100 (register). 0x104 0xAB Nilai dari register 0x104 adalah 0xAB (absolut address). $0x108 0x108 Tanda $ menyatakan bahwa data integer konstan sehingga data tetap (immediate). (%eax) 0xFF %eax = 0x100, sehingga value 0xFF (address 0x100).
  • 3. 4(%eax) 0xAB 0x104 = 0x100 + 4 dan value 0xAB (address 0x104). Operand Value Keterangan 9(%eax,%edx) 0x11 0x10C = (0x9 + 0x3) + 0x100 = C + 0x100 , value 0x11 (address 0x10C). 260(%ecx,%edx) 0x13 260 = 0x104. 0x104 + 0x1 + 0x3 = 0x108, value 0x13 (adress 0x108). 0xFC(, %ecx,4) 0xFF 0xFC + (1*4). 0xFC + 0x4 = 0x100 (address 0x100). (%eax,%edx,4) 0x11 (0x1 * 4) + 0x100 = 0x10C, value 0x11 (address 0x10C). 2. Soal : [Practice Problem 3.2] You are given the following information. A function with prototype void decode1(int *xp, int *yp, int *zp); is compiled into assembly code. The body of the code is as follows: 1. movl 8(%ebp), %edi 2. movl 12(%ebp), %ebx 3. movl 16(%ebp), %esi 4. movl (%edi), %eax 5. movl (%ebx), %edx 6. movl (%esi), %ecx 7. movl %eax, (%ebx) 8. movl %edx, (%esi) 9. movl %ecx, (%edi) Parameters xp, yp, and zp are stored at memory locations with offsets 8, 12, and 16, respectively, relative to the address in register %ebp. Write C code for decode1 that will have an effect equivalent to the assembly code above. You can test your answer by compiling your code with the –S switch. Your compiler may generate code that differs in the usage of registers or the ordering of memory references, but is should still be functionally equivalent. Jawab : Code Assembly : movl 8(%ebp), %edi movl 12(%ebp), %ebx
  • 4. movl 16(%ebp), %esi movl (%edi), %eax movl (%ebx), %edx movl (%esi), %ecx movl %eax, (%ebx) movl %edx, (%esi) movl %ecx, (%edi) void decode1(int *xp, int *yp, int *zp); Code C : void decode1(int *xp, int *yp, int *zp) { int tx = *xp; int ty = *yp; int tz = *zp; *yp = tx; *zp = ty; *xp = tz; } Pembuktian : Membuat file jawabansoalno2.c putu-shinoda@my-machine:~$ touch jawabansoalno2.c Mengisikan script C ke dalam file jawabansoalno2.c putu-shinoda@my-machine:~$ nano jawabansoalno2.c Kode C yang dimasukkan void decode1(int *xp, int *yp, int *zp) { int tx = *xp; int ty = *yp; int tz = *zp; *yp = tx; *zp = ty; *xp = tz; } Ditampilkan pada gambar berikut
  • 5. Kemudian dilanjutkan mencompile file jawabansoalno2.c dengan opsi -S putu-shinoda@my-machine:~$ gcc -O -S jawabansoalno2.c Terbentuk file jawabansoalno2.s dengan isi file sebagai berikut
  • 6. 3. Soal : [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 leal (%eax, %ecx), %edx leal (%eax, %ecx,4) Expression Result leal 7(%eax, %eax,8), %edx leal 0xA(,%ecx, 4), %edx leal 9(%eax, %ecx,2),%edx Jawab : Expression Result Keterangan leal 6(%eax), %edx 6+x %edx = 6 + x. leal (%eax, %ecx), %edx X+y %edx = x + y. leal (%eax, %ecx,4), %edx X + 4y %edx = x + 4y. Expression Result Keterangan leal 7(%eax, %eax,8), %edx 7 + 9x %edx = 7 + x + (8*x) = 7 + 9x. leal 0xA(,%ecx, 4), %edx 10 + 4y 0xA = 10. %edx = 10 + (y*4) = 10 + 4y. leal 9(%eax, %ecx,2), %edx 9 + x + 2y %edx = 9 + x + (2*y) = 9 + x + 2y. 4. Soal : [Practice Problem 3.4] Assume the following values are stored at the indicated memory addresses and registers : Address Value 0x100 0xFF 0x104 0xAB 0x108 0x13
  • 7. 0x10C 0x11 Address Value %eax 0x100 %ecx 0x1 %edx 0x3 Fill in the following table showing the effects of the following instructions, both in terms of the register or memory location that will be updated and the resulting value. Instruksi Tujuan Nilai add1 %ecx, (%eax) 0x100 sub1 %edx, 4 (%eax) Imu11 $16 (%eax, %edx, 4) Inc1 8 (%eax) dec1 %ecx sub1 %edx, %eax Jawab : Instruksi Tujuan Nilai add1 %ecx, (%eax) 0x100 0x100 sub1 %edx, 4 (%eax) 0x104 0xA8 Imu11 $16 (%eax, %edx, 4) 0x10C 0x110 Inc1 8 (%eax) 0x108 0x14 dec1 %ecx %ecx 0x0 sub1 %edx, %eax %eax 0xFD 5. Soal : [Problem 3.31] You are given the information that follows. A function with prototype void decode2(int x, int y, int z); is compiled into assembly code. The body of the code is as follows: 1.movl 16(%ebp), %eax 2.movl 12(%ebp), %edx 3.sub %eax, %edx; 4.movl %edx, %eax 5.imull 8(%ebp), %edx 6.sall $31, %eax 7.sarl $31, %eax 8.xorl %edx, %eax
  • 8. #C Code int decode2(int x, int y, int z) { int t1 = y - z; int t2 = x * t1; int t3 = (t1 << 31) >> 31; int t4 = t3 ˆ t2; return t4; } Parameters x, y, and z are stored at memory locations with offsets 8, 12, and 16 relative to the address in register %ebp. The code stores the return value in register %eax. Write C code for decode2 that will have an effect equivalent to the assembly code. You can test your answer by compiling your code with the –S switch. Your compiler may not generate identical code, but it should be functionally equivalent. Jawab : Membuat file jawabansoalno5.c putu-shinoda@my-machine:~$ touch jawabansoalno5.c Mengisikan script C ke dalam file jawabansoalno5.c putu-shinoda@my-machine:~$ nano jawabansoalno5.c Kode C yang dimasukkan int decode2(int x, int y, int z) { int t1 = y - z; int t2 = x * t1; int t3 = (t1 << 31) >> 31; int t4 = t3 ˆ t2; return t4; } Ditampilkan pada gambar berikut
  • 9. Kemudian dilanjutkan mencompile file jawabansoalno5.c dengan opsi -S putu-shinoda@my-machine:~$ gcc -O -S jawabansoalno5.c Terbentuk file jawabansoalno5.s dengan isi file sebagai berikut