Using this code I get store address not aligned on word boundary 0x10010002
. I want to initialise an array with zeroes, what am I doing wrong in storing the value (word) 0 inside the each element? While debugging I have seen that the problem starts at sw
part and the program enters the loop just once.
.data
hash: .space 40
N: .word 10
.text
.globl main
main:
lw $s0, N # N = 10
addi $t4, $zero, 0 # $t4 = 0 (for counter)
addi $t5, $zero, 0 # $t5 = 0 (index for array, adds 4 every time)
addi $t6, $zero, 0 # $t6 = 0 (used for filling array, never changes)
for:
bge $t4, $s0, terminate
sw $t6, hash($t5)
addi $t5, $t5, 4
addi $t4, $t4, 1
j for
terminate:
li $v0,10
syscall
The $t4
counter is adding 4 bytes to itself because the array is going to have integers. Please let me know if you can see where my mistake is in this simple example, I tried to make it as simple as possible.
I am using MARS 4.5