The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: NewEasycoder on July 08, 2010, 07:11:29 AM

Title: addr vs []
Post by: NewEasycoder on July 08, 2010, 07:11:29 AM
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] = ?


Title: Re: addr vs []
Post by: Yuri on July 08, 2010, 08:02:59 AM

mov eax,addr hWnd       ; Pointer to hWnd.
mov eax,[hWnd]          ; Value (DWORD) stored in hWnd.
mov eax,sizeof hWnd     ; Number of bytes in hWnd.
Title: Re: addr vs []
Post by: NewEasycoder on July 08, 2010, 09:12:42 AM
Hi Yuri, thanks for your fast reply.  One thing, what does the + 2 do in this code?

Add Eax, Addr String + 2


Title: Re: addr vs []
Post by: ecube on July 08, 2010, 10:38:33 AM
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.
Title: Re: addr vs []
Post by: 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.
Title: Re: addr vs []
Post by: NewEasycoder on July 08, 2010, 11:21:33 AM
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?
Title: Re: addr vs []
Post by: ecube on July 08, 2010, 12:09:11 PM
http://www.goprog.com/GoDevTool/GoasmFrame.htm
Title: Re: addr vs []
Post by: Ramon Sala on July 08, 2010, 04:39:53 PM
Hi NewEasycoder,

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

Ramon