home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / SOFTWARE / LIBS / PMC101.ZIP / LIBSRC.ZIP / STRSTR.ASM (.txt) < prev    next >
Assembly Source File  |  1994-06-14  |  966b  |  65 lines

  1. .386p
  2. locals
  3.  
  4. extrn   STRLEN:near
  5.  
  6. public  STRSTR
  7.  
  8. _TEXT           segment byte public use32 'CODE'
  9. assume  cs:_TEXT
  10.  
  11. STRSTR:
  12.         push ebx esi edi
  13.         cld
  14.  
  15.         mov edi,[esp+4+12+04h]
  16.         push edi
  17.         call STRLEN
  18.         or eax,eax
  19.         jz short @@00
  20.  
  21.         mov ebx,eax
  22.         mov esi,[esp+4+12+00h]
  23.         push esi
  24.         call STRLEN
  25.  
  26.         sub ebx,eax
  27.         jc short @@01
  28.  
  29.         lea edx,[eax-1]
  30.         or eax,eax
  31.         mov eax,edi
  32.         jz short @@00
  33.  
  34.         lodsb
  35. @@01l:
  36.         mov ecx,ebx
  37.         jecxz short @@01
  38.  
  39.         repne scasb
  40.         jne short @@01
  41.         mov ebx,ecx
  42.  
  43.         mov ecx,edx
  44.         jecxz short @@02
  45.  
  46.         push esi edi
  47.         repe cmpsb
  48.         pop edi esi
  49.         jne @@01l
  50.  
  51. @@02:
  52.         lea eax,[edi-1]
  53.         jmp short @@00
  54.  
  55. @@01:
  56.         xor eax,eax
  57.  
  58. @@00:
  59.         pop edi esi ebx
  60.         ret 08h
  61.  
  62. _TEXT           ends
  63. end
  64.  
  65.