I'm doing an inline assembly coding with Microsoft Visual C++ 2010 Express.
I have this kind of code. The main point is I need to access each single character of an array of character. Below is just an not that relevant example, when it reach the end of the string (the terminating null character) it will jump to finish or else it will separate each character of the string with a new line.
line[10] = "I am Kevin";
format[] = "%c\n";
_asm {
mov ebx,0
loop:
cmp line[ebx],0
jz finish
mov eax, line[ebx]
push eax
lea eax, format
push eax
call printf
jmp loop
finish:
....
}
Somehow I keep having error for this line:
mov eax, line[ebx]
It kept on saying error C2443: operand size conflict
" eax
" describes 32 bits of register a
.
The low 8 bits of register a
is al
. This will move 8 bits:
mov al, line[ebx]
使用零扩展字节加载insn movzx
:
movzx eax, line[ebx]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.