callpseudo
call
labelpseudo
ra = pc + 4; goto label

call runs a function and arranges to come back afterward. It is the plain-language way to invoke a function: jump to it, while saving the return address in ra so the function can get home. It is a pseudo-instruction that usually becomes jal ra, label; for a function too far away to reach in one jump, the assembler quietly substitutes a longer sequence that goes the distance. Writing call square states your intent and lets the assembler pick the right form. (See jal for the jump-and-save mechanism.)

Making the jump is only half of calling a function; the other half is an agreement about how to pass information, called the calling convention. By this shared rule, you place the function's inputs in the argument registers (named a0, a1, and so on), and after it returns you find its result in a0. Both the caller and the function follow this convention, which is what lets independently written pieces of code work together.

The one rule to internalize: call overwrites ra each time. So if a function makes calls of its own, it must save the ra it was given before making them and restore it before its own return — otherwise the inner call's return address overwrites the outer one and the function cannot find its way back. A function that calls nothing else can skip that bookkeeping.

The example calls square with 6 in a0 and finds 36 in a0 afterward — argument in, result out, the convention at work.

Expands to
jal ra, label

A pseudo-instruction: the assembler turns it into the real instruction(s) above.