LBA_to_CHS() uses geometry taken from BIOS, but LBA_Transfer() was using the geometry from VBR. This caused "count" variable to underflow over unsigned long, then corrupting the entire DOS memory with the large read. This patch makes LBA_to_CHS() to return the geometry to caller, so that the calculus do always match. Thanks to @ecm-pushbx and @andrewbird for helping to nail this down.
fdkernel
FreeDOS kernel - branch from 2042 SVN 0xFD kernel
The FreeDOS kernel implements the core MS/PC-DOS (R) compatible functions. It is derived from Pat Villani's DOS-C kernel and released under the GPL v2. Please see http://www.freedos.org/ for more details about the FreeDOS (TM) Project. Compiled kernels ready to use (just copy kernel.sys over an existing install) are available at http://www.fdos.org/kernel/testing/git/ - also available are the source archive and fdpkg compatible packages.
This version of the kernel is intended only for 8086+ or 80386+ IBM compatible computers in continuation of the goals of the FreeDOS Project. Please see http://www.fdos.org/kernel for my 0xDC kernel that is work on merging back in some of the original portability aspects and other supported features at the cost of some compatibility with older hardware/software.
Please feel free to email me - PerditionC@gmail.com Jan 2014