2474
|
1 **************************************
|
|
2
|
|
3 * STRCMP: compare two null terminated strings.
|
|
4
|
|
5 * NOTE: This routine first finds the length of both
|
|
6 * strings and passes the length of the longer
|
|
7 * one to strncmp.
|
|
8
|
|
9 * OTHER MODULES NEEDED: STRNCMP, STRLEN
|
|
10
|
|
11
|
|
12 * ENTRY: X=start of 1st string
|
|
13 * Y=start of 2nd string
|
|
14
|
|
15 * EXIT: CC zero set if equal (beq)
|
|
16 * carry + zero clear if 1>2 (bhi)
|
|
17 * carry set if 1<2 (blo)
|
|
18
|
|
19
|
|
20 nam Compare Strings
|
|
21 ttl Assembler Library Module
|
|
22
|
|
23
|
|
24 psect STRCMP,0,0,0,0,0
|
|
25
|
|
26 STRCMP:
|
|
27 pshs d
|
|
28 lbsr STRLEN find len of str1
|
|
29 pshs d
|
|
30 exg y,x find len of str2
|
|
31 lbsr STRLEN
|
|
32 exg y,x restore ptrs
|
|
33 cmpd ,s
|
|
34 bhi ok
|
|
35 ldd ,s get bigger value
|
|
36
|
|
37 ok
|
|
38 leas 2,s clean stack
|
|
39 lbsr STRNCMP go compare
|
|
40 puls d,pc go home
|
|
41
|
|
42 endsect
|
|
43
|