以下は私のコードです:
.data
inputOne: .word 2 # Value 1
inputTwo: .word 3 # Value 2
counter: .word 0 # Adds the amount of times that we go through the loop
sum: .word 0 # Where the result of the addition goes
random: .word 0
.text
main:
lw $t2, inputOne # Load 2 into register t2
lw $t3, inputTwo # Load 3 into register t3
lw $t4, counter # Load 0 into register t4
lw $t5, sum # Load 0 into register t5
lw $t7, random
topOfLoop: # Start of the loop
beq $t4, $t2, bottomOfLoop # Until t4 is equal to t2, the loop will continue
addi $t5, $t5, 3 # Adds 3 to register t5 ( Sum)
addi $t4, $t4, 1 # Adds 1 to register t5 (Counter)
j topOfLoop # Jumps to the top of the loop
bottomOfLoop: # End of the loop
sw $t7, 0($t5)
これを MIPS で実行すると、次のエラーが表示されます。
Exception occurred at PC=0x0040005c
Unaligned address in store: 0x00000006
私が間違っていることを教えてくれる人はいますか?
ありがとう