I do not understand how a string is saved in a variable name.

aph  DWORD  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

DWORD = 32 bits.
is each character saved as one bit? or as an ascii equivilant, in a byte per character?

Can someone exaplain this for me please? Thanks in advance.,
Posted on 2005-10-13 13:15:27 by marla
That syntax seems wrong, I don't know how MASM handles it but I'm guessing your string gets truncated to 4 bytes (32 bits).

This is the right way to define a string, as an array of bytes:

aph db "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Then the "aph" label points to the first character in the string.
Posted on 2005-10-13 16:00:08 by QvasiModo
That statement would store one character in each DWORD of memory. There would be one DWORD for each character. I know this because if you want a Unicode string you can do it using the WORD data type instead of BYTE. If I remember correctly, db and BYTE are identical in recent versions of MASM.

Posted on 2005-10-13 16:06:00 by Sparafusile
aph  db  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",0   

Posted on 2005-10-13 16:48:52 by shism2

aph  db  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",0   

That creates a NULL-terminated string, as used in the C language. The Windows API requires these. But a string is a string, terminator or not. :)
Posted on 2005-10-13 18:06:19 by QvasiModo