The answer is below.
The
address of the byte in the lbu
instruction
is computed by (displacement + $9
).
Since the base, $9
, has the address of (points
at) the character, the displacement is zero.
The lbu
loads the
character into the low-order byte of $10
.
The upper three bytes are zero. The
beq
instruction tests
if the entire register is zero,
but, of course,
that also tests if the low-order byte is zero.
Next, the program must increment the count, then move the base register (the character pointer) to the next byte of the string.
Fill in the blanks.