N
Glam Journal

What is DD DW DB?

Author

Chloe Ramirez

Updated on March 04, 2026

What is DD DW DB?

DB = define byte size variables. DW = define word size (16 bits) variables. DD = define double word size (32 bits) variables.

What is DB and DW in assembly language?

DB – Define Byte. DW – Define Word. Generally 2 bytes on a typical x86 32-bit system. DD – Define double word.

What is DW in assembly?

The DW statement initializes memory with one or more word (2-byte) values. label is a symbol that is assigned the current memory address. expression is a word value that is stored in memory. The DW statement may be specified only within a code or const segment.

What is DB in NASM?

db does not have any magic effects: it simply outputs bytes directly to the output object file. If those bytes happen to be in front of a symbol, the symbol will point to that value when the program starts. If you are on the text section, your bytes will get executed. Weather you use db or dw , etc.

What is the difference between DB and DW in 8086?

DB – stays for Define Byte. DW – stays for Define Word. name – can be any letter or digit combination, though it should start with a letter. It’s possible to declare unnamed variables by not specifying the name (this variable will have an address but no name).

What does DB do in assembly?

In assembly language, we use “db” (data byte) to allocate some space, and fill it with a string.

What is DB used for in assembly language?

What is DB Assembly?

In assembly language, we use “db” (data byte) to allocate some space, and fill it with a string. You can actually pull out the bytes of the string directly from memory like below, for example to print their ASCII values as a number, like 0x4E for ‘N’.

What does DD do assembly?

dd is a “pseudo-instruction” that assembles 4-byte constants into the output, the same way that add eax,eax assembles 0x01 0xc0 into the output.

What is DW in microprocessor?

2. DW – The DW directive is used to declare a WORD type variable – A WORD occupies 16 bits or (2 BYTE).

What is RESB in NASM?

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.

Is DB an assembler directive?

1. DB – The DB directive is used to declare a BYTE -2-BYTE variable – A BYTE is made up of 8 bits.

What’s the difference between DB and DW in NASM Assembly?

In NASM assembly, there are db and dw pseudo instructions to declare data. NASM Manual provides a couple of examples but doesn’t say directly what’s the difference between them. I’ve tried the following “hello world” code with both of them, and it turned out that no difference is observable.

How does NASM handle little endian?

NASM’s db, dw, dd, etc. accept a list of integers, and encode them into the output as little-endian, e.g. dw 0x1234, 0x5678 assembles to 34 12 78 56. NASM also supports multi-character character literals, like ‘ab’ in any context where it accepts an integer, e.g. add ax, ’00’ is the same as 0x3030. (maybe for unpacked-BCD->ASCII conversion.)

Why can’t NASM remember that [num1] is a byte?

Some assemblers “remember” that you said “num1” was “db” (bytes) and would barf up an error messages for this. Nasm has amnesia, and does not “remember” that “num1” is supposed to be bytes, and will obediantly do what you told it to do – which is to load both [num1] and [num1 + 1] into ax – a “word (16 bits) register.

How can I force NASM to generate an effective address?

NASM has a hinting mechanism which will cause [eax+ebx] and [ebx+eax] to generate different opcodes; this is occasionally useful because [esi+ebp] and [ebp+esi] have different default segment registers. However, you can force NASM to generate an effective address in a particular form by the use of the keywords BYTE, WORD, DWORD and NOSPLIT.