# `jsr`

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

Web page: https://asm-editor.specy.app/documentation/m68k/instruction/jsr

**Jump to subroutine**

Category: Control flow

Pushes the return address onto the stack and jumps to the specified address.

## Flags

| Flag | Effect |
| --- | --- |
| X | not changed |
| N | not changed |
| Z | not changed |
| V | not changed |
| C | not changed |

## Forms

- `jsr <ea>`
  - Operand: (An), d(An), d(An,Xn), abs, d(PC), d(PC,Xn) (control)

## Operands

- [`<ea>`](https://asm-editor.specy.app/documentation/m68k/addressing-mode.md): An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With `opt p=68020`, an allowed `d(An,Xn)` or `d(PC,Xn)` mode also permits the corresponding 68020 indexed and memory indirect forms. See [68020 addressing](https://asm-editor.specy.app/documentation/m68k/addressing-mode/68020.md).

## Description

For example, `jsr 4(a0)` calls the code at `a0 + 4`. Like [lea](https://asm-editor.specy.app/documentation/m68k/instruction/lea.md), it computes the destination address without reading data there; a 68020 [memory indirect operand](https://asm-editor.specy.app/documentation/m68k/addressing-mode/memory-indirect.md) reads a pointer while computing it.

## Example

```m68k
move.l #10, d0
jsr add_two ; pushes return address, jumps to subroutine
move.l d0, d1 ; d1 = 12 (returned from subroutine)

* --- JSR through address register ---
lea add_two, a0
jsr (a0)
move.l d0, d2 ; d2 = 14
bra END

add_two:
    addq.l #2, d0
    rts

END:
```
