home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / DISKG.ASM < prev    next >
Assembly Source File  |  1994-12-03  |  2KB  |  63 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.     extrn    find_home_path:far
  12.     extrn    scan_last_char3:far
  13.     extrn    strlen1:far
  14. .list
  15. ;----------------------------------------------------------------------------
  16.     extrn    strlen2:far
  17.     extrn    lib_info:byte
  18. comment 
  19. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  DISK   )
  20. INSERT_HOME_PATH - find the full path and filename of the executing program
  21. ;
  22. ; inputs:    ds:si = pointer to file name asciiz string.
  23. ;            es:di = pointer to buffer for constructed path.
  24. ; output:    none 
  25. ;
  26. ; note:      this function is useful to access files with are located
  27. ;            with an executable.  The path of the executable file is
  28. ;            inserted in front of the file name and placed in the buffer
  29. ;            provided.  If the disk drive letter is found, it is also
  30. ;            included.
  31. ;* * * * * * * * * * * * * *
  32. 
  33.     public    INSERT_HOME_PATH
  34. INSERT_HOME_PATH    PROC    FAR
  35.     apush    ax,bx,cx,si,di,ds,es
  36.     apush    si,di
  37.     call    find_home_path        ;returns es:di = ptr cx=length
  38.     push    di            ;save path start
  39.     mov    al,'\'
  40.     call    scan_last_char3
  41.     mov    bx,di            ;save ptr to last '\'
  42.     pop    si            ;get ptr to path
  43.     pop    di            ;get storage buffer offset
  44.     jcxz    ihp_1            ;jmp if zero length path
  45. ihp_lp:    mov    al,byte ptr es:[si]
  46.     mov    byte ptr ds:[di],al
  47.     inc    si
  48.     inc    di
  49.     cmp    si,bx            ;move done?
  50.     jbe    ihp_lp            ;loop till done
  51. ihp_1:    push    ds
  52.     pop    es
  53.     pop    si            ;get filename asciiz
  54.     call    strlen1
  55.     rep    movsb
  56. ihp_exit:
  57.     apop    es,ds,di,si,cx,bx,ax
  58.     retf
  59. INSERT_HOME_PATH    ENDP
  60.  
  61. LIBSEG    ENDS
  62. ;;    end
  63.