This commit is contained in:
mpabi 2025-03-18 11:18:50 +00:00
parent 91fe08a649
commit be3ea1c230

View File

@ -2,7 +2,7 @@
sentence: sentence:
.ascii "Become a Prograammermmmmmrr\0" .ascii "Become a Prograammermmmmmrr\0"
match: match:
.ascii "abc \0" .ascii "Babc m\0"
out: out:
.space 256, 0 .space 256, 0
@ -22,17 +22,19 @@ read_str:
la s2, out # Load address of out into s0 la s2, out # Load address of out into s0
iteruj_match: iteruj_match:
lbu a1, 0(a0) lbu a1, 0(a0)
beq a1, zero, done_match beq a1, zero, done_match
bne t1, a1, 1f bne t1, a1, 1f
lbu s11, 0(s2) lbu s10, 0(s2)
addi s10, s10, 1 addi s10, s10, 1
sb s10, 0(s2) sb s10, 0(s2)
1: 1:
addi s0, s0, 1 addi a0, a0, 1
addi s2, s2, 1
j iteruj_match j iteruj_match
done_match: done_match: