我正在编写一个程序,询问用户他们有哪个温度,然后接受该输入并转换并输出所有四种温度。我需要帮助让我的用户输入读入,以便它可以在我的分支beq中工作。我无法让它识别输入'f'等于存储的版本。如何将存储的字符串与输入的字符串进行比较MIPS
.data
temptype: .asciiz "Enter temperature type i.e. f, c, k, r: "
tempdegree: .asciiz "\n Enter degrees: "
space: .space 2
tempx: .asciiz "Your temperature in celsius is: "
tempc: .asciiz "\nYour temperature in celsius is: "
tempf: .asciiz "\nYour temperature in fahrenheit is: "
tempk: .asciiz "\nYour temperature in kelvin is: "
tempr: .asciiz "\nYour temperature in rankine is: :"
kr: .float 459.67
.globl main
.text
main:
li $v0, 4
la $a0, temptype
syscall
li $v0, 8
la $a0, space
#li $a1, 2
move $t0, $a0
syscall
li $t1, 102
#li $t1, 99
#li $t1, 107
#li $t1, 114
syscall
beq $t0, $t1, fahrenheit
#beq $t0, $t1, celsius
#beq $t0, $t1, kelvin
#beq $t0, $t1, rankine
syscall
li $v0,10
syscall
fahrenheit:
li $v0, 4
la $a0, tempdegree
syscall
li $v0, 5
syscall
move $t0, $v0
li $v0, 4
la $a0, tempf
syscall
move $a0, $t0
li $v0, 1
syscall
您是否在内置调试器中单步执行代码?你是否检查过你正在使用的系统调用的文档,看它是否返回寄存器中的字符,或者是否将它存储在内存中?您可能会将指针与数字或其他内容进行比较。 (你没有评论你的代码,我不知道MIPS模拟器的系统调用数字不在我的头顶。)无论如何**使用调试器**,这将使得能够更容易地检查每个寄存器中'beq'正在看什么。 –