flat assembler
Message board for the users of flat assembler.

Index > Main > why getting virtual address works on lea but fail on mov?

Author
Thread Post new topic Reply to topic
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 17 Mar 2006, 14:04
struct fruit
price dd ?
local db ?
ends

virtual at edx
.banana fruit
end virtual

lea edx,[.banana.price] ;<- ok
mov edx,.banana.price ;<- failed

any idea?
Post 17 Mar 2006, 14:04
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 17 Mar 2006, 15:33
SIB addresses cannot be used like register operand, sorry.
Note that in most cases it would anyway make no sense as it would be "mov edx,edx+some_offset". fasm doesn't bother checking whether the offset it zero (and whether there is no index register, too) to detect the rare case when it could get reduced to be only the register, thus this is like a fasm's limitation. I don't consider it to be very limiting, though.
PS. This limitation also applies to the cases when you write "mov edx,2+edx-2" etc. It's because "2+edx+2" is an expression and simple "edx" is an register - something different from the parsed source point of view (see how the "eqtype" works).
Post 17 Mar 2006, 15:33
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 18 Mar 2006, 14:31
thank you
Post 18 Mar 2006, 14:31
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.