mfld-fr / emu86

Intel IA16 emulator for embedded development
35 stars 6 forks source link

Add BDA equipment word specifying # disk drives #69

Closed ghaerr closed 3 years ago

ghaerr commented 3 years ago

Found another hidden ELKS dependency: the BIOS disk driver peeks at the BIOS DATA Area equipment word at 0040:0010h to determine the number of disk drives present:

/* use BIOS to query floppy configuration*/
static unsigned short int INITPROC bioshd_getfdinfo(void)
{
    register struct drive_infot *drivep = &drive_info[DRIVE_FD0];
    int drive, ndrives = 0;

#ifndef CONFIG_ROMCODE
    /*
     * The INT 13h floppy query will fail on IBM XT v1 BIOS and earlier,
     * so default to # drives from the BIOS data area at 0x040:0x0010 (INT 11h).
     */
    unsigned char equip_flags = peekb(0x10, 0x40);
    if (equip_flags & 0x01)
    ndrives = (equip_flags >> 6) + 1;
#endif

This fixes regression found in https://github.com/mfld-fr/emu86/pull/68#issuecomment-841181775. The problem appeared in a previous commit that cleared the BDA.

More work to be done cleaning up ELKS, or at least documenting it!

mfld-fr commented 3 years ago

Yep, one direct access to BDA to cleanup in ELKS, and to be replaced by INT 11h. Thanks for the fix, it clears the currrent stop of the next to master merge.