home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / SOFTWARE / LIBS / PMC101.ZIP / LIBSRC.ZIP / GETEXE.ASM (.txt) < prev    next >
Assembly Source File  |  1994-06-29  |  1KB  |  64 lines

  1. .386p
  2. locals
  3.  
  4. _DATA           segment dword public use32 'DATA'
  5. _DATA           ends
  6. _BSS            segment dword public use32 'BSS'
  7. _BSS            ends
  8.  
  9. DGROUP          group   _DATA, _BSS
  10. assume  cs:_TEXT, ds:DGROUP
  11.  
  12. extrn   __lowbufptr:dword
  13. extrn   _envsel:word
  14.  
  15. public  GETEXE
  16.  
  17. _TEXT           segment byte public use32 'CODE'
  18. assume  cs:_TEXT, ds:DGROUP
  19.  
  20. GETEXE:
  21.         push esi edi
  22.         cld
  23.  
  24.         mov es,_envsel
  25.         xor edi,edi
  26.  
  27.         or ecx,-1
  28.         xor al,al
  29. @@00l:
  30.         repne scasb
  31.         scasb
  32.         jne @@00l
  33.  
  34.         add edi,2
  35.         mov esi,edi
  36.  
  37.         or ecx,-1
  38.         repne scasb
  39.         not ecx
  40.  
  41.         mov edi,__lowbufptr
  42.         mov ax,es
  43.         mov dx,ds
  44.         mov ds,ax
  45.         mov es,dx
  46.         mov eax,edi
  47.  
  48.         mov dl,cl
  49.         shr ecx,2
  50.         rep movsd
  51.         mov cl,dl
  52.         and cl,3
  53.         rep movsb
  54.  
  55.         mov cx,es
  56.         mov ds,cx
  57.  
  58.         pop edi esi
  59.         ret
  60.  
  61. _TEXT           ends
  62. end
  63.  
  64.