如何访问c中的CPU寄存器?

如何访问c中的CPU寄存器?,c,cpu-registers,C,Cpu Registers,我想进入啊注册。我已经试过了,但它对asmidentifier有争议 register int _AH asm ("AH"); 平台:英特尔CPU x86、Windows 7 试图使用Visual Studio 2010(cl.exe)进行编译您需要指定正在使用的平台和编译器 另外请注意,从C源代码生成的代码当然也将使用CPU的寄存器。您需要指定使用的平台和编译器 还要注意,从C源代码生成的代码当然也将使用CPU的寄存器。我在项目中使用过类似的东西: unsigned char foo;

我想进入啊注册。我已经试过了,但它对
asm
identifier有争议

register int _AH asm ("AH");

平台:英特尔CPU x86、Windows 7
试图使用Visual Studio 2010(cl.exe)进行编译

您需要指定正在使用的平台和编译器


另外请注意,从C源代码生成的代码当然也将使用CPU的寄存器。

您需要指定使用的平台和编译器


还要注意,从C源代码生成的代码当然也将使用CPU的寄存器。

我在项目中使用过类似的东西:

unsigned char foo;

__asm {
   mov foo, ah
}
您在这里有更多信息:


希望有帮助。

我在我的项目中使用过类似的东西:

unsigned char foo;

__asm {
   mov foo, ah
}
您在这里有更多信息:


希望有帮助。

在Visual Studio中,asm语法是

__asm assembly-instruction [ ; ]

__asm { assembly-instruction-list } [ ; ]

正如在Visual Studio中所解释的,asm语法是

__asm assembly-instruction [ ; ]

__asm { assembly-instruction-list } [ ; ]
正如这里所解释的