japheth - 2012-08-22

In Masm 6 and above, there's an odd behavior:

    .386
S1 struc
f1 dw ?
S1 ends
_TEXT SEGMENT 'CODE'
;--- Masm 6 and above swaps in all cases: ecx becomes base, ebx becomes index
    mov ax,[ebx+ecx]
    mov ax,[ebx][ecx]
    mov ax,[ebx].S1.f1[ecx]
    assume ebx:ptr S1
    mov ax,[ebx].f1[ecx]    ;jwasm 2.07 swaps, jwasm 2.08 won't
_TEXT ENDS
    end

As noted in the comment, Masm 6 and above swaps base and index registers ( if no scaling factor is involved and first register isn't ESP/RSP).

Jwasm v2.07 and below did also swap, but just in one very rarely used case - and this was a bug that has been fixed in v2.08.

I won't make jwasm copy Masm's behavior as default. The documentation clearly states that the first ( counting from left to right ) register in an expression is to become the base.

However, jwasm -Zg option has been extended in v2.08 and will swap like Masm does.