First post, by FlynnTinkers
This was in a box with a QDI QD6580W V2.0 Winbond W83787F VLB IO Card. The disk thankfully read right away. It had a handwritten permanent marker label, "VLB IO TEST". Won't be able to try this out for a few weeks, but I've nominated it for being thrown on retroweb's page for that card as a driver (if that's out of policy, I can upload it on archive.org).
ID String:
VESA Local Bus IDE BIOS, Ver 1.05.23-02
(C) Mini-Max Technology, Inc.
(C)Copyright 1993, All Rights Reserved.
I'm out of my depth here, so I fed it to Opus 4.6 to try and figure out the functionality:
INT 13h hooking: At 0x987, the driver saves the original INT 13h vector from IVT location 0:004C and installs its own handler at cs:0x2D6. That handler's very first instruction is test dl, 0x80 — if bit 7 is clear (floppy), it does an immediate far jump through the saved original vector. Hard drive calls continue into the custom dispatcher. The INT 13h handler dispatches specifically on AH=02 (Read Sectors), AH=03 (Write Sectors), and AH=0C (Seek). Everything else gets forwarded to the original BIOS handler.
INT 76h hooking: At 0x9A9. It saves the old vector from IVT 0:01D8 (which is 0x76 × 4) and installs its handler at cs:0x961. That handler sets a completion flag at [0x49], reads status from port 0x1F7, then sends EOI (0x20) to both 0xA0 and 0x20 in that order (slave PIC first, then master).
IDE Multi-sector mode setup: At 0xA11. It writes 0xA0 to port 0x1F6 (selecting the master drive), then writes 0xEC to port 0x1F7 (IDENTIFY DEVICE). It reads 256 words (512 bytes) from port 0x1F0 into a scratch buffer at cs:0xCD2. It then indexes to offset +0x5E from the buffer start, which is byte offset 94 — that's word 47 of the identify block (max sectors per multi-sector transfer). It issues SET MULTIPLE MODE (0xC6) to port 0x1F7 with the extracted count written to port 0x1F2. On success, it patches two function pointers: [0x59] gets set to 0x056E (the multi-sector read routine that uses command 0xC4) and [0x5B] gets set to 0x0825 (the multi-sector write routine that uses command 0xC5). The default single-sector routines use 0x20 (READ SECTORS) and 0x30 (WRITE SECTORS) respectively. Word 47 extraction has a quirk: it tests bits 5 and 6 of the value (test al, 0x60) and if either is set, shifts right by 1 (shr al, 1). This appears to handle certain drives that encode the max multi-sector count in a slightly different bit position.
Burst transfer sizing: Setup at 0x9CB; BIOS data area check at 0040:0475, and all three command-line switches. Burst geometry query order is 0x81 first, then 0x80. It keeps the larger of the two sectors-per-track values (via CMP; JNC) — if drive 0x81 doesn't exist (INT 13h returns carry), it falls through to use only drive 0x80's geometry. The result is then shifted left by 9 (shl cx, 9) to convert to bytes.
Read-ahead cache mechanism: At 0x356; checks whether the current CX/DX (cylinder/head/sector/drive) match a previous request's values stored at [cs:0x4F] and [cs:0x51]. On a cache hit, it does a fast rep movsd memory copy from an internal buffer rather than re-issuing IDE commands.
CHS register setup: At 0x61C, the driver directly writes sector number to 0x1F3, cylinder low to 0x1F4, cylinder high to 0x1F5, and drive/head to 0x1F6 (OR-ing with 0xA0 for master, 0xB0 for slave based on bit 0 of DL). It also unmasks IRQ 14 on the slave PIC (port 0xA1, clearing bit 6) and IRQ 2/cascade on the master PIC (port 0x21, clearing bit 2) during I/O operations.
Command-line switches
Used in CONFIG.SYS: DEVICE=VLB.SYS [/NT] [/NB] [/NM]
/NTNo Transfer — disables INT 13h hooking entirely
/NBNo Burst — disables burst/block size optimization
/NMNo Multi-sector — skips IDE multi-sector mode setup