[英]Problems with multiple 2-digit inputs in Assembly
我对这个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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.