错误 A2070:指令操作数无效 [英] error A2070: invalid instruction operands
问题描述
错误在 AfterLoop skope 行mov [esi], [edi]"中.我该如何解决这个问题?;删除节点函数(headptr, nodeToremove)
the error is in AfterLoop skope in the line " mov [esi], [edi]" . how can I resolve this issue? ; The function for node removing (headptr, nodeToremove)
removeNode proc
headPtr = 8
nodeToRemove = headPtr + 4
push ebp
mov ebp, esp
push esi
push edi
push ebx
mov esi, headPtr[ebp] ; esi = head of list
mov edi, [esi] ; edi = second item
cmp esi, nodeToRemove[ebp] ; head = nodeToRemove?
jne NextNode
mov edi, esi ; edi ( = currNode) = head
mov esi, [esi] ; new head = head->next
jmp AfterLoop
NextNode:
cmp edi, nodeToRemove[ebp] ; currNode = node to remove?
je AfterLoop
mov esi, edi ; prev node = currNode
mov edi, [edi] ; currNode = currNode->next
jmp NextNode
AfterLoop:
mov [esi], [edi] ; error!!! prev->next = curr->next
pop ebx
pop edi
pop esi
pop ebp
ret 8
removeNode endp
推荐答案
mem, mem
不是有效的操作数组合.使用寄存器作为中间体,例如:
mem, mem
is not a valid combination of operands. Use a register as an intermediate, e.g.:
mov eax,[edi]
mov [esi],eax
或者,如果你可以交换 esi
和 edi
你可以使用 movsd
:
Alternatively, if you can swap esi
and edi
you could use movsd
:
movsd ; dword [edi] = dword [esi]; esi += 4; edi += 4
(注意:+= 4
是真的,假设方向标志是明确的.否则它将是 -= 4
.在你的情况下应该无关紧要,因为你pop
esi
和 edi
之后立即).
(Note: the += 4
is true assuming that the direction flag is clear. Otherwise it will be -= 4
. Shouldn't matter in your case since you pop
esi
and edi
immediatly afterwards).
这篇关于错误 A2070:指令操作数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!