Branch to subroutine (agu), Operation assembler syntax – Freescale Semiconductor StarCore SC140 User Manual
Page 419

BSR
SC140 DSP Core Reference Manual
A-105
BSR
Branch to Subroutine (AGU)
BSR
Description
Status and Conditions that Affect Instruction
Status and Conditions Changed by Instruction
None.
Example
bsr _label
Operation
Assembler Syntax
(Next PC)
→ (SP); SR → (SP + 4); SP + 8 → SP;
PC + displacement
→ PC; (Next PC)→ RAS
BSR <label
BSR >label
BSR <label
BSR >label
Pushes the next PC and SR onto the stack and causes program execution to continue at location PC +
displacement. The displacement, calculated by the assembler and linker, is a two’s complement integer that
represents the relative distance from the current PC to the destination label. The assembler determines if
the PC relative displacement is a short branch (
<label [–2
8
≤ displacement < 2
8
, W]) or a long branch
(
>label [–2
20
≤ displacement < –2
8
, W and 2
8
≤ displacement < 2
20
, W]). In addition to being pushed onto
the stack, the next PC is stored in the return address from subroutine register (RAS) and RAS becomes
valid.
Register Address
Bit Name
Description
SR[18]
EXP
Determines the stack pointer used in instructions that have a stack
pointer as an operand.
Register/Memory Address
Before
After
SR
$00E0 0000
_label (displacement)
$0000 0014
PC
$0000 0002
$0000 0016
NSP
$30
$38
($30)
$0000 0006
($34)
$00E0 0000