<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.haidhi.my.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Accessing_Information</id>
	<title>Accessing Information - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.haidhi.my.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Accessing_Information"/>
	<link rel="alternate" type="text/html" href="https://wiki.haidhi.my.id/wiki/index.php?title=Accessing_Information&amp;action=history"/>
	<updated>2026-11-01T20:52:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.haidhi.my.id/wiki/index.php?title=Accessing_Information&amp;diff=866&amp;oldid=prev</id>
		<title>SanzSkuy at 06:46, 9 October 2026</title>
		<link rel="alternate" type="text/html" href="https://wiki.haidhi.my.id/wiki/index.php?title=Accessing_Information&amp;diff=866&amp;oldid=prev"/>
		<updated>2026-10-09T06:46:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:46, 9 October 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l22&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|&amp;lt;------------------- %rax (64 bit) -------------------&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|&amp;lt;------------------- %rax (64 bit) -------------------&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                            |&amp;lt;------ %eax (32 bit) -----&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                            |&amp;lt;------ %eax (32 bit) -----&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;                                          &lt;/del&gt;|&amp;lt;- %ax (16) -&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;                                         &lt;/ins&gt;|&amp;lt;- %ax (16) -&amp;gt;|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                                                  |%al(8)|&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                                                  |%al(8)|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>SanzSkuy</name></author>
	</entry>
	<entry>
		<id>https://wiki.haidhi.my.id/wiki/index.php?title=Accessing_Information&amp;diff=865&amp;oldid=prev</id>
		<title>SanzSkuy: Created page with &quot;CPU x86-64 punya &#039;&#039;&#039;16 general-purpose register&#039;&#039;&#039; berukuran 64-bit. Register ini menyimpan data integer dan pointer.  == Sejarah penamaan == Penamaan register berlapis karena evolusi instruction set:  {| class=&quot;wikitable&quot; ! Generasi !! Lebar !! Nama register !! Catatan |- | 8086 || 16-bit || &lt;code&gt;%ax&lt;/code&gt;, &lt;code&gt;%bx&lt;/code&gt;, &lt;code&gt;%cx&lt;/code&gt;, &lt;code&gt;%dx&lt;/code&gt;, &lt;code&gt;%si&lt;/code&gt;, &lt;code&gt;%di&lt;/code&gt;, &lt;code&gt;%bp&lt;/code&gt;, &lt;code&gt;%sp&lt;/code&gt; || Nama mencerminkan fungsi (accumulat...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.haidhi.my.id/wiki/index.php?title=Accessing_Information&amp;diff=865&amp;oldid=prev"/>
		<updated>2026-10-09T06:45:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;CPU x86-64 punya &amp;#039;&amp;#039;&amp;#039;16 general-purpose register&amp;#039;&amp;#039;&amp;#039; berukuran 64-bit. Register ini menyimpan data integer dan pointer.  == Sejarah penamaan == Penamaan register berlapis karena evolusi instruction set:  {| class=&amp;quot;wikitable&amp;quot; ! Generasi !! Lebar !! Nama register !! Catatan |- | 8086 || 16-bit || &amp;lt;code&amp;gt;%ax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%bx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%cx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%dx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%si&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%di&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%bp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%sp&amp;lt;/code&amp;gt; || Nama mencerminkan fungsi (accumulat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;CPU x86-64 punya &amp;#039;&amp;#039;&amp;#039;16 general-purpose register&amp;#039;&amp;#039;&amp;#039; berukuran 64-bit. Register ini menyimpan data integer dan pointer.&lt;br /&gt;
&lt;br /&gt;
== Sejarah penamaan ==&lt;br /&gt;
Penamaan register berlapis karena evolusi instruction set:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Generasi !! Lebar !! Nama register !! Catatan&lt;br /&gt;
|-&lt;br /&gt;
| 8086 || 16-bit || &amp;lt;code&amp;gt;%ax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%bx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%cx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%dx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%si&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%di&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%bp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%sp&amp;lt;/code&amp;gt; || Nama mencerminkan fungsi (accumulator, counter, source/destination index, stack pointer)&lt;br /&gt;
|-&lt;br /&gt;
| IA32 || 32-bit || &amp;lt;code&amp;gt;%eax&amp;lt;/code&amp;gt; … &amp;lt;code&amp;gt;%ebp&amp;lt;/code&amp;gt; || Prefix &amp;lt;code&amp;gt;e&amp;lt;/code&amp;gt; = &amp;#039;&amp;#039;extended&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| x86-64 || 64-bit || &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; … &amp;lt;code&amp;gt;%rbp&amp;lt;/code&amp;gt; || Prefix &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| x86-64 (baru) || 64-bit || &amp;lt;code&amp;gt;%r8&amp;lt;/code&amp;gt; … &amp;lt;code&amp;gt;%r15&amp;lt;/code&amp;gt; || Konvensi baru, suffix &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; untuk 32/16/8-bit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Sub-register (nested boxes) ==&lt;br /&gt;
&amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%eax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%ax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%al&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;bukan&amp;#039;&amp;#039;&amp;#039; empat register berbeda, melainkan satu register fisik yang diakses dengan lebar berbeda:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
|&amp;lt;------------------- %rax (64 bit) -------------------&amp;gt;|&lt;br /&gt;
                           |&amp;lt;------ %eax (32 bit) -----&amp;gt;|&lt;br /&gt;
                                          |&amp;lt;- %ax (16) -&amp;gt;|&lt;br /&gt;
                                                 |%al(8)|&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Operasi byte → least significant byte&lt;br /&gt;
* Operasi 16-bit → 2 byte terbawah&lt;br /&gt;
* Operasi 32-bit → 4 byte terbawah&lt;br /&gt;
* Operasi 64-bit → seluruh register&lt;br /&gt;
&lt;br /&gt;
== Aturan sisa byte saat menulis ke register ==&lt;br /&gt;
Ketika instruksi menghasilkan nilai kurang dari 8 byte ke register:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Ukuran tulis !! Efek ke byte sisanya&lt;br /&gt;
|-&lt;br /&gt;
| 1 byte / 2 byte || &amp;#039;&amp;#039;&amp;#039;Tidak berubah&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 4 byte || 4 byte atas &amp;#039;&amp;#039;&amp;#039;di-nol-kan&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Contoh, dengan &amp;lt;code&amp;gt;%rax = 0x1122334455667788&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;gas&amp;quot;&amp;gt;&lt;br /&gt;
movb $0xAA, %al      # %rax = 0x11223344556677AA  (sisanya utuh)&lt;br /&gt;
movw $0xAAAA, %ax    # %rax = 0x112233445566AAAA  (sisanya utuh)&lt;br /&gt;
movl $0xAAAA, %eax   # %rax = 0x000000000000AAAA  (4 byte atas = 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Kenapa?&amp;#039;&amp;#039;&amp;#039; Aturan zero-upper diadopsi saat ekspansi IA32 → x86-64 supaya hasil tulisan tidak bergantung pada isi lama register (menghindari &amp;#039;&amp;#039;partial register dependency&amp;#039;&amp;#039;), sehingga eksekusi out-of-order lebih lancar. Compiler memanfaatkannya, misalnya &amp;lt;code&amp;gt;mov $0x0,%eax&amp;lt;/code&amp;gt; untuk &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Peran register (System V ABI) ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Register !! Peran&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; || Return value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%rdi&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rsi&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rdx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rcx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%r8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%r9&amp;lt;/code&amp;gt; || Argumen ke-1 sampai ke-6 (urut)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%rsp&amp;lt;/code&amp;gt; || Stack pointer (spesial, dipakai otomatis oleh &amp;lt;code&amp;gt;push&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;pop&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;call&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;ret&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%rbx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rbp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%r12&amp;lt;/code&amp;gt;–&amp;lt;code&amp;gt;%r15&amp;lt;/code&amp;gt; || &amp;#039;&amp;#039;&amp;#039;Callee saved&amp;#039;&amp;#039;&amp;#039;: fungsi yang dipanggil wajib mengembalikan nilainya&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%r10&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%r11&amp;lt;/code&amp;gt; (+ register argumen &amp;amp; &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt;) || &amp;#039;&amp;#039;&amp;#039;Caller saved&amp;#039;&amp;#039;&amp;#039;: boleh dirusak oleh fungsi yang dipanggil&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Jembatan keledai urutan argumen: &amp;#039;&amp;#039;&amp;#039;&amp;quot;Diane&amp;#039;s Silk Dress Costs $89&amp;quot;&amp;#039;&amp;#039;&amp;#039; → &amp;lt;code&amp;gt;di&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;si&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cx&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;9&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Contoh: &amp;lt;code&amp;gt;multstore&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;gas&amp;quot;&amp;gt;&lt;br /&gt;
push %rbx          # rbx callee-saved → simpan nilai lama&lt;br /&gt;
mov  %rdx,%rbx     # rdx = argumen ke-3 (dest), amankan di rbx&lt;br /&gt;
call mult2         # x, y masih di rdi &amp;amp; rsi&lt;br /&gt;
mov  %rax,(%rbx)   # *dest = hasil mult2 (rax)&lt;br /&gt;
pop  %rbx          # pulihkan rbx&lt;br /&gt;
ret&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;dest&amp;lt;/code&amp;gt; dipindah ke &amp;lt;code&amp;gt;%rbx&amp;lt;/code&amp;gt; karena &amp;lt;code&amp;gt;%rdx&amp;lt;/code&amp;gt; caller-saved (bisa dirusak &amp;lt;code&amp;gt;mult2&amp;lt;/code&amp;gt;), sedangkan &amp;lt;code&amp;gt;%rbx&amp;lt;/code&amp;gt; dijamin selamat melewati &amp;lt;code&amp;gt;call&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= 3.4.1 Operand Specifiers =&lt;br /&gt;
&lt;br /&gt;
== Tiga jenis operand ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Jenis !! Contoh !! Arti&lt;br /&gt;
|-&lt;br /&gt;
| Immediate || &amp;lt;code&amp;gt;$-577&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$0x1F&amp;lt;/code&amp;gt; || Konstanta, nilai tertanam di instruksi&lt;br /&gt;
|-&lt;br /&gt;
| Register || &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%al&amp;lt;/code&amp;gt; || Isi register, notasi &amp;lt;code&amp;gt;R[r&amp;lt;sub&amp;gt;a&amp;lt;/sub&amp;gt;]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Memory || &amp;lt;code&amp;gt;0x104&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;(%rax)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8(%rax)&amp;lt;/code&amp;gt; || Isi memori di &amp;#039;&amp;#039;effective address&amp;#039;&amp;#039;, notasi &amp;lt;code&amp;gt;M[Addr]&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Perhatian:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;$0x10&amp;lt;/code&amp;gt; = angka 16, sedangkan &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt; (tanpa &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) = isi memori di alamat 16.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; vs &amp;lt;code&amp;gt;(%rax)&amp;lt;/code&amp;gt; ==&lt;br /&gt;
* &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; → isi register itu sendiri (seperti &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; di C)&lt;br /&gt;
* &amp;lt;code&amp;gt;(%rax)&amp;lt;/code&amp;gt; → isi register dipakai sebagai alamat, lalu baca memori di alamat itu (seperti &amp;lt;code&amp;gt;*p&amp;lt;/code&amp;gt; di C)&lt;br /&gt;
&lt;br /&gt;
Kurung &amp;lt;code&amp;gt;( )&amp;lt;/code&amp;gt; di AT&amp;amp;T = dereference. Di AT&amp;amp;T, register &amp;#039;&amp;#039;&amp;#039;wajib&amp;#039;&amp;#039;&amp;#039; pakai &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;rax&amp;lt;/code&amp;gt; tanpa &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; akan dianggap nama simbol.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Maksud !! AT&amp;amp;T (gcc, CS:APP) !! Intel (NASM, MASM)&lt;br /&gt;
|-&lt;br /&gt;
| Isi register || &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;rax&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Isi memori di alamat rax || &amp;lt;code&amp;gt;(%rax)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;[rax]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Konstanta || &amp;lt;code&amp;gt;$5&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bentuk umum memory reference ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Imm(rb, ri, s)   →   alamat = Imm + R[rb] + R[ri] · s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Imm&amp;lt;/code&amp;gt;: displacement konstanta&lt;br /&gt;
* &amp;lt;code&amp;gt;rb&amp;lt;/code&amp;gt;: base register (64-bit)&lt;br /&gt;
* &amp;lt;code&amp;gt;ri&amp;lt;/code&amp;gt;: index register (64-bit)&lt;br /&gt;
* &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;: skala, hanya &amp;#039;&amp;#039;&amp;#039;1, 2, 4, atau 8&amp;#039;&amp;#039;&amp;#039; (ukuran &amp;lt;code&amp;gt;char&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;/pointer)&lt;br /&gt;
&lt;br /&gt;
Semua mode lain adalah kasus khusus dengan komponen yang dihilangkan:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Form !! Effective address !! Nama&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Imm&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;Imm&amp;lt;/code&amp;gt; || Absolute&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(rb)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;R[rb]&amp;lt;/code&amp;gt; || Indirect&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Imm(rb)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;Imm + R[rb]&amp;lt;/code&amp;gt; || Base + displacement&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(rb,ri)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;R[rb] + R[ri]&amp;lt;/code&amp;gt; || Indexed&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Imm(rb,ri)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;Imm + R[rb] + R[ri]&amp;lt;/code&amp;gt; || Indexed&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(,ri,s)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;R[ri]·s&amp;lt;/code&amp;gt; || Scaled indexed&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Imm(,ri,s)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;Imm + R[ri]·s&amp;lt;/code&amp;gt; || Scaled indexed&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(rb,ri,s)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;R[rb] + R[ri]·s&amp;lt;/code&amp;gt; || Scaled indexed&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Imm(rb,ri,s)&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;Imm + R[rb] + R[ri]·s&amp;lt;/code&amp;gt; || Scaled indexed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tambahan x86-64 yang tidak ada di tabel: &amp;#039;&amp;#039;&amp;#039;RIP-relative&amp;#039;&amp;#039;&amp;#039;, misalnya &amp;lt;code&amp;gt;lea 0x0(%rip),%rdi&amp;lt;/code&amp;gt;, alamat dihitung relatif terhadap instruksi berikutnya (dipakai untuk data global/string literal).&lt;br /&gt;
&lt;br /&gt;
== Kegunaan: akses array dan struct ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
long a[100];&lt;br /&gt;
x = a[i];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Dengan &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; di &amp;lt;code&amp;gt;%rdx&amp;lt;/code&amp;gt; dan &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; di &amp;lt;code&amp;gt;%rcx&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;gas&amp;quot;&amp;gt;&lt;br /&gt;
movq (%rdx,%rcx,8), %rax     # alamat = a + i*8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Satu instruksi tanpa perkalian terpisah. Untuk &amp;lt;code&amp;gt;arr[i].field&amp;lt;/code&amp;gt;, offset field masuk ke &amp;lt;code&amp;gt;Imm&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Cara menghitung nilai operand ==&lt;br /&gt;
Untuk memory operand selalu dua langkah:&lt;br /&gt;
# Hitung alamat: &amp;lt;code&amp;gt;Imm + R[rb] + R[ri]·s&amp;lt;/code&amp;gt;&lt;br /&gt;
# Baca isi memori di alamat tersebut&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Jebakan umum:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Displacement tanpa &amp;lt;code&amp;gt;0x&amp;lt;/code&amp;gt; adalah &amp;#039;&amp;#039;&amp;#039;desimal&amp;#039;&amp;#039;&amp;#039;: &amp;lt;code&amp;gt;260&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;0x104&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;&lt;br /&gt;
* Koma di depan (&amp;lt;code&amp;gt;0xFC(,%rcx,4)&amp;lt;/code&amp;gt;) berarti &amp;#039;&amp;#039;&amp;#039;tanpa base register&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Perhatikan carry saat menjumlah hex: &amp;lt;code&amp;gt;0xFC + 4 = 0x100&amp;lt;/code&amp;gt;&lt;br /&gt;
* Jangan berhenti di alamat; jawaban adalah &amp;#039;&amp;#039;&amp;#039;isi&amp;#039;&amp;#039;&amp;#039; memorinya&lt;br /&gt;
&lt;br /&gt;
=== Contoh (Practice Problem 3.1) ===&lt;br /&gt;
Data: &amp;lt;code&amp;gt;%rax = 0x100&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rcx = 0x1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%rdx = 0x3&amp;lt;/code&amp;gt;; memori &amp;lt;code&amp;gt;0x100→0xFF&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x104→0xAB&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x108→0x13&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x10C→0x11&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Operand !! Jenis !! Alamat !! Nilai&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%rax&amp;lt;/code&amp;gt; || Register || — || &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0x104&amp;lt;/code&amp;gt; || Absolute || &amp;lt;code&amp;gt;0x104&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0xAB&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;$0x108&amp;lt;/code&amp;gt; || Immediate || — || &amp;lt;code&amp;gt;0x108&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(%rax)&amp;lt;/code&amp;gt; || Indirect || &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0xFF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;4(%rax)&amp;lt;/code&amp;gt; || Base + displacement || &amp;lt;code&amp;gt;4 + 0x100 = 0x104&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0xAB&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;9(%rax,%rdx)&amp;lt;/code&amp;gt; || Indexed || &amp;lt;code&amp;gt;9 + 0x100 + 3 = 0x10C&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0x11&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;260(%rcx,%rdx)&amp;lt;/code&amp;gt; || Indexed || &amp;lt;code&amp;gt;0x104 + 1 + 3 = 0x108&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0x13&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0xFC(,%rcx,4)&amp;lt;/code&amp;gt; || Scaled indexed || &amp;lt;code&amp;gt;0xFC + 1·4 = 0x100&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0xFF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;(%rax,%rdx,4)&amp;lt;/code&amp;gt; || Scaled indexed || &amp;lt;code&amp;gt;0x100 + 3·4 = 0x10C&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;0x11&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SanzSkuy</name></author>
	</entry>
</feed>