flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > suggest to provide a 2nd virtual at that holds real address.

Author
Thread Post new topic Reply to topic
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
Code:
struct struct_fruit
        price   dd 1
        type    dd 2
        name    dd 3
        unit    dd 4
ends

mov  edx,fruit
virtual at edx
        .fr     struct_fruit
end virtual
mov  eax,[.fr.price]
mov  ecx,[.fr.unit]
invoke stockcontroldept,a,b,[.fr.unit]
invoke marketingcontrol,a,[.fr.price] ; the .fr.price would fails coz let say, stockcontrol already modify the EDX values
    


i would suggest maybe fasm could provides 2nd version virtual that holds real address instead of offset, so after the virtual at edx, we could call any invoke (which might modify edx values) but we need to access to [.fr.price] after the invoke, current way is to push the edx and pop them out.
Post 21 Mar 2006, 06:45
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
the problem would still be there if we are going to use fruit as an array Sad
perhaps anyone could guide me a little bit how to solve issue like above?
Post 21 Mar 2006, 06:52
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7751
Location: Kraków, Poland
Tomasz Grysztar
Well, if fruit is just some absolute address, you can do something like
Code:
virtual at fruit
 .fr struct_fruit
end virtual    

But if it is an address you can get only into a register at the run-time, you have to preserve that register to keep it.
Post 21 Mar 2006, 07:52
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
yip yip,
thanks.
Post 21 Mar 2006, 16:38
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
sigh,
i spend hours today to find why i coudln't get a value from a struct...
coz i didn't aware that after i
virtual at edx
and i do some invoke
and i reffer to my virtual struct.. (off course, it would fail like i mentioned above).

stupid me.
Post 10 Apr 2006, 19:27
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.