There are two ideas behind a subroutine.
For making a subroutine call is jal which means "jump-and-link".
jal takes a label as its operand. This label is an address in memory for a subroutine. The assembler translates the label to an address.
To jump to that address really means to update the PC (program counter) to the address of the subroutine. The PC is a hidden register that holds the address of the current instruction being run.
The jal instruction saves the return address in register $r31. This register is also called $ra (where "ra" means return address).
Get Answers For Free
Most questions answered within 1 hours.