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

  1.     page    66,132
  2. ;******************************* SCAN10.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    strlen2:far
  12. .list
  13. comment 
  14. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SEARCH  )
  15. ;SCAN_LAST_CHAR1 - scan asciiz string for last match, case match
  16. ;  inputs: es:di = asciiz string
  17. ;             al = character to search for
  18. ;
  19. ;  output:  registers di,cx are updated
  20. ;           if flags in "je" state then match was found at es:[di+1]
  21. ;
  22. ;           if flags in 'jne' state then no match was found
  23. ;                  cx=0 and es:di point at start of buffer
  24. ;           direction flag = CLD state
  25. ;
  26. ;* * * * * * * * * * * * * *
  27. 
  28.  
  29.     PUBLIC    SCAN_LAST_CHAR1
  30. SCAN_LAST_CHAR1    PROC    FAR
  31.     push    ds
  32.     push    es
  33.     pop    ds
  34.     call    strlen2
  35.     pop    ds
  36.  
  37.     std
  38.     add    di,cx
  39.     dec    di
  40.     repne    scasb
  41.     cld
  42.     retf
  43. SCAN_LAST_CHAR1    ENDP
  44. ;------------------------------------------------------------------------
  45.  
  46. LIBSEG    ENDS
  47. ;;    end
  48.