This question already has an answer here:
DB
allocates 1 byte.
DW
allocates 2 bytes.
DD
allocates 4 bytes.
DQ
allocates 8 bytes.
So I assume that:
RESB 1
allocates 1 byte.
RESW 1
allocates 2 bytes.
RESD 1
allocates 4 bytes.
RESQ 1
allocates 8 bytes.
Am I correct?
The documentation doesn't say much:
3.2.2 RESB and Friends: Declaring Uninitialized Data
RESB, RESW, RESD, RESQ, REST, RESO, RESY and RESZ are designed to be used in the BSS section of a module: they declare uninitialized storage space. Each takes a single operand, which is the number of bytes, words, doublewords or whatever to reserve. As stated in section 2.2.7, NASM does not support the MASM/TASM syntax of reserving uninitialized space by writing DW ? or similar things: this is what it does instead. The operand to a RESB-type pseudo-instruction is a critical expression: see section 3.8.
For example:
buffer: resb 64 ; reserve 64 bytes
wordvar: resw 1 ; reserve a word
realarray resq 10 ; array of ten reals
ymmval: resy 1 ; one YMM register
zmmvals: resz 32 ; 32 ZMM registers
yes.
The size suffixes are consistent throughout NASM, for
d*
andres*
. They match x86 instruction mnemonic suffixes for byte to qword. (e.g.psubd
works with packed dword elements).There's even an instruction mnemonic that uses
o
(oct-word):cqo
.y and z size suffixes obviously match ymm and zmm register sizes, even though the instruction mnemonics are now things like
VBROADCASTI32X8
because of AVX512 masking granularity.