Assembly 输入浮点数

Assembly 输入浮点数,assembly,mips,mars-simulator,Assembly,Mips,Mars Simulator,如何在MIPS中输入浮点数?我试过使用: li.s $f0, 6 syscall 但我一直觉得这条线有错误 li$v0,6 syscall //读取的浮点值将位于$f0寄存器中 syscall //读取的浮点值将在$f0寄存器中不能将立即数加载到浮点寄存器中 li $t0, 6 # load-immediate 6 into an int register mtc1 $t0, $f0 # copies the bit pattern "...110". It

如何在MIPS中输入浮点数?我试过使用:

li.s $f0, 6 
syscall

但我一直觉得这条线有错误

li$v0,6

syscall


//读取的浮点值将位于$f0寄存器中

syscall


//读取的浮点值将在$f0寄存器中

不能将立即数加载到浮点寄存器中

li $t0, 6           # load-immediate 6 into an int register
mtc1 $t0, $f0       # copies the bit pattern "...110". It is NOT 6.0!!
cvt.s.w. $f12, $f0  # convert word to (single) float. $f12 now contains 6.0

不能将立即数加载到浮点寄存器中

li $t0, 6           # load-immediate 6 into an int register
mtc1 $t0, $f0       # copies the bit pattern "...110". It is NOT 6.0!!
cvt.s.w. $f12, $f0  # convert word to (single) float. $f12 now contains 6.0

也可以将浮点放置在数据段中:

.data
  pi: .float 3.1415926535 # place value of pi in the data segment
.text
  lwc1 $f12, pi           # load pi from data segment into $f12
  li $v0, 2
  syscall                 # print $f12
输出将是:

3.1415927
-- program is finished running

也可以将浮点放置在数据段中:

.data
  pi: .float 3.1415926535 # place value of pi in the data segment
.text
  lwc1 $f12, pi           # load pi from data segment into $f12
  li $v0, 2
  syscall                 # print $f12
输出将是:

3.1415927
-- program is finished running

系统呼叫号码是
$v0
,而不是
$f0
。它是系统调用后的结果,该结果以
$f0
结尾。系统调用号以
$v0
结尾,而不是
$f0
结尾。它是在系统调用之后的结果,该结果以
$f0
结尾。