This commit is contained in:
evgenyk 2025-03-13 13:18:47 +00:00
parent 52c546b9d8
commit d58fed710f
2 changed files with 28 additions and 1 deletions

View File

@ -46,3 +46,11 @@ load
si
xit
exit
target extended-remote :3333
dashboard -layout registers memory
file counter.S
load
load file
load counter.S
si
exit

View File

@ -1,6 +1,6 @@
.data
sentence: .ascii "My fbbirbst btbry\0" // \0 to bajt zerowy czyli koniec zdania w asm, C =
sentence2: .ascii "proba do dodawania sentence"
.text
.align 2
.globl _start
@ -9,9 +9,28 @@ _start:
la t2, sentence
li t0, 0x62 //ascii "b"
la s2, sentence
li s3, 0x79 // ascii "o"
li s4, 0x00 // licznik o w sentence2
li t1, 0x00 // licznik b w sentence
loop:
lbu s5, 0(s2)
beq s5, zero, koniec
bne s5, s3, 1f
addi s4, s4, 1
2:
addi s2, s2, 1
j
lbu t3, 0(t2) // ladujemy do rejestra t3 adres 1 litery sentece
beq t3, zero, koniec # jezeli adres w sentence dojdzie do \0 czyli do konca programm sie skonczy