home *** CD-ROM | disk | FTP | other *** search
- include compiler.inc
- ttl STRCPY, 1.04, 08-30-86, clr
-
- ;string function - copies strg2 over strg1
- ;
- ; - copies strg2 over strg1 at most n characters
- ; NOTE: If strg2 has more than cnt characters, the result
- ; will NOT be null terminated!!
-
- dseg
-
- cseg
-
- procdef strncpy, <<strg1, ptr>, <strg2, ptr>, <cnt,word>>
- mov cx,cnt
- jmp short start
-
- entrdef strcpy
- mov cx,7fffh
-
- start:
- pushreg
- pushds
- jcxz endit
- ldptr di,strg1
- ldptr si,strg2
- cld
- lp:
- lodsb
- stosb
- or al,al
- jz endit
- loop lp
- endit:
- clc
- retptrm strg1
- pend strncpy
-
- finish
-
- end