dsp56800 Freescale Semiconductor, Inc, dsp56800 Datasheet - Page 219

no-image

dsp56800

Manufacturer Part Number
dsp56800
Description
16-bit Digital Signal Controllers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
8.11
Sometimes it is necessary to perform a jump or a jump to subroutine using the value stored in an on-chip
register instead of using an absolute address. The RTS instruction is used to perform this task because it
takes the value on the software stack and loads it into the program counter, effectively performing a jump.
The register used for the jump can be any register on the DSC core.
; JMP <register> Operation
; 8 Icyc
; Note: Can use any core register in <register>, e.g. MOVE #LABEL,X0
; Jcc <register> Operation
;
;
; 10 Icyc (3 Icyc if condition false)
; To execute a BEQ <register>
OVER:
;
; JSR <register> Operation - destroys one register, N
; 11 Icyc
NEXT_SEGMENT:
;
Freescale Semiconductor
Examples: JEQ, JLE, JNN will use BNE, BGT and BNR respectively as 1st instr
(Use Bcc instruction whenever possible since it is a single word instruction)
LEA
MOVE
MOVE
RTS
BNE
LEA
MOVE
MOVE
RTS
(instructions)
MOVE
LEA
MOVE
MOVE
MOVE
MOVE
RTS
(instructions)
Jumps and JSRs Using a Register Value
(SP)+
<register>,X:(SP)+ ; Push address of target code location
SR,X:(SP)
OVER
(SP)+
<register>,X:(SP)+ ; Push address of target code location
SR,X:(SP)
#NEXT_SEGMENT,N
(SP)+
N,X:(SP)+
SR,X:(SP)+
<register>,X:(SP)+ ; Push address of subroutine onto stack
SR,X:(SP)
; Update SP to point to unused location
; Push SR onto stack last
; Will return to address specified in <register> and
;
; Use condition exactly opposite the desired cc
; Update SP to point to unused location
; Push SR onto stack last
; Will do a return to the desired target code location
;
; Start of code segment if BEQ fails (BNE succeeds!)
; Update SP to point to unused location
; Push return address onto stack
; Push SR onto stack
; Push SR onto stack last
; Go to address in top two values on stack and
;
; Segment of code executed after returning from
;
correct the SP register to its original value
and correct the SP register to its original value
correct the SP register to its original value
P:<register>
; P address of NEXT_SEGMENT
Software Techniques
Jumps and JSRs Using a Register Value
8-33

Related parts for dsp56800