装配中多个2位输入的问题

问题描述 投票:0回答:1

我对这个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
linux assembly x86
1个回答
0
投票

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

  mov eax, 3
  mov ebx, 0
  mov ecx, num1b
  mov edx, 32
  int 80h
© www.soinside.com 2019 - 2024. All rights reserved.