Why does Visual Studio assemble mov eax, [edx][ebx][ecx][edi] without complaint?
Asked Answered
H

1

6

In Visual Studio, I wrote:

mov eax, [edx][ebx][ecx][edi]

But it assembles just fine.

Why it is not invalid effective address?

Hofmannsthal answered 8/11, 2015 at 16:36 Comment(3)
What do you expect mov eax, [edx][ebx][ecx][edi] to do?Unbosom
nothing, I only wonder why it is correct effective adress.Hofmannsthal
It doesn't assemble with masm 6.14.8444. What does that instruction disassemble to?Higgs
S
7

It appears to be a bug in more recent versions of MASM.

Using the following file as an example:

    .586

_TEXT   SEGMENT USE32
    mov eax, [edx][ebx][ecx][edi]
_TEXT   ENDS
    END

With MASM 6.11d this generates the following error:

t213a.asm(4) : error A2030: multiple index registers not allowed

With MASM 8.00.50727.42 or more recent there's no error, and the statement assembles to:

00000000: 8B 04 0F           mov         eax,dword ptr [edi+ecx]

So [edx][ebx][ecx][edi] is not a valid addressing mode. A bug in the version of MASM you're using is accepting it when it should be rejecting it as an error.

Stockholder answered 8/11, 2015 at 17:1 Comment(4)
Thanks @Ross I found the same thing. You beat me to it. You have my upvoteHeadstrong
@MichaelPetch Thanks, if it wasn't for your comment about 6.14.8444 I would've never have thought to try an older version of MASM to see if this is a regression.Stockholder
That was the other @Higgs ;-)Headstrong
@MichaelPetch Oops. Sorry, Michael.Stockholder

© 2022 - 2024 — McMap. All rights reserved.