flat assembler
Message board for the users of flat assembler.

Index > Windows > Substructures

Author
Thread Post new topic Reply to topic
denial



Joined: 12 Sep 2004
Posts: 98
denial 20 Mar 2005, 13:45
Hello,

I tried to find out how to access elements of a structure inside a structure. I defined the following (it's just a silly example)

Code:
struct PARENT
.name rb 100
.mumordad dd ?
ends

struct PERSON
.mum PARENT
.dad PARENT
.name rb 100
.age dd ?
ends
    


As you can see, mum and dad are PARENT structs inside the person struct. I defined a person and now want to access the mum/dad data inside:

Code:
lea ebx,[myself]
mov ecx,0 ;0=mum
mov [ebx+PERSON.mum.mumordad],ecx
(...)
myself PERSON
    


It compiled - but I wanted to ask if this is the right way? Or did I code shit? Wink

An answer would be kind, thank you in advance Smile
denial
Post 20 Mar 2005, 13:45
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 20 Mar 2005, 14:23
absolutely right code
Post 20 Mar 2005, 14:23
View user's profile Send private message Reply with quote
denial



Joined: 12 Sep 2004
Posts: 98
denial 20 Mar 2005, 19:08
Thank you :O)
Post 20 Mar 2005, 19:08
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.