Mercurial > hg > Members > kono > nitros9-code
comparison lib/alib/strncmp.a @ 2474:7d70b7e1cb21
Moved net and alib files into here
author | boisy |
---|---|
date | Tue, 30 Mar 2010 02:44:42 +0000 |
parents | |
children | aaba193af04f |
comparison
equal
deleted
inserted
replaced
2473:dac1ff96637f | 2474:7d70b7e1cb21 |
---|---|
1 ************************************* | |
2 | |
3 * STRNCMP: compare 2 null terminated strings | |
4 * maximum number of bytes to compare in D | |
5 * | |
6 * OTHER MODULES NEEDED: COMPARE | |
7 | |
8 * ENTRY: X=start of 1st string | |
9 * Y=start of 2nd string | |
10 * D=number of bytes to compare | |
11 * CASEMTCH:(a global variable in COMPARE) | |
12 * 0=match for case | |
13 * -1=ignore case differences | |
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 nam Compare 2 Strings | |
20 ttl Assembler Library Module | |
21 | |
22 | |
23 psect STRNCMP,0,0,0,0,0 | |
24 | |
25 | |
26 STRNCMP: | |
27 pshs d,x,y,u | |
28 | |
29 tfr y,u U=string2 | |
30 tfr d,y use Y for counter | |
31 leay 1,y comp for initial dec. | |
32 | |
33 loop | |
34 leay -1,y count down | |
35 beq exit no miss-matches | |
36 lda ,x+ get 2 to compare | |
37 ldb ,u+ | |
38 lbsr COMPARE go compare chars. | |
39 beq loop chars match, do more | |
40 | |
41 * exit with flags set. Do a beq, bhi or blo to correct | |
42 * routines.... | |
43 | |
44 exit | |
45 puls d,x,y,u,pc | |
46 | |
47 endsect |