VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've implemented most ATA-4/ATAPI commands, but the TOC-based commands still have me puzzled. The emulator can mount .ISO files only atm, so no cuesheets yet. The actual sector reading is already implemented (normal read(10)/read(12) commands and read capacity commands are already supported).

I'm still trying to figure out what my emulation should do when these commands are sent as ATAPI packets:
0xBE Read CD
0xB9 Read CD MSF
0x44 Read Header
0x42 Read Sub-channel
0x43 Read TOC

Also, can anyone tell me the purpose of the Seek command(0x2B)? It seems kind of pointless, seeing as Data CD-ROMs already have the LBA specified in it's Read command(implicit Seeking?)?

How should my emulation handle these commands (it's using mounted .ISO disk images)? It currently redirects these commands to become an invalid command (error register becomes 4 with the Sense Key copied in the high 4 bits. The Sense key is set to 5, The additional Sense code is set to 0x20(Invalid command operation code)).

Edit: Currently, I've implemented the Read CD, Read Sub-channel and Read TOC commands based on Bochs' cdrom.cc and harddrv.cc. The other commands (Read CD MSF and Read Header) simply respond like an unsupported command (Sense Key 5, Additional Sense code 0x20, error flag set).

Edit: I've implemented the Read CD MSF based on Bochs' Read CD, but with MSF to LBA translation used instead of direct LBA.
I've implemented the Read Header result giving either the LBA address of the specified sector, or the MSF address of the specified sector. Is that correct? If it is, all mandatory CD-ROM ATAPI commands are now supported by the most recent UniPCemu commit. I've yet to see other emulators fully supporting all those commands (even Bochs only supports a smaller subset of it). Within Dosbox I couldn't find the ATAPI CD-ROM handling? Does it even have it? If it doesn't, then that would explain the troubles it has with Windows 95 and CD-ROMs:P

Although the ATAPI code is largely untested, due to being unable to boot at all on AT emulation (80286) for some strange reason (XT-IDE on XT works without any problems. It's AT ROM doesn't even detect the emulated harddisks? Auto-detect only finds the CD-ROM drives instead at base addresses 170h and 370h?)

The most recent 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

Reply 1 of 2, by Kisai

User metadata
Rank Member
Rank
Member
superfury wrote:
I've implemented most ATA-4/ATAPI commands, but the TOC-based commands still have me puzzled. The emulator can mount .ISO files […]
Show full quote

I've implemented most ATA-4/ATAPI commands, but the TOC-based commands still have me puzzled. The emulator can mount .ISO files only atm, so no cuesheets yet. The actual sector reading is already implemented (normal read(10)/read(12) commands and read capacity commands are already supported).

Within Dosbox I couldn't find the ATAPI CD-ROM handling? Does it even have it? If it doesn't, then that would explain the troubles it has with Windows 95 and CD-ROMs:P

Although the ATAPI code is largely untested, due to being unable to boot at all on AT emulation (80286) for some strange reason (XT-IDE on XT works without any problems. It's AT ROM doesn't even detect the emulated harddisks? Auto-detect only finds the CD-ROM drives instead at base addresses 170h and 370h?)

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

Dosbox doesn't emulate a disk controller, it only emulates the BIOS (int 13) and offers it's own MSCDEX when it's in the DOS shell.

src/ints/bios_disk.cpp is where the int 13h commands are.

src/dos/drive_iso.cpp is where the cd-rom image handling is.

src/dos/dos_mscdex is where the cd-rom commands are, and 0x83 (seek) is just ignored.

It doesn't emulate any ATA/IDE hardware. And that's why Win95 can't use protected mode drivers for the disk and cd-rom.

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

There's one strange command among them: the Read Header command. It simply returns the given LBA or translated LBA to MSF format and the CD-ROM written mode(mode 0, 1 or 2). What's the purpose of this command, other than translating LBA to MSF and detecting the CD-ROM mode? What is it used for?

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