72h UT$ICPB case independent 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.
Output
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.
Description

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",
  • "abcd" precedes "BCD",
  • "A" precedes "AA",
  • "ABCD","abcd" and "AbcD" are all equal.

The X register is preserved.

LZ users, see also UT$CMPB.

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$ICPB
        BEQ     MATCHED         ; branch to code for matched strings
        BMI     BUF1FIRST       ; branch to code for BUF1 first
BUF2FIRST:                      ; here if BUF2 first
Errors - none -