Ok, i know i'm gonna blame myself with that question:confused:, but it would may be help some other newbies too. Well, Could somebody explain to me what those dword, word etc mean ? I read the AOA, what i mean is more like when you declare a pointer like Text db "test",0 test dd 0 test2 dword ? what do those things like dd,db,dword mean to me as coder ? does it depend on the length of the string i put on it, like how many byte in a dword or in a word ? Please tell me that stuff, i just don't feel right when i'm coding and don't really know what these things mean, the other thing is that i could save on file size by declaring those pionter? (i guess that's right, correct me if i'm wrong) So far thanks for your time, and sorry but i really like to know stuff i'm doing for at least 100% Regards Typhoon
Posted on 2001-04-16 01:31:00 by Typhoon
Typhoon, It really simple, they are just alternative notations for the data sizes. db = BYTE dw = WORD dd = DWORD .data text db "this is a text",0 text_pointer dd 0 .code mov eax, offset text ; get address of text mov text_pointer, eax ; put it into a DWORD pointer Regards, hutch@pbq.com.au
Posted on 2001-04-16 02:48:00 by hutch--
thanks hutch, just one more question: so if i would declare--> text db "1",0 it would be a byte so 8 bit can i do that too?:-->text dd "1",0 so 2x16 bit ? would it still have the same effect ?
Posted on 2001-04-16 02:57:00 by Typhoon
Typhoon, You cannot get away with that one, text data is effectively a BYTE sequence so when you put it in a DB line, you are setting a sequence of bytes. text db "this is a text !",0 A peculiarity of Intel processors is that they store numerical data in reverse order to text data so if you do something like mov eax, "1234" in memory you get 4321. A BYTE data type can store simple numbers as well, number db 1 but it is limited to the range of a BYTE which is 256. Regards, hutch@pbq.com.au
Posted on 2001-04-16 03:03:00 by hutch--
thanks hutch, got it
Posted on 2001-04-16 03:12:00 by Typhoon
Just a sec here.... >so if i would declare--> text db "1",0 >it would be a byte so 8 bit >can i do that too?:-->text dd "1",0 so 2x16 bit ? >would it still have the same effect ? While I have no idea how you would find "text dd "1",0" *useful*, or what '2x16 bit' means, this is still valid code. In fact, I use a similar definition: wszWideString WORD "H","I"," ","T","H","E","R","E",0 That yeilds a valid 'ascii code page' wide or Unicode string. MASM has no trouble understanding placing an 8 bit (or 1 bit) quantity into a word or dword placeholder. It pads out the other zeros as needed. hutch is correct it's pretty useless for pure ascii string data, unless you start respecting little endian and define the sequences in hex. Still, occasionally for very short strings this is still useful, as you can define a complete zero terminated 3 character string inside a dword (4 chars if you assume the trailing zero). It's good for fast checks inside optomized loops.
Posted on 2001-04-16 07:16:00 by Ernie