summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/CLOSE.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/MAPPER/CLOSE.ASM')
-rw-r--r--v4.0/src/MAPPER/CLOSE.ASM74
1 files changed, 74 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/CLOSE.ASM b/v4.0/src/MAPPER/CLOSE.ASM
new file mode 100644
index 0000000..ee7aa4c
--- /dev/null
+++ b/v4.0/src/MAPPER/CLOSE.ASM
@@ -0,0 +1,74 @@
1;0
2page 80,132
3
4title CP/DOS DosClose mapper * * *
5
6dosxxx segment byte public 'dos'
7 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
8;
9; ************************************************************************* *
10; *
11; * MODULE: DosClose
12; *
13; * FUNCTION: This module will close a file or a device.
14; *
15; * CALLING SEQUENCE:
16; *
17; * PUSH WORD FileHandle ; File Handle or device handle
18; * CALL DosClose
19; *
20; * RETURN SEQUENCE:
21; *
22; * IF ERROR (AX not = 0)
23; *
24; * AX = Error Code:
25; *
26; * o Invalid file handle
27; *
28; *
29; * MODULES CALLED: DOS int 21H function 3EH
30; *
31; *
32; *************************************************************************
33
34 public DosClose
35 .sall
36 .xlist
37 include macros.inc
38 .list
39
40str struc
41old_bp dw ?
42return dd ?
43FileHandle dw ? ; file or device handle
44str ends
45
46
47DosClose proc far
48 Enter DosClose ; push registers
49
50; Only files are closed. Devices are not closed, since OPEN creates
51; a dummy device handle without actually openning the device.
52
53 mov bx,[bp].FileHandle ; load the handle
54 mov ax,bx ; check for device handle
55 neg ax ; if device handle, return
56 jns GoodExit ; do not close the device
57
58FileCloseRequest:
59 mov ax,03e00h ; load opcode
60 int 21h ; close the file
61 jc ErrorExit ; return if error
62
63GoodExit:
64 sub ax,ax ; else, set good return code
65
66ErrorExit:
67 mexit ; pop registers
68 ret size str - 6 ; return
69
70DosClose endp
71
72dosxxx ends
73
74 end