我在 Assembly x86 类的代码中遇到这个编译错误,
A2070: invalid instruction operands
这条线是
shl eax, ecx
ecx
应该是循环的(减 1)并且此时永远不会大于 5,那么为什么我不能移动值呢?我需要将 eax
中的值乘以 2^n,n 是 ecx
中的值,左移。
createArray PROC
;saving 5 multiples of the value currently in eax into an array addres that
is ;on the stack
push ecx
push eax
push esi
push ebp
mov ebp, esp
mov ecx, 5
mov esi, [ebp+24] ;address of array
L1:
call multiply ;call multiply with two numbers eax, ecx
pop eax
mov [esi],eax
add esi, 4
Loop L1
....cont
createArray endp
multiply PROC
shl eax, ecx ; this line right here
push eax
multiply endp
如果我替换
shl eax, 5
然后就可以了 我只是不知道为什么 ecx 不工作。
最佳答案
关于SHL eax、ecx 的程序集 x86 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49313418/