这周我刚刚开始用汇编语言编程,我遇到了一些麻烦。我使用PCSpim在MIPS中编写了一个程序,该程序会提示用户输入两个非负整数。但是,由于某些原因,我的代码使两个提示出现在同一行上,并且只接受一个整数。有人能帮我吗?我一点也不习惯这种语法,我可以使用一些指针。
.text
.align 2
.globl main
# Prompts the user for two non-negative integers, x and y, and then finds the greatest common divisor of the two.
main:
la $a0, prompt
li $v0, 4
syscall # Display prompt for the x integer.
li $v0, 5
syscall # Get x integer response.
move $t0, $v0
la $a1, secondprompt
li $v1, 4
syscall # Display prompt for the y integer
li $v1, 5 # Get y integer response
syscall
move $t1, $v1
prompt: .asciiz "Enter a non-negative integer: \n"
secondprompt: .asciiz "Enter a second non-negative integer: \n"发布于 2011-10-10 09:36:35
你在哪里读到过你应该使用$a1和$v1?这两个数字都应该是$a0和$v0。
https://stackoverflow.com/questions/7707699
复制相似问题