两个整数的NASM打印产品
我正在尝试乘以两个整数,然后将它们转换为ASCII然后打印。代码编译罚款,没有任何错误,但在屏幕上没有显示任何内容。
section .text
global _start
_start:
;to print a number after multiplication
mov eax, x
mov ebx, y
MUL ebx
ADD eax, '0' ;convert product to ascii
mov [mynum], eax
mov ecx, mynum
mov edx, 1
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
section .data
x dd 2
y dd 3
segment .bss
mynum resd 1
谢谢您的帮助!
编辑:当我在第10行上删除中断时,现在将零打印到终端
I am trying to multiply two integers and then converting them to ascii and then printing. The code compiles fine and no errors are given but nothing shows on screen.
section .text
global _start
_start:
;to print a number after multiplication
mov eax, x
mov ebx, y
MUL ebx
ADD eax, '0' ;convert product to ascii
mov [mynum], eax
mov ecx, mynum
mov edx, 1
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
section .data
x dd 2
y dd 3
segment .bss
mynum resd 1
Thank you for helping!
EDIT: When I remove the interrupt on line 10, a zero is now printed to the terminal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论