misc: less useless comments; document utility functions; follow the AAPCS calling convention

This commit is contained in:
2025-08-29 18:52:18 +02:00
parent a1455660e2
commit 9ee7b86b9f
6 changed files with 90 additions and 86 deletions
+25
View File
@@ -0,0 +1,25 @@
/*
Current implementation only counts the bytes instead of characters.
@args:
r1 => pointer to the string
@returns:
r0 => string length
@clobbers:
r2
*/
strlen:
mov r0, #0
1:
ldrb r2, [r1, r0]
cmp r2, #0
bxle lr
add r0, r0, #1
b 1b
/*
@input r1, r2 - pointers to the strings to compare
@return r0 - 0 if equal, -1 if a < b, 1 if a > b
*/
strcmp: @ TODO: implement