flat assembler
Message board for the users of flat assembler.

Index > Main > Error: add eax,[edx+esi+edi]?

Author
Thread Post new topic Reply to topic
chooka



Joined: 14 Apr 2006
Posts: 2
chooka
Why fasm gives out a mistake on a design add eax, [edx+esi+edi]?
Post 14 Apr 2006, 05:32
View user's profile Send private message ICQ Number Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
You can check your instruction set documentation.

There's no opcode add reg, [reg1 + reg2 + reg3]
So you'll have to
Code:
lea ecx, [esi + edi]
add eax, [edx + ecx]
    
Post 14 Apr 2006, 05:44
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
lea ecx, [esi + edx]
add eax, [edi + ecx]

even better Wink
Post 14 Apr 2006, 07:00
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
shoorick, why is your solution better than r22's?
Post 14 Apr 2006, 11:45
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
in true there is no difference in bytes (do not know about clocks), but usually i try to approach to shema:
addr = [indexing register]+[common register]+[offset]
for example, in 16-bit mode this is possible:
add ax,[di + cx]
and this no:
add ax,[dx + cx]
so, it is just a rule
Post 14 Apr 2006, 12:18
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
Yeah, I got it.

Just one thing, [di+cx] addressing in not applicable in 16-bit mode, only [di+bx] or [di+bp].
Post 14 Apr 2006, 16:51
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
MazeGen wrote:
Yeah, I got it.

Just one thing, [di+cx] addressing in not applicable in 16-bit mode, only [di+bx] or [di+bp].


he is correct Smile

_________________
redghost.ca
Post 14 Apr 2006, 19:58
View user's profile Send private message AIM Address MSN Messenger Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
Smile you are right. i see, 16-bit ages are leaving me more and more
Post 15 Apr 2006, 05:07
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.