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

  1.     page    66,132
  2. ;******************************* SCAN13.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.     extrn    strlen1:far
  12. .list
  13. comment 
  14. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SEARCH  )
  15. ;SCAN_LAST_CHAR4 - scan buffer for last char match, match either case
  16. ;  inputs:    dl = character
  17. ;          ds:si = string buffer, terminated with zero char.
  18. ;             cx = buffer length
  19. ;           
  20. ;  output: if flag set to "je" then match found
  21. ;                  ds:si = pointer one char past match point
  22. ;                     cx = amount of data remaining to be searched
  23. ;          if flag set to "jne" then no match found
  24. ;                  ds:si = pointer past end of buffer
  25. ;                     cx = zero
  26. ;           register -ax- modified
  27. ;* * * * * * * * * * * * * *
  28. 
  29.  
  30.     PUBLIC    SCAN_LAST_CHAR4
  31. SCAN_LAST_CHAR4    PROC    FAR
  32.     push    dx
  33.     mov     dh,dl
  34.     mov    ah, dl        ;try matching other
  35.     or    ah, 20h        ;  case if char
  36.         sub     ah, 'a'        ;     is an alpha
  37.         cmp     ah, 'z' - 'a' + 1
  38.     jnc    not_alpha
  39.     xor    dh,20h
  40. not_alpha:
  41.     add    si,cx
  42.     std
  43. lp1:    lodsb
  44.     cmp    al,dl
  45.     je    c4_exit        ;jmp if match
  46.     cmp    al,dh
  47.     je    c4_exit        ;jmp if match
  48.     loop    lp1
  49. c4_exit:pop    dx
  50.     cld
  51.     retf    
  52. SCAN_LAST_CHAR4    ENDP
  53. ;------------------------------------------------------------------------
  54.  
  55. LIBSEG    ENDS
  56. ;;    end
  57.