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

  1.     page    66,132
  2. ;******************************* SCAN09.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_CHAR4 - scan buffer for character, 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_CHAR4
  31. SCAN_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. lp1:    lodsb
  42.     cmp    al,dl
  43.     je    c4_exit        ;jmp if match
  44.     cmp    al,dh
  45.     je    c4_exit        ;jmp if match
  46.     loop    lp1
  47. c4_exit:pop    dx
  48.     retf    
  49. SCAN_CHAR4    ENDP
  50. ;------------------------------------------------------------------------
  51.  
  52. LIBSEG    ENDS
  53. ;;    end
  54.