What is the use of a $zero register in MIPS?

The zero register always holds the constant 0. There’s not really anything special about it except for the fact that 0 happens to be a very useful constant. So useful that the MIPS designers dedicated a register to holding its value. (This way you don’t have to waste another register, or any memory, holding the value.)


EDIT:

As for the question of what that line of code means, it loads the word from MEMORY[myInteger + 0] into the $t0 register. The lw command takes both a constant (myInteger) and a register ($zero). Not sure why that is, but that’s just how the instructions work. Since myInteger was used as the constant, a register had to be provided, so $zero was used.

Leave a Comment