comparison 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
comparison
equal deleted inserted replaced
2782:aaba193af04f 2783:03f26e88b809
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 section .text
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