home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 454.lha / RexxHostLib_v36.14 / StringAsm.asm < prev    next >
Assembly Source File  |  1990-12-09  |  2KB  |  70 lines

  1. * $Revision Header * Header built automatically - do not edit! *************
  2. *
  3. *    (C) Copyright 1990 by MXM
  4. *
  5. *    Name .....: StringAsm.asm
  6. *    Created ..: Friday 13-Apr-90 15:56
  7. *    Revision .: 1
  8. *
  9. *    Date            Author          Comment
  10. *    =========       ========        ====================
  11. *    24-May-90       Olsen           Added InitList function
  12. *    13-Apr-90       Olsen           Created this file!
  13. *
  14. * $Revision Header *********************************************************
  15. *
  16. *    This file contains the assembly language source code for
  17. *    the string routines employed by rexxhost.library.
  18. *
  19. *    Now also contains the InitList macro function.
  20. *
  21. ****************************************************************************
  22.  
  23.         INCLUDE    "exec/types.i"
  24.         INCLUDE    "exec/lists.i"
  25.  
  26.         SECTION    StringAsm,CODE
  27.  
  28.         XDEF    _StrLen
  29.         XDEF    _StrCpy
  30.         XDEF    _StrNCpy
  31.  
  32.         XDEF    _InitList
  33.  
  34. *----------------------------------------------------------------------------
  35.  
  36. _StrLen:    MOVEQ    #0,D0        ; Reset counter
  37. 1$        TST.B    (A0)+        ; Test for 0
  38.         BEQ.S    2$        ; End of string
  39.         ADDQ    #1,D0        ; Increment length counter
  40.         BRA.S    1$        ; Test again...
  41. 2$        RTS
  42.  
  43. *----------------------------------------------------------------------------
  44.  
  45. _StrCpy:    TST.B    (A1)        ; Empty string?
  46.         BEQ.S    1$
  47.         MOVE.B    (A1)+,(A0)+    ; Copy character
  48.         BRA.S    _StrCpy        ; Check for 0
  49. 1$        MOVE.B    #0,(A0)        ; Null-termination
  50.         RTS
  51.  
  52. *----------------------------------------------------------------------------
  53.  
  54. _StrNCpy:    TST.L    D0        ; Legal length?
  55.         BEQ.S    2$
  56.  
  57. 1$        MOVE.B    (A1)+,(A0)+    ; Copy character
  58.         DBRA    D0,1$        ; Decrement length counter
  59.  
  60. 2$        MOVE.L    D0,A1        ; Null-termination
  61.         MOVE.B    #0,0(A0,A1)
  62.         RTS
  63.  
  64. *----------------------------------------------------------------------------
  65.  
  66. _InitList:    NEWLIST    A0        ; Perform list initialization,
  67.         RTS            ; and return
  68.  
  69.         END
  70.