; File: add2.asm ; ; Various addressing modes with the add operation. ; section .data x: dd 42 ; 4-byte word section .text global _start _start: nop ; initialize start: mov eax, 17 ; eax := 17 mov ebx, x ; ebx := address of x mov ecx, 9 ; ecx := 9 add eax, 3 ; add immediate add eax, ecx ; add 32-bit registers add ax, cx ; add 16-bit registers add eax, [x] ; add memory add eax, [ebx] ; add register indirect add [x], dword 5 ; add immediate to mem add [x], eax ; add register to mem ; these two are not allowed (commented out): ; add [x], [x] ; add mem to mem ; add [x], [ebx] ; add reg indirect to mem exit: mov ebx, 0 ; exit code, 0=normal mov eax, 1 ; Exit. int 080H ; Call kernel.