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

  1.     page    66,132
  2. ;******************************** SCAN14.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    scan_last_char3:far
  12.     extrn    compare1:far
  13. .list
  14. ;----------------------------------------------------------------------------
  15. comment 
  16. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SEARCH  )
  17. SCAN_LAST_STR1 -  find last match of string in buffer, case match
  18. ;
  19. ; inputs:    ES:[DI] pointing to area to be searched
  20. ;                CX  length of search area
  21. ;            DS:[SI] pointing to asciiz match string.
  22. ;            
  23. ; output:    if flags set to "je"  ES:[DI+1] = offset of match
  24. ;            if carry - no match
  25. ;            registers cx,si modified
  26. ;            
  27. ; note:      case of strings must also match.
  28. ;* * * * * * * * * * * * * *
  29. 
  30.  
  31.     PUBLIC    SCAN_LAST_STR1
  32. SCAN_LAST_STR1    PROC    FAR
  33.     lodsb
  34. sls_lp:    call    scan_last_char3        ;find last char
  35.     jne    sls_exit        ;jmp if char not found
  36.     apush    cx,si,di
  37.     add    di,2
  38.     sub    cx,2
  39.     call    compare1
  40.     apop    di,si,cx
  41.     jcxz    sls_exit        ;jmp if no more data
  42.     jne    sls_lp            ;jmp if no match    
  43. sls_exit:
  44.     retf
  45. SCAN_LAST_STR1    ENDP
  46.  
  47. LIBSEG    ENDS
  48.     end
  49.