summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/SMARTDRV/FL13.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/DEV/SMARTDRV/FL13.ASM')
-rw-r--r--v4.0/src/DEV/SMARTDRV/FL13.ASM148
1 files changed, 148 insertions, 0 deletions
diff --git a/v4.0/src/DEV/SMARTDRV/FL13.ASM b/v4.0/src/DEV/SMARTDRV/FL13.ASM
new file mode 100644
index 0000000..6ae1e44
--- /dev/null
+++ b/v4.0/src/DEV/SMARTDRV/FL13.ASM
@@ -0,0 +1,148 @@
1 TITLE Assembler helper routines for FLUSH13
2
3PAGE 58,132
4
5
6memS EQU 1 ; Small model
7?PLM = 0 ; Standard 'C'
8?WIN = 0 ; Not windows
9
10include cmacros.inc
11
12;extern int IOCTLOpen(char *);
13;extern int IOCTLWrite(int,char *,int);
14;extern int IOCTLRead(int,status *,int);
15;extern int IOCTLClose(int);
16
17sBegin CODE
18
19assumes CS, CODE
20assumes DS, DATA
21
22;** IOCTLOpen - Open the indicated device and make sure it's a device
23;
24; ENTRY:
25; Pointer to name of device
26; EXIT:
27; AX = -1 if error, device not opened
28; else AX = handle of open device
29; USES:
30; Standard 'C'
31;
32cProc IOCTLOpen, <PUBLIC>, <si,di,es>
33
34ParmW Nameptr
35
36cBegin
37 mov dx,Nameptr
38 MOV AX,3D02H
39 INT 21H ; Open the device
40 JC NO_DEV_ERR ; No device
41 MOV BX,AX
42 MOV AX,4400H
43 INT 21H ; Make sure it IS a device
44 JC CLOSE_NO_DEV
45 TEST DX,4080H
46 JZ CLOSE_NO_DEV
47 mov ax,bx ; Return the handle
48 jmp short PXDONE
49
50CLOSE_NO_DEV:
51 mov ax,3e00H ; Close
52 int 21H
53NO_DEV_ERR:
54 mov ax,-1
55PXDONE:
56cEnd
57
58;** IOCTLClose - Close the indicated handle
59;
60; ENTRY:
61; Handle
62; EXIT:
63; None
64; USES:
65; Standard 'C'
66;
67cProc IOCTLClose, <PUBLIC>, <si,di,es>
68
69ParmW Handle
70
71cBegin
72 mov bx,Handle
73 MOV AX,3E00H
74 INT 21H ; close the device
75cEnd
76
77;** IOCTLWrite - Perform IOCTLWrite to device handle
78;
79; ENTRY:
80; Handle to open device
81; Pointer to data to write
82; Count in bytes of data to write
83; EXIT:
84; AX = -1 error
85; else AX = input count
86; USES:
87; Standard 'C'
88;
89cProc IOCTLWrite, <PUBLIC>, <si,di,es>
90
91ParmW WHandle
92ParmW WDataPtr
93ParmW WCount
94
95cBegin
96 mov bx,WHandle
97 mov cx,WCount
98 mov dx,WDataPtr
99 MOV AX,4403H ; IOCTL Write
100 INT 21H
101 JC Werr
102 CMP AX,CX
103 JNZ Werr
104 jmp short WDONE
105
106WERR:
107 mov ax,-1
108WDONE:
109cEnd
110
111;** IOCTLRead - Perform IOCTLRead to device handle
112;
113; ENTRY:
114; Handle to open device
115; Pointer to data area to read into
116; Count in bytes of size of data area
117; EXIT:
118; AX = -1 error
119; else AX = input count
120; USES:
121; Standard 'C'
122;
123cProc IOCTLRead, <PUBLIC>, <si,di,es>
124
125ParmW RHandle
126ParmW RDataPtr
127ParmW RCount
128
129cBegin
130 mov bx,RHandle
131 mov cx,RCount
132 mov dx,RDataPtr
133 MOV AX,4402H ; IOCTL Read
134 INT 21H
135 JC Rerr
136 CMP AX,CX
137 JNZ Rerr
138 jmp short RDONE
139
140RERR:
141 mov ax,-1
142RDONE:
143cEnd
144
145
146sEnd CODE
147
148 end