OK. Indeed, literally the first thing that happens when it says "Setup is starting Windows 2000" is resetting the hard drives with a SRST reset.
So that makes it easy to debug (as the remainder of the loading of files from the CD-ROM doesn't touch it) with a breakpoint.
New behaviour:
I did some more debugging of the "Starting Windows 2000..." and what it's doing.
I see it reading some sector, afterwards reading some registers (not logical?) and throwing the BSOD immediately after that?
The BIOS is somehow always corrupted somehow during boot for Windows 2000? The only fix atm seems to be replacing the ROM with a fresh unflashed copy (before the BIOS flashes anything new for it's parameter tables)?
Observerd crashes:
SCSI Port Driver crash @F000:F00A opcode FF /7=@1F00A=Corrupted BIOS!
Human Interface Parser crashes above as well? This is with the ROM BIOS?
So the BIOS gets corrupted at this point?
The final messages before the crash (Setup is loading files (insert below)...)):
Floppy Disk Driver
SCSI CD-ROM
SCSI Disk
SCSI Floppy Disk
FAT File System
Windows NT File System (NTFS)
CD-ROM File System
Then:
Starting Windows 2000...
(Paused at this point to activate the HDD debugging breakpoints, which is easy.)
*** new data ***
Write 08h to the channel 2 drive control register.
Write E0h to the channel 2 drive/head register.
Write 08h to the channel 2 drive control register.
Write E0h to the channel 2 drive/head register.
Write 08h to the channel 2 drive control register.
Write E0h to the channel 2 drive control register.
Read 50h from the channel 2 master status register.
Write E0 the the channel 2 drive/head register.
Read 50h from the channel 2 master status register.
"
Write 00h to the channel 2 features register.
Write 01h to the channel 2 sector count register.
Write 00h to the channel 2 sector number register.
Write 00h to the channel 2 cylinder low register.
Write 00h to the channel 2 cylinder high register.
Write E0h to the channel 2 drive/head register.
Read 50h from the channel 2 status register.
Write command C4 to the channel 2 master (executed).
Read 58h from the channel 2 status register.
"
Command finished properly.
Write 08h to channel 2 control register.
Write E0h to channel 2 drive/head register.
Write 08h to channel 2 control register.
Write E0h to channel 2 drive/head register.
CD-ROM action starts in "Windows 2000" boot:
Write A0h to channel 3 drive/head register.
Read 40h from channel 3 master status register.
Write A0h to channel 3 drive/head register.
Read 40h from channel 3 master status register.
Write 00h to channel 3 features register.
Write 00h to channel 3 cylinder low register.
Write 08h to channel 3 cylinder high register.
Write A0h to channel 3 drive/head register.
Read 40h from channel 3 master status register.
"
"
Write A0h to channel 3 command register (ATAPI PACKET command starting).
Read 80h from channel 3 master status register.
Read 48h from channel 3 master status register(ATAPI ready to receive packet).
"
UniPCemu Command parsing started after 6 words written: Read sector 10h from disc, length of 1 sector.
Read 80h from channel 3 master status register.
"
Read 48h from channel 3 master status register.
"
Read 02h from sector count register (ATAPI Interrupt Reason: Data In)
Read 48h from channel 3 master status register.
"
Entire sector is read from the buffer by the CPU.
Result phase IRQ reason is loaded and INTRQ is raised.
Read C0h from channel 3 master status register. INTRQ is lowered.
"
"
"
Result phase ends and reports.
Read 40h from channel 3 master status register.
(the earlier bug in the BIOS with the invalid reads of data is showing up at this point again)
After that whole mess with invalid multiple reads from port 170 (due to it performing them anyways even though the status register is 40h (although starting out as c0h due to the result phase timing that's done now)), it continues on.
Write A0h to the drive/head register.
Read 40h from the master status register.
Write A0h to the drive/head register.
Read 40h from the master status register.
Write 00h to the features register.
Write 00h to the cylinder low register.
Write 08h to the cylinder high register.
Write A0h to the drive/head register.
Read 40h from the master status register.
"
"
Write A0h to the command register.
Read 80h from the master status register.
Preparation completes and hardware becomes ready to receive the packet.
Read 48h from the master status register.
"
Another packet for reading sector 0x10 from the CD-ROM is written.
Read 80h from the master status register.
"
Execution completes and data becomes ready to read.
Read 48h from the master status register.
"
Read 02h from the sector count register(Interrupt reason: Data In)
Read 48h from the master status register.
"
Data transfer completes as all data is read
Read C0 from the master status register.
"
"
"
Result pending status completes. Result phase is entered and interrupt reason loaded. No interrupt is thrown.
Read 40h from the master status register.
"
"
"
"
etc.
BSOD 7b (0xFDC63848,0xC0000034,0x00000000,0x00000000)
INACCESSIBLE_BOOT_DEVICE
Edit: OK. So since that's working again now, I've restored the IRQ to trigger at the end of the timeout of the result phase.
The BIOS still does weird things with Windows 2000 though. It keeps reading data when it shouldn't, not looking at the right flags to determine if the transfer has ended. I never once see it properly handling the result phase when a transfer ends(sector counte register being 03h). And it only seems to check that if the DRQ bit is set, which by definition isn't the case for the result phase (as documented, DRQ=0 in that case).