Reply 160 of 187, by superfury
I've implemented the reset to allow a maximum of 4 sense interrupts (reporting 0xC1 for valid drives). The sense interrupt results are stopped(start giving normal results) when a command is sent that's not a Sense Interrupt command. When booting from harddisk MS-DOS 5.0 can read the floppy fine (PC-DOS 3.1 floppy), but the BIOS cannot boot from it.
Floppy log when trying to boot from it:
0:00:18:63.5.0929: FLOPPY: Write DOR=1C
0:00:18:63.6.0332: FLOPPY: MSR changed: 80
0:00:18:63.6.0336: FLOPPY: Read MSR=80
0:00:18:63.6.0346: FLOPPY: Command byte sent: 07
0:00:18:63.6.0367: FLOPPY: MSR changed: 90
0:00:18:63.6.0369: FLOPPY: Read MSR=90
0:00:18:63.6.0377: FLOPPY: Parameter sent: 00(#1/1)
0:00:18:63.6.0379: FLOPPY: executing command: 07
0:00:18:63.6.0408: FLOPPY: MSR changed: 80
0:00:18:63.6.0412: FLOPPY: Read MSR=80
0:00:18:63.6.0418: FLOPPY: Command byte sent: 0F
0:00:18:63.6.0428: FLOPPY: MSR changed: 90
0:00:18:63.6.0430: FLOPPY: Read MSR=90
0:00:18:63.6.0437: FLOPPY: Parameter sent: 00(#1/2)
0:00:18:63.6.0447: FLOPPY: Read MSR=90
0:00:18:63.6.0453: FLOPPY: Parameter sent: 00(#2/2)
0:00:18:63.6.0457: FLOPPY: executing command: 0F
0:00:18:63.6.0539: FLOPPY: MSR changed: 80
0:00:18:63.6.0543: FLOPPY: Read MSR=80
0:00:18:63.6.0549: FLOPPY: Command byte sent: 08
0:00:18:63.6.0553: FLOPPY: executing command: 08
0:00:18:63.6.0561: FLOPPY: Sense interrupt: ST0=20, Currentcylinder=00
0:00:18:63.6.0572: FLOPPY: MSR changed: d0
0:00:18:63.6.0574: FLOPPY: Read MSR=D0
0:00:18:63.6.0580: FLOPPY: Reading result byte 1/2=20
0:00:18:63.6.0590: FLOPPY: Read MSR=D0
0:00:18:63.6.0600: FLOPPY: Read MSR=D0
0:00:18:63.6.0607: FLOPPY: Reading result byte 2/2=00
0:00:18:63.6.0617: FLOPPY: MSR changed: 80
0:00:18:63.6.0621: FLOPPY: Read MSR=80
0:00:18:64.6.0324: FLOPPY: Read MSR=80
0:00:18:64.6.0335: FLOPPY: Command byte sent: E6
0:00:18:64.6.0345: FLOPPY: MSR changed: 90
0:00:18:64.6.0349: FLOPPY: Read MSR=90
0:00:18:64.6.0357: FLOPPY: Parameter sent: 00(#1/8)
0:00:18:64.6.0369: FLOPPY: Read MSR=90
0:00:18:64.6.0376: FLOPPY: Parameter sent: 00(#2/8)
0:00:18:64.6.0386: FLOPPY: Read MSR=90
0:00:18:64.6.0394: FLOPPY: Parameter sent: 00(#3/8)
0:00:18:64.6.0404: FLOPPY: Read MSR=90
0:00:18:64.6.0410: FLOPPY: Parameter sent: 01(#4/8)
0:00:18:64.6.0421: FLOPPY: Read MSR=90
0:00:18:64.6.0429: FLOPPY: Parameter sent: 02(#5/8)
0:00:18:64.6.0439: FLOPPY: Read MSR=90
0:00:18:64.6.0445: FLOPPY: Parameter sent: 08(#6/8)
0:00:18:64.6.0455: FLOPPY: Read MSR=90
0:00:18:64.6.0462: FLOPPY: Parameter sent: 2A(#7/8)
0:00:18:64.6.0472: FLOPPY: Read MSR=90
0:00:18:64.6.0480: FLOPPY: Parameter sent: FF(#8/8)
0:00:18:64.6.0482: FLOPPY: executing command: 06
0:00:18:64.6.0486: FLOPPY: Read sector #0
0:00:18:64.6.0488: FLOPPY: Sector size: 512 bytes
0:00:18:64.6.0490: FLOPPY: Requesting transfer for 512 bytes.
0:00:18:64.6.0529: FLOPPY: Start transfer of data (DMA: 1)...
0:00:18:64.6.0748: FLOPPY: Finished transfer of data (1 sectors).
0:00:18:64.6.0771: FLOPPY: MSR changed: d0
0:00:18:64.6.0775: FLOPPY: Read MSR=D0
0:00:18:64.6.0781: FLOPPY: Reading result byte 1/7=20
0:00:18:64.6.0791: FLOPPY: Read MSR=D0
0:00:18:64.6.0804: FLOPPY: Read MSR=D0
0:00:18:64.6.0810: FLOPPY: Reading result byte 2/7=00
0:00:18:64.6.0820: FLOPPY: Read MSR=D0
0:00:18:64.6.0830: FLOPPY: Read MSR=D0
0:00:18:64.6.0836: FLOPPY: Reading result byte 3/7=00
0:00:18:64.6.0849: FLOPPY: Read MSR=D0
0:00:18:64.6.0859: FLOPPY: Read MSR=D0
0:00:18:64.6.0865: FLOPPY: Reading result byte 4/7=00
0:00:18:64.6.0873: FLOPPY: Read MSR=D0
0:00:18:64.6.0885: FLOPPY: Read MSR=D0
0:00:18:64.6.0892: FLOPPY: Reading result byte 5/7=00
0:00:18:64.6.0902: FLOPPY: Read MSR=D0
0:00:18:64.6.0912: FLOPPY: Read MSR=D0
0:00:18:64.6.0918: FLOPPY: Reading result byte 6/7=02
0:00:18:64.6.0928: FLOPPY: Read MSR=D0
0:00:18:64.6.0951: FLOPPY: Read MSR=D0
0:00:18:64.6.0957: FLOPPY: Reading result byte 7/7=00
0:00:18:64.6.0969: FLOPPY: MSR changed: 80
0:00:18:64.6.0971: FLOPPY: Read MSR=80
0:00:18:64.7.0221: FLOPPY: Write DOR=18
0:00:18:64.7.0225: FLOPPY: Reset requested by DOR!
0:00:18:64.7.0230: FLOPPY: Write DOR=1C
0:00:18:64.7.0232: FLOPPY: Activation requested by DOR!
0:00:18:64.7.0252: FLOPPY: Read MSR=80
0:00:18:64.7.0258: FLOPPY: Command byte sent: 08
0:00:18:64.7.0260: FLOPPY: executing command: 08
0:00:18:64.7.0264: FLOPPY: Sense interrupt: ST0=C1, Currentcylinder=00
0:00:18:64.7.0275: FLOPPY: MSR changed: d0
0:00:18:64.7.0277: FLOPPY: Read MSR=D0
0:00:18:64.7.0367: FLOPPY: Reading result byte 1/2=C1
0:00:18:64.7.0391: FLOPPY: Read MSR=D0
0:00:18:64.7.0402: FLOPPY: Read MSR=D0
0:00:18:64.7.0408: FLOPPY: Reading result byte 2/2=00
0:00:18:64.7.0420: FLOPPY: MSR changed: 80
0:00:18:64.7.0422: FLOPPY: Read MSR=80
0:00:19:65.9.0188: FLOPPY: Write DOR=0C
Anyone knows what's happening here? Why won't it boot from it?
Edit: Fixed a bug where it wasn't reporting the result bytes correctly. Although this didn't fix that:
0:00:31:75.8.0114: FLOPPY: Write DOR=1C
0:00:31:75.8.0634: FLOPPY: MSR changed: 80
0:00:31:75.8.0638: FLOPPY: Read MSR=80
0:00:31:75.8.0658: FLOPPY: Command byte sent: 07
0:00:31:75.8.0686: FLOPPY: MSR changed: 90
0:00:31:75.8.0688: FLOPPY: Read MSR=90
0:00:31:75.8.0724: FLOPPY: Parameter sent: 00(#1/1)
0:00:31:75.8.0726: FLOPPY: executing command: 07
0:00:31:75.8.0808: FLOPPY: MSR changed: 80
0:00:31:75.8.0810: FLOPPY: Read MSR=80
0:00:31:75.8.0852: FLOPPY: Command byte sent: 0F
0:00:31:75.8.0914: FLOPPY: MSR changed: 90
0:00:31:75.8.0916: FLOPPY: Read MSR=90
0:00:31:75.8.0946: FLOPPY: Parameter sent: 00(#1/2)
0:00:31:75.8.0970: FLOPPY: Read MSR=90
0:00:31:75.9.0008: FLOPPY: Parameter sent: 00(#2/2)
0:00:31:75.9.0010: FLOPPY: executing command: 0F
0:00:31:75.9.0148: FLOPPY: MSR changed: 80
0:00:31:75.9.0150: FLOPPY: Read MSR=80
0:00:31:75.9.0196: FLOPPY: Command byte sent: 08
0:00:31:75.9.0196: FLOPPY: executing command: 08
0:00:31:75.9.0200: FLOPPY: Sense interrupt: ST0=20, Currentcylinder=00
0:00:31:75.9.0232: FLOPPY: MSR changed: d0
0:00:31:75.9.0234: FLOPPY: Read MSR=D0
0:00:31:75.9.0252: FLOPPY: Reading result byte 1/2=20
0:00:31:75.9.0304: FLOPPY: Read MSR=D0
0:00:31:75.9.0342: FLOPPY: Read MSR=D0
0:00:31:75.9.0362: FLOPPY: Reading result byte 2/2=00
0:00:31:75.9.0410: FLOPPY: MSR changed: 80
0:00:31:75.9.0412: FLOPPY: Read MSR=80
0:00:31:84.8.0686: FLOPPY: Read MSR=80
0:00:31:84.8.0736: FLOPPY: Command byte sent: E6
0:00:31:84.8.0778: FLOPPY: MSR changed: 90
0:00:31:84.8.0782: FLOPPY: Read MSR=90
0:00:31:84.8.0800: FLOPPY: Parameter sent: 00(#1/8)
0:00:31:84.8.0856: FLOPPY: Read MSR=90
0:00:31:84.8.0888: FLOPPY: Parameter sent: 00(#2/8)
0:00:31:84.8.0924: FLOPPY: Read MSR=90
0:00:31:84.8.0938: FLOPPY: Parameter sent: 00(#3/8)
0:00:31:84.9.0030: FLOPPY: Read MSR=90
0:00:31:84.9.0054: FLOPPY: Parameter sent: 01(#4/8)
0:00:31:84.9.0086: FLOPPY: Read MSR=90
0:00:31:84.9.0098: FLOPPY: Parameter sent: 02(#5/8)
0:00:31:84.9.0160: FLOPPY: Read MSR=90
0:00:31:84.9.0188: FLOPPY: Parameter sent: 08(#6/8)
0:00:31:84.9.0218: FLOPPY: Read MSR=90
0:00:31:84.9.0278: FLOPPY: Parameter sent: 2A(#7/8)
0:00:31:84.9.0334: FLOPPY: Read MSR=90
0:00:31:84.9.0354: FLOPPY: Parameter sent: FF(#8/8)
0:00:31:84.9.0356: FLOPPY: executing command: 06
0:00:31:84.9.0360: FLOPPY: Read sector #0
0:00:31:84.9.0360: FLOPPY: Sector size: 512 bytes
0:00:31:84.9.0364: FLOPPY: Requesting transfer for 512 bytes.
0:00:31:84.9.0452: FLOPPY: Start transfer of data (DMA: 1)...
0:03:10:95.2.0720: FLOPPY: Finished transfer of data (1 sectors).
0:03:10:97.3.0936: FLOPPY: MSR changed: d0
0:03:10:97.3.0936: FLOPPY: Read MSR=D0
0:03:10:97.3.0952: FLOPPY: Reading result byte 1/7=20
0:03:10:97.4.0000: FLOPPY: Read MSR=D0
0:03:10:97.4.0048: FLOPPY: Read MSR=D0
0:03:10:97.4.0064: FLOPPY: Reading result byte 2/7=00
0:03:10:97.4.0112: FLOPPY: Read MSR=D0
0:03:10:97.4.0144: FLOPPY: Read MSR=D0
0:03:10:97.4.0192: FLOPPY: Reading result byte 3/7=00
0:03:10:97.4.0224: FLOPPY: Read MSR=D0
0:03:10:97.4.0256: FLOPPY: Read MSR=D0
0:03:10:97.4.0304: FLOPPY: Reading result byte 4/7=00
0:03:10:97.4.0336: FLOPPY: Read MSR=D0
0:03:10:97.4.0368: FLOPPY: Read MSR=D0
0:03:10:97.4.0384: FLOPPY: Reading result byte 5/7=00
0:03:10:97.4.0448: FLOPPY: Read MSR=D0
0:03:10:97.4.0528: FLOPPY: Read MSR=D0
0:03:10:97.4.0544: FLOPPY: Reading result byte 6/7=02
0:03:10:97.4.0624: FLOPPY: Read MSR=D0
0:03:10:97.4.0672: FLOPPY: Read MSR=D0
0:03:10:97.4.0688: FLOPPY: Reading result byte 7/7=02
0:03:10:97.4.0752: FLOPPY: MSR changed: 80
0:03:10:97.4.0752: FLOPPY: Read MSR=80
0:03:10:97.9.0872: FLOPPY: Write DOR=18
0:03:10:97.9.0872: FLOPPY: Reset requested by DOR!
0:03:10:97.9.0888: FLOPPY: Write DOR=1C
0:03:10:97.9.0888: FLOPPY: Activation requested by DOR!
0:03:10:98.0.0000: FLOPPY: Read MSR=80
0:03:10:98.0.0016: FLOPPY: Command byte sent: 08
0:03:10:98.0.0016: FLOPPY: executing command: 08
0:03:10:98.0.0016: FLOPPY: Sense interrupt: ST0=C1, Currentcylinder=00
0:03:10:98.0.0048: FLOPPY: MSR changed: d0
0:03:10:98.0.0048: FLOPPY: Read MSR=D0
0:03:10:98.0.0176: FLOPPY: Reading result byte 1/2=C1
0:03:10:98.0.0208: FLOPPY: Read MSR=D0
0:03:10:98.0.0240: FLOPPY: Read MSR=D0
0:03:10:98.0.0288: FLOPPY: Reading result byte 2/2=00
0:03:10:98.0.0320: FLOPPY: MSR changed: 80
0:03:10:98.0.0320: FLOPPY: Read MSR=80
0:03:17:39.3.0248: FLOPPY: Write DOR=0C
0:04:23:91.7.0296: FLOPPY: Write DOR=0C
0:05:29:29.3.0088: FLOPPY: Write DOR=0C
Looking at the DMA transaction, it sets TC(The DMA transfer is finished, with 1 sector of 512 bytes). Why would it still reset the disk controller and issue a boot failure?
Edit: Fixed it. The problem was in that the controller decreased the counter (which goes from 4 to 0(0 being finished)) before using the value to generate a drive (thus generating drives 1, 2, 3 and 4 instead of 0,1,2,3). This has now been fixed. Also any command which isn't the Sense Interrupt command after reset will set the counter to 0(disabling the reset 0xC* status) and clear the ST0 register to be able to give correct results for the commands being executed. Invalid commands will always give 0x80, so they don't have to check for it(since they don't use the register). This fixes both BIOSes and other drivers etc. which might use some, all or none of those Sense Interrupts(providing what is requested, for up to 4 Sense Interrupts. No Sense Interrupt is also supported now).
So now, the only problem left in the IBM XT BIOS is that it reports a 301 error before the memory check. Anyone knows what might cause this?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io