flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Struct offset (2 developers of fasm)

Author
Thread Post new topic Reply to topic
Alexandoros



Joined: 20 Aug 2004
Posts: 3
Alexandoros 20 Aug 2004, 21:17
Now i wrote like this:

Code:
 
     ...
    struc   CPoint 
     {
            x rw 1
            y rw 1
            z rw 1   
      }
       ....
    point     CPoint 
     .....

     mov    si,point
    mov    [si + point.z - point], 12
    


Is it possible to do something like this:

Code:
     
mov    si,point
mov    [si + CPoint.z ], 12
    

with result exactly before ??
p.s. sorry for my english
Post 20 Aug 2004, 21:17
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 20 Aug 2004, 21:26
Code:
virtual at si
  si_point CPoint
end virtual

mov si,point
mov [si_point.z],12    

You can use whatever label you want.
Post 20 Aug 2004, 21:26
View user's profile Send private message Visit poster's website Reply with quote
Alexandoros



Joined: 20 Aug 2004
Posts: 3
Alexandoros 20 Aug 2004, 23:11
ye,ye i know about this way, but how about 20 different struct and 4 registers (for example) = 80 virtual define? Too much.
Macro? - Only 1 name, possible many mistake, and code will be not so good readable. But its IMHO.

I can not speak you what to do, but if future with local offset inside struct will be introduced - its will be very cool.
Post 20 Aug 2004, 23:11
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 20 Aug 2004, 23:39
When you want just the local offset, do the same what the "struct" macro does:
Code:
virtual at 0
  CPoint CPoint 
end virtual 

mov si,point 
mov [si+CPoint.z],12    
Post 20 Aug 2004, 23:39
View user's profile Send private message Visit poster's website Reply with quote
Alexandoros



Joined: 20 Aug 2004
Posts: 3
Alexandoros 22 Aug 2004, 05:07
Thx, its work.
Post 22 Aug 2004, 05:07
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.