Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
46
Добавлен:
27.04.2015
Размер:
4.26 Mб
Скачать

Jumps and JSRs Using a Register Value

8.11 Jumps and JSRs Using a Register Value

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 DSP core.

;JMP <register> Operation

;8 Icyc

LEA (SP)+

;Note: Can use any core register MOVE <register>,X:(SP)+

MOVE SR,X:(SP) RTS

;Jcc <register> Operation

;10 Icyc (3 Icyc if condition false)

Bcc~

OVER

; (cc~ is the condition exactly opposite the

LEA

(SP)+

; desired cc)

 

MOVE

<register>,X:(SP)+

MOVE

SR,X:(SP)

 

RTS

 

 

OVER

;JSR <register> Operation - destroys one register, N

;11 Icyc

MOVE

#NEXT,N

 

LEA

(SP)+

 

MOVE

N,X:(SP)+

; Push return address onto stack

MOVE

SR,X:(SP)

; Push SR onto stack

MOVE

<register>,X:(SP)+

 

 

; Push address of subroutine onto stack

MOVE

SR,X:(SP)

; Push SR onto stack

RTS

 

; Go to address in top two values on stack

NEXT

 

Software Techniques

8-33

Соседние файлы в папке DSP568xx