From: hars AT dutch DOT nl Message-Id: <199612102145.QAA19099@delorie.com> To: djgpp AT delorie DOT com Date: 10 Dec 1996 13:29:02 +0100 Subject: DOS/BIOS direct Floppy access Hello all, I am trying to check the floppy drive. I copied some source(many thanks to the author) so I can test this. There are still some things going wrong although as far as I can tell the code is OK. I try to write C++ as much as possible :) The code compiles and runs. The program returns floppy status 1. This means a i ncorrect floppy command??. Can some one shine some light on this problem. If I get this to work I want to expand this to reading sectors and displaying t he sector, especially the 1e and 2e FAT, which is a 12 bits FAT. Can some on gi ve me some hints. I will also look in the mail-archives. Grtx & thnx Roy #include #include #include #include #include int get_floppy_drive(int) ; main() { int test_drive = 0x00 ; // drive A int floppy_status ; clrscr() ; while((floppy_status = get_floppy_drive(test_drive)) == 6 ) ; cout << "floppy status = " << floppy_status << endl ; if (!floppy_status) { cout << "Able to access disk. " << endl ; } else cout << "Unable to access disk. " << endl ; return 0 ; } int get_floppy_drive(int test_drive) { _go32_dpmi_registers registers ; registers.h.ah = 0x02 ; // bios disk read registers.h.al = 0x01 ; // read one sector registers.h.ch = 0x00 ; // track zero registers.h.cl = 0x01 ; // sector 1 registers.h.dh = test_drive ; // drive 0x00=A 0x01=B registers.x.bx = (__tb & 0x0f) ; registers.x.es = (__tb >> 4) ; registers.x.ss = registers.x.sp = 0 ; _go32_dpmi_simulate_int(0x13, ®isters) ; return(registers.h.ah) ; }