feat: sort the entries before printing them
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
Current implementation only counts the bytes instead of characters.
|
||||
|
||||
@args:
|
||||
r1 => pointer to the string
|
||||
@returns:
|
||||
@@ -8,7 +6,7 @@
|
||||
@clobbers:
|
||||
r2
|
||||
*/
|
||||
strlen:
|
||||
bytelen:
|
||||
mov r0, #0
|
||||
1:
|
||||
ldrb r2, [r1, r0]
|
||||
@@ -19,7 +17,32 @@ strlen:
|
||||
b 1b
|
||||
|
||||
/*
|
||||
@input r1, r2 - pointers to the strings to compare
|
||||
@return r0 - 0 if equal, -1 if a < b, 1 if a > b
|
||||
@args:
|
||||
r1 => pointer to first string
|
||||
r2 => pointer to second string
|
||||
@returns:
|
||||
r0 => 0 if equal, -1 if a < b, 1 if a > b
|
||||
@clobbers:
|
||||
r1, r2, r3
|
||||
*/
|
||||
strcmp: @ TODO: implement
|
||||
strcmp_ascii:
|
||||
@ comparison loop
|
||||
1:
|
||||
ldrb r0, [r1], #1
|
||||
ldrb r3, [r2], #1
|
||||
cmp r0, r3
|
||||
bne 2f
|
||||
cmp r0, #0
|
||||
bne 1b
|
||||
|
||||
@ strings are equal
|
||||
mov r0, #0
|
||||
bx lr
|
||||
|
||||
@ if we found a different byte then return the appropriate integer
|
||||
2:
|
||||
sub r0, r0, r3
|
||||
cmp r0, #0
|
||||
movlt r0, #-1
|
||||
movgt r0, #1
|
||||
bx lr
|
||||
|
||||
Reference in New Issue
Block a user