beautypg.com

Texas Instruments MSP50C6xx User Manual

Page 321

background image

Implementation Details

5-25

Code Development Tools

-

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

Assembly

Test

Condition

_ult

a < b

AULT

_ule

a <= b

!AUGT

_uge

a >= b

!AULT

_ugt

a > b

AUGT

The small number of comparisons was an invitation to use them as vector
calls. We return a 1 or 0 in A0 as the result of the comparison, and also set flag
2 if the comparison is true. The flag is not currently used by the compiler.

It is important to note that functions return their results via A0, but there is no
guarantee that the absolute value of the A0 pointer is not changed by the
function. To compare integers a and b: after loading a in A0, and b in A0~, do
a vector call to the appropriate comparison routine:

Assembly

Vector

_eq

0

_ne

1

_lt

2

_le

3

_ge

4

_gt

5

_ult

6

_ule

7

_uge

8

_ugt

9

_lneg

10

We return the result of the comparison in Flag 2 ( set for TRUE, reset for
FALSE), and in A0 (1 for TRUE, 0 for FALSE). We have also implemented
vector calls for string comparisons. There are a few C callable routines that
make use of those calls. (

test_string

,

or_string

,

and_string

,

xor_string

,

neg_string

,

not_string

)