Page 1 of 1

Int 13h returns controller failure on some hardware?

Posted: Tue Apr 06, 2021 7:54 am
by clementttttttttt
So, my own os's bootloader is suddenly saying controller failure, when it was proved to be working earlier. I initially suspected that it's the drive's problem, but after several tries with different drives, the result is the same. I did not modify the bootloader in anyway in that time period.

Re: Int 13h returns controller failure on some hardware?

Posted: Tue Apr 06, 2021 8:36 am
by MichaelPetch
Hard to say without seeing the code. You should retry 3 times on failure. You shouldn't read/write across a cylinder boundary (assuming you are on a controller that support multitrack reads/writes), you should not read/write a series of sectors across a 64KiB DMA boundary in memory (Don't read/write data across the physical addresses 0x10000, 0x20000, 0x30000).

Are you using Int 13h AH=2h for reads or Int 21h/AH=42h? Are you accessing the correct drive number?

Re: Int 13h returns controller failure on some hardware?

Posted: Tue Apr 06, 2021 8:53 am
by clementttttttttt
I'm using 42h, and dl has been preserved.

Re: Int 13h returns controller failure on some hardware?

Posted: Tue Apr 06, 2021 9:04 am
by MichaelPetch
Do you have a git repository or something similar where we can look at the code? There is likely something amiss in your code or it is making assumptions that it shouldn't be making. There are suggestions that with some BIOSes that ES must match the segment in a DAP packet (although I haven't seen that on recent hardware, or on hardware I have used in the past). Are you sure the drive you are accessing supports Int 13h MS extensions (ie AH=42h) on the BIOS you are using?

Virtual environments are far more forgiving than real systems and often assumptions made made not apply to real environments.

Re: Int 13h returns controller failure on some hardware?

Posted: Tue Apr 06, 2021 9:09 am
by MichaelPetch
I assume that you are booting as hard drive or hard drive emulated media (and not floppy drive or floppy drive emulated media) on real hardware since you are apparently able to use extended BIOS extensions. If you were booting as floppy emulated media especially on USB media I could think of another issue.