Files
ls-arm/string.S
T

26 lines
439 B
ArmAsm
Raw Normal View History

/*
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