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

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