Changeset 605 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
May 8, 2021, 6:55:56 PM (3 years ago)
Author:
krille_n_
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.
Location:
trunk/XTIDE_Universal_BIOS
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r601 r605  
    4040
    4141struc HOTKEYVARS
    42     .fpPrevTimerHandler resb    4       ; Previous 1Ch timer handler
     42    .fpPrevTimerHandler resb    4       ; Previous 08h timer handler
    4343    .wTimeWhenDisplayed resb    2       ; System time (ticks) when Hotkey bar was first displayed
    4444    .wFddAndHddLetters:
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r598 r605  
    5353%endif
    5454
    55 %ifdef MODULE_WIN95_CMOS_HACK
     55%ifdef MODULE_WIN9X_CMOS_HACK
    5656    %ifndef USE_386
    57         %error "MODULE_WIN95_CMOS_HACK requires USE_386!"
     57        %error "MODULE_WIN9X_CMOS_HACK requires USE_386!"
    5858    %endif
    5959%endif
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r601 r605  
    8484
    8585STANDARD_CONTROL_BLOCK_OFFSET           EQU     200h
    86 XTIDE_CONTROL_BLOCK_OFFSET              EQU     8h      ; for XTIDE, A3 is used to control selected register (CS0 vs CS1)...
     86XTIDE_CONTROL_BLOCK_OFFSET              EQU     8h      ; For XTIDE, A3 is used to control selected register (CS0 vs CS1)...
    8787XTCF_CONTROL_BLOCK_OFFSET               EQU     10h     ; ...and for XT-CF (all variants), it's A4
    8888ADP50L_CONTROL_BLOCK_OFFSET             EQU     10h
     
    183183; Bit defines for ROMVARS.wFlags
    184184FLG_ROMVARS_FULLMODE                    EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
    185 FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES   EQU (1<<1)  ; Ignores drives configured in motherboard BIOS setup.
    186                                                     ; For now it is a hack to get Windows 95 IDE drivers working
    187                                                     ; but it will be needed later when XTUB supports dynamic drive overlay.
    188                                                     ; Because of that this must be included into AT builds and cannot be a
    189                                                     ; module (any AT or 386 must be installable to the hard drive so
    190                                                     ; there won't be need for even more different builds).
     185FLG_ROMVARS_CLEAR_BDA_HD_COUNT          EQU (1<<1)  ; This flag has two purposes; * Removes the system BIOS "dummy" drive
     186                                                    ; so that Windows 9x protected mode drivers can be used with XUB drives.
     187                                                    ; * Some computers (Zenith Z-171 and Z-161) do not clear the BDA hard
     188                                                    ; drive count which causes it to increment on each warm boot.
    191189FLG_ROMVARS_SERIAL_SCANDETECT           EQU (1<<3)  ; Scan COM ports at the end of drive detection.  Can also be invoked
    192190                                                    ; by holding down the ALT key at the end of drive detection.
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r604 r605  
    9797    ;call   HotkeyBar_UpdateDuringDriveDetection
    9898
     99    push    ds
     100    push    es
     101    pop     ds
     102
    99103.WaitUntilTimeToCloseHotkeyBar:
    100     call    TimerTicks_ReadFromBdaToAX
    101     sub     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed]
     104    mov     ax, [BDA.dwTimerTicks]
     105    sub     ax, [BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed]
    102106    cmp     ax, MIN_TIME_TO_DISPLAY_HOTKEY_BAR
    103107    jb      SHORT .WaitUntilTimeToCloseHotkeyBar
     
    105109    ; Restore system timer tick handler since hotkeys are no longer needed
    106110    cli
    107     mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
    108     mov     [es:BIOS_SYSTEM_TIMER_TICK_INTERRUPT_08h*4], ax
    109     mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2]
    110     mov     [es:BIOS_SYSTEM_TIMER_TICK_INTERRUPT_08h*4+2], ax
     111    mov     ax, [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
     112    mov     [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_08h*4], ax
     113    mov     ax, [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2]
     114    mov     [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_08h*4+2], ax
    111115    sti
     116
     117    pop     ds
    112118%endif
    113119    ; Fall to .ResetAllDrives
  • 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:
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r594 r605  
    7878%ifdef USE_AT
    7979%ifdef USE_386
    80     at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES | MASK_ROMVARS_INCLUDED_MODULES
     80    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_CLEAR_BDA_HD_COUNT | MASK_ROMVARS_INCLUDED_MODULES
    8181%else
    8282    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | MASK_ROMVARS_INCLUDED_MODULES
     
    192192
    193193    %include "AssemblyLibrary.asm"
    194 %ifdef MODULE_WIN95_CMOS_HACK
     194%ifdef MODULE_WIN9X_CMOS_HACK
    195195    %include "CMOS.asm"             ; This belongs in the Assembly Library
    196196%endif
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r568 r605  
    220220;       C. the serial server always returns floppy drives last
    221221;
    222     adc     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0
    223     jnz     .AllDone
     222    adc     BYTE [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0
     223    jnz     SHORT .AllDone
    224224%else ; ~MODULE_SERIAL_FLOPPY
    225225;
     
    228228; floppies are supported, so it is important to still fail here if a floppy is seen during the drive scan.
    229229;
    230     jc      .AllDone
     230    jc      SHORT .AllDone
    231231%endif ; MODULE_SERIAL_FLOPPY
    232232%endif ; MODULE_SERIAL
  • trunk/XTIDE_Universal_BIOS/makefile

    r603 r605  
    2929# MODULE_VERY_LATE_INIT       Initialize on INT 13h if our INT 19h handler is not called           #
    3030# MODULE_POWER_MANAGEMENT     Power Management support                                             #
    31 # MODULE_WIN95_CMOS_HACK      Hack for Windows 95 compatibility                                    #
     31# MODULE_WIN9X_CMOS_HACK      Hack for Windows 9x compatibility                                    #
    3232# MODULE_MFM_COMPATIBILITY    Restores BDA drive count for MFM controllers that expect to be the   #
    3333#                             only hard drive controller on the system                             #
     
    119119
    120120DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION CLD_NEEDED
    121 DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN95_CMOS_HACK
     121DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
    122122DEFINES_386_LARGE = $(DEFINES_386) $(DEFINES_COMMON_LARGE)
    123123
Note: See TracChangeset for help on using the changeset viewer.