Date: Thu, 26 Sep 1996 14:58:30 +0200 (MET DST) From: Mark Habersack Reply-To: grendel AT ananke DOT amu DOT edu DOT pl To: djgpp-workers AT delorie DOT com Subject: biosdisk() Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII This patch allows biosdisk() to read more that 18 sectors at once. I see no reason to put such a restriction. There might be only two things that may cause this modified version to go into trouble: (1) old BIOSes do not support cross-tracks reads. However, AFAIK, this is true for machines with BIOS (AMI) from 1991 and older. (2) DMA transfer buffer cannot exceed 64 KB. Most modern disk drives do not use DMA at all so it is not a problem. I have successfully read 200 sectors at once on following machines: 386DX40 with AMI BIOS (1992) Pentium 133MHz with Award BIOS (1996) and folowing systems (on each of the above machines): Windows 95 Plain DOS 7.00 MS-DOS 6.xx *** /djgpp.201/src/libc/bios/biosdisk.c Mon Oct 9 06:00:00 1995 --- biosdisk.c Thu Sep 26 01:00:04 1996 *************** *** 26,38 **** dos_segment = dos_selector = 0; } ! static void alloc_dos_buffer(void); static void ! alloc_dos_buffer(void) { if (dos_segment) return; ! dos_segment = __dpmi_allocate_dos_memory(18*512/16, &dos_selector); if (dos_segment == -1) { dos_segment = 0; --- 26,38 ---- dos_segment = dos_selector = 0; } ! static void alloc_dos_buffer(unsigned sectors); static void ! alloc_dos_buffer(unsigned sectors) { if (dos_segment) return; ! dos_segment = __dpmi_allocate_dos_memory(sectors*512/16, &dos_selector); if (dos_segment == -1) { dos_segment = 0; *************** *** 80,92 **** } if (xfer) { if (xfer > 18*512) ! return 1; /* bad command */ if (xfer > _go32_info_block.size_of_transfer_buffer) { ! alloc_dos_buffer(); if (dos_segment == 0) ! return 0xbb; /* undefined error */ seg = dos_segment; ofs = 0; } --- 80,94 ---- } if (xfer) { + #if 0 if (xfer > 18*512) ! return 1; /* bad command */ ! #endif if (xfer > _go32_info_block.size_of_transfer_buffer) { ! alloc_dos_buffer(nsects); if (dos_segment == 0) ! return 0xbb; /* undefined error */ seg = dos_segment; ofs = 0; } *************** *** 140,152 **** } if (xfer) { if (xfer > 18*512) ! return 1; /* bad command */ if (xfer > _go32_info_block.size_of_transfer_buffer) { ! alloc_dos_buffer(); if (dos_segment == 0) ! return 0xbb; /* undefined error */ seg = dos_segment; ofs = 0; } --- 142,156 ---- } if (xfer) { + #if 0 if (xfer > 18*512) ! return 1; /* bad command */ ! #endif if (xfer > _go32_info_block.size_of_transfer_buffer) { ! alloc_dos_buffer(_di->nsectors); if (dos_segment == 0) ! return 0xbb; /* undefined error */ seg = dos_segment; ofs = 0; } --------------------------------------------------------------------------- You can't brush me under the carpet, you can't hide me under the stairs, The custodian of your private fears, your leading actor of yesteryear, Who as you crawled out of the alleys of obscurity, sentenced to rejection in the morass of anonymity. You who I directed with a lover's will, you who I let hypnotise the lens. You who I let bathe in the spotlights glare. You who wiped me from your memory like a greasepaint mask, just like a greasepaint mask... -------------------- http://ananke.amu.edu.pl/~grendel -------------------