annotate lib/alib/strncpy.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/strncpy.a@aaba193af04f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2474
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
1 **********************************
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
2
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
3 * STRNCPY: copy N bytes of a null terminated string
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
4 * User must ensure there is room in buffer!!!
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
5 * If N>string length only N bytes will be moved
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
6
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
7 * OTHER MODULES NEEDED: STRLEN, MEMMOVE
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
8
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
9 * ENTRY: X=start of string to move
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
10 * Y=buffer for copy of string
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
11
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
12 * EXIT: D = actual number of bytes moved
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
13 * all other regs preserved (except cc)
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
14
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
15
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
16 nam Copy partial String
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
17 ttl Assembler Library Module
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
18
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
19
2782
aaba193af04f Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2474
diff changeset
20 section .text
2474
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
21
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
22 STRNCPY:
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
23 pshs d bytes wanted to move
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
24 lbsr STRLEN find length of string
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
25 addd #1 move NULL also
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
26 cmpd ,s get smaller of passed/actual size
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
27 bls skip use actual leng
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
28 ldd ,s use passed leng²²
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
29 skip
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
30 lbsr MEMMOVE move it
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
31 leas 2,s
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
32 rts
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
33
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
34 endsect
7d70b7e1cb21 Moved net and alib files into here
boisy
parents:
diff changeset
35
2782
aaba193af04f Updated code to use lwasm/lwlink
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2474
diff changeset
36