以下QtSPIM/MIPS代码的作用是什么
以下QtSPIM/MIPS代码的作用是什么。通过参考不同代码块(块1、块2等)的功能进行描述 回答特定说明前面的问题以下QtSPIM/MIPS代码的作用是什么,mips,qtspim,Mips,Qtspim,以下QtSPIM/MIPS代码的作用是什么。通过参考不同代码块(块1、块2等)的功能进行描述 回答特定说明前面的问题 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 $v
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 "
所以我需要帮助识别代码的作用。。。我有一个概念,我只是想确保我能正确地解决这个问题。。。到目前为止,我有一个:
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
最后一个我不太明白…“---将数字存储在t0中”我严重怀疑这是否会被接受为答案。当谈到第三个问题时;如果您在MIPS指令集引用中查找BEQ
的编码,就会发现这一点。您的第二个“猜测”也不完全正确。您应该能够通过实际读取变量名来了解它:新行和新空格之间的区别是什么?