Mercurial > hg > Members > kono > nitros9-code
annotate lib/alib/strncmp.as @ 3158:927ba5ebc06e
mc09 l2: move MMU bit-field defines to defs file.
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Thu, 06 Apr 2017 21:43:58 +0100 |
parents | 03f26e88b809 |
children |
rev | line source |
---|---|
2474 | 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 | |
2782
aaba193af04f
Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2474
diff
changeset
|
23 section .text |
2474 | 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 |