flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Enumerate structure fields & fileds' relative offsets

Author
Thread Post new topic Reply to topic
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
virtual method is not much convenient:
Code:
virtual at eax
  structure1 STRUCTURE
end virtual
    

further relocation is not possible as label already defined:
Code:
virtual at ebx
  structure1 STRUCTURE
end virtual
    

of course we can find out a new name but that is a bit stupid:
Code:
virtual at eax
  structure1a STRUCTURE
end virtual
    

there are also arrays of structures where base is not fixed and we need a 0-offset of a field, eg:
Code:
struct STRUCTURE
  f1 db ?
  f2 db ?
ends
structure1 STRUCTURE
mov eax,[eax+structure1.f1-structure1]
    

not the best decision, so that relative offset constants needed ie the macro from a respective *.inc file must be fixed
Code:
mov eax,[eax+structure1.rel.f1] ;etc naming
    
Post 13 Nov 2010, 23:53
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
Code:
mov eax,[eax+STRUCTURE.f1]    
Post 14 Nov 2010, 01:07
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
"Eye for an eye", thanx.
rus:
That post #3 has been updated into post #5.
Post 14 Nov 2010, 01:38
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2945
Location: vpcmipstrm
bitRAKE
Just one of the reasons I only use STRUC.
Post 14 Nov 2010, 04:17
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.