Changeset 605 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization
- Timestamp:
- May 8, 2021, 6:55:56 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r601 r605 70 70 ; 71 71 call FindDPT_ToDSDIforSerialDevice ; Does not modify AX 72 jnc .AddHardDisks72 jnc SHORT .AddHardDisks 73 73 74 74 mov bp, ROMVARS.ideVarsSerialAuto ; Point to our special IDEVARS structure, just for serial scans … … 76 76 %ifdef MODULE_HOTKEYS 77 77 cmp al, COM_DETECT_HOTKEY_SCANCODE ; Set by last call to ScanHotkeysFromKeyBufferAndStoreToBootvars above 78 je .DriveDetectLoop78 je SHORT .DriveDetectLoop 79 79 %endif 80 80 … … 82 82 or al, [es:BDA.bKBFlgs1] ; Or, did the user hold down the ALT key? 83 83 and al, 8 ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_SCANDETECT 84 jnz .DriveDetectLoop84 jnz SHORT .DriveDetectLoop 85 85 %endif ; MODULE_SERIAL 86 86 … … 96 96 ; 97 97 98 ; Here we might want to replace BIOS configured drives with the ones we detected. 99 ; Primary reason is to support dynamic overlay feature in the future. Second reason 100 ; is a hack to get Windows 95 to load its built-in protected mode IDE driver. 98 ; This is a hack to get Windows 9x to load its built-in protected mode IDE driver. 101 99 ; 102 100 ; The Windows hack has two parts. First part is to try to alter CMOS address 12h as that 103 ; is what Windows 9 5driver reads to detect IDE drives. Altering is not possible on all101 ; is what Windows 9x driver reads to detect IDE drives. Altering is not possible on all 104 102 ; systems since CMOS has a checksum but its location is not standardized. We will first 105 103 ; try to detect valid checksum. If it succeeds, then it is safe to assume this system 106 104 ; has compatible CMOS and we can alter it. 107 ; If verify fails, we do the more dirty hack to zero BDA drive count. Then Windows 9 5works105 ; If verify fails, we do the more dirty hack to zero BDA drive count. Then Windows 9x works 108 106 ; as long as user has configured at least one drive in the BIOS setup. 109 110 %ifdef USE_AT ; FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES is for AT builds only 111 %ifdef MODULE_WIN95_CMOS_HACK 107 %ifdef MODULE_WIN9X_CMOS_HACK 112 108 mov dl, HARD_DISK_TYPES 113 109 call CMOS_ReadFromIndexInDLtoAL 114 110 test al, 0F0h 115 jnz SHORT .ClearBdaDriveCount ; CMOS byte 12h is ready for Windows 9 5111 jnz SHORT .ClearBdaDriveCount ; CMOS byte 12h is ready for Windows 9x 116 112 call CMOS_Verify10hTo2Dh ; Can we modify CMOS? 117 113 jnz SHORT .ClearBdaDriveCount ; Unsupported BIOS, use plan B 118 114 119 115 ; Now we can alter CMOS location 12h. Award BIOS locks if we set drive 0 type to Fh 120 ; (but accept changes to drive type 1). Windows 9 5requires that the drive 0 type is116 ; (but accept changes to drive type 1). Windows 9x requires that the drive 0 type is 121 117 ; non zero and ignores drive 1 type. So if we only set drive 1, then Award BIOS 122 ; won't give problems but Windows 9 5stays in MS-DOS compatibility mode.118 ; won't give problems but Windows 9x stays in MS-DOS compatibility mode. 123 119 ; 124 120 ; For Award BIOSes we could set the Drive 0 type to 1 and then clear the BDA drive count. 125 ; So essentially we could automatically do what user needs to do manually to get Windows 9 5121 ; So essentially we could automatically do what user needs to do manually to get Windows 9x 126 122 ; working on Award BIOSes. However, I think that should be left to do manually since 127 ; there may be SCSI drives on the system or FLG_ROMVARS_ IGNORE_MOTHERBOARD_DRIVEScould123 ; there may be SCSI drives on the system or FLG_ROMVARS_CLEAR_BDA_HD_COUNT could 128 124 ; be intentionally cleared and forcing the dummy drive might cause only trouble. 129 125 … … 147 143 call CMOS_StoreNewChecksumFor10hto2Dh 148 144 .ClearBdaDriveCount: 149 %endif ; MODULE_WIN95_CMOS_HACK 150 151 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES 152 jz SHORT .ContinueInitialization 153 mov BYTE [es:BDA.bHDCount], 0 ; Set hard disk count to zero 154 .ContinueInitialization: 155 %endif ; USE_AT 145 %endif ; MODULE_WIN9X_CMOS_HACK 156 146 157 147 mov cx, [RAMVARS.wDrvCntAndFlopCnt] ; Our count of hard disks 158 148 mov al, [es:BDA.bHDCount] 159 add [es:BDA.bHDCount], cl ; Add our drives to the system count 149 %ifndef MODULE_MFM_COMPATIBILITY 150 ; This is excluded when MODULE_MFM_COMPATIBILITY is included because it doesn't make sense to use both at the same time anyway. 151 ; Note that the option to "Remove other hard drives" is still visible in XTIDECFG.COM for builds including MODULE_MFM_COMPATIBILITY. 152 ; Changing that option just won't do anything. We might want to remove the option for builds that contain MODULE_MFM_COMPATIBILITY 153 ; but that would require a ROMVARS flag that is probably better spent on other things. 154 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_CLEAR_BDA_HD_COUNT ; Clears CF 155 jz SHORT .ContinueInitialization 156 %ifdef USE_UNDOC_INTEL 157 salc 158 %else 159 xor al, al 160 %endif 161 .ContinueInitialization: 162 %endif ; MODULE_MFM_COMPATIBILITY 163 add cl, al 164 mov [es:BDA.bHDCount], cl ; Update the system count 160 165 or al, 80h ; Or in hard disk flag 161 166 mov [RAMVARS.bFirstDrv], al ; Store first drive number … … 177 182 add al, ch ; Add our drives to existing drive count 178 183 cmp al, 3 ; For BDA, max out at 4 drives (ours is zero based) 179 jb .MaxBDAFloppiesExceeded184 jb SHORT .MaxBDAFloppiesExceeded 180 185 mov al, 3 181 186 .MaxBDAFloppiesExceeded:
Note:
See TracChangeset
for help on using the changeset viewer.