以下QtSPIM / MIPS代码的作用是什么

时间:2014-04-28 15:45:24

标签: mips qtspim

以下QtSPIM / MIPS代码的作用是什么。通过参考代码的各个块的功能来描述(Block1,Block2,...)。

在某些说明前回答问题。

Block1:

.text

main:

li $s4, 0

la $a0, input

li $v0, 4

syscall

li $v0, 5

syscall

move $t0, $v0 #Why do we need this?

Block2:

la $a0, output

li $v0, 4

syscall

move $a0, $t0

li $v0, 1

syscall

la $a0, newline # How will the output change if newline is replaced by newspace defined as “ “?

li $v0, 4

syscall

Block3:

Do:

move $a0, $s4

li $v0, 1

syscall

la $a0, newline

li $v0, 4

syscall

slt $s1, $s4, $t0

addi $s4, $s4, 1

bgt $s1, $zero, Do # Why can’t we use “beq $s1, 1, Do “?

Block4:

Exit:

li $v0, 10

syscall



.data

input: .asciiz "Input a number: "

output: .asciiz "Let me count till "

newline: .asciiz "\n "

所以我需要帮助确定代码的作用...我有一个我只想要的概念o确保我正确地想出这个...所以我到目前为止这样:

move $t0, $v0 #Why do we need this?  --- to store number in t0

la $a0, newline # How will the output change if newline is replaced by newspace defined as “ “?
---  load address of string to be printed into $a0 and adds the space if replaced by newspace

最后一个我无法弄清楚......

0 个答案:

没有答案