如何在C或C ++中访问AX,BX等寄存器 [英] How to access register like AX, BX in C or C++
本文介绍了如何在C或C ++中访问AX,BX等寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mov ax,some value
工作正常,但这不能直接使用c,因为它没有定义是以任何方式访问c中的这个寄存器。
我是什么尝试过:
i尝试将obj的代码转换为使用dos.h和int86函数的c,但是没用。
解决方案
你不能。编译器从您的C / C ++代码中抽象出来并使用它认为合适的寄存器。
但是,如果您的C / C ++编译器支持Inline Assembly,在其中可以编写汇编语言代码。阅读它此处 [ ^ ]您正在使用Visual Studio。
registers like AX,BX,CX etc are the primary register in assembly language :
mov ax,some value
work good but this doesnt work directly with c because it not defined is any way to access this register in c.
What I have tried:
i try to convert code of obj to c which use dos.h and int86 function,but its no use.
解决方案
You can't. The compiler abstracts this from your C/C++ code and uses the registers as it see fit.
You CAN, however, if your C/C++ compiler supports Inline Assembly, inside which you can write assembly language code. Read up on it here[^] is you're using Visual Studio.
这篇关于如何在C或C ++中访问AX,BX等寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文