home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
dskutl
/
fix_disk.arc
/
DISKINFO.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-01-01
|
11KB
|
273 lines
PAGE ,132
TITLE Disk Information Program, Version 2.01 01-Jan-1987
;
; Written By Steven Georgiades
;
; If you are using this program and find it of value, your
; contribution in any amount ($5.00 suggested) will be greatly
; appreciated. Makes checks payable to Steven M. Georgiades.
; Thank you.
;
; If you have any questions or comments about this or any other
; SMG program, write to me at the following address:
;
; Steven M. Georgiades
; 701-H South Hayward Street
; Anaheim, CA 92804
;
CODE SEGMENT BYTE 'CODE'
ASSUME CS:CODE,DS:CODE,ES:CODE
ORG 5CH
FCB LABEL BYTE
ORG 100H
START: JMP DISKINFO
DATASEC DW ?
SIGNON DB "Disk Information Program, Version 2.01",13,10
DB "SMG Software",13,10
DB "(C) Copyright 1987 Steven M. Georgiades",13,10,10,"$"
DISKINFO: PUSH AX ; Save Parameter Indicator
MOV AH,9 ; Output Sign-On Message
MOV DX,OFFSET SIGNON
INT 21H
POP AX ; Restore Parameter Indicator
CMP AL,0 ; If Invalid Parameter, Error
JE DRVOK
MOV AH,9 ; Output INVALID DRIVE Message
MOV DX,OFFSET ERRMSG
INT 21H
MOV AX,4C01H ; Exit
INT 21H
DRVOK: MOV AL,FCB ; Get Drive Number
DEC AL
CMP AL,0 ; If Default,
JGE SAVEDRV
MOV AH,19H ; Determine Default Drive
INT 21H
SAVEDRV: MOV DL,AL ; Indicate Drive Letter
ADD DL,'A'
MOV INFO01[22],DL
MOV CX,1 ; Read Boot Record of Drive
XOR DX,DX
MOV BX,OFFSET BOOTREC
INT 25H
POPF
MOV SI,OFFSET OEMSTR ; Copy OEM Name & Version
MOV DI,OFFSET INFO[22]
MOV CX,8
REP MOVSB
MOV AX,SECSIZE ; Convert Bytes/Sector
MOV DI,OFFSET INFO02[9]
CALL DEC4OUT
CALL STRIP0
MOV AL,CLSTSEC ; Convert Sectors/Cluster
XOR AH,AH
MOV DI,OFFSET INFO03[9]
CALL DEC4OUT
CALL STRIP0
MOV BX,SECSIZE ; Convert Bytes/Cluster
MUL BX
MOV DI,OFFSET INFO03[31]
CALL DEC4OUT
CALL STRIP0
MOV AX,TRKSEC ; Convert Sectors/Track
MOV DI,OFFSET INFO04[9]
CALL DEC4OUT
CALL STRIP0
MOV AX,HEADCNT ; Convert Number of Heads
MOV DI,OFFSET INFO05[9]
CALL DEC4OUT
CALL STRIP0
MOV AX,TOTSEC ; Convert Total Sectors
MOV DI,OFFSET INFO06[31]
CALL DEC5OUT
CALL STRIP0
MOV DX,AX ; Calculate Total Data Sectors
MOV AX,RESVSEC ; Convert Reserved Sectors
MOV DI,OFFSET INFO07[31]
CALL DEC5OUT
CALL STRIP0
SUB DX,AX
MOV AX,FATSEC ; (Calculate Total FAT Sectors)
MOV BL,FATCNT
XOR BH,BH
PUSH DX
MUL BX
POP DX
MOV DI,OFFSET INFO08[31] ; Convert Total FAT Sectors
CALL DEC5OUT
CALL STRIP0
SUB DX,AX
MOV AX,DIRCNT ; (Calculate DIR Sectors)
MOV CL,5
SHL AX,CL
MOV BX,SECSIZE
PUSH DX
XOR DX,DX
DIV BX
OR DX,DX
JZ NOROUND
INC AX
NOROUND: POP DX
MOV DI,OFFSET INFO09[31] ; Convert DIR Sectors
CALL DEC5OUT
CALL STRIP0
MOV DI,OFFSET INFO15[40] ; Convert DIR Sectors Again
CALL DEC2OUT
CALL STRIP0
SUB DX,AX
MOV DATASEC,DX
MOV AX,DX ; Convert Total Data Sectors
MOV DI,OFFSET INFO11[31]
CALL DEC5OUT
CALL STRIP0
MOV AX,DATASEC ; Convert Total Data Clusters
XOR DX,DX
MOV BL,CLSTSEC
XOR BH,BH
DIV BX
MOV DI,OFFSET INFO12[31]
CALL DEC5OUT
CALL STRIP0
CMP AX,4079 ; Convert FAT Entry Size
MOV AX,12
JLE FATOK
MOV AX,16
FATOK: MOV DI,OFFSET INFO14[29]
CALL DEC2OUT
MOV AX,DATASEC ; Convert Total Data Bytes
MOV BX,SECSIZE
MUL BX
MOV DI,OFFSET INFO10[31]
CALL DEC8OUT
CALL STRIP0
MOV AL,FATCNT ; Convert Number of FAT's
ADD AL,'0'
MOV INFO13[21],AL
MOV AX,FATSEC ; Convert FAT Sectors
MOV DI,OFFSET INFO14[6]
CALL DEC2OUT
CALL STRIP0
MOV AX,DIRCNT ; Convert DIR Entries
MOV DI,OFFSET INFO16[17]
CALL DEC4OUT
CALL STRIP0
MOV AH,9 ; Output to Screen
MOV DX,OFFSET INFO
INT 21H
MOV AX,4C00H ; Exit to DOS
INT 21H
STRIP0: CMP BYTE PTR [DI],'0' ; If Char != '0', Done
JNE STRIP1
CMP BYTE PTR [DI+1],'0' ; If Next Char != Numeric, Done
JL STRIP1
CMP BYTE PTR [DI+1],'9'
JG STRIP1
MOV BYTE PTR [DI],' ' ; Change Char to Space
INC DI
JMP SHORT STRIP0 ; Repeat
STRIP1: RET ; Done
DEC2OUT: PUSH AX ; Save Registers
PUSH BX
XOR AH,AH ; Clear AH
MOV BL,10 ; AH=AX%10,AL=AX/10
DIV BL
ADD AX,'00' ; Convert to ASCII
SUB DI,2
MOV [DI],AX ; Store in String
POP BX ; Restore Registers
POP AX
RET ; Done
DEC4OUT: PUSH AX ; Save Registers
PUSH BX
MOV BL,100 ; AH=AX%100,AL=AX/100
DIV BL
XCHG AH,AL ; Convert 2 LSD's
CALL DEC2OUT
XCHG AH,AL ; Convert 2 MSD's
CALL DEC2OUT
POP BX ; Restore Registers
POP AX
RET ; Done
DEC5OUT: PUSH AX ; Save Registers
PUSH BX
PUSH DX
XOR DX,DX ; MSW = 0
MOV BX,10000 ; DX=AX%10000,AX=AX/10000
DIV BX
XCHG AX,DX
CALL DEC4OUT ; Convert 4 LSD's
MOV AL,DL ; Convert MSD to ASCII
ADD AL,'0'
DEC DI
MOV [DI],AL ; Store in String
POP DX ; Restore Registers
POP BX
POP AX
RET ; Done
DEC8OUT: PUSH AX ; Save Registers
PUSH BX
PUSH DX
MOV BX,10000 ; DX=DX:AX%10000,AX=DX:AX/10000
DIV BX
XCHG DX,AX ; Convert 4 LSD's
CALL DEC4OUT
XCHG DX,AX ; Convert 4 MSD's
CALL DEC4OUT
POP DX ; Restore Registers
POP BX
POP AX
RET ; Done
ERRMSG DB "Invalid Drive Specification!",7,13,10,"$"
INFO DB "OEM Name and Version: XXXXXXXX",13,10,10
INFO01 DB "Information for Drive X:",13,10
INFO02 DB " xxxx Bytes/Sector",13,10
INFO03 DB " xxxx Sectors/Cluster (xxxx Bytes/Cluster)",13,10
INFO04 DB " xxxx Sectors/Track",13,10
INFO05 DB " xxxx Heads on Disk",13,10,10
INFO06 DB " Total Disk Capacity is xxxxx Sectors",13,10
INFO07 DB " including xxxxx Boot Sector",13,10
INFO08 DB " xxxxx FAT Sectors",13,10
INFO09 DB " and xxxxx Root DIR Sectors",13,10,10
INFO10 DB " Storage Capacity is xxxxxxxx Bytes",13,10
INFO11 DB " xxxxx Sectors",13,10
INFO12 DB " xxxx Clusters",13,10,10
INFO13 DB " The disk contains x FAT's"
INFO14 DB " of xx sectors each, using xx bit FAT entries",13,10
INFO15 DB " The disk's root directory occupies xx sectors"
INFO16 DB " and can hold xxx files",13,10,"$"
BOOTREC LABEL BYTE
OEMSTR EQU BYTE PTR BOOTREC[3]
SECSIZE EQU WORD PTR BOOTREC[11]
CLSTSEC EQU BYTE PTR BOOTREC[13]
RESVSEC EQU WORD PTR BOOTREC[14]
FATCNT EQU BYTE PTR BOOTREC[16]
DIRCNT EQU WORD PTR BOOTREC[17]
TOTSEC EQU WORD PTR BOOTREC[19]
MEDIA EQU BYTE PTR BOOTREC[21]
FATSEC EQU WORD PTR BOOTREC[22]
TRKSEC EQU WORD PTR BOOTREC[24]
HEADCNT EQU WORD PTR BOOTREC[26]
HIDNSEC EQU WORD PTR BOOTREC[28]
CODE ENDS
END START