Assembly SHL eax、ecx的程序集x86错误

Assembly SHL eax、ecx的程序集x86错误,assembly,x86,cpu-registers,instruction-set,operands,Assembly,X86,Cpu Registers,Instruction Set,Operands,我在汇编x86类的代码中遇到了这个编译错误 A2070:无效的指令操作数 电话是 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 e

我在汇编x86类的代码中遇到了这个编译错误

A2070:无效的指令操作数

电话是

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不工作。

轮班说明

您需要使用
cl
中的低位:

shl eax, cl

不清楚为什么要推/弹出eax(并省略ret?)。这是因为为了简单起见省略了代码吗?如果您删除了push/pop/ret,就没有太多理由打电话了。只要把shl放到循环中。