Implementation Details

5.6 Implementation Details

This section is C– – specific.

5.6.1Comparisons

We use the CMP instruction for both signed and unsigned comparisons. The two integers a and b to be compared are in A0 and A0~.

CMP A0,A0~ : A0 contains a, A0~ contains b

A0

A0~

ACO

AZ

ANEG

 

 

 

 

 

5

0

1

0

0

5

1

1

0

0

0

5

0

0

1

1

5

0

0

1

0

0

1

1

0

5

5

1

1

0

FFFF

0

1

0

1

0

FFFF

0

0

0

FFFF

FFFF

1

1

0

FFFF

FFFE

1

0

0

-FFFE

FFFF

0

0

1

 

 

 

 

 

Signed comparison of a and b. (a is in A0, b is in A0~)

Assembly

Test

Condition

 

 

 

_eq

a = b

AEQ

_ne

a != b

!AEQ

_lt

a < b

ALZ

_le

a <= b

!AGT

_ge

a >= b

!ALZ

_gt

a > b

AGT

 

 

 

5-24

Page 320
Image 320
Texas Instruments MSP50C6xx manual Implementation Details, Comparisons, This section is C- specific