MIPS convert hex string to decimal
I need to create a MIPS program using only these types of simple instructions to get a hex string and convert it to it's decimal form and print the result. This is what I have so far... (The equation I have used to convert it needs to look something like what I wrote if I did it wrong. I need to use sll). I tried debugging step by step but I don't understand why it's not working because I'm still new at learning MIPS. Any help would be appreciated
.data
string: .asciiz "ACED"
.text
main:
la $a0, string # load string into a0
move $t0, $a0 # save string to t0
li $t3, 0
hexcheck: lb $t1, 0($t0)
beqz $t1, end
slti $t2, $t1, 65
beq $t2, $zero, letter
sll $t3, $t3, 1 # x=x
add $t3, $t3, $t1 # x=x+c[i]
subi $t3, $t3, 48 # x=x-48
sb $t3, 0($t0)
addi $t0, $t0, 1
add $t3, $zero, $zero
j hexcheck
letter:
sll $t3, $t3, 1 # x=x
add $t3, $t3, $t1 # x=x+c[i]
subi $t3, $t3, 55 # x=x-55
sb $t3, 0($t0)
addi $t0, $t0, 1
add $t3, $zero, $zero
j hexcheck
end:
move $a0, $t0
li $v0, 4
syscall
li $v0, 10
syscall