From 737eed1b0c3518befd1ed56b7709d37b74485aaa Mon Sep 17 00:00:00 2001 From: mpabi Date: Thu, 13 Mar 2025 11:25:33 +0000 Subject: [PATCH] still errors --- counter.S | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/counter.S b/counter.S index dbfd049..21c1a58 100644 --- a/counter.S +++ b/counter.S @@ -12,21 +12,24 @@ _start: la t0, sentence # Load the address of sentence into t0 + read_str: lbu t1, 0(t0) # Load unsigned byte from sentence into t1 beq t1, zero, read_str_done # If end of string (\0), exit loop la a0, match # Load address of match into a0 - la s0, out # Load address of out into s0 + la s2, out # Load address of out into s0 iteruj_match: lbu a1, 0(a0) # Load unsigned byte from match into a1 beq a1, zero, done_match # If end of match string (\0), exit inner loop bne t1, a1, 1f # If t1 != a1, skip increment - lbu s10, 0(s0) # Load current counter value from out into s10 + + lbu s10, 0(s2) # Load current counter value from out into s10 addi s10, s10, 1 # Increment counter - sb s10, 0(s0) # Store updated counter back to out + sb s10, 0(s2) # Store updated counter back to out + 1: j iteruj_match # Jump back to start of inner loop