I am having difficulties figuring out what the result of the below operation would be. After doing research online and referencing my 80x86 book, it looks likes the mul instruction always references the ax register.
The 'mul ecx' instruction is executed starting with the register values below:
EAX: 00 00 00 10
ECX: FF FF FF FD
EDX: FF 03 FF 01
How is ecx calculated? I understand that the mul instruction is "mul ", but what is it actually multiplying by?
Any help would be appreciated.
it looks likes the mul instruction always references the
ax
register.
The x86 mul
instruction always multiplies the accumulator register (EAX
, AX
, or AL
) by whichever operand you provide in the instruction:
The dword-sized mul ecx
will multiply EAX with ECX and leave its double-length product in the register combo EDX:EAX.
The word-sized mul cx
will multiply AX with CX and leave its double-length product in the register combo DX:AX.
The byte-sized mul cl
will multiply AL with CL and leave its double-length product in the register
AX.
All three versions are available in the real address mode of any x86, but the first version (mul ecx
) does not exist on 8086.
On x86-64 there's also a qword-sized mul rcx
that will multiply RAX with RCX and leave its double-length product in the register combo RDX:RAX.
How is
ecx
calculated?
The operand in mul ecx
is not modified in any way. It's a given that you need to initialize beforehand.