Reply 20 of 27, by HwAoRrDk
I thought I would have a crack at disassembling and reverse-engineering the BIOS ROM myself, in case AI is just making things up. I don't really know what I'm doing, or much about x86 assembly, but I know how to use Ghidra well enough to be dangerous. 😜
Trying to track down the source of the "Get Configuration Failed !" message leads me to some code in the 'main' function (i.e. where the JMP at the start of the ROM goes to) at offset 0x27e6. It calls a function and depending on the result (carry flag), either continues or prints the error message and skips to near the end of 'main'.
This function seems to do some kind of testing/resetting/initialisation of the primary and secondary IDE controllers. It starts off with the primary IDE controller and then the secondary in turn. For each:
- Tests if the controller is present by reading Sector Count and Sector Number registers. If they both read as 0xFF, the controller is not present and it skips to step 5.
- Calls another function which has several other sub function calls, none of which I have worked out yet, but one does appear to have a lengthy Status register 'busy' flag timeout loop (655,360 iterations!). This function doesn't seem to have a success/fail return value.
- Reads the Status register; if 'busy' skip to step 5.
- Calls yet another function which is very complicated, with many sub-function calls. The success/fail return value of this function is used. If fails, skip to step 5.
- Loads a 16-bit word from... somewhere ( MOV BX,word ptr [DI + 0xe]), mask off bits 10..8 (0-7 value), subtracts 2, and shifts right by 7 bits. Then uses this value as a lookup index into a table of ROM base addresses (6 entries, C800h through DC00h) and compares that lookup value to the current code segment (CS). It breaks out if there is a match.
- Calls BIOS INT 13h, issuing disk system reset for first fixed disk (argument 0x80).
If there was no breaking out, sets carry for 'failure' and returns.
I'm wondering whether this mysterious 16-bit read is somehow reading from the 93C46 EEPROM - which is a 16-bit word ROM. If it's returning a junk value, I suppose it will indeed fail out. But anyway, even if it is, I think this could be a red herring. And maybe my problem is the "test if the controller is present" step. Problem is, I don't understand the architecture of the card enough to know if the controllers are directly on the bus, or they communicate via the 286.