Changeset 593 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Jun 30, 2018, 8:27:04 AM (6 years ago)
Author:
aitotat
Message:

Flashing now works again.
Hack to get Windows 95 to work properly (MODULE_WIN95_CMOS_HACK included for 386 builds by default).
Edited makefile to produce large 386 build.
Fixed recovery time for QDI Vision VLB-IDE controllers.
No more warnings with Nasm 2.13.xx and later.
File dialog now properly restores default drive when file selection is cancelled.

Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r592 r593  
    9090;--------------------------------------------------------------------
    9191.InitializeBiosAndDetectDrives:
    92 %ifdef MODULE_HOTKEYS
    93     call    TimerTicks_ReadFromBdaToAX
    94     mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
    95 %endif
    96 
    9792    call    Initialize_AndDetectDrives
    9893
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm

    r592 r593  
    3333;               Cleared if no controller
    3434;   Corrupts registers:
    35 ;       BX
     35;       BX, CX
    3636;--------------------------------------------------------------------
    3737AdvAtaInit_DetectControllerForIdeBaseInBX:
     38    ; Detect if system has PCI bus. If it does, we can skip VLB detection. This is
     39    ; good thing since detecting Vision QD6850 is dangerous since Intel PIIX4 south bridge
     40    ; mirrors Interrupt Controller registers from Axh to Bxh. This can lead to faulty
     41    ; detection of QD6850 that will eventually crash the system when ports are written.
     42
     43    ; We should save the 32-bit registers but we don't since system BIOS has stored
     44    ; them already and we don't use the 32-bit registers ourselves anywhere at the moment.
     45    push    bx
     46    push    di
     47    xor     edi, edi        ; Some BIOSes require this to be set to zero
     48    mov     ax, PCI_INSTALLATION_CHECK
     49    int     BIOS_TIME_PCI_PNP_1Ah
     50    pop     di
     51    pop     bx
     52    test    ah, ah
     53    jz      SHORT .ThisSystemHasPCIbus
     54
     55    ; Detect VLB controllers
    3856    call    Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent
    3957    jnz     SHORT .NoVisionControllerFound
     
    5169
    5270.NoAdvancedControllerForPortBX:
     71.ThisSystemHasPCIbus:
    5372    xor     ax, ax      ; Clear ID in AX and CF
    5473    ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm

    r592 r593  
    4141    in      al, QD65XX_BASE_PORT + QD65XX_CONFIG_REGISTER_in
    4242
    43 %ifdef DANGEROUS_DETECTION
    44     ; Checking alternative base port is currently commented away
    45     ; since Intel PIIX4 south bridge mirrors Interrupt Controller registers
    46     ; from Axh to Bxh.
    4743    call    IsConfigRegisterWithIDinAL
    4844    je      SHORT VisionControllerDetected.Return
     
    5147    mov     dl, QD65XX_ALTERNATIVE_BASE_PORT
    5248    in      al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in
    53 %endif ; DANGEROUS_DETECTION
    5449    ; Fall to IsConfigRegisterWithIDinAL
    5550
     
    198193
    199194    ; Calculate Recovery Time value for QD65xx IDE Timing Register
    200     call    AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX
     195    xchg    ax, cx
     196    eMOVZX  cx, BYTE [cs:bx+.rgbToSubtractFromCycleTimeBasedOnPIOmode]
     197    sub     ax, cx
    201198    mov     bx, bp                      ; Active Time value now in BL
    202199    mov     bp, QD65xx_MAX_RECOVERY_TIME_CLOCKS | (QD65xx_MIN_RECOVERY_TIME_CLOCKS << 8)
     
    209206    ret                                 ; Return with CF cleared
    210207
     208.rgbToSubtractFromCycleTimeBasedOnPIOmode:
     209    ; For PIO 0 to 2 this method (t0 - (t1+t8+t9)) seems to give closest (little less) values to the fixed preset
     210    ; values used by QDI6580 DOS driver v3.7
     211    db      (PIO_0_MIN_ADDRESS_VALID_NS + PIO_0_MAX_ADDR_VALID_TO_IOCS16_RELEASED + PIO_0_DIORW_TO_ADDR_VALID_HOLD)
     212    db      (PIO_1_MIN_ADDRESS_VALID_NS + PIO_1_MAX_ADDR_VALID_TO_IOCS16_RELEASED + PIO_1_DIORW_TO_ADDR_VALID_HOLD)
     213    db      (PIO_2_MIN_ADDRESS_VALID_NS + PIO_2_MAX_ADDR_VALID_TO_IOCS16_RELEASED + PIO_2_DIORW_TO_ADDR_VALID_HOLD)
     214    db      102     ; QDI6580 DOS driver v3.7 uses fixed values for PIO 3...
     215    db      61      ; ...and PIO 4. No idea where these values come from.
     216    db      (PIO_5_MIN_CYCLE_TIME_NS / 2) ; PIO 5 and 6 were not available when QD6850 was released. Use values...
     217    db      (PIO_6_MIN_CYCLE_TIME_NS / 2) ; ...that resembles those used for PIO 4
     218
    211219
    212220;--------------------------------------------------------------------
     
    226234
    227235    ; Get VLB Cycle Time in nanosecs
    228     mov     cl, VLB_33MHZ_CYCLE_TIME    ; Assume 33 MHz or slower VLB bus
     236    mov     cl, VLB_33MHZ_CYCLE_TIME    ; Assume 33 MHz or slower VLB bus (30 ns)
    229237    test    BYTE [di+DPT_ADVANCED_ATA.wControllerID], FLG_QDCONFIG_ID3
    230     eCMOVZ  cl, VLB_40MHZ_CYCLE_TIME
     238    eCMOVZ  cl, VLB_40MHZ_CYCLE_TIME    ; (25 ns)
    231239
    232240    ; Convert value in AX to VLB ticks
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r592 r593  
    211211
    212212;--------------------------------------------------------------------
    213 ; AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX
    214 ;   Parameters:
    215 ;       BX:     PIO Mode
    216 ;       CX:     PIO Cycle Time in nanosecs
    217 ;   Returns:
    218 ;       AX:     Active Time in nanosecs
    219 ;   Corrupts registers:
    220 ;       BX, CX
    221 ;--------------------------------------------------------------------
    222 AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX:
    223     call    AtaID_GetActiveTimeToAXfromPioModeInBX
    224     mov     bl, [cs:bx+.rgbPioModeToAddressValidTimeNs]
    225     sub     cx, bx  ; Cycle Time (t0) - Address Valid Time (t1)
    226     sub     cx, ax  ; - Active Time (t2)
    227     xchg    ax, cx  ; AX = Recovery Time (t2i)
    228     ret
    229 
    230 .rgbPioModeToAddressValidTimeNs:
    231     db      PIO_0_MIN_ADDRESS_VALID_NS
    232     db      PIO_1_MIN_ADDRESS_VALID_NS
    233     db      PIO_2_MIN_ADDRESS_VALID_NS
    234     db      PIO_3_MIN_ADDRESS_VALID_NS
    235     db      PIO_4_MIN_ADDRESS_VALID_NS
    236     db      PIO_5_MIN_ADDRESS_VALID_NS
    237     db      PIO_6_MIN_ADDRESS_VALID_NS
    238 
    239 
    240 ;--------------------------------------------------------------------
    241213; AtaID_GetActiveTimeToAXfromPioModeInBX
    242214;   Parameters:
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r589 r593  
    9595; FindDPT_ForDriveNumber will not find any drives that are ours.
    9696;
     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 load proper IDE drivers.
     101;
     102; 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
     104; systems since CMOS has a checksum but it's location is not standardized. We will first
     105; try to detect valid checksum. If it succeeds, then it is safe to assume this system
     106; 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
     108; 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
     112    %ifdef MODULE_WIN95_CMOS_HACK
     113        mov     dl, HARD_DISK_TYPES
     114        call    CMOS_ReadFromIndexInDLtoAL
     115        test    al, al
     116        jnz     SHORT .ContinueInitialization   ; CMOS byte 12h is ready for Windows 95
     117        call    CMOS_Verify10hTo2Dh
     118        jnz     SHORT .ClearBdaDriveCount       ; Unsupported BIOS, use plan B
     119   
     120        ; Now we can alter CMOS location 12h
     121        mov     dl, HARD_DISK_TYPES
     122        mov     al, 0F0h    ; Drive 0 type 16...47 but Windows doesn't care as long as this is not zero
     123        call    CMOS_WriteALtoIndexInDL
     124        call    CMOS_StoreNewChecksumFor10hto2Dh
     125    %endif
     126
     127    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES
     128    jz      SHORT .ContinueInitialization
     129.ClearBdaDriveCount:
     130    mov     BYTE [es:BDA.bHDCount], 0   ; Set hard disk count to zero
     131.ContinueInitialization:
     132%endif
     133
    97134    mov     cx, [RAMVARS.wDrvCntAndFlopCnt]     ; Our count of hard disks
    98135    mov     al, [es:BDA.bHDCount]
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r592 r593  
    7777;---------------------------;
    7878%ifdef USE_AT
     79%ifdef USE_386
     80    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_IGNORE_MOTHERBOARD_DRIVES | MASK_ROMVARS_INCLUDED_MODULES
     81%else
    7982    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | MASK_ROMVARS_INCLUDED_MODULES
     83%endif
    8084    at  ROMVARS.wDisplayMode,   dw  DEFAULT_TEXT_MODE
    8185%ifdef MODULE_BOOT_MENU
     
    188192
    189193    %include "AssemblyLibrary.asm"
     194%ifdef MODULE_WIN95_CMOS_HACK
     195    %include "CMOS.asm"             ; This belongs in the Assembly Library
     196%endif
    190197
    191198    ; String compression tables need to come after the AssemblyLibrary (since they depend on addresses
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r592 r593  
    7575    mov     cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFddLetter]
    7676    mov     di, g_szFDD
     77
     78    ; Clear CH if floppy drive is selected for boot
     79    mov     ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
     80    ;and        ch, FLG_HOTKEY_HD_FIRST     ; Needed if more flags are added
    7781    call    FormatDriveHotkeyString
    7882
     
    9296    call    BootVars_GetLetterForFirstHardDriveToAX
    9397    mov     ah, ANGLE_QUOTE_RIGHT
    94     mov     cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bHddLetter]
     98    mov     cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bHddLetter]  ; Letter to CL, flags to CH
     99    ;and        ch, FLG_HOTKEY_HD_FIRST     ; Needed if more flags are added
     100    xor     ch, FLG_HOTKEY_HD_FIRST     ; Clear CH if HD is selected for boot, set otherwise
    95101    mov     di, g_szHDD
    96102    call    FormatDriveHotkeyString
     
    182188; FormatDriveHotkeyString
    183189;   Parameters:
     190;       CH:         Zero if letter in CL is selected for boot
    184191;       CL:         Drive letter hotkey from BOOTVARS
    185192;       AL:         First character for drive key string
     
    192199;       AX, CX, DX, SI, DI
    193200;--------------------------------------------------------------------
    194 ;; No work to do before going into FormatFunctionHotkeyString
    195 FormatDriveHotkeyString  equ  GetNonSelectedHotkeyDescriptionAttributeToDX
     201FormatDriveHotkeyString:
     202    ; Invalid scancodes are filtered on HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
     203    ; so here we have either drive letter or function key pressed. If latter, draw
     204    ; drive letters as unselected
     205    cmp     BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], FIRST_FUNCTION_KEY_SCANCODE
     206    jae     SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
     207
     208    ; Drive selected to boot from?
     209    test    ch, ch
     210    jnz     SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
     211    jmp     SHORT GetSelectedHotkeyDescriptionAttributeToDX
     212
    196213
    197214;--------------------------------------------------------------------
     
    216233%ifdef MODULE_BOOT_MENU
    217234
     235GetSelectedHotkeyDescriptionAttributeToDX:
    218236    mov     si, ATTRIBUTE_CHARS.cHurryTimeout       ; Selected hotkey
    219     je      SHORT GetDescriptionAttributeToDX       ; From compare with bScancode above
     237    je      SHORT GetDescriptionAttributeToDX       ; From compare with bScancode above and from FormatDriveHotkeyString
    220238
    221239GetNonSelectedHotkeyDescriptionAttributeToDX:
     
    232250%else ; if no MODULE_BOOT_MENU - No boot menu so use simpler attributes
    233251
     252GetSelectedHotkeyDescriptionAttributeToDX:
    234253    mov     dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
    235     je      SHORT SelectAttributeFromDHorDLbasedOnVideoMode     ; From compare with bScancode above
     254    je      SHORT SelectAttributeFromDHorDLbasedOnVideoMode     ; From compare with bScancode above and from FormatDriveHotkeyString
    236255
    237256GetNonSelectedHotkeyDescriptionAttributeToDX:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r589 r593  
    6464    mov     al, FLG_DEVCONTROL_nIEN ; Disable IRQ
    6565.EnableDeviceIrq:
    66 %else
     66%else   ; ifndef MODULE_IRQ
    6767    mov     al, FLG_DEVCONTROL_nIEN ; Disable IRQ
    6868%endif ; MODULE_IRQ
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm

    r547 r593  
    3535    mov     al, DRVDETECTINFO_size
    3636    mul     BYTE [cs:ROMVARS.bIdeCnt]
    37     mov     di, BOOTVARS.rgDrvDetectInfo    ; We must not initialize anything before this!
    3837    xchg    cx, ax
    3938%ifndef MODULE_HOTKEYS
     39    mov     di, BOOTVARS.rgDrvDetectInfo    ; We must not initialize anything before this!
    4040    jmp     Memory_ZeroESDIwithSizeInCX
    4141
    4242%else ; if MODULE_HOTKEYS
     43    ; Also zero HOTKEYVARS located above DRVDETECTINFO structs
     44    mov     di, BOOTVARS.hotkeyVars
     45    add     cx, BYTE HOTKEYVARS_size
    4346    call    Memory_ZeroESDIwithSizeInCX
     47
     48    ; Store time when hotkeybar is displayed
     49    ; (it will be displayed after initialization is complete)
     50    call    TimerTicks_ReadFromBdaToAX
     51    mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
    4452
    4553    ; Initialize HOTKEYVARS by storing default drives to boot from
Note: See TracChangeset for help on using the changeset viewer.