Arm/strlen

From ASMBits

Write a function named strlen that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.

Return (in r0) the length of the string, which excludes the null termination character;

unsigned int strlen (const char *string);

Expected solution length: Around 10 lines.

Sample Input

"Hello World"

Sample Output

11

Write your solution here

x
 
1
.data
2
MyString: .string "Hello World"
3
4
.text
5
.global _start
6
_start:
7
    ldr r0, =MyString
8
    bl strlen
9
    1: b 1b
10
11
.global strlen
12
strlen:
13
    
14
    
Upload a source file...