I am trying to write a code which takes a,b,c or d as user input then branches them depending on what the user wants to. For some reason when I pick one of the 4 options the code just falls through all the branches and the program ends. Is it because there can only be one branch statement used?
.data
#messages
options: .asciiz "\nPlease enter a, b, c or d: "
youEntered: .asciiz "\nYou picked: "
bmiMessage: .asciiz "\nThis is the BMI Calculator!"
tempMessage: .asciiz "\nThis converts Farenheit to Celcius!"
weightMessage: .asciiz "\nThis converts Pounds to Kilograms!"
sumMessage: .asciiz "\nThis is the sum calculator!"
repeatMessage: .asciiz "\nThat was not a, b, c or d!"
#variables
input: .space 4 #only takes in one character
.text
main:
#display "options" messsage
li $v0, 4
la $a0, options
syscall
#user input
li $v0, 8
la $a0, input
li $a1, 4
syscall
#display "youEntered" messsage
li $v0, 4
la $a0, youEntered
syscall
#display option picked
li $v0, 4
la $a0, input
syscall
#branching
beq $a0, 'a', bmi
beq $a0, 'b', temperature
beq $a0, 'c', weight
beq $a0, 'd', sum
#end of main
li $v0, 10
syscall
bmi:
li $v0, 4
la $a0, bmiMessage
syscall
temperature:
li $v0, 4
la $a0, tempMessage
syscall
weight:
li $v0, 4
la $a0, weightMessage
syscall
sum:
li $v0, 4
la $a0, sumMessage
syscall
repeat:
li $v0, 4
la $a0, repeatMessage
syscall
Anything will be helpful Thanks guys!