How many bytes do RESB, RESW, RESD, RESQ allocate in NASM?

Viewed 40944

DB allocates in chunks of 1 byte.

DW allocates in chunks of 2 bytes.

DD allocates in chunks of 4 bytes.

DQ allocates in chunks of 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

1 Answers
Related