I have declared an structure in asm like this

STRUCT MyStructure
X dd ?
y dd ?
MyStructure ENDS

that's ok, but when i try to acces it as a global variable or a local one the assember trough me errors. For examble we are in a proc called paint

paint proc ;the procudere
local point:MyStructure ;The Structure Declaration

point.X = 3 <--- This line trough an error when i try to acces the
member

paint endp

The Same happens if i try to initialize a global structure:
suppouse:

Strc1 MyStrucutre

the assembler assembles it, but the code again "Strc1.X = 3" is trated as an error.

I have readed carrefully the masm help file.
This is my first stpes in masm and i would like someone help me please.
Posted on 2002-07-10 16:55:03 by IrOn
Forgive me the code is no "Point.X" its "Mov, Point.X" (i make the mistake thinking in C), but the problem is still there.
Posted on 2002-07-10 17:01:51 by IrOn
POINT STRUCT

x DD ?
y DD ?
POINT ENDS

.DATA?

mypt POINT<>

.CODE

PaintFunc PROC
LOCAL pointStr:POINT
mov pointStr.x, 3
mov eax, pointStr.x
...
ret
PaintFunc ENDP

Start:

mov mypt.x, 3
mov edx, mypt.x

....
:)
Posted on 2002-07-10 17:08:41 by stryker
MOV it where? You need to state a destination.


You defined MyStructure.X as a dd, or a word (I forget, thats why I never use 'dd' or 'dw', I use DWORD and WORD and BYTE and...)

Anyway, the point is, MyStructure.X is a memory location, so you can only MOV it to a register. Additionally, the register must be the same size as X is, here a (I think) word.

mov ax, MyStructure.X ; should compile
mov eax, MyStructure.X ; should NOT compile

OK? <g>
Posted on 2002-07-10 21:16:13 by Ernie
Instead of starting a new thread, you should have posted a reply to your original thread, it keeps things nice and organised.....

You said your code still doesn't work, if you post your code (just cut&paste it inline if it is short, not as an attachment), then we can check it.

Posted on 2002-07-10 21:36:22 by sluggy
Thanks for the help, i was so stupid that i have been using "Struct " instead of " Struct".
:tongue:
Posted on 2002-07-11 11:32:20 by IrOn