0
votes

A small project that we have to do in MIPS using mars linux is to make 4 different versions using this basic code that the teachers gave us but the problem is that in school it works when i try it home it gives me

Runtime exception at 0x00400028: address out of range 0x00000000

this would be located at B0_7

integer_to_string_v0:       # ($a0, $a1, $a2) = (n, base, buf)
    move $t0, $a2           # char *p = buff

    # for (int i = n; i > 0; i = i / base) {
    move $t1, $a0           # int i = n
    B0_3:   
        blez  $t1, B0_7     # si i <= 0 salta el bucle
        div   $t1, $a1      # i / base
        mflo  $t1           # i = i / base
        mfhi  $t2           # d = i % base
        addiu $t2, $t2, '0' # d + '0'
        sb    $t2, 0($t0)   # *p = $t2 
        addiu $t0, $t0, 1   # ++p
        j     B0_3          # sigue el bucle
    # }
B0_7: 
    sb $zero, 0($t0)        # *p = '\0'

B0_10: 
    jr $ra
1
$ra register contains the value 0, so jr $ra jumps to an invalid address. You may want to issue a syscall 10 to end the program instead. - gusbro

1 Answers

0
votes

Solution: Settings->Initialize Program Counter to global "main" if defined Found this over the internet if it helps anyone else