zlicz/counter.S
2025-03-11 11:20:07 +00:00

51 lines
879 B
ArmAsm

.data
sentence:
.ascii "Become a Prograammermmmmmrr\0"
// ^
match:
.ascii "abc \0"
// ^
out:
.space 256, 0
.text
.align 2
.globl _start
_start:
la t0, sentence # Load the address of sentence into t2
read_str:
lbu t1, 0(t0)
beq t1, zero, read_str_done
la a0, match
la s0, out
iteruj_match:
lbu a1, 0(match)
beq a1, zero, done_match
bne t1, a1, 1f
lbu s10, 0(out)
addi s10, s10, 1
sb s10, 0(out)
1:
j iteruj_match
done_match:
addi t0, t0, 1 # Increment pointer to the next character
j read_str
read_str_done:
ebreak # End program (or use an exit system call)