Nasm Error: invalid combination of opcode and operands

I keep seeing this form often: div 3, 15 this is not any valid INTEL mneumonic!

To divide 15 by 3:

xor     edx, edx
mov     eax, 15
mov     ecx, 3
div     ecx

For the second error, you cannot move a 16 bit register into a 32 bit register like that. You need to use one of the following:

xor     ecx, ecx
mov     cx, ax

Or:

movzx   ecx, ax

Leave a Comment

tech