]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/QCURDIR.ASM
4 title CP
/DOS DosQCurDir mapper
6 buffer
segment word public 'buffer'
7 CurrentDirectoryBuffer db 128 dup(?
)
10 dosxxx
segment byte public 'dos'
11 assume
cs:dosxxx
,ds:nothing
,es:nothing
,ss:nothing
13 ;**********************************************************************
17 ;* FILE NAME: dos036.asm
21 ;* push word drive number (0=default, 1=a, etc.)
22 ;* push@ other dirpath
23 ;* push@ other dirpathlen
27 ;* MODULES CALLED: PC-DOS Int 21h, ah=47h, get current directory
29 ;*********************************************************************
38 BufferLengthPtr dd ?
; directory path buffer length pointer
39 BufferPtr dd ?
; directory path buffer pointer
40 Drive dw ?
; driver number
46 Enter Dosqcurdir
; push registers
48 mov ax,seg buffer
; set temporary buffer to receive
49 mov ds,ax ; dircetory path information
51 mov si,offset buffer
:CurrentDirectoryBuffer
52 mov dx,[bp].drive
; set driver number
55 int 21h
; get directory path information
56 jc ErrorExit
; check for error
62 ; next calculate the size of the path name just received
64 mov di,offset buffer
:CurrentDirectoryBuffer
66 mov al,0 ; look for the non-ascii chara
67 cld ; in the buffer indciates the
68 repne scasb ; end of the path.
71 sub dx,cx ; calculate actual path length
73 les di,[bp].BufferLengthPtr
; set path buffer lenght pointer
75 mov cx,es:[di] ; check for directory path
77 cmp cx,dx ; compare with needed length
78 jnc HaveThePathLength
; branch if length is ok
80 mov ax,8 ; else, set error code
81 jmp ErrorExit
; return
85 mov es:[di],dx ; return path length
87 les di,[bp].BufferPtr
; prepare to move directory path name
89 mov si,offset buffer
:CurrentDirectoryBuffer
91 rep movsb ; copy dir path to return buffer
93 sub ax,ax ; set good return
97 ret size
str - 6 ; return