I used to declare an array like this:
TheData db 128 dup(?) ; array of 128 bytes
But while reading some old drawing software, I've seen a declaration like this:
CMYKProfile db 1024 dup(0ffh, 0feh, 078h)
I don't know what that declaration means, and MSDN doesn't seem to have
answer either. Probably some of the gurus here can shead a light about
what that data declaration means?
1. Is it a 3x1024 array initialized with sequence 0ffh, 0feh, 078h?
2. Or just 1024 bytes array filled with 0ffh, 0feh, 078h?
Thanks,
-chris
Chris,
MASM never builds complex arrays, you get the byte count with the specified content. Its much the same technique as an array of structures.
To expand the answer to a picture, if I place the statement:
CMYKProfile db 1024 dup(0ffh, 0feh, 078h)
In the initialized data section, then assemble, link, and dump the contents of the EXE, this is what the data looks like:
00000800 FF FE 78 FF FE 78 FF FE - 78 FF FE 78 FF FE 78 FF ..x..x..x..x..x.
00000810 FE 78 FF FE 78 FF FE 78 - FF FE 78 FF FE 78 FF FE .x..x..x..x..x..
. . .
000013E0 FE 78 FF FE 78 FF FE 78 - FF FE 78 FF FE 78 FF FE .x..x..x..x..x..
000013F0 78 FF FE 78 FF FE 78 FF - FE 78 FF FE 78 FF FE 78 x..x..x..x..x..x
aa db 9 dup ('A','B','C')
ABCABCABC
Thanks for the very helpful responses.
:bg
Cheers,
-chris
Quote from: dsouza123 on August 11, 2008, 03:22:17 AM
aa db 9 dup ('A','B','C')
ABCABCABC
ABCABCABC is nine chars long, but this is not the output you will get: db 9 means "get the full sequence 9 times", i.e. ABCABCABCABCABCABCABCABCABC
Quote from: jj2007 on August 11, 2008, 08:22:29 AM
... aa db 9 dup ('A', 'B', 'C')
db 9 means "get the full sequence 9 times", i.e. ABCABCABCABCABCABCABCABCABC
Thanks, this made it clear.
From the original example:
CMYKProfile db 1024 dup (0ffh, 0feh, 078h)
I did got a 1024x3 block of initialized memory :U
-chris