VirtualBox

Changeset 94649 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Apr 20, 2022 10:30:03 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151012
Message:

DevFdc: Only use the DOR to select drive, the drive selection bits in FDC command bytes have no real function (see bugref:6793).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevFdc.cpp

    r93115 r94649  
    8686/********************************************************/
    8787/* Floppy drive emulation                               */
     88
     89/* Drive selection note:
     90 * For many commands, the FDC can select one of four drives through the
     91 * second command byte. The Digital Output Register (DOR) can also select
     92 * one of four drives. On PCs, the FDC drive selection is ignored, but
     93 * should be reflected back in command status. Only the DOR drive selection
     94 * is effective; on old PCs with a discrete NEC uPD765 or similar, the FDC
     95 * drive selection signals (US0/US1) are not connected at all.
     96 * NB: A drive is actually selected only when its motor on bit in the DOR
     97 * is also set. It is possible to have no drive selected.
     98 *
     99 * The FDC cur_drv field tracks the drive the FDC thinks is selected, but
     100 * the DOR is used for actual drive selection.
     101 */
    88102
    89103#define GET_CUR_DRV(fdctrl) ((fdctrl)->cur_drv)
     
    599613enum {
    600614#if MAX_FD == 4
    601     FD_DOR_SELMASK  = 0x03,
     615    FD_DRV_SELMASK  = 0x03,
    602616#else
    603     FD_DOR_SELMASK  = 0x01,
     617    FD_DRV_SELMASK  = 0x01,
    604618#endif
     619};
     620
     621enum {
     622    FD_DOR_SELMASK  = 0x03, /* Always two bits regardless of FD_DRV_SELMASK. */
    605623    FD_DOR_nRESET   = 0x04,
    606624    FD_DOR_DMAEN    = 0x08,
     
    888906static fdrive_t *get_cur_drv(fdctrl_t *fdctrl)
    889907{
    890     switch (fdctrl->cur_drv) {
     908    switch (fdctrl->dor & FD_DRV_SELMASK) {
    891909        case 0: return drv0(fdctrl);
    892910        case 1: return drv1(fdctrl);
     
    924942    uint32_t retval = fdctrl->dor;
    925943
    926     /* Selected drive */
    927     retval |= fdctrl->cur_drv;
    928944    FLOPPY_DPRINTF("digital output register: 0x%02x\n", retval);
    929945
     
    963979        }
    964980    }
    965     /* Selected drive */
    966     fdctrl->cur_drv = value & FD_DOR_SELMASK;
    967981
    968982    fdctrl->dor = value;
     
    10571071     */
    10581072    if (fdctrl_media_changed(get_cur_drv(fdctrl))
    1059      && (fdctrl->dor & (0x10 << fdctrl->cur_drv)))
     1073     && (fdctrl->dor & (0x10 << (fdctrl->dor & FD_DOR_SELMASK))))
    10601074        retval |= FD_DIR_DSKCHG;
    10611075    if (retval != 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette