Mercurial > hg > Members > kono > nitros9-code
comparison lib/alib/strncpy.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 * STRNCPY: copy N bytes of a null terminated string | |
4 * User must ensure there is room in buffer!!! | |
5 * If N>string length only N bytes will be moved | |
6 | |
7 * OTHER MODULES NEEDED: STRLEN, MEMMOVE | |
8 | |
9 * ENTRY: X=start of string to move | |
10 * Y=buffer for copy of string | |
11 | |
12 * EXIT: D = actual number of bytes moved | |
13 * all other regs preserved (except cc) | |
14 | |
15 | |
16 nam Copy partial String | |
17 ttl Assembler Library Module | |
18 | |
19 | |
20 psect STRNCPY,0,0,0,0,0 | |
21 | |
22 STRNCPY: | |
23 pshs d bytes wanted to move | |
24 lbsr STRLEN find length of string | |
25 addd #1 move NULL also | |
26 cmpd ,s get smaller of passed/actual size | |
27 bls skip use actual leng | |
28 ldd ,s use passed leng²² | |
29 skip | |
30 lbsr MEMMOVE move it | |
31 leas 2,s | |
32 rts | |
33 | |
34 endsect | |
35 | |
36 |