Compare commits

..

No commits in common. "0f3d64990b7e8fddd626de9b7bcc5ec58641eca4" and "52c546b9d8dd4c904908e2c02c5b1c730495e849" have entirely different histories.

2 changed files with 18 additions and 120 deletions

View File

@ -46,86 +46,3 @@ load
si si
xit xit
exit exit
target extended-remote :3333
dashboard -layout registers memory
file counter.S
load
load file
load counter.S
si
exit
target extended-remote :3333
dashboard -layout registers
file counter.S
load
load counter.S
monitor reset halt
monitor reset halt
clear
ls
help
exit
target remote :3333
dashboard -layout registers memory
monitor reset halt
file counter.S
load
load counter
si
exit
target extended-remote :3333
dashboard -layout registers memory
file counter.S
load counter
si
load
load file
load counter
go
si
monitor reset halt
ls
help
run
si
exit
target extended-remote :3333
dashboard -layout registers memory
file counter
load counter
si
si
exit
target extended-remote :3333
target extended-remote :3333
target extended-remote :3333
target extended-remote :3333
target extended-remote :3333
exit
target extended-remote :3333
sudo systemctl restart openocd
target extended-remote :3333
exit
target extended-remote :3333
dashboard -layout registers memory
file counter
load counter
si
target remote :3333
dashboard -layout registers memory
file counter
load counter
si
file counter
load counter
si
target extended-remote :3333
si
exit
target extended-remote :3333
dashboard -layout registers memory
file counter
load counter
si
exit

View File

@ -1,46 +1,27 @@
.data .data
sentence: sentence: .ascii "My fbbirbst btbry\0" // \0 to bajt zerowy czyli koniec zdania w asm, C =
.ascii "Become a Programmer\0" # The string to search in
match:
.ascii "bpera\0" # The string containing characters to search for in sentence
out:
.space 4, 0 # Space to store the match count
.text .text
.align 2 .align 2
.globl _start .globl _start
_start: _start:
la t0, sentence # Load the address of the sentence string into t0 la t2, sentence
la a0, match # Load the address of the match string into a0 li t0, 0x62 //ascii "b"
la s2, out # Load the address of the out variable (match counter) into s2
lbu s3, 0(s2) # Load the current match counter from out into s3
check_match: li t1, 0x00 // licznik b w sentence
lbu t1, 0(a0) # Load the current character from match into t1
beq t1, zero, done # If we reach the end of match (t1 == 0), finish the program
# Search for the current character from match in sentence loop:
la t0, sentence # Reload the address of the sentence string lbu t3, 0(t2) // ladujemy do rejestra t3 adres 1 litery sentece
j find_in_sentence # Jump to search for the current character in sentence beq t3, zero, koniec # jezeli adres w sentence dojdzie do \0 czyli do konca programm sie skonczy
find_in_sentence: bne t3, t0, 1f // jezeli adres liczby nie jest "b" to prechodzi do 1f pomijanie przyrostu licznika.
lbu t2, 0(t0) # Load the current character from sentence into t2 addi t1, t1, 1 // dodajemy 1 do licznika liter b
beq t2, zero, next_match # If we reach the end of sentence (t2 == 0), move to next character in match
# If the characters match, increment the match counter 1:
bne t1, t2, not_found # If characters do not match, continue searching
addi s3, s3, 1 # If characters match, increment the match counter
sb s3, 0(s2) # Store the updated match counter back to out
not_found: addi t2, t2, 1 // Tutaj wskaźnik zostanie przesunięty do następnego znaku w linii
addi t0, t0, 1 # Move to the next character in sentence j loop // skok do poczatku petli
j find_in_sentence # Repeat the search
next_match:
addi a0, a0, 1 # Move to the next character in match
j check_match # Continue checking for the next character in match
done:
ebreak # End the program
koniec:
ebreak