Jump to subroutine (agu), Description, Example – Freescale Semiconductor StarCore SC140 User Manual

Page 527: Operation assembler syntax

Advertising
background image

JSR

SC140 DSP Core Reference Manual

A-213

JSR

Jump to Subroutine (AGU)

JSR

Description

These operations jump to the subroutine location in program memory that is given by the instruction’s
effective address. The operation includes an implicit push of the status register (SR) and the program
counter (PC) onto the stack. The value of PC stored on the stack is that of the execution set following the
current execution set. In addition, the value of the next PC is stored in the RAS shadow register. The
destination address cannot be in the middle of an execution set.

Status and Conditions that Affect Instruction

Status and Conditions Changed by Instruction

None.

Example

jsr r6

Operation

Assembler Syntax

(Next PC)

→ (SP); SR → (SP + 4); SP + 8 → SP; label → PC

JSR label {0

≤ label < 2

32

,W}

(Next PC)

→ (SP); SR → (SP + 4); SP + 8 → SP; Rn → PC

JSR Rn

JSR label

Jumps to a memory location specified by the label. The assembler and linker calculate the 32-bit absolute
destination address from the label.

JSR Rn

Jumps to a memory location contained in an address register (Rn). The value in Rn must be word-aligned.

Register Address

Bit Name

Description

SR[18]

EXP

Determines which stack pointer is used.

Register/Memory Address

Before

After

R6

$0000 0012

PC

$0000 0004

$0000 0012

SP

$0000 0100

$00000108

SR

$00E0 0000

($00000100)

$0000 000A

($00000104)

$00E0 0000

Advertising