News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

addr vs []

Started by NewEasycoder, July 08, 2010, 07:11:29 AM

Previous topic - Next topic

NewEasycoder

I was trying to work out how to refer to the location of the label/variable (pointer?), the number of bytes used by the label/variable, and the actual value stored in the label/variable.

eg.
Addr hWnd = pointer to where hWnd is stored, or is it the number of bytes used by hWnd?
[hwnd] = ?



Yuri


mov eax,addr hWnd       ; Pointer to hWnd.
mov eax,[hWnd]          ; Value (DWORD) stored in hWnd.
mov eax,sizeof hWnd     ; Number of bytes in hWnd.

NewEasycoder

#2
Hi Yuri, thanks for your fast reply.  One thing, what does the + 2 do in this code?

Add Eax, Addr String + 2



ecube

mov eax,sizeof hWnd     ; Number of bytes in hWnd.

careful with that, it gives you the sizeof of the data type, so for instance that'd be 4 bytes if you did globalloc 100000 bytes, the return handle would still be 4 bytes with sizeof.

Yuri

Quote from: NewEasycoder on July 08, 2010, 09:12:42 AM
One thing, what does the + 2 do in this code?

Add Eax, Addr String + 2
It adds 2 to the address of String.

NewEasycoder

Quote from: Yuri on July 08, 2010, 10:41:56 AM
Quote from: NewEasycoder on July 08, 2010, 09:12:42 AM
One thing, what does the + 2 do in this code?

Add Eax, Addr String + 2
It adds 2 to the address of String.

Hi again Yuri, GoAsm.chm doesn't want to run on my machine for some reason, even though EasyCode.chm does, so rather than asking lots of questions, is there any resource that I can use that describes the GoASM operators such as Add, Mov, etc?


Ramon Sala

Hi NewEasycoder,

Right click on the GoAsm.chm, choose 'Properties', click on the 'Unlock' button and then 'OK'.

Ramon
Greetings from Catalonia