Assembly: Define Directives

Posted March 9, 2006 by William_Wilson in Computer programming

The size and reason for defining different sized parameters is discussed in this tech-recipes tutorial.

DB: Define Byte ;allocates 1 byte
DW: Define Word ;allocates 2 bytes
DD: Define Doubleword ;allocates 4 bytes
DQ: Define Quadword ;allocates 8 bytes
DT: Define Ten bytes ;allocates 10 bytes

Keep in mind that Assembly does not actually care about words, but rather the number of bytes. To define a string, DW is used to ensure enough space is reserved (though space is not reserved the same way as it is in high level languages).

These directives would be used to declare variables in the following manner in the .DATA section of your program.

sorted DB ’y’
empty DB ? ;no initialization
number DW 25159
float DD 1.234

Questions/Comments: [email protected]
-William. § (marvin_gohan)

The Conversation

Follow the reactions below and share your own thoughts.