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

Software Techniques

8.1.3 Register Exchanges

The XCHG operation can be emulated as shown in the following code:

;XCHG Operation

;Emulated at 4 Icyc

PUSH

X0

MOVE

A,X0

POP

A

If a register is available, the exchange of any two registers can be emulated as shown in the following code:

;XCHG Operation

;Emulated at 3 Icyc

MOVE

X0,N

MOVE

A,X0

MOVE

N,A

A faster exchange of any two registers can be emulated using one address register when N equals 0, as shown in the following code:

;XCHG Operation

;N register is 0, Emulated at 2 Icyc

MOVE

A,X:(R0)

TFR

X0,A X:(R0)+N,X0

8.1.4 Minimum and Maximum Values

The MAX operation returns the maximum of two values; the MIN operation return the minimum.

8.1.4.1 MAX Operation

The MAX operation can be emulated as shown in the following code:

; MAX Operation

MAX X0,A

;------ becomes ------

;MAX operation

;Emulated at 4 Icyc

CMP

X0,A

TGT

X0,A

; (can also use TGE if desired)

8-6

DSP56800 Family Manual

 

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