1 ; SCCSID = @(#)dinfo.asm 1.1 85/04/10
2 ; SCCSID = @(#)dinfo.asm 1.1 85/04/10
3 TITLE DISK_INFO
- Internal Get Disk Info
5 ; Low level routine for returning disk drive information from a local
10 ; Modification history:
12 ; Created: ARR 30 March 1983
16 ; get the appropriate segment definitions
21 CODE SEGMENT BYTE PUBLIC 'CODE'
22 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
34 i_need EXTERR_LOCUS
,BYTE
41 Break <DISK_INFO
-- Get Disk Drive Information
>
44 ; [THISCDS] Points to the Macro List Structure of interest
45 ; (It MAY NOT be NUL, error not detected)
47 ; Get Interesting Drive Information
49 ; DX = Number of free allocation units
50 ; BX = Total Number of allocation units on disk
52 ; AL = Sectors per allocation unit
54 ; Carry set if error (currently user FAILed to I 24)
55 ; Segs except ES preserved, others destroyed
57 procedure DISK_INFO
,NEAR
58 DOSAssume
CS,<DS>,"Disk_Info"
64 transfer NET_DISK_INFO
66 MOV AX,(multNET
SHL 8) OR 12
72 MOV [EXTERR_LOCUS
],errLOC_Disk
74 invoke FATREAD_CDS
; perform media check.
77 invoke UNPACK
; Get first FAT sector into CURBUF
81 MOV AH,[SI].bufinsiz
; get FAT ID BYTE
83 MOV CX,ES:[BP.dpb_max_cluster
]
85 ; Examine the current free count. If it indicates that we have an invalid
86 ; count, do the expensive calculation.
88 MOV DX,ES:[BP.dpb_free_cnt
] ; get free count
89 CMP DX,-1 ; is it valid?
92 ; Check to see if it is in a reasonalbe range. If so, trust it and return.
93 ; Otherwise, we need to blast out an internal error message and then recompute
96 CMP DX,CX ; is it in a reasonable range?
97 JB GotVal
; yes, trust it.
98 fmt TypInt
,LevLog
,<"Internal error: MaxClus <= FreeClus\n">
108 INC BX ; Next cluster
110 DEC BX ; BX was next cluster. Convert to
113 MOV AL,ES:[BP.dpb_cluster_mask
]
114 INC AL ; Sectors/cluster
115 MOV CX,ES:[BP.dpb_sector_size
] ; Bytes/sector
116 MOV ES:[BP.dpb_free_cnt
],DX
122 ; We have correctly computed everything previously. Load up registers for
125 GotVal: MOV BX,CX ; get cluster count