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

  1.     page    66,132
  2. ;******************************** DISKB.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. .list
  12. ;----------------------------------------------------------------------------
  13.     extrn    strlen2:far
  14.     extrn    lib_info:byte
  15. comment 
  16. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  DISK   )
  17. FIND_HOME_PATH - find the full path and filename of the executing program
  18. ;
  19. ; inputs:    nothing
  20. ; output:    ES:[DI] = pointer to the the name of the executing program
  21. ;                CX  = length of path string.
  22. ;
  23. ;  note:     The filename returned is an ASCIIZ string, and may be mixed
  24. ;            upper- and lower-case characters.
  25. ;            
  26. ;* * * * * * * * * * * * * *
  27. 
  28.     public    FIND_HOME_PATH
  29. FIND_HOME_PATH    PROC    FAR
  30.    mov    es,lib_info.psp_seg
  31.    CLD
  32.    APUSH   AX,DS
  33.    MOV       ES,WORD PTR ES:[002Ch]    ;get enviorn seg
  34.    XOR     DI,DI
  35.    XOR     AL,AL
  36.    MOV     CX,0FFFFh
  37. FHP_1:
  38.    REPNZ   SCASB            ;look for name
  39.    SCASB
  40.    JNZ     FHP_1
  41.    ADD     DI,2
  42.    PUSH    ES
  43.    POP     DS
  44.    CALL    strlen2
  45.    APOP    DS,AX
  46.    RETF
  47. FIND_HOME_PATH    ENDP
  48.  
  49. LIBSEG    ENDS
  50. ;;    end
  51.