1 / 6

NILAI OPERAND: Address vs. Data

NILAI OPERAND: Address vs. Data. Jenis-jenis Operand. Format Instruksi: OP-CODE DEST,SRC DEST (Destination Operand): Register Operand: operand menunjuk ke register tujuan EAX, EBX, ... Memory Operand: operand menunjuk ke alamat lokasi memori tujuan [LABEL]

foster
Download Presentation

NILAI OPERAND: Address vs. Data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NILAI OPERAND: Address vs. Data

  2. Jenis-jenis Operand • Format Instruksi: • OP-CODE DEST,SRC • DEST (Destination Operand): • Register Operand: operand menunjuk ke register tujuan • EAX, EBX, ... • Memory Operand: operand menunjuk ke alamat lokasi memori tujuan • [LABEL] • [REG], [R-base+Scale*R-index+Displacement] • SRC (Source Operand): • Register Operand: operand menunjuk register, tempat data sumber • Memory Operand: operand menunjuk alamat lokasi memori, tempat data sumber • Immediate Operand: data sumber berupa konstanta • NAMA, LABEL, Konstanta

  3. Nilai Sebuah Operand • Konstanta dapat dideklarasikan terlebih dahulu: • const equ 3 • Data harus dideklarasikan terlebih dahulu: • var_a dd 0x234 • Nilai Immediate Operand • mov ecx,8 ; ecx  8 • mov ecx,const ; ecx  3 (nilai yang direpresentasikan oleh const) • mov esi,var_a ; esi  alamat lokasi memori yang direpresentasikan ; oleh var_a, dimana 0x234 disimpan • Nilai Memory Operand • mov eax,[var_a] ; eax  0x234 (data yang disimpan di lokasi memori ; yang alamatnya direpresentasikan oleh var_a) • mov eax,[esi] ; eax  [[esi]] ; [esi] = alamat lokasi memori tempat data disimpanmov [esi],eax ; [esi] [eax] ; [esi] = alamat lokasi memori tujuan • Nilai Register Operand • add eax,ebx ; eax  [eax] + [ebx]

  4. Register Transfer Notation (RTN) • Digunakan untuk menggambarkan proses pertukaran data yang terjadi pada eksekusi sebuah instruksi: • DEST  SRC1 OP SRC2 • OP: ‘+’, ‘-’, … • DEST: alamat tujuan sebagai tempat penyimpanan hasil operasi • MOV EAX,EBX ; EAX [EBX] ; alamat tujuan: register EAX • MOV [ESI],EAX ; [ESI] EAX ; alamat tujuan: alamat lokasi memori yang ditunjuk oleh ; register ESI • MOV [VAR_A],EAX ; VAR_A [EAX] ; alamat tujuan: alamat lokasi memori yang direpresentasikan ; oleh VAR_A • SRC: data yang akan dioperasikan • MOV EAX,EBX ; EAX [EBX] ; data: isi register EBX • MOV EAX,[ESI] ; EAX [[ESI]] ; data: isi lokasi memori yang alamatnya ditunjuk oleh register ; ESI • MOV EAX,[VAR_A] ; EAX [VAR_A] ; data: isi lokasi memori yang alamatnya direpresentasikan ; oleh VAR_A

  5. Contoh Interpretasi Nilai Operand 92d0:01 00 00 00 92d4: 02 00 00 00 92d8:00 00 00 00 15c0: push eax 15c1: mov ecx,0x3 ... 15c8: mov eax,[0x92d0] 15cd: mov ebx,[0x92d4] 15d3: mov esi,0x92d8 15d8: addeax,ebx 15da: mov [0x92d8],eax ... 15de: pop eax const equ 3 segment .data var_add 1 var_bdd 2 var_cdd 0 ... segment .text global _main _main: push eax mov ecx,const ... mov eax,[var_a] mov ebx,[var_b] mov esi,var_c add eax,ebx mov [esi],eax ... pop eax

  6. Nilai Immediate-, Memory-, Register-Operand

More Related