Assembly code embedded in c giving a improper operand type error for cmp?

The first operand of the cmp instruction must be a register or a memory location, not an immediate value. You need to use cmp eax, 0 instead. This would also be consistent with your conditional jumps ( jl would jump if eax is negative, etc.) You may be confusing Intel assembly syntax (which you used) with AT&T syntax, where the order of operands is reversed Additionally, your usage of ret is incorrect: ret is used to return from a function, but there is no function call here.

What you need there is a jmp to the mov output, ebx line.

The first operand of the cmp instruction must be a register or a memory location, not an immediate value. You need to use cmp eax, 0 instead. This would also be consistent with your conditional jumps (jl would jump if eax is negative, etc.).

You may be confusing Intel assembly syntax (which you used) with AT&T syntax, where the order of operands is reversed. Additionally, your usage of ret is incorrect: ret is used to return from a function, but there is no function call here. What you need there is a jmp to the mov output, ebx line.

Thank you, that fixed the issue – Ryan Sep 14 at 15:10.

You cannot have an immediate as the first operand to cmp. You need to do cmp eax, 0 instead.

The syntax of cmp for comparing a register against a constant requires the constant to come second. So cmp eax, 0 should be fine. Valid combinations are: cmp reg, reg cmp reg, mem cmp mem, reg cmp reg, const.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions