home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
USCX
/
ASMUT-03.ZIP
/
GETSP.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-05-01
|
4KB
|
162 lines
; GETSPACE
;
; THIS ROUTINE COMPUTES USUABLE SPACE
; AVAILABLE ON
; DISKETTE OR HARD DISK AND IS CALLED
; FROM BASIC
;
; WRITTEN BY HOWARD GLOSSER
;
CSEG SEGMENT
GETSPACE PROC FAR
ASSUME CS:CSEG
PUSH BP
MOV BP,SP
MOV BX,[BP]+6
MOV DI,2[BX]
MOV CX,8
MOV AL,' '
CLD
REP STOSB
MOV BX,[BP+8]
MOV SI,2[BX]
MOV AX,[SI]
AND AL,0DFH
CMP AL,41H
JGE CKVER
JMP EXITSPC
CKVER:
PUSH AX
MOV AH,30H
INT 21H
XCHG AL,AH
CMP AX,0200H
JB SYSDRV
JMP SPACE20
SYSDRV:
MOV AH,19H
INT 21H
POP DX
XOR DL,40H
DEC DL
CMP AL,DL
JE GETFAT
PUSH AX
PUSH DX
MOV AH,0EH
INT 21H
POP CX
POP DX
INC CL
CMP CL,AL
JBE GETFAT
JMP EXITSPC
GETFAT:
PUSH DX
MOV AH,1BH
INT 21H
POP AX
PUSH DX
XCHG AL,DL
MOV AH,0EH
INT 21H
POP DX
MOV DI,BX
MOV AL,BYTE PTR[DI]
MOV SI,CX
CMP AL,0FEH
JE SNGLSIDE
SHL SI,1
SNGLSIDE:
ADD DI,3
MOV CX,DX
XOR AX,AX
XOR DX,DX
;WORD
PUSH AX
PUSH DX
SCANFAT:
MOV AX,[DI]
INC DI
AND AX,0FFFH
CMP AX,00H
JNE NEXTENT
CLC
POP DX
POP AX
ADD AX,SI
JNC STRSPC1
INC DX
STRSPC1:
PUSH AX
PUSH DX
NEXTENT:
DEC CX
JCXZ END1
MOV AX,[DI]
ADD DI,2
PUSH CX
MOV CL,4
SHR AX,CL
POP CX
CMP AX,00H
JNE NOTAVAIL
CLC
POP DX
POP AX
ADD AX,SI
JNC STRSPC2
INC DX
STRSPC2:
PUSH AX
PUSH DX
NOTAVAIL:
LOOP SCANFAT
END1:
MOV AX,ES
MOV DS,AX
JMP ENDSPC
SPACE20:
POP DX
XOR DL,40H
MOV AH,36H
INT 21H
CMP AX,0FFFFH
JE EXITSPC
XOR DX,DX
MUL CX
XCHG BX,CX
MUL CX
PUSH AX
PUSH DX
ENDSPC:
MOV BX,[BP]+6
MOV DI,2[BX]
ADD DI,7
POP DX
POP AX
HEXTODEC:
MOV SI,10
PUSH AX
MOV AX,DX
XOR DX,DX
DIV SI
POP CX
PUSH AX
MOV AX,CX
DIV SI
POP SI
OR DL,30H
MOV BYTE PTR[DI],DL
DEC DI
XCHG DX,SI
OR AX,AX
JNZ HEXTODEC
EXITSPC:
POP BP
RET 4
RET
GETSPACE ENDP
CSEG ENDS
END