Mercurial > hg > Members > kono > nitros9-code
comparison lib/alib/strncmp.as @ 2783:03f26e88b809 lwtools-port
Renamed files and setup for lwasm/lwlink work
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Sat, 26 Jan 2013 17:18:24 -0600 |
parents | lib/alib/strncmp.a@aaba193af04f |
children |
comparison
equal
deleted
inserted
replaced
2782:aaba193af04f | 2783:03f26e88b809 |
---|---|
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 section .text | |
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 |