fetch address not aligned on word boundary 0x00000002

0

I was trying to load a .word from a structure, but when I try to run the program it's shows the error "fetch address not aligned on word boundary 0x00000002". Don't understand, cause I have seen a friend's code with the same and it's works for her. The code uses these structures:

    .data   

pantalla:
    .word   0
    .word   0
    .space  1024

campo:
    .word   0
    .word   0
    .space  1024

pieza_actual:
    .word   0
    .word   0
    .space  1024

pieza_actual_x:
    .word 0

pieza_actual_y:
    .word 0

imagen_auxiliar:
    .word   0
    .word   0
    .space  1024

pieza_jota:
    .word   2
    .word   3
    .ascii  "\0#\0###\0\0"
    .space  1016

pieza_ele:
    .word   2
    .word   3
    .ascii  "#\0#\0##\0\0"
    .space  1016

pieza_barra:
    .word   1
    .word   4
    .ascii  "####\0\0\0\0"
    .space  1016

pieza_zeta:
    .word   3
    .word   2
    .ascii  "##\0\0##\0\0"
    .space  1016

pieza_ese:
    .word   3
    .word   2
    .ascii  "\0####\0\0\0"
    .space  1016

pieza_cuadro:
    .word   2
    .word   2
    .ascii  "####\0\0\0\0"
    .space  1016

pieza_te:
    .word   3
    .word   2
    .ascii  "\0#\0###\0\0"
    .space  1016

(they're not mine, these are structures that the teachers created). And this is function that shows the error, more specifically what is bold

imagen_copy:
    addiu   $sp,$sp,-4
    sw  $ra,0($sp)
    move    $t6,$a0     #figura 1
    move    $t7,$a1     #figura 2
    **lw    $t0,0($t6)  #anchura pieza 1
    lw  $t1,0($t6)  #altura pieza 1
    lw  $t2,0($t7)  #anchura pieza 2
    lw  $t3,0($t7)  #altura pieza 2**
    
    li  $t4,0       #variable y=0
For_1_copy:
    bge $t4,$t3,fin_for_1_copy
    li  $t5,0       #variable x=0
For_2_copy:
    bge $t5,$t2,fin_for_2_copy
    
    move    $a0,$t7
    move    $a1,$t5
    move    $a2,$t4     #entradas de la funciĆ³n
    
    addiu   $sp,$sp,-36 #9*4=36
    sw  $t0,0($sp)
    sw  $t1,4($sp)
    sw  $t2,8($sp)
    sw  $t3,12($sp)
    sw  $t4,16($sp)
    sw  $t5,20($sp)
    sw  $t6,24($sp)
    sw  $t7,28($sp)
    sb  $t8,32($sp)
    
    jal imagen_get_pixel
    
    lw  $t0,0($sp)
    lw  $t1,4($sp)
    lw  $t2,8($sp)
    lw  $t3,12($sp)
    lw  $t4,16($sp)
    lw  $t5,20($sp)
    lw  $t6,24($sp)
    lw  $t7,28($sp)
    lb  $t8,32($sp)
    addiu   $sp,$sp,36
    
    move    $a0,$t6
    move    $a1,$t5
    move    $a2,$t4
    move    $a3,$t8
    
    addiu   $sp,$sp,-36
    sw  $t0,0($sp)
    sw  $t1,4($sp)
    sw  $t2,8($sp)
    sw  $t3,12($sp)
    sw  $t4,16($sp)
    sw  $t5,20($sp)
    sw  $t6,24($sp)
    sw  $t7,28($sp)
    sb  $t8,32($sp)
    
    jal imagen_set_pixel
    
    lw  $t0,0($sp)
    lw  $t1,4($sp)
    lw  $t2,8($sp)
    lw  $t3,12($sp)
    lw  $t4,16($sp)
    lw  $t5,20($sp)
    lw  $t6,24($sp)
    lw  $t7,28($sp)
    lb  $t8,32($sp)
    addiu   $sp,$sp,36
    
    addiu   $t5,$t5,1
    j   For_2_copy
fin_for_2_copy:
    addiu   $t4,$t4,1
    j   For_1_copy
fin_for_1_copy:
    lw  $ra,0($sp)
    addiu   $sp,$sp,4
    jr  $ra
assembly
mips
asked on Stack Overflow May 21, 2021 by NaoKurobane rw • edited May 21, 2021 by Peter Cordes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0