在 x86 程序集中打印寄存器值的简单方法
我需要在 8086 Assembly 中编写一个程序,接收来自用户的数据,进行一些数学计算并在屏幕上打印答案,我已经编写了程序的所有部分并且一切正常,但我不知道如何打印号码显示到屏幕上。
在我所有计算结束时,答案是 AX,它被视为无符号 16 位整数。如何打印 AX 寄存器的十进制(无符号)值?
I need to write a program in 8086 Assembly that receives data from the user, does some mathematical calculations and prints the answer on the screen, I have written all parts of the program and all work fine but I don't know how to print the number to the screen.
At the end of all my calculation the answer is AX and it is treated as an unsigned 16 bit integer. How do I print the decimal (unsigned) value of the AX register?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以使用 C 库函数 itoa,
实现它并不难,基本上,你可以这样做:
然后反转缓冲区(或向后打印字符)
void print_number(int x);
you could use the C-library function itoa,
implementing it isn't that hard, basicaly, you do:
and then invert the buffer (or print character-wise backwards)
void print_number(int x);