Implementation Details

-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

_eq0

_ne1

_lt2

_le3

_ge4

_gt5

_ult6

_ule7

_uge8

_ugt9

_lneg10

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)

Code Development Tools

5-25

Page 321
Image 321
Texas Instruments MSP50C6xx manual Unsigned comparison of a and b. a is in A0, b is in A0~, Ult, Ugt, Assembly Vector