Slide 5.8: Defining strings Slide 5.10: Defining other data Home |
WORD
and SWORD
Data
word1 WORD 100h + 0B00h ; integer expression word2 SWORD -32768 ; smallest signed value |
|
DUP
Operator
DUP
operator generates a repeated storage allocation, using a constant expression as a counter.
val5 BYTE 10 DUP('a') ; 10 bytes, all equal to 'a' val6 BYTE 10 DUP(?) ; 10 bytes, uninitialized val7 BYTE 3 DUP("test") ; 12 bytes, "testtesttest"
An array can be created by using the following statement:
myArray WORD 10, 10, 10, 10
which is equal to
myArray WORD 4 DUP(10)
|
|
myArray
starts at offset 0.
All offsets are shown on the above.
EAX == 12345678h, (Y/N) |
||
.data X WORD 1234h Y WORD 5678h .code mov eax, X call WriteHex |
.data X WORD 1234h Y WORD 5678h Z DWORD ? .code mov bx, Y mov Z, bx mov bx, X mov Z+2, bx mov eax, Z call WriteHex |
|
Output | Output | Output |
12345678h |