Am a beginner in the Assembly Language.. and I have a question on this piece of code.. It just keeps giving me this error - on the code - Isn't .. :? This function should reverse a number
rev proc _x:word
uses EAX, EDX, EBX, ECX
LOCALS
MOV EBX, 0
MOV Cx,10
MOV AX, _x
CWD
DIV CX
iMUL EBX,10
MOVS EDX,DX ; error Operand types do not match..
push EAX
MOV AX, DX
Again:CWDE
Add EBX, EAX
POP EAX
cmp EAX, 0
JA again
ret
endp rev
The assembler is probably thinking that you want the MOVSB/MOVSW/MOVSD
instruction. Its operands (implicit) are indeed of the same size.
Write MOVSX
instead of MOVS
.