The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Astro on July 06, 2009, 01:32:41 AM

Title: Data Types
Post by: Astro on July 06, 2009, 01:32:41 AM
Hi,

.DATA
ClassName db "SimpleWinClass",0        ; the name of our window class
AppName db "Our First Window",0        ; the name of our window


What is "db"? Double Byte? Where can I find the different types?

Something else I don't quite get (example ripped out of windows.inc):

HENHMETAFILE                typedef DWORD
HFILE                       typedef DWORD
HFONT                       typedef DWORD
HGDIOBJ                     typedef DWORD
HGLOBAL                     typedef DWORD

Are all these interchangable as they are the type DWORD?

e.g.

could:

HANDLE myHandle

equally be:

HGLOBAL myHandle

without any problems? (Although, yes, it would make reading the code a complete nightmare!!!!).

In other words, isn't there any siginificance except to make the code more readable?
Title: Re: Data Types
Post by: dedndave on July 06, 2009, 01:42:01 AM
 "db" = Define Byte
dw word
dd dword
dq dairy queen - ooops - qword (quadword)

as for the windows.inc file - that is the standard windows include file for the windows API's
best not to use those names, as they are used in structures, pins, etc for windows API's

as an example, NULL is equal to 0 - it is defined in windows.inc
there are other values in there that also are equal to 0, but they are defined for clarity and to match the API reference manuals
Title: Re: Data Types
Post by: Mark Jones on July 06, 2009, 01:51:40 AM
Hi, check out this file: \masm32\help\asmintro.chm. It is essential and very brief, and will answer most initial questions.
Title: Re: Data Types
Post by: disintx on July 06, 2009, 01:53:38 AM
1. db means 'define byte'.
Others include:
dw - define word (two bytes)
dd - define double word (four bytes)
dq - define quadword (8 bytes)
dt - define 10 bytes - never really seen this used but I'm 99% certain this is real..maybe someone will verify

2. What that means is just that each of those values are 4 bytes long (double word). Generally they're
pointers (4-byte address) to where the actual value/junk is stored in memory.
They "are interchangeable", but they are obviously all different values when you're receiving them. You COULD
do what you're saying but it would just be confusing. :)

edit: dave beat me to it :|
Title: Re: Data Types
Post by: Astro on July 06, 2009, 01:57:24 AM
Thanks!!!  :8)

I'll check out that CHM file.

EDIT: PERFECT!!!!  :eek
Title: Re: Data Types
Post by: dedndave on July 06, 2009, 02:11:07 AM
disintx - lol - good you were there - i forgot dt
it is used for 80 bit floats
Title: Re: Data Types
Post by: disintx on July 06, 2009, 02:13:00 AM
Quote from: dedndave on July 06, 2009, 02:11:07 AM
disintx - lol - good you were there - i forgot dt
it is used for 80 bit floats
Ah yes :)