# `jal`

[MIPS Documentation](https://asm-editor.specy.app/documentation/mips.md) › [Instructions](https://asm-editor.specy.app/documentation/mips/instruction.md)

Web page: https://asm-editor.specy.app/documentation/mips/instruction/jal

**Jump and link**

Category: Control flow

Saves the return address in $ra and jumps to label, the usual way to call a function.

Used in: [jal, jr, and the course calling convention](https://asm-editor.specy.app/learn/courses/mips/think-in-assembly/jal-jr-and-the-calling-convention.md) (MIPS assembly), [Floating point and Coprocessor 1](https://asm-editor.specy.app/learn/courses/mips/think-in-assembly/floating-point-and-coprocessor-1.md) (MIPS assembly), [A subroutine with its arguments in registers](https://asm-editor.specy.app/learn/courses/mips/examples/subroutine-with-register-arguments.md) (MIPS assembly), [Stack arguments and a stack frame](https://asm-editor.specy.app/learn/courses/mips/examples/subroutine-with-stack-arguments.md) (MIPS assembly), [Recursion: factorial and Fibonacci](https://asm-editor.specy.app/learn/courses/mips/examples/factorial-and-fibonacci.md) (MIPS assembly), [Convert a number to a string](https://asm-editor.specy.app/learn/courses/mips/examples/number-to-string.md) (MIPS assembly), [Drawing shapes on the screen](https://asm-editor.specy.app/learn/courses/mips/examples/drawing-on-the-screen.md) (MIPS assembly), [A bouncing ball](https://asm-editor.specy.app/learn/courses/mips/examples/bouncing-ball.md) (MIPS assembly), [Move a square with the keyboard](https://asm-editor.specy.app/learn/courses/mips/examples/keyboard-control.md) (MIPS assembly), [The snake game](https://asm-editor.specy.app/learn/courses/mips/examples/snake.md) (MIPS assembly)

## Forms

- `jal label`

## Operands

- `label`: A named address in the program, such as the start of a loop or a variable in `.data`.

## Description

The standard function-call instruction in MIPS. The called function returns with 'jr $ra'. Same address-range restriction as 'j'.

## Example

```mips
# jal calls a local routine and saves the return address in $ra. Inspect $t2: 1 after return.
jal routine
li $t2, 1
b done # Skip the routine after returning.
routine: li $t2, 2
jr $ra # Return to the instruction after the call.
done:
```
