home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / dpl.zip / _STREND.D < prev    next >
Text File  |  1988-07-11  |  1KB  |  45 lines

  1. ; Doug's Programming Language  -- DPL, Version 2.22
  2. ; Copyright (c) 1988 Douglas S. Cody, All rights reserved.
  3. ;----------------------------------
  4. ; _STREND  -- MOVE THE TEXT POINT TO THE END OF THE STRING
  5. ;
  6. ; Entry conditions:
  7. ;    SI holds the offset to the beginning of the string
  8. ; Exit conditions:
  9. ;    SI points to the terminator in the string
  10. ;    CX holds the length of the text, but not the terminator
  11. ;
  12. SUBPGM    _STREND
  13. BEGIN    _STREND
  14.     SUB    AL,AL
  15.     SUB    CX,CX
  16.     DEC    SI
  17. ;
  18. LOOPR:
  19.     INC    SI
  20.     CMP    AL,[SI]        ; NULL TERMINATOR?
  21.     LOOPNE    LOOPR        ; IF NOT, CONTINUE LOOPING
  22.     NEG    CX
  23.     DEC    CX
  24.     RET
  25. ;
  26. ;
  27. ; _STRLEN  -- GET THE LENGTH OF THE SOURCE STRING INTO CX
  28. ;
  29. ; Entry conditions:
  30. ;    SI holds the offset to the beginning of the string
  31. ; Exit conditions:
  32. ;    SI not changed
  33. ;    CX holds the length of the text, but not the terminator
  34. ;
  35.     PUBLIC    _STRLEN
  36. _STRLEN    PROC    NEAR
  37.     PUSH    SI
  38.     CALL    _STREND
  39.     POP    SI
  40.     RET
  41.  
  42. _STRLEN    ENDP
  43. ;
  44. ENDPGM    _STREND
  45. ;