stringss.inc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. {$ifdef REGCALL}
  22. movl %eax,%edi // load destination address
  23. movl %edx,%esi // Load Source adress
  24. {$else}
  25. movl s,%esi // Load Source adress
  26. movl d,%edi // load destination address
  27. {$endif}
  28. movzbl (%esi),%ecx // load length in ECX
  29. incl %esi
  30. rep
  31. movsb
  32. movb $0,(%edi)
  33. {$ifndef REGCALL}
  34. movl d,%eax // return value to EAX
  35. {$endif}
  36. movl saveedi,%edi
  37. movl saveesi,%esi
  38. end;
  39. {$endif FPC_UNIT_HAS_STRPCOPY}