我想访问AH寄存器。我已经尝试了,但它争论asm
标识符。
register int _AH asm ("AH");
平台:Intel CPU x86,Windows 7 尝试使用Visual Studio 2010(cl.exe)进行编译
答案 0 :(得分:3)
我在我的项目中使用了类似的东西:
unsigned char foo;
__asm {
mov foo, ah
}
您可以在此处获得更多信息:http://msdn.microsoft.com/en-us/library/fabdxz08.aspx
希望它有所帮助。
答案 1 :(得分:1)
您需要指定您正在使用的平台和编译器。
另外请注意,从C源代码生成的代码当然也会使用CPU的寄存器。
答案 2 :(得分:1)
在Visual Studio中,asm语法为
__asm assembly-instruction [ ; ]
__asm { assembly-instruction-list } [ ; ]
所述