user4407915
user4407915

Reputation:

cmp DWORD [ebp - 25], [ebp + 12] is causing an error

The following instruction is causing an invalid combination of opcode and operands error:

cmp DWORD [ebp - 25], [ebp + 12]

I thought that the DWORD is used to prevent such an error!

I also tried the following but still the same error:

cmp DWORD [ebp - 25], DWORD [ebp + 12]

Upvotes: 0

Views: 268

Answers (1)

Generally, on x86, memory-to-memory operations are not supported.

You need to first load one of the arguments into a register. Then you can compare that register content to another memory location. E.g:

mov eax, DWORD [ebp - 25] 
cmp eax, [ebp + 12]

Upvotes: 4

Related Questions