Board index » delphi » REQ: Code to count the number of Floppy-Drives

REQ: Code to count the number of Floppy-Drives

Hi together,
can anybody give me some support for my little programming-problem.
I'm looking for a code (Turbo Pascal 6.0 for DOS) to get the number of
active Floppy-Diskdrives, no matter wether a disk is in or not. The inbuild
commands like DISKFREE or anything else only work when a disk is in the
drive.

Please send me a code.

Greetings from Germany
Volker

 

Re:REQ: Code to count the number of Floppy-Drives


This is a multi-part message in MIME format.

--------------6B5A309077F2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote
V. Brockhoff wrote:

> Hi together,
> can anybody give me some support for my little programming-problem.
> I'm looking for a code (Turbo Pascal 6.0 for DOS) to get the number of
> active Floppy-Diskdrives, no matter wether a disk is in or not. The inbuild

U have to read drive status byte from CMOS to get number and type
of active floppy drives. Cause CMOS is not normally adressed u have to
use port command. To read from cmos use port 70 to ask whadda ya want
and youll find the answer in the port 71. Heres code

O.F.

--------------6B5A309077F2
Content-Type: text/plain; charset=us-ascii; name="Drive.pas"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Drive.pas"

Program drive;
Var  drive_status_byte,
     hi_bits,
     lo_bits             : Byte;

 Begin
  port[$70]:=$10; {dear CMOS i want a byte from address 10h}
  drive_status_byte:=port[$71]; {OK. OK. ill you get it}
  hi_bits:=drive_status_byte Shr 4; {high bits indicate first FDD}
  lo_bits:=drive_status_byte And 15; {low bits indicate second FDD}
  Writeln(hi_bits,' ',lo_bits);
End.

{Writes 2 numbers from 0 to 4. 0 means - No drive 1 means 360, 2 means
1,2 M, 3 means 720K, 4 means 1,44M}
{Dunno how bout 2,88 Mb fdd-s, maybe 5, maybe uses some extendad
CMOS area, maybe special drivers never seen one}

--------------6B5A309077F2--

Other Threads