home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / STR01.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  84 lines

  1.     page    66,132
  2. ;******************************** STR01.ASM  *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. comment 
  13. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  14. STRLEN1 - finds length of a ASCII string at DS:SI
  15. ;
  16. ; inputs:    DS:[SI] = address of the string
  17. ; output:    CX = length of string excluding the terminating NUL
  18. ;* * * * * * * * * * * * * *
  19. 
  20.     PUBLIC    STRLEN1
  21. STRLEN1    PROC    FAR
  22.     apush    ax,di,es,ds
  23.     pop    es            ;set es = ds
  24.     cld
  25.     mov    di,si
  26.     sub    al,al            ;set al=0
  27.     mov    cx,-1
  28.     repnz    scasb
  29.     not    cx
  30.     dec    cx
  31.     apop    es,di,ax
  32.     retf
  33. STRLEN1    ENDP
  34. comment 
  35. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  36. STRLEN2 - finds length of a ASCII string at DS:DI
  37. ;
  38. ; inputs:    DS:[DI] = address of the string
  39. ; output:    CX = length of string excluding the terminating NUL
  40. ;* * * * * * * * * * * * * *
  41. 
  42.     PUBLIC    STRLEN2
  43. STRLEN2    PROC    FAR
  44.     apush    ax,di,es,ds
  45.     pop    es            ;set es = ds
  46.     cld
  47.     sub    al,al            ;set al=0
  48.     mov    cx,-1
  49.     repnz    scasb
  50.     not    cx
  51.     dec    cx
  52.     apop    es,di,ax
  53.     retf
  54. STRLEN2    ENDP
  55. comment 
  56. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  57. STRLEN3 - finds length of a ASCII string at DS:BX
  58. ;
  59. ; inputs:    DS:[BX] = address of the string
  60. ; output:    CX = length of string excluding the terminating NUL
  61. ;* * * * * * * * * * * * * *
  62. 
  63.     PUBLIC    STRLEN3
  64. STRLEN3    PROC    FAR
  65.     apush    ax,di,es,ds
  66.     pop    es            ;set es = ds
  67.     cld
  68.     mov    di,bx
  69.     sub    al,al            ;set al=0
  70.     mov    cx,-1
  71.     repnz    scasb
  72.     not    cx
  73.     dec    cx
  74.     apop    es,di,ax
  75.     retf
  76. STRLEN3    ENDP
  77. ;------------------------------------------------------------------------
  78.  
  79. LIBSEG    ENDS
  80.     end
  81.