2

Every assembly mips source with a .byte declaration displays a syntax error. I must use, for given indications, .byte to declare variable and arrays of integer. Il I replace .byte instrunction with .word there isn't problems, but I need to use .byte. I give an example code that QtSpim gives syntax error.

    .data
      v: .byte 2,0,0,0,4,0,0,0
      array: .byte 2,0,0,0,3,0,0,0,5,0,0,0,7,0,0,0,11,0,0,0,13,0,0,0,17,0,0,0,19,0,0,0

    .text
    .globl main

 main:
    la $s1, array
    la $s2, v

    lw $to, 0($s2)
    addi $t0, $t0, -1
    mul $t0, $t0, 4
    add $t1, $s1, $t0
    lw $t2, 0($t1)
    addi $t2, $t2, 1

    lw $t0, 4($s2)
    addi $t0, $t0, -1
    mul $t0, $t0, 4
    add $t3, $s1, $t0
    lw $t4 0($t3)
    addi $t4, $t4, -1

    sw $t2 , 0($t3)
    sw $t4, 0($t1)

    jr $ra

Error shown is

spim: (parser) syntax error on line 2 of file /Users/***/***/***/es3.1.asm
  .byte 2,0,0,0,4,0,0,0
        ^
azkidenz
  • 53
  • 1
  • 6

0 Answers0