stringss.inc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. {$define FPC_UNIT_HAS_STRPAS}
  15. function strpas(p : pchar) : string; assembler;
  16. {$i strpas.inc}
  17. {$define FPC_UNIT_HAS_STRPCOPY}
  18. function strpcopy(d : pchar;const s : string) : pchar;assembler;
  19. asm
  20. { get length }
  21. lbz r0,0(r4)
  22. { put in counter }
  23. cmplwi r0,0
  24. mtctr r0
  25. subi r10,r3,1
  26. beq .LStrPCopyEmpty
  27. .LStrPCopyLoop:
  28. { copy everything }
  29. lbzu r0,1(r4)
  30. stbu r0,1(r10)
  31. bdnz .LStrPCopyLoop
  32. { add terminating #0 }
  33. li r0,0
  34. .LStrPCopyEmpty:
  35. stb r0,1(r10)
  36. end;
  37. {
  38. $Log$
  39. Revision 1.11 2003-11-29 16:27:19 jonas
  40. * fixed several ppc assembler reader related problems
  41. * local vars in assembler procedures now start at offset 4
  42. * fixed second_int_to_bool (apparently an integer can be in LOC_JUMP??)
  43. Revision 1.10 2003/07/07 20:23:46 peter
  44. * added defines to override generic implementations
  45. Revision 1.9 2003/06/14 12:41:09 jonas
  46. * fixed compilation problems (removed unnecessary modified registers
  47. lists from procedures)
  48. Revision 1.8 2002/09/11 07:49:40 jonas
  49. * fixed assembler errors
  50. Revision 1.7 2002/09/07 16:01:26 peter
  51. * old logs removed and tabs fixed
  52. Revision 1.6 2002/09/06 16:58:43 jonas
  53. * fixed wrong references (used r0 as base register)
  54. Revision 1.5 2002/08/10 17:14:36 jonas
  55. * various fixes, mostly changing the names of the modifies registers to
  56. upper case since that seems to be required by the compiler
  57. }