]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/F_CLOSE.ASM
3 title CP
/DOS DosFindClose mapper
8 FindSegment
segment word public 'find'
10 ; We will use the offset into the segment 'FindSegment' as the handle that we
11 ; return and use in subsequent FindNext and FindClose calls. The data that is
12 ; in the word is the offset into the 'FindSegment' to the DTA that we should
15 extrn FindHandles
:word
20 ; ************************************************************************* *
22 ; * MODULE: DosFindClose
24 ; * FUNCTION: Close Find Handle
26 ; * FUNCTION: This module closes the directory handle used by CP/DOS
27 ; * in a find first/find next search. Since PC/DOS does not
28 ; * use directory handles it will simply return to the caller
29 ; * removing the parameters passed on the stack.
33 ; * PUSH WORD DirHandle ; Directory search handle
39 ; * IF ERROR (AX not = 0)
44 ; * MODULES CALLED: None
46 ; *************************************************************************
57 DirHandle dw ?
; dirctory search handle
61 dosxxx
segment byte public 'dos'
62 assume
cs:dosxxx
,ds:nothing
,es:nothing
,ss:nothing
65 Enter DosFindClose
; push registers
67 mov ax,seg FindSegment
; get address to our data
73 ; The 'DirHandle' that the mapper returns from FindFirst, is the offset into
74 ; 'FindSegment' of the pointer to the DTA for that Handle. The 08000h bit
75 ; of the pointer is used to indicate that the handle is open. Reset the bit.
77 ; Special Logic to handle DirHandle = 1
79 mov si,[bp].DirHandle
; get directory hanlde
80 cmp si,1 ; handle = 1??
81 jne CheckForClose
; branch if not
83 mov si,offset FindSegment
:FindHandles
86 test ds:[si],OpenedHandle
; handle is open ??
87 jnz OkToClose
; go and close if it is open
89 mov ax,6 ; else load error code
90 jmp ErrorExit
; return
93 and ds:[si],not OpenedHandle
; set close flag
94 xor ax,ax ; set good return code
98 ret size
str - 6 ; return