Hi i have a function in Visual C++ that i want to write in assembly but i have to access pointer to structs and i don't know how to do that. this function below would work if I passed the full object but i don't so any help appreciated... How to access pointer to structures.


VEC3D AddVectors(const VEC3D* self,const VEC3D * operand )
{
VEC3D vec={0};
__asm
{
fld self.X
fadd operand.X
fstp vec.X

fld self.Y
fadd operand.Y
fstp vec.Y

fld self.Z
fadd operand.Z
fstp vec.Z

}
return vec;

}
Posted on 2002-04-02 21:41:46 by lynear
YourStructure STRUCT
x DWORD ?
y DWORD ?
YourStructure ENDS

YourSub proc pStruct:DWORD

mov esi,pStruct
assume esi:ptr YourStructure

mov eax,.x
mov ebx,.y

YourSub endp
Posted on 2002-04-02 23:36:04 by Qweerdy



VECT STRUCT
fieldName01 DD ?
VECT ENDP

...

data?
vct VECT<?>

...

AddVectors PROC AddressOfYourStructure:DWORD

mov eax, AddressOfYourStructure
mov (VECT PTR [eax]).fieldName01, 5
...

ret

AddVectors ENDP

...

invoke AddVectors, OFFSET vct

:)
Posted on 2002-04-02 23:57:34 by stryker