Changeset 410 in xtideuniversalbios


Ignore:
Timestamp:
Apr 26, 2012, 1:46:54 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Hotkey Bar now support color attributes even when not including MODULE_BOOT_MENU.
  • Cleaned AH=09h code a bit.
  • MODULE_ADVANCED_ATA now properly changes the device type to 32-bit.
  • BSY and RDY timeouts are now 2500 ms.
Location:
trunk/XTIDE_Universal_BIOS
Files:
4 edited

Legend:

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

    r400 r410  
    3434TIMEOUT_DRDY            EQU     TIMEOUT_MOTOR_STARTUP
    3535%else
    36 TIMEOUT_BSY             EQU     (2000/55)   ; 2000 ms
    37 TIMEOUT_DRDY            EQU     (2000/55)   ; 2000 ms
     36TIMEOUT_BSY             EQU     (2500/55)   ; 2500 ms
     37TIMEOUT_DRDY            EQU     (2500/55)   ; 2500 ms
    3838%endif
    3939
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r400 r410  
    4747.DetectPowerManagementSupport:
    4848    test    BYTE [es:si+ATA6.wSetSup82], A6_wSetSup82_POWERMAN
    49     jz      .NoPowerManagementSupport
     49    jz      SHORT .NoPowerManagementSupport
    5050    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
    5151.NoPowerManagementSupport:
    5252%endif ; MODULE_FEATURE_SETS
     53
     54
     55;--------------------------------------------------------------------
     56; .StoreDeviceType
     57;   Parameters:
     58;       DS:DI:  Ptr to Disk Parameter Table
     59;       CS:BP:  Ptr to IDEVARS for the controller
     60;   Returns:
     61;       Nothing
     62;   Corrupts registers:
     63;       AL
     64;--------------------------------------------------------------------
     65.StoreDeviceType:
     66    call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     67
    5368
    5469;--------------------------------------------------------------------
     
    6378.StoreBlockMode:
    6479    mov     BYTE [di+DPT_ATA.bBlockSize], 1
     80
    6581
    6682%ifdef MODULE_ADVANCED_ATA
     
    8197    mov     [di+DPT_ADVANCED_ATA.bPioMode], al
    8298    or      [di+DPT.bFlagsHigh], ah
     99
    83100
    84101;--------------------------------------------------------------------
     
    111128.ChangeTo32bitDevice:
    112129    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
     130.NoAdvancedControllerDetected:
     131%endif  ; MODULE_ADVANCED_ATA
    113132
    114 .NoAdvancedControllerDetected:
    115     ; Fall to IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
    116133
    117 %endif  ; MODULE_ADVANCED_ATA
     134; End DPT
     135    clc
     136    ret
    118137
    119138
     
    131150    mov     al, [cs:bp+IDEVARS.bDevice]
    132151    mov     [di+DPT_ATA.bDevice], al
    133 ; End DPT
    134     clc
    135152    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r400 r410  
    2020; Section containing code
    2121SECTION .text
     22
     23;--------------------------------------------------------------------
     24; STORE_ERROR_FLAG_TO_DPT
     25;   Parameters:
     26;       %1:     Error flag to set
     27;       AH:     BIOS Error Code
     28;       DS:DI:  Ptr to DPT
     29;       CF:     Set if error code in AH
     30;   Returns:
     31;       CF:     Clear if no error
     32;               Set if error flag was set
     33;   Corrupts registers:
     34;       Nothing
     35;--------------------------------------------------------------------
     36%macro STORE_ERROR_FLAG_TO_DPT 1
     37%ifdef MODULE_ADVANCED_ATA
     38    mov     al, %1
     39    call    SetErrorFlagFromALwithErrorCodeInAH
     40%endif
     41%endmacro
     42
    2243
    2344;--------------------------------------------------------------------
     
    5778;--------------------------------------------------------------------
    5879AH9h_InitializeDriveForUse:
    59     xor     ax, ax
     80    xor     ax, ax              ; Clear AH to assume no errors
    6081
    6182%ifdef MODULE_ADVANCED_ATA
     
    6990    jz      SHORT .ContinueInitialization
    7091    ret     ; With AH and CF cleared
    71     .ContinueInitialization:
     92.ContinueInitialization:
    7293%endif
    7394
    7495    push    es
    7596    push    si
     97
    7698
    7799;;; SelectDrive
     
    80102    mov     [bp+IDEPACK.bDrvAndHead], al
    81103    call    Device_SelectDrive
    82 
    83 %ifdef MODULE_ADVANCED_ATA
    84     mov     al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE
    85     call    .SetErrorFlagFromALwithErrorCodeInAH
    86 %endif
    87     jc      .ReturnWithErrorCodeInAH
     104    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SELECT_DRIVE
     105    jnc     SHORT .ContinueInitializationSinceDriveSelectedSuccesfully
     106    jmp     .ReturnWithErrorCodeInAH
     107.ContinueInitializationSinceDriveSelectedSuccesfully:
     108
    88109
    89110;;; InitializeDeviceParameters
     
    99120    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    100121    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    101 
    102 %ifdef MODULE_ADVANCED_ATA
    103     mov     al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    104     call    .SetErrorFlagFromALwithErrorCodeInAH
    105 %endif
     122    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    106123.SkipInitializeDeviceParameters:
     124
    107125
    108126;;; SetWriteCache
     
    115133    mov     si, [cs:bx+.rgbWriteCacheCommands]
    116134    call    AH23h_SetControllerFeatures
    117 
    118 %ifdef MODULE_ADVANCED_ATA
    119     mov     al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE
    120     call    .SetErrorFlagFromALwithErrorCodeInAH
    121 %endif
     135    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE
    122136.SkipSetWriteCache:
     137
    123138
    124139;;; RecalibrateDrive
    125140    ; Recalibrate drive by seeking to cylinder 0
    126141    call    AH11h_RecalibrateDrive
    127 
    128 %ifdef MODULE_ADVANCED_ATA
    129     mov     al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE
    130     call    .SetErrorFlagFromALwithErrorCodeInAH
    131 %endif
     142    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE
     143
    132144
    133145;;; InitializeBlockMode
     
    147159    shr     bl, 1
    148160    jnc     SHORT .TryNextBlockSize
    149 
    150 %ifdef MODULE_ADVANCED_ATA
    151     mov     al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE
    152     call    .SetErrorFlagFromALwithErrorCodeInAH
    153 %endif
     161    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE
    154162.BlockModeNotSupportedOrDisabled:
    155163.SupportedBlockSizeFound:
     164
    156165
    157166%ifdef MODULE_ADVANCED_ATA
     
    169178    mov     si, FEATURE_SET_TRANSFER_MODE
    170179    call    AH23h_SetControllerFeatures
    171 
    172     mov     al, FLG_INITERROR_FAILED_TO_SET_PIO_MODE
    173     call    .SetErrorFlagFromALwithErrorCodeInAH
     180    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_PIO_MODE
    174181%endif ; MODULE_ADVANCED_ATA
     182
    175183
    176184%ifdef MODULE_FEATURE_SETS
     
    178186    ; Initialize the standby timer (if supported)
    179187    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
    180     jz      .NoPowerManagementSupport
     188    jz      SHORT .NoPowerManagementSupport
    181189
    182190    mov     al, COMMAND_IDLE
     
    184192    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    185193    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    186 
    187 %ifdef MODULE_ADVANCED_ATA
    188     mov     al, FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER
    189     call    .SetErrorFlagFromALwithErrorCodeInAH
    190 %endif
     194    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER
    191195.NoPowerManagementSupport:
    192196%endif ; MODULE_FEATURE_SETS
    193197
     198
    194199    ; There might have been several errors so just return one error code for them all
     200.ReturnWithErrorCodeInAH:
    195201%ifdef MODULE_ADVANCED_ATA
    196202    mov     ah, [di+DPT_ADVANCED_ATA.bInitError]
    197203    test    ah, ah  ; Clears CF
    198     jz      SHORT .ReturnWithErrorCodeInAH
     204    jz      SHORT .ReturnWithSuccess
    199205    mov     ah, RET_HD_RESETFAIL
    200206    stc
    201 %endif
    202 
    203 .ReturnWithErrorCodeInAH:
     207.ReturnWithSuccess:
     208%endif
     209
    204210    pop     si
    205211    pop     es
     
    207213
    208214
    209 %ifdef MODULE_ADVANCED_ATA
    210 ;--------------------------------------------------------------------
    211 ; .SetErrorFlagFromALwithErrorCodeInAH
     215.rgbWriteCacheCommands:
     216    db      0                               ; DEFAULT_WRITE_CACHE
     217    db      FEATURE_DISABLE_WRITE_CACHE     ; DISABLE_WRITE_CACHE
     218    db      FEATURE_ENABLE_WRITE_CACHE      ; ENABLE_WRITE_CACHE
     219
     220
     221
     222%ifdef MODULE_ADVANCED_ATA
     223;--------------------------------------------------------------------
     224; SetErrorFlagFromALwithErrorCodeInAH
    212225;   Parameters:
    213226;       AH:     BIOS Error Code
    214227;       AL:     Error flag to set
    215228;       DS:DI:  Ptr to DPT
     229;       CF:     Set if error code in AH
     230;               Clear if AH = 0
    216231;   Returns:
    217232;       CF:     Clear if no error
     
    220235;       Nothing
    221236;--------------------------------------------------------------------
    222 .IgnoreInvalidCommandError:
     237IgnoreInvalidCommandError:
    223238    xor     ah, ah  ; Clears CF
    224 
    225 .SetErrorFlagFromALwithErrorCodeInAH:
     239SetErrorFlagFromALwithErrorCodeInAH:
    226240    jnc     SHORT .NoErrorFlagToSet
    227241    cmp     ah, RET_HD_INVALID
    228     jbe     SHORT .IgnoreInvalidCommandError
     242    jbe     SHORT IgnoreInvalidCommandError
    229243
    230244    or      [di+DPT_ADVANCED_ATA.bInitError], al
     
    234248
    235249%endif
    236 
    237 
    238 .rgbWriteCacheCommands:
    239     db      0                               ; DEFAULT_WRITE_CACHE
    240     db      FEATURE_DISABLE_WRITE_CACHE     ; DISABLE_WRITE_CACHE
    241     db      FEATURE_ENABLE_WRITE_CACHE      ; ENABLE_WRITE_CACHE
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r399 r410  
    209209;       CF:     Set if selected hotkey
    210210;               Cleared if unselected hotkey
     211;       ES:     BDA segment (zero)
    211212;   Returns:
    212213;       DX:     Description Attribute
     
    234235
    235236GetSelectedHotkeyDescriptionAttributeToDX:
    236     mov     dl, MONO_REVERSE_BLINK
    237     ret
     237    mov     dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
     238    jmp     SHORT SelectAttributeFromDHorDLbasedOnVideoMode
    238239
    239240GetNonSelectedHotkeyDescriptionAttributeToDX:
    240     mov     dl, MONO_REVERSE
    241     ret
     241    mov     dx, (COLOR_ATTRIBUTE(COLOR_BLACK, COLOR_CYAN) << 8) | MONO_REVERSE
     242SelectAttributeFromDHorDLbasedOnVideoMode:
     243    mov     al, [es:BDA.bVidMode]
     244    shr     al, 1
     245    jnc     SHORT .AttributeLoadedToDL  ; Black & White modes
     246    shr     al, 1
     247    jnz     SHORT .AttributeLoadedToDL  ; MDA
     248    mov     dl, dh
     249.AttributeLoadedToDL:
     250    ret
     251
    242252%endif
    243253
Note: See TracChangeset for help on using the changeset viewer.