I'm trying to use mips assembly and I find issues with the branch mechanisms. In this "short" part of my code, but is where the error resides (I think). I't doesn't matter what number I type, will always jump to func1. Can someone help me? Thanks!
Code:
.text
.globl main
main:
.data
param: .float 0
val_1: .float 1
val_2: .float 2
val_3: .float 3
texto: .asciiz "type 1 for func 1, 2 for func 2 and 3 for func 3: \n"
.text
la $a0, texto #print
li $v0, 4
syscall
li $v0, 6 #read
syscall
la $t0, ($v0) #from $v0 to $t0
beq $t0, 1, func1 #branch for func1
beq $t0, 2, func2 #branch for func2
beq $t0, 3, func3 #branch for func3
j end
syscallwith$v0 == 6isread_float, why do you expect($v0)to be set to a valid adress? - EOFla $t0, ($v0)? Why are you using syscall 6 (read_float) when the options are 1, 2, and 3 (which are all integers)? - Michael