Changeset 94649 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Apr 20, 2022 10:30:03 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151012
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevFdc.cpp
r93115 r94649 86 86 /********************************************************/ 87 87 /* 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 */ 88 102 89 103 #define GET_CUR_DRV(fdctrl) ((fdctrl)->cur_drv) … … 599 613 enum { 600 614 #if MAX_FD == 4 601 FD_D OR_SELMASK = 0x03,615 FD_DRV_SELMASK = 0x03, 602 616 #else 603 FD_D OR_SELMASK = 0x01,617 FD_DRV_SELMASK = 0x01, 604 618 #endif 619 }; 620 621 enum { 622 FD_DOR_SELMASK = 0x03, /* Always two bits regardless of FD_DRV_SELMASK. */ 605 623 FD_DOR_nRESET = 0x04, 606 624 FD_DOR_DMAEN = 0x08, … … 888 906 static fdrive_t *get_cur_drv(fdctrl_t *fdctrl) 889 907 { 890 switch (fdctrl-> cur_drv) {908 switch (fdctrl->dor & FD_DRV_SELMASK) { 891 909 case 0: return drv0(fdctrl); 892 910 case 1: return drv1(fdctrl); … … 924 942 uint32_t retval = fdctrl->dor; 925 943 926 /* Selected drive */927 retval |= fdctrl->cur_drv;928 944 FLOPPY_DPRINTF("digital output register: 0x%02x\n", retval); 929 945 … … 963 979 } 964 980 } 965 /* Selected drive */966 fdctrl->cur_drv = value & FD_DOR_SELMASK;967 981 968 982 fdctrl->dor = value; … … 1057 1071 */ 1058 1072 if (fdctrl_media_changed(get_cur_drv(fdctrl)) 1059 && (fdctrl->dor & (0x10 << fdctrl->cur_drv)))1073 && (fdctrl->dor & (0x10 << (fdctrl->dor & FD_DOR_SELMASK)))) 1060 1074 retval |= FD_DIR_DSKCHG; 1061 1075 if (retval != 0)
Note:
See TracChangeset
for help on using the changeset viewer.