gpt4 book ai didi

linux - 汇编中多个 2 位输入的问题

转载 作者:太空宇宙 更新时间:2023-11-04 03:52:33 24 4
gpt4 key购买 nike

我对这个 PL 还很陌生,我真的不知道我在做什么。看来我的代码只采用第一个两位数,而不是第二个或第三个。

我真正要做的就是打印一条提示,要求输入两位数,如下所示。然后取十位和个位。有人能指出哪里出了问题吗?

;Prompt to enter first number
...

;Gets the first number
mov eax, 3
mov ebx, 0
mov ecx, num1a
mov edx, 1
int 80h

mov eax, 3
mov ebx, 0
mov ecx, num1b
mov edx, 1
int 80h

;Prompt to enter Second Number
...

;Gets the second number
mov eax, 3
mov ebx, 0
mov ecx, num2a
mov edx, 1
int 80h

mov eax, 3
mov ebx, 0
mov ecx, num2b
;mov edx, 1
int 80h

;Prompt to enter Third Number
...

;Gets the third number
mov eax, 3
mov ebx, 0
mov ecx, num3a
mov edx, 1
int 80h

mov eax, 3
mov ebx, 0
mov ecx, num3b
mov edx, 1
int 80h

它不会让我再输入任何代码,但是代码中的...都是一样的。

mov eax, 4
mov ebx, 1
mov ecx. prompt
mov edx, promptLen
int 80h

where:

section .data
prompt db 'Enter a two-digit number: '
promptLen equ $-prompt

最佳答案

您可以做的是,当您从用户读取值时增加 edx 的大小。

  mov eax, 3
mov ebx, 0
mov ecx, num1b
mov edx, 32
int 80h

关于linux - 汇编中多个 2 位输入的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25802006/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com