summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/F_CLOSE.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/MAPPER/F_CLOSE.ASM')
-rw-r--r--v4.0/src/MAPPER/F_CLOSE.ASM104
1 files changed, 104 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/F_CLOSE.ASM b/v4.0/src/MAPPER/F_CLOSE.ASM
new file mode 100644
index 0000000..2da07b5
--- /dev/null
+++ b/v4.0/src/MAPPER/F_CLOSE.ASM
@@ -0,0 +1,104 @@
1page 80,132
2
3title CP/DOS DosFindClose mapper
4
5 include find.inc
6
7
8FindSegment segment word public 'find'
9
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
13; use.
14 extrn FindDTAs:word
15 extrn FindHandles:word
16
17FindSegment ends
18
19
20; ************************************************************************* *
21; *
22; * MODULE: DosFindClose
23; *
24; * FUNCTION: Close Find Handle
25; *
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.
30; *
31; * CALLING SEQUENCE:
32; *
33; * PUSH WORD DirHandle ; Directory search handle
34; * CALL DosFindClose
35; *
36; *
37; * RETURN SEQUENCE:
38; *
39; * IF ERROR (AX not = 0)
40; *
41; * AX = Error Code:
42; *
43; *
44; * MODULES CALLED: None
45; *
46; *************************************************************************
47
48 public DosFindClose
49 .sall
50 .xlist
51 include macros.inc
52 .list
53
54str struc
55old_bp dw ?
56return dd ?
57DirHandle dw ? ; dirctory search handle
58str ends
59
60
61dosxxx segment byte public 'dos'
62 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
63
64DosFindClose proc far
65 Enter DosFindClose ; push registers
66
67 mov ax,seg FindSegment ; get address to our data
68 mov ds,ax
69 assume ds:FindSegment
70
71; Close the handle
72
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.
76
77; Special Logic to handle DirHandle = 1
78
79 mov si,[bp].DirHandle ; get directory hanlde
80 cmp si,1 ; handle = 1??
81 jne CheckForClose ; branch if not
82
83 mov si,offset FindSegment:FindHandles
84
85CheckForClose:
86 test ds:[si],OpenedHandle ; handle is open ??
87 jnz OkToClose ; go and close if it is open
88
89 mov ax,6 ; else load error code
90 jmp ErrorExit ; return
91
92OkToClose:
93 and ds:[si],not OpenedHandle ; set close flag
94 xor ax,ax ; set good return code
95
96ErrorExit:
97 mexit ; pop registers
98 ret size str - 6 ; return
99
100DosFindClose endp
101
102dosxxx ends
103
104 end