stringss.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Jonas Maebe, member of the
  5. Free Pascal development team
  6. Processor dependent part of strings.pp, not shared with
  7. sysutils unit.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. function strpas(p : pchar) : string; assembler;
  15. {$i strpas.inc}
  16. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  17. asm
  18. { get length }
  19. lbz r10,0(r4)
  20. { put in counter }
  21. cmpli r10,0
  22. mtctr r10
  23. subi r0,r3,1
  24. beq LStrPCopyEmpty
  25. LStrPCopyLoop:
  26. { copy everything }
  27. lbzu r10,1(r4)
  28. stbu r10,1(r0)
  29. bdnz LStrPCopyLoop
  30. { add terminating #0 }
  31. li r10,0
  32. LStrPCopyEmpty:
  33. stb r10,1(r0)
  34. end ['r0','r4','r10','cr0','ctr'];
  35. {
  36. $Log$
  37. Revision 1.4 2001-09-27 15:30:29 jonas
  38. * conversion to compilerproc and to structure used by i386 rtl
  39. * some bugfixes
  40. * powerpc.inc is almost complete (only fillchar/word/dword, get_frame etc
  41. and the class helpers are still needed
  42. - removed unnecessary register saving in set.inc (thanks to compilerproc)
  43. * use registers reserved for parameters as much as possible instead of
  44. those reserved for local vars (since those have to be saved by the
  45. called anyway, while the ones for local vars have to be saved by the
  46. callee)
  47. Revision 1.3 2001/07/07 12:46:12 jonas
  48. * some small bugfixes and cache optimizations
  49. Revision 1.2 2001/02/11 12:15:03 jonas
  50. * some small optimizations and bugfixes
  51. Revision 1.1 2001/02/10 16:10:32 jonas
  52. * initial implementation: everything implemented, nothing tested
  53. }