VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm trying to get the ATAPI CD-ROM emulation in UniPCemu working. So far I've found out that the CD-ROM(SCSI) Inquiry command doesn't fail when no media is inserted, and fixed it accordingly. Then I notice that the IRQ is trying to be raised, but it's already raised(not lowered by reading the ATA Status register), thus not triggering the IRQ that's needed for the command to be recognized.

Is it correct that the IRQ line is only lowered when the Status Register is read?

Edit: I now see the driver (vide-cdd.sys) execute a ATAPI Inquiry command, which has strange packet data (6 words of 0x12 in little endian, so 0x12 0x00 0x12 0x00 0x12 0x00 0x12 0x00 etc...), then it waits some thing until finally giving up? Anyone can tell me what's going wrong? The IRQ(IRQ15 for the CD-ROM controller, the Secondary ATA controller) should be triggered? So why doesn't it continue? I've also implemented the missing ATAPI packet size that's returned when the packet's sent(in the Mid and High registers), but it won't read the resulting data for some reason?

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

Reply 1 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

The current version can be found at:
https://bitbucket.org/superfury/unipcemu/src/ … ide.c?at=master

The driver (vide-cdd.sys) doesn't seem to read the result from the buffer for some reason after transferring the complete command?

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

Reply 2 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

After the latest CPU OUTSB/W fix, now the correct packet is loaded into the ATAPI4 CD-ROM drive. Then it starts to infinitely read the Status Register(IRQ is asserted directly when the packet is fully received, commandstatus becoming 1(Indicating it's to read the packet result from the device)). The LBA registers in total contain 0xA0240001(Sector number 0x01, Size 0x24).

Strangely I eventually notice that the status returns to 0(Which usually is the case because of an invalid command or device reset)?
https://bitbucket.org/superfury/unipcemu/src/ … ide.c?at=master

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++

After the latest changes in the 80286 emulation, the OAKCDROM.SYS doesn't seem to crash just like that anymore. Now it seems to be doing something strange: it's outputting some byte to the ATA data port, then reading the status register, expecting it to not set bits 6&4(!=0x50)? Why would it do this? Is some kind of ready/not ready behaviour expected and required for CD-ROM drivers?

The controller itself is in the default command status(status 0, which means ready for command), ready to accept a command. The status register contains 0x40.

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++

Anyone can see why the cd-rom driver fails to continue after sending the inquiry command with parameters? Why isn't it reading the result?

https://bitbucket.org/superfury/unipcemu/src/ … ide.c?at=master

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++

It's clearing the IDE busy flag, since it's not doing anything while transferring packet data(the result data that's in the buffers, or transferring packet data(like Mode data tables)). Also no sector count register is set(it's in polling mode always). Is that a problem with CD-ROM drivers?

Current source code: https://bitbucket.org/superfury/unipcemu/src/ … ide.c?at=master

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