Hey all.

After a long hiatus I've come back to my assembler, and am (still) encoding MOV :)

I'm up to the last section though, and after this I am sure encoding becomes much quicker (once I've got the hang of effective addressing, and I think I have!).

My question: the Intel x86 manual says this:
C7 /0 MOV r/m32,imm32 Move imm32 to r/m32

So, why isn't this type of instruction possible?

mov [esp+ecx*2], 0FFh
mov [esp+ecx*2], eax ; Assembles just fine.
MASM says "invalid operands" when I try to assemble it. But doesn't it fit the manual's description?

Posted on 2004-08-18 14:44:49 by
Should be:
mov byte ptr , 0FFh

The problem is not in the encoding but in the syntax MASM expects you to use. :)
Posted on 2004-08-18 14:47:28 by QvasiModo
It's also ambiguous.

Which does it mean?

mov byte ptr ,0ffh
mov word ptr ,0ffh
mov dword ptr ,0ffh

They are all valid.
Posted on 2004-08-18 14:54:34 by tenkey
Lol.. thanks. A simple oversight of course :)

tenkey: What would be the difference between the types in terms of encoding? The ModR/M byte would hold a different R/M field (DispByte or DispDWord)?
Posted on 2004-08-18 14:55:47 by
Nevermind, a little inspection of disassembled MASM reveals all. Aw man, just when I thought it was getting easy - now I have to look at prefix bytes.. :)
Posted on 2004-08-18 15:03:00 by
i can also recommend using hiew while dealing with assembling opcodes and such (or another tool that allows you to assemble instructions quickly). you can check and compare things very fast in this way.
Posted on 2004-08-19 03:39:42 by Mbee