27 lines
817 B
NASM
27 lines
817 B
NASM
bits 64
|
|
|
|
SECTION .data
|
|
var1: dd 0x00112233
|
|
var2: dd 0x55667788
|
|
|
|
SECTION .text
|
|
global _start
|
|
_start:
|
|
%include "header.asm.inc"
|
|
|
|
; interactions between memory and registers
|
|
mov eax, [var1] ; store content at address `var1` in eax
|
|
mov eax, var1 ; store address `var1` in eax
|
|
mov [var1], eax ; store eax at address `var1`
|
|
;mov var1, eax ; invalid!
|
|
|
|
; many more instructions allow to work on operands
|
|
add eax, [var1] ; add value at address `var1` to eax
|
|
add [var1], dword 0x42 ; store immediate value at address `var1`
|
|
|
|
; some combinations are invalid, e.g., two memory operands in arithmetic ops
|
|
; (but many others, too!)
|
|
; add [var1], [var2] ; invalid!
|
|
|
|
%include "sysexit.asm.inc"
|