summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/QFSINFO.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/MAPPER/QFSINFO.ASM')
-rw-r--r--v4.0/src/MAPPER/QFSINFO.ASM136
1 files changed, 136 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/QFSINFO.ASM b/v4.0/src/MAPPER/QFSINFO.ASM
new file mode 100644
index 0000000..fe0fdba
--- /dev/null
+++ b/v4.0/src/MAPPER/QFSINFO.ASM
@@ -0,0 +1,136 @@
1page 80,132
2
3title CP/DOS DosQFsInfo mapper
4
5buffer segment word public 'buffer'
6
7clsdr40 dw ?
8avlcls40 dw ?
9secalc40 dw ?
10bytsec40 dw ?
11
12buffer ends
13
14dosxxx segment byte public 'dos'
15 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
16;
17; ************************************************************************* *
18; *
19; * MODULE: DosQFsInfo
20; *
21; * FILE NAME: DOS040.ASM
22; *
23; * FUNCTION: This module will return the information for a file
24; * system device.
25; *
26; * CALLING SEQUENCE:
27; *
28; * PUSH WORD DriveNumber ; Drive Number
29; * PUSH OTHER FSInfoLevel ; File system info required
30; * PUSH@ OTHER FSInfoBuf ; File system info buffer
31; * PUSH WORD FSInfoBufSize ; file system info buffer size
32; * Call DosQFsInfo
33; *
34; *
35; * RETURN SEQUENCE:
36; *
37; * IF ERROR (AX not = 0)
38; *
39; * AX = Error Code:
40; *
41; * o Invalid parameter
42; *
43; *
44; * MODULES CALLED: DOS int 21H function 19H
45; * DOS int 25H
46; *
47; *
48; *************************************************************************
49
50 public DosQFsInfo
51 .sall
52 .xlist
53 include macros.inc
54 include error.inc
55 .list
56
57str struc
58old_bp dw ?
59return dd ?
60FSIBS40 dw ? ; info buffer size
61FSIB40 dd ? ; info buffer
62ILL40 dw ? ; info level
63DRNUM40 dw ? ; driver number
64str ends
65
66DosQFsInfo proc far
67 Enter Dosqfsinfo ; push registers
68
69 mov dx,[bp].drnum40 ; load drive number
70 mov ah,036h
71 int 21h ; get disk space
72
73 cmp ax,0ffffh ; check if valid drive number
74 jne valdr40 ; jump if drive is ok
75
76 mov ax,error_invalid_parameter ; esle set error code
77 jmp erret40 ; error return
78
79valdr40:;
80 push ax
81 mov ax,buffer ; set the data segment and save
82 push ax ; space information in the data area
83 pop ds
84 assume ds:buffer
85 mov avlcls40,bx ; save available cluster
86 mov clsdr40,dx ; save clusters per drive
87 mov bytsec40,cx ; save bytes per sector
88 pop ax ;
89 mov secalc40,ax ; save sectors per allocation unit
90 mov ax,[bp].ill40 ; get info level
91 cmp al,01 ; valid level ??
92 je getinfo40 ; jump if valid
93
94 mov ax,error_invalid_parameter ; else invalid parameter
95 jmp erret40 ; error return
96
97getinfo40:;
98 mov ax,[bp].fsibs40 ; get info buffer size address
99 cmp ax,18 ; check if valid
100 jge bufok40 ; jump if valid
101
102 mov ax,error_buffer_overflow ; move buffer not big enough
103 jmp erret40 ; error return
104
105bufok40:;
106 les di,[bp].fsib40 ; get FSI buffer pointer
107 sub ax,ax ; return
108 mov es:[di],ax ; null
109 mov es:[di]+2,ax ; File system ID
110 add di,4 ; set pointer to number of sectors in alloc
111 sub ax,ax ;
112 mov es:[di]+2,ax ; set high order # of sectors in alloc to 0
113 mov ax,secalc40 ;
114 mov es:[di],ax ; store low order # of sectors in alloc
115 add di,4 ; set pointer to number of allocation units
116 mov ax,clsdr40 ; load low order number
117 mov es:[di],ax ; of alloc units
118 sub ax,ax ;
119 mov es:[di]+2,ax ; set high order # of alloc units to 0
120 mov ax,avlcls40 ; load low order number
121 mov es:[di]+4,ax ; of avail alloc units
122 sub ax,ax ;
123 mov es:[di]+6,ax ; set high order # of avail alloc to 0
124 mov ax,bytsec40 ; get number
125 mov es:[di]+8,ax ; of bytes per sector
126 sub ax,ax ; set good return code
127
128erret40:;
129 mexit ; pop registers
130 ret size str - 6 ; return
131
132DosQFsInfo endp
133
134dosxxx ends
135
136 end