stringss.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. {$ifdef FPC_ENABLED_CLD}
  21. cld
  22. {$endif FPC_ENABLED_CLD}
  23. movl %eax,%edi // load destination address
  24. movl %edx,%esi // Load Source adress
  25. movzbl (%esi),%ecx // load length in ECX
  26. incl %esi
  27. rep
  28. movsb
  29. movb $0,(%edi)
  30. movl saveedi,%edi
  31. movl saveesi,%esi
  32. end;
  33. {$endif FPC_UNIT_HAS_STRPCOPY}