I'm very new to writing code in MIPS, so any help would be appreciated. I have been trying to a simple mips program, but my program seems to keep going to the else statement everytime.
.text
.globl __start
__start: # execution starts here
printprompt:
la $a0,prompt0 # print prompt on terminal
li $v0,4 # system call to print
syscall # out a string
#reading user input
la $a0, str1
li $a1, 80
li $v0, 8
syscall
# la $a0,str1 # checking $a0 print on terminal
# li $v0,4 # system call to print
# syscall # out a string
lb $a0, ($a0) #added code here- it's working now
#if 'c' or 'C' branch to convertC2F
beq $a0 , 'c', convertC2F
beq $a0 , 'C', convertC2F
#if 'f' or 'F' branch to convertf2C
beq $a0 , 'f' , convertf2C
beq $a0, 'F' , convertf2C
#else go to error
j error
convertC2F:
la $a0,prompt # print prompt on terminal
li $v0,4 # system call to print
syscall # out a string
li $v0,5 # syscall 5 reads an integer
syscall
mul $t0,$v0,9 # to convert, multiply by 9,
div $t0,$t0,5 # divide by 5, then
addi $t0,$t0,32 # add 32
la $a0,ans1 # print string before result
li $v0,4
syscall
move $a0,$t0 # print result
li $v0,1
syscall
la $a0,endl # syscal to print out
li $v0,4 # a new line
syscall
li $v0,10
syscall # Bye!
convertf2C:
la $a0,prompt # print prompt on terminal
li $v0,4 # system call to print
syscall # out a string
li $v0,5 # syscall 5 reads an integer
syscall
addi $t0,$v0,-32 # to convert, subtract input by 32
mul $t0, $t0, 5 # multiply by 9
div $t0,$t0,9 # divide by 9, then
la $a0,ans1 # print string before result
li $v0,4
syscall
move $a0,$t0 # print result
li $v0,1
syscall
li $v0,10
syscall # Bye!
error:
la $a0, prompt3
li $v0, 4
syscall
la $a0,endl # syscal to print out
li $v0,4 # a new line
syscall
j printprompt
li $v0,10
syscall # Bye!
#################################################
# #
# data segment #
# #
#################################################
.data
prompt0: .asciiz "Enter c, C or f F: "
str1: .space 80
prompt: .asciiz "Enter temperature: "
prompt3: .asciiz "Wrong letter: "
ans1: .asciiz "The temperature is "
endl: .asciiz "\n"
I tried rearranging the order to see if that makes any difference, but for any input c,C,f, and F it all keeps going to the error function and I'm not really sure why.