Possible Duplicates:
error A2070:invalid instruction operands with MASM
Need help understanding conditional directives with MASM
I am trying to implement the following basic codeblock. I am trying to implement a basic if, elseif, elseif block to learn to use the conditional directives in MASM, but can’t seem to make the logic work.
.if a > b
sub a, 1
.elseif b >= c1
sub b, 2
.elseif c1 > d
mov eax, d
add c1, eax
.else
mov eax, d
cdq
mov ebx, 2
idiv ebx
mov d, eax
.endif
On the .if and .elseif lines I get the above error A2070.
Why? What is the actualy problem with my code?
Most likely MASM expects the compared entities to be directly encodable in a single
CMPinstruction.CMPsupports the following pairs of operands:Where
regis a register,memis a memory location,immis a numeric constant,reg/memis eitherregormem. Thus, you can’t compare directly two memory locations or two constants, such an operand combination isn’t supported by theCMPinstruction.