B2h UT$CMPB case dependent compare
Input X register - Address of one string.
UTW_S0 - Address of other string.
A register - length of string at X.
B register - length of string at UTW_S0.
B register - 
0 : matched and same length.
< 0 : string at X first alphabetically.
> 0 : string at UTW_S0 is first alphabetically.
Z flag - according to B register.
N flag - according to B register.

Case independent buffer compare.

The bytes are compared from low to high memory. If the strings match but are of different lengths, the shorter string precedes the other alphabetically. So,

  • "ABCD" precedes "BCD",
  • "A" precedes "AA".

The X register is preserved.

See also UT$ICPB.

Example Compares BUF1, length LENBUF1, with BUF2, length LENBUF2, branching according to the return value.
        LDX     #BUF1           ; point to buffer BUF1
        LDD     #BUF2
        STD     UTW_S0          ; point to buffer BUF2
        LDAA    #LENBUF1
        LDAB    #LENBUF2
        OS      UT$CMPB
        BEQ     MATCHED         ; branch to code for matched strings
        BMI     BUF1FIRST       ; branch to code for BUF1 first
BUF2FIRST:                      ; here if BUF2 first
Errors - none -