VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I notice that OAKCDROM.SYS issues a Inspect command to the CD-ROM drive, then without completing the command reports it cannot find and CD-ROM drives?

The VIDE-CDD.SYS driver works without any known problems.

Anyone knows the exact differences between the two drivers and their behaviours? Is there a problem with my ATAPI emulation?

Edit: Looking at the commands the CD-ROM drive receives, the Inquiry command is sent and received completely(including the result phases), but the Driver just sends a Inquiry command to both CD-ROM drives, after which it aborts for some unknown reason?

Edit: Could it be it doesn't like the data returned by the Inquiry command for some odd reason?

Edit: This is the data returned by the Inquiry command(as it's filled in the C++ code):

		memset(&ATA[channel].Drive[drive].data,0,ATA[channel].Drive[drive].datablock); //Clear the result!
//Now fill the packet with data!
ATA[channel].Drive[drive].data[0] = 0x05; //We're a CD-ROM drive!
ATA[channel].Drive[drive].data[1] = 0x80; //We're always removable!
ATA[channel].Drive[drive].data[3] = ((2<<4)|(1)); //We're ATAPI version 2(high nibble, from SFF-8020i documentation we're based on), response data format 1?
ATA[channel].Drive[drive].data[4] = 31; //Amount of bytes following this byte for the full buffer? Total 36, so 31 more.
strcpy_padded(&ATA[channel].Drive[drive].data[8],8,(byte *)"UniPCemu"); //Vendor ID
strcpy_padded(&ATA[channel].Drive[drive].data[16],16,(byte *)"Generic CD-ROM"); //Product ID
strcpy_padded(&ATA[channel].Drive[drive].data[32],4,&FIRMWARE[1][0]); //Product revision level

Anyone can see something OAKCDROM.SYS doesn't like? I'm trying the OAKCDROM.SYS driver from Windows 95 B bootdisk.

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

Reply 1 of 5, by Stenzek

User metadata
Rank Newbie
Rank
Newbie

Are you setting the signature in the command block after the reset/identify commands? (see the ATA/ATAPI spec, 4.3.2 Identification of PACKET feature set devices). If I remember right, the driver does check for this, and skips the drive if it's missing.

Reply 2 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

The signature is set(until the commit I just made) in all documented cases(in ATA/ATAPI-4), except device poweron. Just implemented the poweron, as well as the missing drive/head register being set to 00h or 10h(depending on Master or Slave drive). The drive/head wasn't set for both ATA and ATAPI signatures.

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

Reply 3 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've modified the signature to be set properly when all those signature cases are handled, but after completing the Inquiry command, it gets the Status Register being 0x40(Thus being Ready for a new command), it waits a bit without doing anything, then aborts saying no CD-ROM drives are found?

Currently improved source code for ATA/ATAPI PCI drive:
https://bitbucket.org/superfury/unipcemu/src/ … ide.c?at=master

Edit: Odd, I see the CD-ROM driver execute command 0xEC on the ATAPI drive, then proceeding to read the ATAPI data port(170h), which doesn't return anything, because the 0xEC command is invalid on an ATAPI device.

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

Reply 4 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

After some more debugging and bugfixing(missing drive/head register in the signature, missing ATA/ATAPI power-on signature, incorrect signature on device reset, fixed error register code and status register error bit on invalid command reporting Abort correctly(required for ATAPI to work and be detected(e.g. 0xEC command being an invalid command)), sector count register also existing on ATAPI devices, Error bit being reported correctly on ATA/ATAPI devices), the OAKCDROM.SYS now sees a Programmed I/O drive, 2 drives. 😁 It also executes some mode sense and sense request commands. After finishing the booting process, CD-ROM accesses seem to work without any noticable problems(although some delays here and there).

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

Reply 5 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

One thing I still notice is that the XT-IDE configurator utility still detects 2 controllers, even though the second controller(when there's hard drives present) is actually a CD-ROM controller(both Master and Slave controllers)?

Does anyone know the exact differences in the status register with ATAPI devices, compared to ATA devices? How does a ATA driver know not to use an ATAPI device?

Edit: Just made a slight improvement: SRST keeps BSY and DRDY inverted(1 and 0 while it's bit is set) now.

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