首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用户输入问题

用户输入问题
EN

Stack Overflow用户
提问于 2011-10-10 09:16:04
回答 1查看 1.1K关注 0票数 1

这周我刚刚开始用汇编语言编程,我遇到了一些麻烦。我使用PCSpim在MIPS中编写了一个程序,该程序会提示用户输入两个非负整数。但是,由于某些原因,我的代码使两个提示出现在同一行上,并且只接受一个整数。有人能帮我吗?我一点也不习惯这种语法,我可以使用一些指针。

代码语言:javascript
复制
.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"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-10-10 09:36:35

你在哪里读到过你应该使用$a1和$v1?这两个数字都应该是$a0和$v0。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7707699

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档