summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-rw-r--r--documentation/assembler/at&t19
1 files changed, 19 insertions, 0 deletions
diff --git a/documentation/assembler/at&t b/documentation/assembler/at&t
new file mode 100644
index 0000000..3fde006
--- /dev/null
+++ b/documentation/assembler/at&t
@@ -0,0 +1,19 @@
+ADRESSING MEMORY
+====================
+
+mov (%ebx), %eax /* Load 4 bytes from the memory address in EBX into EAX. */
+mov %ebx, var(,1) /* Move the contents of EBX into the 4 bytes at memory address var.
+ (Note, var is a 32-bit constant). */
+mov -4(%esi), % /* Move 4 bytes at memory address ESI + (-4) into EAX. */
+mov %cl, (%esi,%eax,1) /* Move the contents of CL into the byte at address ESI+EAX. */
+mov (%esi,%ebx,4), %edx /* Move the 4 bytes of data at address ESI+4*EBX into EDX. */
+
+OPERATION SUFFIXES
+=====================
+movb $2, (%ebx) /* Move 2 into the single byte at the address stored in EBX. */
+movw $2, (%ebx) /* Move the 16-bit integer representation of 2 into the 2 bytes starting at the address in EBX. */
+movl $2, (%ebx) /* Move the 32-bit integer representation of 2 into the 4 bytes starting at the address in EBX. */
+
+In assembly language, all the labels and numeric constants used as immediate operands (i.e. not in an address calculation
+like 3(%eax,%ebx,8) ) are always prefixed by a dollar sign. When needed, hexadecimal notation can be used with the 0x
+prefix (e.g. $0xABC ). Without the prefix, numbers are interpreted in the decimal basis.