From 8f252c15c6213d027b7335577f3e619cebaf6a4c Mon Sep 17 00:00:00 2001 From: Wesley Moore <wes@wezm.net> Date: Mon, 10 Feb 2025 15:03:55 +1000 Subject: [PATCH] Fix bug in tohex --- hex.s | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hex.s b/hex.s index dc9c696..afdc82c 100644 --- a/hex.s +++ b/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