VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm trying to get my floppy disk controller properly and accurately(except time-based events, like seek times) working. I'm creating a 1.44MB floppy disk, mount it in my emulator and try to get it fully working again.

My source code: https://bitbucket.org/superfury/x86emu/src/69 … ppy.c?at=master

For some reason the floppy errors out (using the Generic Super PC/Turbo XT BIOS with XT-IDE harddisk ROMs. The ATA/IDE device works accurately and without errors. When I try to do anything to the floppy (reading/writing it, using MS-DOS 5.0 dir, echo to file and type (also format fails with a message it's the wrong format for the disk, detecting it as 360KB without /f:1.44 parameter)).

Do I need some NEC µPD765 ROM for this to work with 1.44MB/2MB disk images?

When executing dir/type/copy etc. on the floppy, it errors out with a message that track 0 couldn't be found? My latest additions are the verification on data rates against the floppy disk(failing reads, writes and read ID commands if not matched to the floppy's specifications in it's geometry). Also proper ST3 emulation has been added according to specs on the u765 chip.

Anyone can see what's going wrong? Reads used to work previously(with writes giving corrupted file data).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've fixed some stuff on my floppy disk controller:
https://bitbucket.org/superfury/x86emu/src/51 … ppy.c?at=master

When I try to read an automatically generated 1.44MB floppy I get: "
Sector not found reading drive A
abort retry fail?
".

Also, when trying to format it: "
Insert new diskette for drive A:
and press ENTER when ready...

Checking existing disk format.
Existing format differs from that specified.
Proceed with Format (Y/N)?y
Formatting 1.44M
Invalid media or Track 0 bad - disk unusable.
Format terminated.
Format another (Y/N)?n"

Anyone knows what's going wrong here?

When I run CheckIt! Diagnostics, it executes the first two steps, but skips the write step?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

When trying to read a floppy disk(MS-DOS 5.0a setup disk 1 using MS-DOS 5.0a installed on a hard disk image), it throws a drive not ready error.

Floppy disk log:

The attachment floppy_errorsMSDOS5.0a-DIRSetupDisk1.zip is no longer available

I do notice that according to the manuals I find, a reset needs to give an interrupt (which is supposed to happen according to the IRQ raising). Then the interrupt handler sets a flag, which allows the resetting function to continue. This resetting function then has to read the status of all 4 disk controllers using the Sense Interrupt command. The first giving ST0=C0, the second one giving ST0=21. Then it seems to abort and try to issue a read sector command (only having read 2 out of 4 Sense Interrupt commands, leaving the reset mechanism in a wrong state?).

Is there an error in the Sense Interrupt function? Does it need to keep the two high bits high for all 4 instructions instead of going into state 21?

Edit: Changed the floppy disk controller to hold the bits valued 0xC0 high during reset and it's required Sense Interrupt commands. For some reason it just stops polling the Sense Interrupt after just two checks?

Edit: Could it be that the floppy disk controller is never properly initialized due to the XT-IDE BIOS overriding the first call to int 13 function 00h? Thus the Sense Interrupts given after the first reset given to the FDC aren't the sense interrupt of the initialization (reset, 4 Sense Interruots, Configure (, and Lock if used)), but the BIOS trying to send a int 13h function 02h command to an uninitialized floppy drive due to the XT-IDE BIOS skipping initializing it for some reason?

Edit: I've fixed a bug in the FDC that caused it to read floppy 0-4 instead of 0-3 when reset and calling the Sense Interrupt function. It still has the problem though.

Edit: I've adjusted it a bit and enabled all logging in the hardware. I've also added logging of invalid commands, but they don't show in the log.

The attachment floppy_errorsMSDOS5.0a-DIRSetupDisk1.zip is no longer available

So in any case, it's only executing one or two out of four required Sense Interrupt commands. Anyone can see why? I don't think the count is wrong in this case. This test is based on my latest built (on bitbucket, https://bitbucket.org/superfury/x86emu.git . Look at hardware/floppy.c for the emulation itself.)

Also I don't think the floppy disk count flag present at port 62h bits 2&3 affect this? Those bits are currently set to set bit 2 and clear bit 3 always.

Edit: This problem has been fixed in the latest x86EMU build. The only thing still having problems is the firmatting software.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io