I need to write a program with MIPS for an evaluation of an exam. If someone gets ≥ 40 points, he succeeded and if he gets <40 points, he failed.
At the beginning the variable "Success" get's 99, which means that we do not know if someone succeeded or not.
The task is to complete the program so that we get 1 for successful and 0 for not successful.
.data
Points : .word 42 # Exampoints
Success : .word 99 # 0 No, 1 Yes, 99 We don't know
Minimum: .word 40 # MinimumToSucceed 40 Points
.text
.globl main
.
.
.
What I have tried:
.data
Points : .word 42 # Exampoints
Success : .word 99 # 0 No, 1 Yes, 99 We don't know
Minimum: .word 40 # MinimumToSucceed 40 Points
.text
.globl main
main:
lw $2,Points
lw $3,Minimum
lw $4,Success
loop:blt $2,$3,end
li $4,1
end:li $4,0
li $2,10 #these two last lines are just to complete
syscall #the program without errors (not task related)
Oh i just discovered a problem: If i use numbers lower than 0 or greater than 99 for "Points", it still gives me 1 for sucessful (e.g 105 > 40) and 0 for failed (e.g. -5 < 40).
How can i integrate this in my program?