	.text
	.p2align	2
	.globl	strlen
strlen:
	# this is a comment
        # don't forget the labels and the  .text and .global things at the top of the program
        # a0 is a pointer to the beginning of the string to get the length of
        addi t0, x0, 0   # set the temporary t0 to be 0 (this will be our length counter)
        lb   t1, 0(a0)   # load in the first character from memory into t1
.CONDITION:
	beq  t1, x0, .AFTER  # if the character is equal to 0 (x0 is always 0) jump to the end
        addi t0, t0, 1       # otherwise increment the length counter
        addi a0, a0, 1       # advance the pointer by 1
        lb   t1, 0(a0)       # read the next byte
        j    .CONDITION      # jump up to the beginning of the "loop"
.AFTER:
        addi a0, t0, 0       # move our calculated length into the a0 register
.END:
