why sometimes the lea intr not work?

lea eax,works_
mov eax,works_

work very well...
Posted on 2002-08-28 04:33:22 by Hume
lea eax, is the correct syntax.
Posted on 2002-08-28 04:40:40 by Tomasz Grysztar
thx...another question...
How to access structure members using register convieniently...
for ex:
struc test
.x dd 0
.y dd 0

and in a loop I want to do such things:

lea esi,testarray

add ,5
loop @B

but fasm don't let me do so,I din't find anyway....l to how to solve it? thx in advance...
Posted on 2002-08-28 04:55:57 by Hume
Documentation shows how can you do it using the virtual directive.
Posted on 2002-08-28 05:55:57 by Tomasz Grysztar
I was also thinking how to allow you to use esi.x and esi.y labels for that purpose, and I have found a small inconsequency in my preprocessor. Then I fixed it and released still as an 1.40 (because it was really very small fix), you can download it now - you know you have the latest version when the date of release in whatsnew.txt is 28-08-2002. The thing I fixed is allowing the struc name to be recognized as symbolic constant. Because symbolic contants in every other location inside the struc macro were recognized, it was logical to allow this also with the main name.
This fix allows you to do the following trick:

struc POINT
.x dd ?
.y dd ?

macro assume reg,struc
virtual at reg
local undefined
reg equ undefined
reg struc
restore reg
end virtual

assume esi,POINT

mov eax,[esi.x]
mov ebx,[esi.y]

It works because of general rule that symbolic constants are replaced after processing the macroinstructions.
Posted on 2002-08-28 06:08:09 by Tomasz Grysztar

thx very much,I am totally a newbie to fasm,but I found it rather interesting...

good work.!keep on!
Posted on 2002-08-28 09:20:39 by Hume