不正确的操作数类型是什么意思?
我正在尝试将一些c ++代码转换为汇编程序
temp_char = OChar[i] //temp_char is a character and OChar is array and i is the index
我试过
mov eax, i
mov temp_char, [eax+OChar]
以及
mov eax, i
movsx temp_char, [eax+OChar]
任何人都可以解释我如何避免不正确的操作数类型?
这是完整的代码
char temp_char;
int i;
__asm{
mov i,0
jmp checkend
startfor: mov eax,i
add eax,1
mov i,eax
checkend: cmp i,length
jge endloop
movsx temp_char, [eax+OChars]
//encryption of string//
push eax
and eax,0xAA
not al
mov edx,eax
pop eax
and eax,0x55
xor ecx,edx
xor ecx,eax
rol cl,2
sub al,0x20
pop ebp
//end of encryption//
movsx [eax+EChars], temp_char
jmp startfor
endloop: ret
}
答案 0 :(得分:5)
你无法将内存直接从内存移动到x86上的内存 - 你必须通过一个寄存器 - 按照以下方式:
mov eax, i
mov bx, word ptr [eax+OChar]
mov temp_char, bx