如果我mov, eax 12345
及更高版本mov var, eax
(假设var是一个32位int等..等等),并输出var
它会输出正确。为什么我可以mov进入eax,进入ax,但不进入al,甚至可能进入ah?
与ax
相同。 mov ax, 65535
- >mov var16, ax
会正确输出。
但是,如果我mov
到al
甚至ah
它不会输出任何东西。
也许搬到ah
不起作用是有道理的。但为什么这两个?
typedef int int32;
typedef unsigned char int8;
typedef short int16;
int _tmain(int argc, _TCHAR* argv[])
{
int8 c1 = 0;
int8 c2 = 0;
__asm
{
mov al, 255
mov c1, al
}
cout << c1 << endl; //outputs nothing, same if I used ah
//whereas
int32 n = 0;
__asm
{
mov eax, 10000
mov n, eax
}
cout << n << endl; // works fine, well, you get the picture
return 0;
}
8位无符号字节的最大值为255(基于零)。 –
请注意256对于8位变量来说太大了。 – fuz
“AX”有相同的范围错误。一个'WORD'的范围是0..65535和_not_ 65536. – zx485