From e64b3068fa641ae36acebdf549580342afe2ac1f Mon Sep 17 00:00:00 2001 From: Regina König Date: Wed, 22 Jul 2020 12:44:51 +0200 Subject: Added some information about at&t assembler --- documentation/assembler/at&t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 documentation/assembler/at&t (limited to 'documentation') 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. -- cgit v1.2.3-55-g7522