So, I understand that MIPS runs as 32-bit and that words are 8 bits (4 bytes).
If I have the following code,
.data
.word 5
.asciiz "Hi"
I know that there is one word being stored and it must be 4 bytes, but how do I determine the number of bytes in the third line? I've asked my instructor for help but she keeps referencing me to the following example:
.asciiz "help"
Apparently this is 5 bytes, but I'm not able to see how or why it is 5 bytes. I would appreciate some clarification, my instructor is reluctant to share techniques and I can't find information on this in my textbook
.asciiz
creates a zero-terminated ASCII string, i.e. a string of ASCII characters followed by a byte with the value 0 (terminator).
So the the number of bytes required is the number of characters plus 1. Hence asciiz "help"
-> 5 bytes, and asciiz "Hi"
-> 3 bytes.