Fix bug in tohex
This commit is contained in:
parent
4e67ba4a7c
commit
8f252c15c6
1 changed files with 4 additions and 4 deletions
8
hex.s
8
hex.s
|
@ -17,8 +17,8 @@ hexchars:
|
|||
# none
|
||||
tohex:
|
||||
addi sp, sp, -20 # allocate stack space
|
||||
sw s0, 12(sp) # save contents of s0
|
||||
sw s1, 8(sp) # save contents of s1
|
||||
sw s0, 16(sp) # save contents of s0
|
||||
sw s1, 12(sp) # save contents of s1
|
||||
li s0, 0 # set up loop variables
|
||||
li s1, 4
|
||||
addi a1, a1, 6 # offset output address to end chars
|
||||
|
@ -35,8 +35,8 @@ tohex_loop:
|
|||
addi a1, a1, -2 # decrement output buffer address
|
||||
addi s0, s0, 1 # increment loop counter
|
||||
blt s0, s1, tohex_loop # TODO: we don't need the loop counter and output addr
|
||||
lw s0, 12(sp) # restore s0 & s1
|
||||
lw s1, 8(sp)
|
||||
lw s0, 16(sp) # restore s0 & s1
|
||||
lw s1, 12(sp)
|
||||
addi sp, sp, 20 # deallocate stack space
|
||||
ret
|
||||
|
||||
|
|
Loading…
Reference in a new issue