PCSpim - MIPS - исключение 5 Ошибка адреса ошибки в магазине

Поэтому я столкнулся с проблемой с моей программой PCSpim, после того как я все еще не могу найти правильное решение, я подумал, что это может быть директива 'align', либо я ее пропускаю, либо я пропускаю.

Вот начало программы, инициализация массива

  .data
  .align  2             # Let's make sure that it's aligned  

   Z: .word  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23,
                        # above we allocated and initialized 13 
                        # elements of array Z 

  .space  80            # here we allocated space here for 20 elements
  .text

  .globl main

main:                   # main has to be a global label
  addu  $s7, $0, $ra    # save the return address
                        # in a global register
  la  $s3, Z            # $s3 has the starting address of Z 

===============================================================

Я думаю, что это где-то здесь, где запутался

#-------------------------------------Compute Z[12] = Z[k] + z[k+j]
 .text
 .align 2

    la $t3, Z            # put address of Z into $t3
    li $t5, 12           # put the index into $t5
    add $t5, $t2, $t3    # combine the two components of the address
    sw $t4, 0($t1)       # store the value into the array cell

#-----------------------------------printing Z[12] = Z[k] + z[k+j] on the console

    .data   
    .globl  message4 
    message4:  .asciiz "\nZ[12] = "  #string to print

    .text   li  $v0, 4            # print_str (system call 4)   
     la  $a0, message             # takes the address of string as an argument    
     syscall

     li  $v0, 1            # print_int (system call 1)  
     add  $a0, $0, $t1     # put value to print in $a0   
     syscall

Любые предложения будут ценны!:)

0 ответов

Другие вопросы по тегам