VirtualBox

Changeset 47036 in vbox for trunk/src/VBox/Devices/PC/BIOS


Ignore:
Timestamp:
Jul 8, 2013 12:26:47 PM (12 years ago)
Author:
vboxsync
Message:

BIOS,DevFdc,DrvBlock: The floppy controller should query the block/host driver for the drive type, or it'll all go real bad if the guest code trusts CMOS/BIOS drive info. Changed the block driver to automatically upgrade the drive type (for fdc and bios/cmos setup only) if the image is larger than the configured drive capacity. Introduced two fake drive types with max capacities, 15.6 MB and 63.5 MB, the first is the max that INT13 can officially access, the second is reinterpreting CL as holding an 8-bit wide sector number and no cylinder bits (which actually seems to be how real bioses work with floppies).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/floppy.c

    r46947 r47036  
    392392        retval = 1;
    393393    }
     394    else if ( drive_type == 14 || drive_type == 15 ) {
     395        // 15.6 MB 3.5" (fake) || 63.5 MB 3.5" (fake) - report same as 2.88 MB.
     396        config_data = 0xCC; // 1100 1100
     397        media_state = 0xD7; // 1101 0111
     398        retval = 1;
     399    }
    394400    else {
    395401        // not recognized
     
    10261032        SET_AL(0);
    10271033        SET_DL(num_floppies);
     1034        SET_DH(1);      // max head #
    10281035       
    10291036        switch (drive_type) {
     
    10351042        case 1: // 360KB, 5.25"
    10361043            CX = 0x2709;    // 40 tracks, 9 sectors
    1037             SET_DH(1);      // max head #
    10381044            break;
    10391045       
    10401046        case 2: // 1.2MB, 5.25"
    10411047            CX = 0x4f0f;    // 80 tracks, 15 sectors
    1042             SET_DH(1);      // max head #
    10431048            break;
    10441049       
    10451050        case 3: // 720KB, 3.5"
    10461051            CX = 0x4f09;    // 80 tracks, 9 sectors
    1047             SET_DH(1);      // max head #
    10481052            break;
    10491053       
    10501054        case 4: // 1.44MB, 3.5"
    10511055            CX = 0x4f12;    // 80 tracks, 18 sectors
    1052             SET_DH(1);      // max head #
    10531056            break;
    10541057       
    10551058        case 5: // 2.88MB, 3.5"
    10561059            CX = 0x4f24;    // 80 tracks, 36 sectors
    1057             SET_DH(1);      // max head #
    10581060            break;
    10591061       
     
    10701072        case 8: // 320k, 5.25"
    10711073            CX = 0x2708;    // 40 tracks, 8 sectors
    1072             SET_DH(1);      // max head #
    1073             break;
    1074        
     1074            break;
     1075       
     1076        case 14: // 15.6 MB 3.5" (fake)
     1077            CX = 0xfe3f;    // 255 tracks, 63 sectors
     1078            break;
     1079
     1080        case 15: // 63.5 MB 3.5" (fake)
     1081            CX = 0xfeff;    // 255 tracks, 255 sectors - This works because the cylinder
     1082            break;          // and sectors limits/encoding aren't checked by the BIOS
     1083                            // due to copy protection schemes and such stuff.
     1084
    10751085        default: // ?
    10761086            BX_PANIC("%s: bad floppy type\n", __func__);
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