0

I just started to learn mips32 and I use QtSpim emulator on Windows 10. I get that error when I try to load the following code :

.data
X:  .byte 5,1,4,2,8
.text
.globl main

main:

deb:    
    xor $t4, $t4, $t4   
    la $t3, X       
    addi $t5, $t3, 4
bcl:
    slt $t6, $t2, $t1
    move $t4, $t6       
suite:              
    bne $t3, $t5, bcl
    jr $ra      

I thank you in advance for your answers !

P.S. The code is copied from a tutorial.

  • `.byte` should work I think. Nevertheless that code looks broken, I am not sure I would recommend that tutorial. – Jester Oct 11 '17 at 19:06
  • 2
    Don't use `xor $t4, $t4, $t4` to zero MIPS registers. It's [a zeroing idiom on x86 CPUs](https://stackoverflow.com/questions/33666617/what-is-the-best-way-to-set-a-register-to-zero-in-x86-assembly-xor-mov-or-and), but not MIPS. In fact, it probably *has* to have a dependency on the old value of `$t4` for memory dependency-ordering rules, like on ARM. Use `mov $t4, $zero`, because MIPS has an architectural zero register. (Or more generally, `addui $t4, $zero, any small constant`. `move` is a pseudo-instruction for `addui dst, src, 0`) – Peter Cordes Oct 11 '17 at 21:13
  • 1
    Thank you for your help the problem was with commas : It was `.byte 5,1,4,2,8` and it should have been like that : `.byte 5, 1, 4, 2, 8` – HelloWorld Oct 12 '17 at 14:29
  • That's a silly parser if it requires the spaces. Good to know though. – Jester Oct 12 '17 at 15:33

0 Answers0