stringss.inc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Processor dependent part of strings.pp, not shared with
  6. sysutils unit.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$ifndef FPC_UNIT_HAS_STRPCOPY}
  14. {$define FPC_UNIT_HAS_STRPCOPY}
  15. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  16. var
  17. saveesi,saveedi : longint;
  18. asm
  19. movl %edi,saveedi
  20. movl %esi,saveesi
  21. cld
  22. {$ifdef REGCALL}
  23. movl %eax,%edi // load destination address
  24. movl %edx,%esi // Load Source adress
  25. {$else}
  26. movl s,%esi // Load Source adress
  27. movl d,%edi // load destination address
  28. {$endif}
  29. movzbl (%esi),%ecx // load length in ECX
  30. incl %esi
  31. rep
  32. movsb
  33. movb $0,(%edi)
  34. {$ifndef REGCALL}
  35. movl d,%eax // return value to EAX
  36. {$endif}
  37. movl saveedi,%edi
  38. movl saveesi,%esi
  39. end;
  40. {$endif FPC_UNIT_HAS_STRPCOPY}
  41. {
  42. $Log$
  43. Revision 1.13 2004-11-21 16:33:55 peter
  44. * external fixes
  45. Revision 1.12 2004/05/01 15:26:33 jonas
  46. * use some more string routines from libc if FPC_USE_LIBC is used
  47. Revision 1.11 2003/11/19 16:58:44 peter
  48. * make strpas assembler function
  49. Revision 1.10 2003/11/11 21:08:17 peter
  50. * REGCALL define added
  51. Revision 1.9 2003/09/08 18:21:37 peter
  52. * save edi,esi,ebx
  53. Revision 1.8 2003/07/07 20:22:05 peter
  54. * generic string routines added
  55. Revision 1.7 2002/09/07 16:01:19 peter
  56. * old logs removed and tabs fixed
  57. }