News:

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

Why this does not work

Started by untio, October 05, 2010, 01:37:04 PM

Previous topic - Next topic

untio

Hi to all,

I am writing a dll to read the tags from an mp3 file. Obviously, I have started with the version 1 of the tags. But a problem raised:
I pass to a procedure a pointer that points to the integer to hold the track number. When I write in memory using this pointer directly:
mov [pointertotracknumber], eax
I receive strange results.
When I do exactly the same thing using a register:
mov ebx, pointertotracknumber
mov [ebx], eax
All works fine.

And my question is why this happens and when is correct:
mov [pointertosomething], some value

Thanks in advance.

redskull

You can't use a value in memory to write into other memory.  MASM does funny things with brackets (or, at least non-standard things), so you are basically removing thre brackets and changing the pointer itself.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

untio

Thanks for your answer redskull.
After google a lot I have found that it is not possible to dereference using a memory address. It must be done using a register.
Thanks once more.