Reserving space for variables (in the
.bss section:)
myarr resb 10 ; Reserve space for 10 bytes
var1 resw 2 ; Reserve space for 2 words (= 2 * 2 = 4 bytes)
large resd 5 ; Reserve space for 5 dwords (= 5 * 4 = 20 bytes)
wow resq 1; ; Reserve space for 1 qword (= 8 bytes)
NASM has greater data types (e.g.,
reso = 16 bytes, resy = 32 bytes, etc., but we won't need these for our course.) Also:
mov rbx, byte [loc] ; Copies a single byte at RAM[loc] to rbx
mov rbx, word [loc] ; Copies a single word (= 2 bytes) starting at RAM[loc] to rbx
mov rbx, dword [loc] ; Copies a single dword (= 4 bytes) starting at RAM[loc] to rbx
mov rbx, qword [loc] ; Copies a single qword (= 8 bytes) starting at RAM[loc] to rbx