From: "A.Appleyard" To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Date: Thu, 11 May 1995 13:10:35 BST Subject: Is there a floppy in the drive? I tried the following version. It gave AH = : 0x80 for no floppy, 6 ("floppy changed") the first time after I put a floppy in, and thereafter 4 ("sector not found / read error") (not 2 = "address mark not found" as Phelps got). And always AL = 0 ("no sectors read"). I then changed the CH and CL lines to:- regs.h.ch = 0x01; regs.h.cl = 0x01; I then got the same for no floppy and for "new floppy", but after that instead of AH=4 I got strange happenings:- One time I got "AH=1, AL=1" and then the system locked tight. Another time the screen cleared, and as I took the floppy out the system rebooted spontaneously. It thus seems that "here be dragons" if I try to poke about in the floppy system myself. #include #include #include #define uns unsigned _go32_dpmi_registers cb_regs; /*-----*//* conventional memory:- */ class c_mem {public: _go32_dpmi_seginfo x; inline c_mem(int nbytes){x.size=nbytes; _go32_dpmi_allocate_dos_memory(&x);}; inline ~c_mem(){_go32_dpmi_free_dos_memory(&x);};}; /*-----*/ class c_byte_addr; /*-----*/ class c_byte {public: uns int addr; inline c_byte_addr&adr();}; /*-----*/ class c_byte_addr {public: uns int addr; inline c_byte_addr(uns int Addr=0){addr=Addr;}; inline c_byte_addr(c_mem m){addr=m.x.rm_segment*16+m.x.rm_offset;};}; /*-----*/ int main() {char disk_buffer[1024]; _go32_dpmi_registers regs; c_mem XYZ(4096); c_byte_addr buf(XYZ); regs.h.ah = 0x02; /* BIOS disk read */ regs.h.al = 0x01; /* read one sector */ regs.h.ch = 0x00; /* track zero?? */ regs.h.cl = 0x00; /* sector zero?? */ regs.h.dh = 0x00; /* head zero?? */ regs.h.dl = 0x00; /* drive A?? */ regs.x.bx = buf.addr; /* pointer to buffer???? */ regs.x.es = 0; regs.x.ss = regs.x.sp = 0; _go32_dpmi_simulate_int(0x13, ®s); /* call BIOS function */ printf("AH=0x%02x, %1d sectors transferred\n",regs.h.ah,regs.h.al);}