stringss.inc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. Processor dependent part of strings.pp, not shared with
  5. sysutils unit.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$ifndef FPC_UNIT_HAS_STRPCOPY}
  13. {$define FPC_UNIT_HAS_STRPCOPY}
  14. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  15. var
  16. saveesi,saveedi : longint;
  17. asm
  18. movl %edi,saveedi
  19. movl %esi,saveesi
  20. cld
  21. movl %eax,%edi // load destination address
  22. movl %edx,%esi // Load Source adress
  23. movzbl (%esi),%ecx // load length in ECX
  24. incl %esi
  25. rep
  26. movsb
  27. movb $0,(%edi)
  28. movl saveedi,%edi
  29. movl saveesi,%esi
  30. end;
  31. {$endif FPC_UNIT_HAS_STRPCOPY}