错误:“存储地址未在字边界上对齐”

时间:2017-06-13 22:47:49

标签: assembly mips

当我尝试在MIPS中编译我的程序时,我收到此错误:

“商店地址未在字边界上对齐”

Theres my code:

.data
string: .asciiz "ola"

a: .ascii "a"
a1: .ascii "ab"

e: .ascii "e"
e1: .ascii "ef"

i: .ascii "i"
i1: .ascii "ij"

o: .ascii "o"
o1: .ascii "op"

u: .ascii "u"
u1: .ascii "uv"

tam: .word 3

.text 

main:
lw $t6, tam #string length
lb $t1, string($t0) #read bit by bit

lh $s0, a #save in register the char that we want to search
lh $s1, a1 #save in register the char that we want to replace


beq $t0, $t6, done

beq $t1, $s0, continua #if the char of (bit by bit) its like the char of chars, swap it
bne $t1, $s0, else #if not, saves
else:
lb $s0, e
lhu $s1, e1

beq $t1, $s0, continua
bne $t1, $s0, else2

else2:  
lb $s0, i
lh $s1, i1

beq $t1, $s0, continua
bne $t1, $s0, else3

else3:  
lb $s0, o
lh $s1, o1

beq $t1, $s0, continua
bne $t1, $s0, else4                         

else4: 
lb $s0, u
lh $s1, u1

beq $t1, $s0, continua
bne $t1, $s0, store

continua:
la $a0, a
li $v0, 4
syscall
sb $s1, string($t0) #do the swap 
addi $t0, $t0, 1 #+1 in the index
j main 

store:
la $a0, a
li $v0, 4
syscall
sh $t1, string($t0) #saves
addi $t0, $t0, 1 #+1 in the index
j main
done:
li $v0, 10
syscall

我收到错误的行是:“lh $ s0,#save注册我们要搜索的字符”

谢谢。

0 个答案:

没有答案