beautypg.com

Motorola DSP96002 User Manual

Page 296

background image

A - 108

DSP96002 USER’S MANUAL

MOTOROLA

FCMPG

Graphics Compare

FCMPG

with Trivial Accept/Reject Flags

Operation:

S2 - S1 (parallel data bus move)

Assembler Syntax:

FCMPG S1,S2 (move syntax - see the MOVE in-

struction description.)

Description:

Subtract the two operands as specified in the operation column above. No result is stored; however, the

condition codes are affected as described. This instruction differs from FSUB when S1=S2; in this case,

the result is always +0 and therefore, N is cleared. Note that this is true even if S1, S2 are infinity.

FCMPG and FCMP differ primarily in the definition of the CCR condition code bits LR and R. These differ-

ences are particularly useful in performing clipping operations in graphics applications. In the code seg-

ment, the FCMP instruction tests the first point of a line, X0, against X

min

and sets LR accordingly; the FC-

MPG instruction tests the second point of a line, X1, against X

min

and sets

R depending on the condition

of LR. Note that the line segment will be trivially accepted if A is set (and R=1), whereas the line will be

trivially rejected if

R is cleared (and A=0). This choice of accept/reject conditions was selected to permit

the CCR to be initialized by a single ORI instruction.

ORI

#$E0,CCR

;SET A,

R, LR – i. e.,

;assume line is initially

;accepted and not rejected.

MOVE

X:(R0)+N0,D0.S

Y:(R4)+,D1.S

;get X0, X

min

FCMP

D1, D0

X:(R0)-N0, D0.S

;X0-X

min

, get X1

FCMPG

D1, D0

;X1=X

min

Input Operand(s) Precision: SEP Floating-Point.

Output Operand Precision: n.a.