Changeset 605 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization


Ignore:
Timestamp:
May 8, 2021, 6:55:56 PM (4 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • The "Remove other hard drives" option in the Boot settings menu in XTIDECFG is now exposed in all BIOS builds. This is needed because the system BIOS in at least two Zenith computer models (Z-161 and Z-171) does not clear the BDA HD count which causes it to increment on warm boot. Running "Auto Configure" in XTIDECFG now also tries to identify these machines by doing a CRC check on the system BIOS and sets the option to YES if a match is found.
  • WORD_ALIGN is now 2 for XT builds. This should benefit XT class machines with 8086 and NEC V30 CPU:s and the cost is negligible (1 byte for the XT BIOS builds and 12 bytes for XTIDECFG.COM).
  • Other minor optimizations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r601 r605  
    7070;
    7171    call    FindDPT_ToDSDIforSerialDevice   ; Does not modify AX
    72     jnc     .AddHardDisks
     72    jnc     SHORT .AddHardDisks
    7373
    7474    mov     bp, ROMVARS.ideVarsSerialAuto   ; Point to our special IDEVARS structure, just for serial scans
     
    7676%ifdef MODULE_HOTKEYS
    7777    cmp     al, COM_DETECT_HOTKEY_SCANCODE  ; Set by last call to ScanHotkeysFromKeyBufferAndStoreToBootvars above
    78     je      .DriveDetectLoop
     78    je      SHORT .DriveDetectLoop
    7979%endif
    8080
     
    8282    or      al, [es:BDA.bKBFlgs1]           ; Or, did the user hold down the ALT key?
    8383    and     al, 8                           ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_SCANDETECT
    84     jnz     .DriveDetectLoop
     84    jnz     SHORT .DriveDetectLoop
    8585%endif ; MODULE_SERIAL
    8686
     
    9696;
    9797
    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.
    10199;
    102100; The Windows hack has two parts. First part is to try to alter CMOS address 12h as that
    103 ; is what Windows 95 driver reads to detect IDE drives. Altering is not possible on all
     101; is what Windows 9x driver reads to detect IDE drives. Altering is not possible on all
    104102; systems since CMOS has a checksum but its location is not standardized. We will first
    105103; try to detect valid checksum. If it succeeds, then it is safe to assume this system
    106104; 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 95 works
     105; If verify fails, we do the more dirty hack to zero BDA drive count. Then Windows 9x works
    108106; 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
    112108    mov     dl, HARD_DISK_TYPES
    113109    call    CMOS_ReadFromIndexInDLtoAL
    114110    test    al, 0F0h
    115     jnz     SHORT .ClearBdaDriveCount       ; CMOS byte 12h is ready for Windows 95
     111    jnz     SHORT .ClearBdaDriveCount       ; CMOS byte 12h is ready for Windows 9x
    116112    call    CMOS_Verify10hTo2Dh             ; Can we modify CMOS?
    117113    jnz     SHORT .ClearBdaDriveCount       ; Unsupported BIOS, use plan B
    118114
    119115    ; 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 95 requires that the drive 0 type is
     116    ; (but accept changes to drive type 1). Windows 9x requires that the drive 0 type is
    121117    ; non zero and ignores drive 1 type. So if we only set drive 1, then Award BIOS
    122     ; won't give problems but Windows 95 stays in MS-DOS compatibility mode.
     118    ; won't give problems but Windows 9x stays in MS-DOS compatibility mode.
    123119    ;
    124120    ; 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 95
     121    ; So essentially we could automatically do what user needs to do manually to get Windows 9x
    126122    ; 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_DRIVES could
     123    ; there may be SCSI drives on the system or FLG_ROMVARS_CLEAR_BDA_HD_COUNT could
    128124    ; be intentionally cleared and forcing the dummy drive might cause only trouble.
    129125
     
    147143    call    CMOS_StoreNewChecksumFor10hto2Dh
    148144.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
    156146
    157147    mov     cx, [RAMVARS.wDrvCntAndFlopCnt] ; Our count of hard disks
    158148    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
    160165    or      al, 80h                         ; Or in hard disk flag
    161166    mov     [RAMVARS.bFirstDrv], al         ; Store first drive number
     
    177182    add     al, ch                          ; Add our drives to existing drive count
    178183    cmp     al, 3                           ; For BDA, max out at 4 drives (ours is zero based)
    179     jb      .MaxBDAFloppiesExceeded
     184    jb      SHORT .MaxBDAFloppiesExceeded
    180185    mov     al, 3
    181186.MaxBDAFloppiesExceeded:
Note: See TracChangeset for help on using the changeset viewer.