【发布时间】:2016-04-24 14:04:26
【问题描述】:
我正在尝试在 ASM 中编写一个简单的 for 循环。我需要访问两个数组,它们是在 C++ 中的代码 sn-p 之外编写的(即 OrigChars 和 EncrChars)
char temporary_char;
__asm {
xor ebx, ebx
jmp checkend
loopfor: inc ebx
checkend: cmp ebx, len
jge endfor1
mov bx, word ptr[ebx + OrigChars]
mov temporary_char, bx //error - "operand size conflict"
push eax
push ecx
movzx ecx, temporary_char
lea eax, EKey
push eax
push ecx
call encrypt1
add esp, 8
mov temporary_char, al
pop ecx
pop eax
mov EncrChars[ebx], temporary_char //error - "improper operand type"
jmp loopfor
}
上面已经注释了有错误的行。
简而言之,为什么这些对我不起作用:
- mov temporary_char, bx // temp_char = OChars [i];
- mov EncrChars[ebx],temporary_char //EncrChars[ebx] =temporary_char;
【问题讨论】:
-
您确定
mov bx, word ptr[ebx + OrigChars]不起作用吗?它看起来像是问题 insns 的要点列表中唯一正确的一个。 (顺便说一句,请参阅 x86 tag wiki 以获取许多有用的链接。