本文介绍了在MSVC的伪寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Borland的C有伪寄存器_AX,_BX,_FLAGS等,可以在'C'code至寄存器保存到临时变量。
Borland C has pseudo-Registers _AX,_BX, _FLAGS etc that could be used in 'C' code to save the registers to temp variables.
有没有MSVC相同呢?我试过@AX,@BX等,但是编译器(MSVC1.5)给了错误('40'无法识别的符号)。
Is there any MSVC equivalent? I tried @AX, @BX, etc, but the compiler (MSVC1.5) gave error ('40' unrecognized symbol).
我正在开发一个16位的pre-启动应用程序,不能使用。
谢谢你。
I'm developing a 16-bit pre-boot app and can't use .Thanks.
推荐答案
您不需要拥有的伪寄存器,如果你只寄存器和变量之间移动的值。例如:
you don't need to have pseudo registers if you only move values between registers and variables. example:
int a = 4;
int b = 999;
__asm
{
mov eax, a; // eax equals to 4
mov b, eax; // b equals to eax
}
// b equals to 4 now
编辑:再次标志复制到一个变量,并回到标志,您可以用 LAHF
和 SAHF
说明。例如:
int flags = 0;
__asm
{
lahf;
mov flags, eax;
}
flags |= (1 << 3);
__asm
{
mov eax, flags;
sahf;
// 4th bit of the flag is set
}
这篇关于在MSVC的伪寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!