Changeset 521 in xtideuniversalbios


Ignore:
Timestamp:
Mar 10, 2013, 3:46:59 PM (8 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Hopefully fixed problems with recent changes to AH=00h.
  • Timeout error code is no longer displayed when trying to boot from floppy drive.
Location:
trunk/XTIDE_Universal_BIOS
Files:
7 edited

Legend:

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

    r506 r521  
    4242
    4343%define TITLE_STRING            TITLE_STRING_START, TITLE_STRING_END
    44 %define ROM_VERSION_STRING      "v2.0.0",BETA,"3 (",__DATE__,")",NULL
     44%define ROM_VERSION_STRING      "v2.0.0",BETA,"3+ (",__DATE__,")",NULL
    4545%define FLASH_SIGNATURE         "XTIDE203"  ; Do not terminate with NULL
    4646
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r520 r521  
    119119    jz      SHORT .ErrorCodeNotUsed
    120120    mov     bl, [di+DPT.bIdevarsOffset]                 ; replace drive number with Idevars pointer for cmp with dl
    121 .ErrorCodeNotUsed:
    122 
    123     mov     si, ControllerResetForDPTinDSDI
    124     call    .CallSIforEveryController                   ; Reset all drives to power on settings
    125     mov     si, ControllerInitForMasterOrSingleDPTinDSDI
    126     ; Fall to .CallSIforEveryController                 ; Initialize all controllers (Master and Slave drives)
    127 
    128 .CallSIforEveryController:                              ; BH will be garbage on exit if this entry point is used,
     121.ErrorCodeNotUsed:                                      ; BH will be garbage on exit if this entry point is used,
    129122                                                        ; but reset of all drives will still happen
    130 
    131123    mov     dl, ROMVARS.ideVars0                        ; starting Idevars offset
    132124
     
    139131
    140132.loop:
    141     push    si
    142     call    FindDPT_ForIdevarsOffsetInDL                ; look for the first drive on this controller, if any
    143     pop     si
    144     jc      SHORT .notFound
     133    call    FindDPT_MasterOrSingleForIdevarsOffsetInDL
     134    jc      SHORT .ControllerNotAvailable
    145135
    146     push    bx
     136    ; Reset controller (both Master and Slave Drive). We ignore error codes
     137    ; here since initialization is the one that matters.
    147138    push    cx
    148139    push    dx
    149     call    si                                          ; Reset Master AND Slave or initialize Master OR Slave drive
     140    push    bx
     141%ifdef MODULE_IRQ
     142    call    Interrupts_UnmaskInterruptControllerForDriveInDSDI
     143%endif
     144    call    Device_ResetMasterAndSlaveController
     145%ifdef MODULE_ADVANCED_ATA
     146    call    AdvAtaInit_InitializeControllerForDPTinDSDI
     147%endif
     148    pop     bx
    150149    pop     dx
     150
     151    ; Initialize Master Drive
     152    call    AH9h_InitializeDriveForUse                  ; Initialize Master drive
     153    call    BackupErrorCodeFromTheRequestedDriveToBH
     154
     155    ; Initialize Slave Drive
     156    call    FindDPT_SlaveForIdevarsOffsetInDL
     157    jc      SHORT .SlaveDriveNotAvailable
     158    call    AH9h_InitializeDriveForUse
     159    ; Here we have a small problem. Since DL now has offset to IDEVARS, it will be the same
     160    ; for both Master and Slave Drive. We simply ignore error from slave drive reset since most
     161    ; systems do not have slave drives at all and it is unlikely that AH=00h would be called for
     162    ; specific drive anyway. AH=Dh is for that.
     163
     164.SlaveDriveNotAvailable:
    151165    pop     cx
    152     pop     bx
    153     call    BackupErrorCodeFromTheRequestedDriveToBH    ; save error code if same controller as drive from entry
    154 
    155 .notFound:
     166.ControllerNotAvailable:
    156167    add     dl, IDEVARS_size                            ; move Idevars pointer forward
    157168    loop    .loop
    158169    ret
    159 
    160 
    161 ;--------------------------------------------------------------------
    162 ; ControllerResetForDPTinDSDI
    163 ;   Parameters:
    164 ;       DS:DI:  Ptr to DPT for drive to reset (resets both Master and Slave drive)
    165 ;       SS:BP:  Ptr to IDEPACK
    166 ;   Returns:
    167 ;       AH:     Int 13h return status
    168 ;   Corrupts registers:
    169 ;       AL, BX, CX, DX
    170 ;--------------------------------------------------------------------
    171 ControllerResetForDPTinDSDI:
    172 %ifdef MODULE_IRQ
    173     call    Interrupts_UnmaskInterruptControllerForDriveInDSDI
    174 %endif
    175 %ifdef MODULE_ADVANCED_ATA
    176     call    Device_ResetMasterAndSlaveController
    177     jmp     AdvAtaInit_InitializeControllerForDPTinDSDI
    178 %else
    179     jmp     Device_ResetMasterAndSlaveController
    180 %endif
    181 
    182 
    183 ;--------------------------------------------------------------------
    184 ; ControllerInitForMasterOrSingleDPTinDSDI
    185 ;   Parameters:
    186 ;       DS:DI:  Ptr to DPT for Master or Single Drive (initializes both Master and Slave drive)
    187 ;       SS:BP:  Ptr to IDEPACK
    188 ;   Returns:
    189 ;       AH:     Int 13h return status
    190 ;   Corrupts registers:
    191 ;       AL, BX, CX, DX
    192 ;--------------------------------------------------------------------
    193 ControllerInitForMasterOrSingleDPTinDSDI:
    194     call    AH9h_InitializeDriveForUse          ; Init Master or Single drive
    195     push    ax                                  ; Store error code
    196 
    197     eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]    ; Clear AH
    198     add     di, BYTE LARGEST_DPT_SIZE           ; Slave drive or next controller
    199     cmp     [di+DPT.bIdevarsOffset], al
    200     jne     SHORT .NoSlaveDrivePresent
    201 
    202     call    AH9h_InitializeDriveForUse          ; Init Slave drive
    203 .NoSlaveDrivePresent:
    204     pop     bx
    205     MAX_U   ah, bh                              ; Return error code from either drive
    206     ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r505 r521  
    7373;       CF:     0 if successful, 1 if error
    7474;   Corrupts registers:
    75 ;       AL, BX, CX, DX
     75;       AL, CX
    7676;--------------------------------------------------------------------
    7777AH9h_InitializeDriveForUse:
     
    9393    push    es
    9494    push    si
     95    push    dx
     96    push    bx
    9597
    9698
     
    232234%endif
    233235
     236    pop     bx
     237    pop     dx
    234238    pop     si
    235239    pop     es
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r520 r521  
    161161%endif
    162162    clc
    163     ;; fall through to JumpToBootSector_or_RomBoot
    164 
    165 ;--------------------------------------------------------------------
    166 ; JumpToBootSector_or_RomBoot
     163    ;; fall through to Int19_JumpToBootSectorOrRomBoot
     164
     165;--------------------------------------------------------------------
     166; Int19_JumpToBootSectorOrRomBoot
    167167;
    168168; Switches back to the POST stack, clears the DS and ES registers,
     
    179179;       Never returns
    180180;--------------------------------------------------------------------
    181 JumpToBootSector_or_RomBoot:
     181Int19_JumpToBootSectorOrRomBoot:
    182182    mov     cx, es      ; Preserve MBR segment (can't push because of stack change)
    183183    mov     ax, 0       ; NOTE: can't use XOR (LOAD_BDA_SEGMENT_TO) as it impacts CF
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm

    r505 r521  
    3636    call    DetectPrint_TryToBootFromDL
    3737    call    LoadFirstSectorFromDriveDL
    38 %ifndef USE_386
    39     jc      SHORT .FailedToLoadFirstSector
     38    jnc     SHORT .FirstSectorLoadedToESBX
     39
     40    ; Do not display timeout error (80h) for floppy drives since
     41    ; it most likely mean no diskette in drive. This way we do not
     42    ; display error code every time user intends to boot from hard disk
     43    ; when A then C boot order is used.
     44    js      SHORT .PrintFailedToLoadErrorCode   ; Hard Drive
     45    cmp     ah, RET_HD_TIMEOUT
     46    je      SHORT .ReturnWithCFclearSinceFailedToLoadBootSector
     47    cmp     ah, RET_HD_NOMEDIA
     48    je      SHORT .ReturnWithCFclearSinceFailedToLoadBootSector
     49.PrintFailedToLoadErrorCode:
     50%ifdef USE_186
     51    push    .ReturnWithCFclearSinceFailedToLoadBootSector
     52    jmp     DetectPrint_FailedToLoadFirstSector
    4053%else
    41     jc      DetectPrint_FailedToLoadFirstSector
     54    call    DetectPrint_FailedToLoadFirstSector
     55    jmp     .ReturnWithCFclearSinceFailedToLoadBootSector
    4256%endif
    4357
     58
     59.FirstSectorLoadedToESBX:
    4460    test    dl, dl
    4561    jns     SHORT .AlwaysBootFromFloppyDriveForBooterGames
     
    4763    jne     SHORT .FirstHardDiskSectorNotBootable
    4864.AlwaysBootFromFloppyDriveForBooterGames:
    49     stc
    50     jmp     SHORT JumpToBootSector_or_RomBoot
    51 
    52 %ifndef USE_386
    53 .FailedToLoadFirstSector:
    54     jmp     DetectPrint_FailedToLoadFirstSector
    55 %endif
     65    stc     ; Boot Sector loaded succesfully
     66    jmp     SHORT Int19_JumpToBootSectorOrRomBoot
    5667
    5768.FirstHardDiskSectorNotBootable:
    5869    mov     si, g_szBootSectorNotFound
    59     jmp     DetectPrint_NullTerminatedStringFromCSSIandSetCF
     70    call    DetectPrint_NullTerminatedStringFromCSSI
     71.ReturnWithCFclearSinceFailedToLoadBootSector:
     72    clc
     73    ret
    6074
    6175%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r505 r521  
    200200;       AH:     INT 13h error code
    201201;   Returns:
    202 ;       Nothing
     202;       CF:     Set
    203203;   Corrupts registers:
    204204;       AX, CX, SI, DI
     
    210210    push    cx                  ; Push INT 13h error code
    211211    mov     si, g_szReadError
    212     jmp     SHORT DetectPrint_FormatCSSIfromParamsInSSBP
     212    jmp     SHORT DetectPrint_FormatCSSIfromParamsInSSBP    ; Sets CF
    213213
    214214
     
    261261
    262262;--------------------------------------------------------------------
     263; DetectPrint_NullTerminatedStringFromCSSI
    263264; DetectPrint_NullTerminatedStringFromCSSIandSetCF
    264265;   Parameters:
     
    269270;       AX, DI
    270271;--------------------------------------------------------------------
     272DetectPrint_NullTerminatedStringFromCSSI:
    271273DetectPrint_NullTerminatedStringFromCSSIandSetCF:
    272274;
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r489 r521  
    136136
    137137;--------------------------------------------------------------------
    138 ; FindDPT_ForIdevarsOffsetInDL
     138; FindDPT_MasterOrSingleForIdevarsOffsetInDL
    139139;   Parameters:
    140140;       DL:     Offset to IDEVARS to search for
     
    147147;       SI
    148148;--------------------------------------------------------------------
    149 FindDPT_ForIdevarsOffsetInDL:
     149FindDPT_MasterOrSingleForIdevarsOffsetInDL:
    150150    mov     si, IterateFindFirstDPTforIdevars           ; iteration routine (see below)
    151151    jmp     SHORT FindDPT_IterateAllDPTs                ; look for the first drive on this controller, if any
    152152
    153153;--------------------------------------------------------------------
    154 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL,
    155 ; for use with IterateAllDPTs
     154; FindDPT_SlaveForIdevarsOffsetInDL
     155;   Parameters:
     156;       DL:     Offset to IDEVARS to search for
     157;       DS:     RAMVARS segment
     158;   Returns:
     159;       DS:DI:      Ptr to second DPT with same IDEVARS as in DL
     160;       CF:         Clear if wanted DPT found
     161;                   Set if DPT not found, or no DPTs present
     162;   Corrupts registers:
     163;       SI
     164;--------------------------------------------------------------------
     165FindDPT_SlaveForIdevarsOffsetInDL:
     166    mov     si, IterateFindSecondDPTforIdevars          ; iteration routine (see below)
     167    jmp     SHORT FindDPT_IterateAllDPTs                ; look for the second drive on this controller, if any
     168
     169;--------------------------------------------------------------------
     170; Iteration routines for FindDPT_MasterOrSingleForIdevarsOffsetInDL and
     171; FindDPT_SlaveForIdevarsOffsetInDL, for use with IterateAllDPTs
    156172;
    157173; Returns when DPT is found on the controller with Idevars offset in DL
    158174;
     175; IterateFindSecondDPTforIdevars
    159176; IterateFindFirstDPTforIdevars
    160177;       DL:     Offset to IDEVARS to search from DPTs
     
    164181;               Set if wrong DPT
    165182;--------------------------------------------------------------------
     183IterateFindSecondDPTforIdevars:
     184    call    IterateFindFirstDPTforIdevars
     185    jc      SHORT IterateFindFirstDPTforIdevars.done    ; Wrong controller
     186
     187    ; We have found DPT for Master Drive,
     188    ; next DPT is for slave drive or master for another controller
     189    add     di, BYTE LARGEST_DPT_SIZE
     190    ; Fall to IterateFindFirstDPTforIdevars
     191
    166192IterateFindFirstDPTforIdevars:
    167193    cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
     
    293319    pop     cx
    294320    ret
    295 
Note: See TracChangeset for help on using the changeset viewer.