Assembly: Define Directives

Contributor Icon Contributed by William_Wilson Date Icon March 9, 2006  
Tag Icon Tagged: Computer programming

The size and reason for defining different sized parameters



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: william_a_wilson@hotmail.com
-William. § (marvin_gohan)

Previous recipe | Next recipe |
 
blog comments powered by Disqus