How do I work with integers that result in bigger than 10 with MIPS?

0

I am trying to make a Fibonacci sequence with MIPS and this is the code I have so far.

main:
    li $t1, 0
    li $t2, 1
    
    add $t3, $t1, $t2
    
    loop:
        add $t3, $t1, $t2
        la $t1, ($t3)
        
        add $t3, $t1, $t2
        la $t2, ($t3)
        j loop

It works fine until it gets to 8, it should then be adding 5 to make 13 but instead the register shows 0x0000000d, then it completely messes up the sequence, somehow a 15 comes up then 22 then 37. I'm guessing it has something to do with the carry but how would I actually deal with this so that it carries on with the sequence properly?

Thank you

mips
fibonacci
asked on Stack Overflow Oct 22, 2020 by (unknown user)

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0