Changeset 148 in xtideuniversalbios


Ignore:
Timestamp:
Mar 19, 2011, 8:09:41 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
Location:
trunk/XTIDE_Universal_BIOS
Files:
27 edited

Legend:

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

    r97 r148  
    1212    .bFDSwap        resb    1   ; Floppy Drive to swap to 00h and vice versa
    1313    .bHDSwap        resb    1   ; Hard Drive to swap to 80h and vice versa
    14     .bRecurCnt      resb    1   ; INT 13h recursion counter for drive translation
     14    .bXlatedDrv     resb    1   ; Drive number after translation
    1515                    resb    1   ; For WORD alignment
    1616endstruc
     
    2020; at the top of interrupt vectors.
    2121struc RAMVARS
    22     .fpOldI13h      resb    4   ; Far pointer to old INT 13h handler
    23 
    24     .dwI13DIDS:                 ; Temporary DI and DS storages when calling...
    25     .wI13hDI:                   ; ...previous INT 13h handler
    26     .wIdeBase       resb    2   ; Base port address for currently handled controller
    27 
    28     .wI13hDS:
     22    .fpOldI13h          resb    4   ; Far pointer to old INT 13h handler
     23    .wIdeBase           resb    2   ; Base port address for currently handled controller
    2924    .wTimeoutCounter    resb    2
    3025
    3126    .wDrvCntAndFirst:
    32     .bDrvCnt        resb    1   ; Number of drives handled by this BIOS
    33     .bFirstDrv      resb    1   ; Number of first drive for this BIOS
     27    .bDrvCnt            resb    1   ; Number of drives handled by this BIOS
     28    .bFirstDrv          resb    1   ; Number of first drive for this BIOS
    3429
    3530    ; Variables for drive number translation
     
    3934; Full mode RAM variables.
    4035struc FULLRAMVARS
    41     .ramVars        resb    RAMVARS_size
    42     .wSign          resb    2           ; FULLRAMVARS signature for finding segment
     36    .ramVars            resb    RAMVARS_size
     37    .wSign              resb    2       ; FULLRAMVARS signature for finding segment
    4338endstruc
    4439
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootSector.asm

    r143 r148  
    8585    mov     ah, 0Dh                         ; AH=Dh, Reset Hard Disk (Alternate reset)
    8686.SkipAltReset:
    87     int     INTV_DISK_FUNC
     87    int     BIOS_DISK_INTERRUPT_13h
    8888    ret
    8989
     
    106106    mov     cx, 1                           ; Cylinder 0, Sector 1
    107107    xor     dh, dh                          ; Head 0
    108     int     INTV_DISK_FUNC
     108    int     BIOS_DISK_INTERRUPT_13h
    109109    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r90 r148  
    44; Section containing code
    55SECTION .text
    6 
    7 ;--------------------------------------------------------------------
    8 ; Macro that prints drive and function number.
    9 ; Used only for debugging.
    10 ;
    11 ; DEBUG_PRINT_DRIVE_AND_FUNCTION
    12 ;   Parameters:
    13 ;       AH:     INT 13h function number
    14 ;       DL:     Drive number
    15 ;   Returns:
    16 ;       Nothing
    17 ;   Corrupts registers:
    18 ;       Nothing
    19 ;--------------------------------------------------------------------
    20 %macro DEBUG_PRINT_DRIVE_AND_FUNCTION 0
    21     push    dx
    22     push    ax
    23     mov     al, dl
    24     call    Print_IntHexW
    25     pop     ax
    26     pop     dx
    27 %endmacro
    28 
    296
    307;--------------------------------------------------------------------
     
    329; Jumps to specific function defined in AH.
    3310;
    34 ; Int13h_Jump
     11; Note to developers: Do not make recursive INT 13h calls!
     12;
     13; Int13h_DiskFunctionsHandler
    3514;   Parameters:
    3615;       AH:     Bios function
    3716;       DL:     Drive number
     17;       Other:  Depends on function
     18;   Returns:
     19;       Depends on function
     20;--------------------------------------------------------------------
     21ALIGN JUMP_ALIGN
     22Int13h_DiskFunctionsHandler:
     23    sti                                 ; Enable interrupts
     24    SAVE_AND_GET_INTPACK_TO_SSBP
     25
     26    call    RamVars_GetSegmentToDS
     27    call    DriveXlate_ToOrBack
     28    mov     [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl
     29    call    RamVars_IsFunctionHandledByThisBIOS
     30    jnc     SHORT Int13h_DirectCallToAnotherBios
     31    call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
     32
     33    ; Jump to correct BIOS function
     34JumpToBiosFunctionInAH:
     35    cmp     ah, 25h                     ; Valid BIOS function?
     36    ja      SHORT Int13h_UnsupportedFunction
     37    eMOVZX  bx, ah
     38    shl     bx, 1
     39    jmp     [cs:bx+g_rgw13hFuncJump]    ; Jump to BIOS function
     40
     41
     42;--------------------------------------------------------------------
     43; Int13h_UnsupportedFunction
     44; Int13h_DirectCallToAnotherBios
     45;   Parameters:
     46;       DL:     Translated drive number
     47;       DS:     RAMVARS segment
     48;       SS:BP:  Ptr to INTPACK
     49;       BX, DI: Corrupted on Int13h_DiskFunctionsHandler
     50;       Other:  Function specific INT 13h parameters
    3851;   Returns:
    3952;       Depends on function
     
    4255;--------------------------------------------------------------------
    4356ALIGN JUMP_ALIGN
    44 Int13h_DiskFunctions:
    45     ; Save registers
    46     sti                                 ; Enable interrupts
    47     push    ds                          ; Store DS
    48     push    di                          ; Store DI
    49 
    50     ;DEBUG_PRINT_DRIVE_AND_FUNCTION
     57Int13h_UnsupportedFunction:
     58Int13h_DirectCallToAnotherBios:
     59    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     60    mov     bx, [bp+INTPACK.bx]
     61    mov     di, [bp+INTPACK.di]
     62    mov     ds, [bp+INTPACK.ds]
     63    push    WORD [bp+INTPACK.flags]
     64    popf
     65    push    bp
     66    mov     bp, [bp+INTPACK.bp]
     67    int     BIOS_DISK_INTERRUPT_13h ; Can safely do as much recursion as it wants
     68
     69    ; Store returned values to INTPACK
     70    pop     bp  ; Standard INT 13h functions never uses BP as return register
     71%ifdef USE_386
     72    mov     [bp+INTPACK.gs], gs
     73    mov     [bp+INTPACK.fs], fs
     74%endif
     75    mov     [bp+INTPACK.es], es
     76    mov     [bp+INTPACK.ds], ds
     77    mov     [bp+INTPACK.di], di
     78    mov     [bp+INTPACK.si], si
     79    mov     [bp+INTPACK.bx], bx
     80    mov     [bp+INTPACK.dh], dh
     81    mov     [bp+INTPACK.cx], cx
     82    mov     [bp+INTPACK.ax], ax
     83    pushf
     84    pop     WORD [bp+INTPACK.flags]
    5185    call    RamVars_GetSegmentToDS
    52     call    DriveXlate_WhenEnteringInt13h
    53     call    RamVars_IsFunctionHandledByThisBIOS
    54     jnc     SHORT Int13h_DirectCallToAnotherBios
    55     ;DEBUG_PRINT_DRIVE_AND_FUNCTION
    56 
    57     ; Jump to correct BIOS function
    58     cmp     ah, 25h                     ; Valid BIOS function?
    59     ja      SHORT Int13h_UnsupportedFunction
    60     mov     di, ax
    61 %ifndef USE_186 ; This uses 9 bytes less and is about 5 cycles faster
    62     mov     al, ah                      ; Copy bits in AH to AL and then
    63     shl     al, 1                       ; shift them "back" 1 step
    64     and     al, 7Eh                     ; AND them (clears the MSB)
    65     cbw                                 ; Clear AH using sign extension
    66     xchg    di, ax                      ; and finally swap DI with AX
    67 %else
    68     eSHR_IM di, 7                       ; Shift function to DI...
    69     and     di, BYTE 7Eh                ; ...and prepare for word lookup
    70 %endif
    71     jmp     [cs:di+g_rgw13hFuncJump]    ; Jump to BIOS function
    72 
    73 
    74 ;--------------------------------------------------------------------
    75 ; Directs call to another INT13h function whose pointer is
    76 ; stored to RAMVARS.
    77 ;
    78 ; Int13h_DirectCallToAnotherBios
    79 ;   Parameters:
    80 ;       AH:     Bios function
     86    cmp     dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv]
     87    je      SHORT .ExchangeInt13hHandlers
     88    mov     [bp+INTPACK.dl], dl     ; Something is returned in DL
     89ALIGN JUMP_ALIGN
     90.ExchangeInt13hHandlers:
     91    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     92    ; Fall to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     93
     94
     95;--------------------------------------------------------------------
     96; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     97; Int13h_ReturnFromHandlerWithoutStoringErrorCode
     98;   Parameters:
     99;       AH:     BIOS Error code
     100;       SS:BP:  Ptr to INTPACK
     101;   Returns:
     102;       All registers are loaded from INTPACK
     103;--------------------------------------------------------------------
     104ALIGN JUMP_ALIGN
     105Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH:
     106    call    HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
     107Int13h_ReturnFromHandlerWithoutStoringErrorCode:
     108    or      WORD [bp+INTPACK.flags], FLG_FLAGS_IF   ; Return with interrupts enabled
     109    mov     sp, bp                                  ; Now we can exit anytime
     110    RESTORE_INTPACK_FROM_SSBP
     111
     112
     113;--------------------------------------------------------------------
     114; Int13h_CallPreviousInt13hHandler
     115;   Parameters:
     116;       AH:     INT 13h function to call
    81117;       DL:     Drive number
    82118;       DS:     RAMVARS segment
    83 ;       DI:     Corrupted
    84 ;       Stack from top to down:
    85 ;               Original DI
    86 ;               Original DS
    87119;   Returns:
    88120;       Depends on function
    89121;   Corrupts registers:
    90 ;       Flags
    91 ;--------------------------------------------------------------------
    92 ALIGN JUMP_ALIGN
    93 Int13h_UnsupportedFunction:
    94 Int13h_DirectCallToAnotherBios:
    95     ; Temporarily store original DI and DS from stack to RAMVARS
    96     pop     WORD [RAMVARS.wI13hDI]
    97     pop     WORD [RAMVARS.wI13hDS]
    98 
    99     ; Special return processing required if target function
    100     ; returns something in DL
    101     mov     di, Int13h_ReturnFromAnotherBiosWithValueInDL
    102     call    DriveXlate_DoesFunctionReturnSomethingInDL
    103     jc      SHORT .PushIretAddress
    104     add     di, BYTE Int13h_ReturnFromAnotherBios - Int13h_ReturnFromAnotherBiosWithValueInDL
    105 .PushIretAddress:
    106     pushf                               ; Push FLAGS to simulate INT
    107     push    cs                          ; Push return segment
    108     push    di                          ; Push return offset
    109 
    110     ; "Return" to another INT 13h with original DI and DS
    111     push    WORD [RAMVARS.fpOldI13h+2]  ; Segment
    112     push    WORD [RAMVARS.fpOldI13h]    ; Offset
    113     lds     di, [RAMVARS.dwI13DIDS]
    114     cli                                 ; Disable interrupts as INT would
    115     retf
    116 
    117 
    118 ;--------------------------------------------------------------------
    119 ; Int13h_CallPreviousInt13hHandler
    120 ;   Parameters:
    121 ;       AH:     Bios function
     122;       BX, DI, ES
     123;--------------------------------------------------------------------
     124ALIGN JUMP_ALIGN
     125Int13h_CallPreviousInt13hHandler:
     126    push    di
     127    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     128    int     BIOS_DISK_INTERRUPT_13h
     129    call    ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     130    pop     di
     131    ret
     132
     133
     134;--------------------------------------------------------------------
     135; ExchangeCurrentInt13hHandlerWithOldInt13hHandler
     136;   Parameters:
    122137;       DS:     RAMVARS segment
    123 ;       Other:  Depends on function to call
    124 ;   Returns:
    125 ;       Depends on function to call
     138;   Returns:
     139;       Nothing
    126140;   Corrupts registers:
    127 ;       Nothing
    128 ;--------------------------------------------------------------------
    129 ALIGN JUMP_ALIGN
    130 Int13h_CallPreviousInt13hHandler:
    131     pushf                               ; Push flags to simulate INT
    132     cli                                 ; Disable interrupts since INT does that
    133     call    FAR [RAMVARS.fpOldI13h]
    134     sti
     141;       DI
     142;--------------------------------------------------------------------
     143ALIGN JUMP_ALIGN
     144ExchangeCurrentInt13hHandlerWithOldInt13hHandler:
     145    push    es
     146    LOAD_BDA_SEGMENT_TO es, di
     147    mov     di, [RAMVARS.fpOldI13h]
     148    xchg    di, [es:BIOS_DISK_INTERRUPT_13h*4]
     149    mov     [RAMVARS.fpOldI13h], di
     150    mov     di, [RAMVARS.fpOldI13h+2]
     151    xchg    di, [es:BIOS_DISK_INTERRUPT_13h*4+2]
     152    mov     [RAMVARS.fpOldI13h+2], di
     153    pop     es
    135154    ret
    136155
    137 
    138 ;--------------------------------------------------------------------
    139 ; Int13h_ReturnFromAnotherBiosWithValueInDL
    140 ; Int13h_ReturnFromAnotherBios
    141 ;   Parameters:
    142 ;       AH:     Error code
    143 ;       DL:     Drive number (only on Int13h_ReturnFromAnotherBios)
    144 ;       CF:     Error status
    145 ;   Returns:
    146 ;       Depends on function
    147 ;   Corrupts registers:
    148 ;       Nothing (not even FLAGS)
    149 ;--------------------------------------------------------------------
    150 ALIGN JUMP_ALIGN
    151 Int13h_ReturnFromAnotherBiosWithValueInDL:
    152     push    ds
    153     push    di
    154     pushf                               ; Store return flags
    155     call    RamVars_GetSegmentToDS
    156     call    DriveXlate_WhenLeavingInt13hWithReturnValueInDL
    157     jmp     SHORT Int13h_Leave
    158 
    159 ALIGN JUMP_ALIGN
    160 Int13h_ReturnFromAnotherBios:
    161     push    ds
    162     push    di
    163     pushf                               ; Store return flags
    164     call    RamVars_GetSegmentToDS
    165     call    DriveXlate_WhenLeavingInt13h
    166     jmp     SHORT Int13h_Leave
    167 
    168 
    169 ;--------------------------------------------------------------------
    170 ; Returns from any BIOS function implemented by this BIOS.
    171 ;
    172 ; Int13h_ReturnWithValueInDL
    173 ; Int13h_PopXRegsAndReturn
    174 ; Int13h_PopDiDsAndReturn
    175 ;   Parameters:
    176 ;       DL:     Drive number (not Int13h_ReturnWithoutSwappingDrives)
    177 ;       DS:     RAMVARS segment
    178 ;   Returns:
    179 ;       Depends on function
    180 ;   Corrupts registers:
    181 ;       Nothing (not even FLAGS)
    182 ;--------------------------------------------------------------------
    183 ALIGN JUMP_ALIGN
    184 Int13h_ReturnWithValueInDL:
    185     pushf
    186     call    DriveXlate_WhenLeavingInt13hWithReturnValueInDL
    187     jmp     SHORT Int13h_LeaveAfterStoringErrorCodeToBDA
    188 
    189 ALIGN JUMP_ALIGN
    190 Int13h_PopXRegsAndReturn:
    191     pop     bx                          ; Pop old AX to BX
    192     mov     al, bl                      ; Restore AL
    193     pop     bx
    194     pop     cx
    195     pop     dx
    196     ; Fall to Int13h_PopDiDsAndReturn
    197 
    198 ALIGN JUMP_ALIGN
    199 Int13h_PopDiDsAndReturn:
    200     pushf
    201     call    DriveXlate_WhenLeavingInt13h
    202     ; Fall to Int13h_LeaveAfterStoringErrorCodeToBDA
    203 
    204 Int13h_LeaveAfterStoringErrorCodeToBDA:
    205     LOAD_BDA_SEGMENT_TO ds, di
    206     mov     [BDA.bHDStatus], ah
    207     ; Fall to Int13h_Leave
    208 
    209 Int13h_Leave:
    210     popf
    211     pop     di
    212     pop     ds
    213     retf    2
    214156
    215157
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r128 r148  
    1010; AH0h_HandlerForDiskControllerReset
    1111;   Parameters:
    12 ;       AH:     Bios function 0h
    13 ;       DL:     Drive number (ignored so all drives are reset)
     12;       DL:     Translated Drive number (ignored so all drives are reset)
    1413;               If bit 7 is set all hard disks and floppy disks reset.
    15 ;   Parameters loaded by Int13h_Jump:
    16 ;       DS:     RAMVARS segment
    17 ;   Returns:
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Returns with INTPACK in SS:BP:
    1817;       AH:     Int 13h return status (from drive requested in DL)
    1918;       CF:     0 if succesfull, 1 if error
    20 ;       IF:     1
    21 ;   Corrupts registers:
    22 ;       Flags
    2319;--------------------------------------------------------------------
    2420ALIGN JUMP_ALIGN
    2521AH0h_HandlerForDiskControllerReset:
    26     push    dx
    27     push    cx
    28     push    bx
    29     push    ax
    30 
    3122    eMOVZX  bx, dl                      ; Copy requested drive to BL, zero BH to assume no errors
    3223    call    ResetFloppyDrivesWithInt40h
     
    3526    call    ResetForeignHardDisks
    3627    call    AH0h_ResetHardDisksHandledByOurBIOS
    37 ALIGN JUMP_ALIGN
    3828.SkipHardDiskReset:
    39     mov     ah, bh                      ; Copy error code to AH
    40     xor     al, al                      ; Zero AL...
    41     cmp     al, bh                      ; ...and set CF if error
    42     jmp     Int13h_PopXRegsAndReturn
     29    mov     ah, bh
     30    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4331
    4432
     
    5745    and     dl, 7Fh                     ; Clear hard disk bit
    5846    xor     ah, ah                      ; Disk Controller Reset
    59     int     INTV_FLOPPY_FUNC
     47    int     BIOS_DISKETTE_INTERRUPT_40h
    6048    jmp     SHORT BackupErrorCodeFromTheRequestedDriveToBH
    6149
     
    9684    jnc     SHORT .Return               ; Return what was in BL unmodified
    9785    mov     dl, 80h
    98 ALIGN JUMP_ALIGN
    9986.Return:
    10087    ret
     
    171158BackupErrorCodeFromTheRequestedDriveToBH:
    172159    cmp     dl, bl              ; Requested drive?
    173     jne     SHORT .Return
    174     mov     bh, ah
    175 ALIGN JUMP_ALIGN
    176 .Return:
     160    eCMOVE  bh, ah
    177161    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH10h_HReady.asm

    r3 r148  
    1 ; File name     :   AH10h_HReady.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   9.12.2007
    4 ; Last update   :   12.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=10h, Check Drive Ready.
    73
     
    1410; AH10h_HandlerForCheckDriveReady
    1511;   Parameters:
    16 ;       AH:     Bios function 10h
    17 ;       DL:     Drive number (8xh)
    18 ;   Parameters loaded by Int13h_Jump:
    19 ;       DS:     RAMVARS segment
    20 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    2116;       AH:     Int 13h return status
    2217;       CF:     0 if succesfull, 1 if error
    23 ;       IF:     1
    24 ;   Corrupts registers:
    25 ;       Flags
    2618;--------------------------------------------------------------------
    2719ALIGN JUMP_ALIGN
    2820AH10h_HandlerForCheckDriveReady:
    29     ; Save registers
    30     push    dx
    31     push    cx
    32     push    bx
    33     push    ax
    34 
    35     ; Wait until drive is ready
    36     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    3721    call    HStatus_WaitRdyDefTime
    38     jmp     Int13h_PopXRegsAndReturn
     22    xor     ah, ah
     23    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH11h_HRecal.asm

    r84 r148  
    1 ; File name     :   AH11h_HRecal.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   28.9.2007
    4 ; Last update   :   14.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
     1; Project name  :   XTIDE Universal BIOS
    72; Description   :   Int 13h function AH=11h, Recalibrate.
    83
     
    1510; AH11h_HandlerForRecalibrate
    1611;   Parameters:
    17 ;       AH:     Bios function 11h
    18 ;       DL:     Drive number
    19 ;   Parameters loaded by Int13h_Jump:
    20 ;       DS:     RAMVARS segment
    21 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    2216;       AH:     BIOS Error code
    2317;       CF:     0 if succesfull, 1 if error
    24 ;       IF:     1
    25 ;   Corrupts registers:
    26 ;       Flags
    2718;--------------------------------------------------------------------
    2819ALIGN JUMP_ALIGN
    2920AH11h_HandlerForRecalibrate:
    30     push    dx
    31     push    cx
    32     push    bx
    33     push    ax
    3421%ifndef USE_186
    3522    call    AH11h_RecalibrateDrive
    36     jmp     Int13h_PopXRegsAndReturn
     23    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3724%else
    38     push    Int13h_PopXRegsAndReturn
     25    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3926    ; Fall through to AH11h_RecalibrateDrive
    4027%endif
     
    4229
    4330;--------------------------------------------------------------------
    44 ; Int 13h function AH=11h, Recalibrate.
    45 ;
    4631; AH11h_HRecalibrate
    4732;   Parameters:
    48 ;       DL:     Drive number
    49 ;       DS:     RAMVARS segment
     33;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5034;   Returns:
    51 ;       DS:DI:  Ptr to DPT
    5235;       AH:     BIOS Error code
    5336;       CF:     0 if succesfull, 1 if error
     
    5538;       AL, BX, CX, DX
    5639;--------------------------------------------------------------------
    57 ALIGN JUMP_ALIGN
    5840AH11h_RecalibrateDrive:
    5941    ; Recalibrate command is optional, vendor specific and not even
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm

    r117 r148  
    1010; AH15h_HandlerForReadDiskDriveSize
    1111;   Parameters:
    12 ;       AH:     Bios function 15h
    13 ;       DL:     Drive number
    14 ;   Parameters loaded by Int13h_Jump:
    15 ;       DS:     RAMVARS segment
    16 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    1716;       If succesfull:
    1817;           AH:     3 (Hard disk accessible)
     
    2322;           CX:DX:  0
    2423;           CF:     1
    25 ;       IF:     1
    26 ;   Corrupts registers:
    27 ;       Flags
    2824;--------------------------------------------------------------------
    2925ALIGN JUMP_ALIGN
    3026AH15h_HandlerForReadDiskDriveSize:
    31     push    bx
    32     push    ax
     27    call    HCapacity_GetSectorCountFromOurAH08h        ; Sector count to DX:AX
     28    mov     [bp+INTPACK.cx], dx                         ; HIWORD to CX
     29    mov     [bp+INTPACK.dx], ax                         ; LOWORD to DX
    3330
    34     call    HCapacity_GetSectorCountFromOurAH08h; Sector count to DX:AX (clears CF)
    35     mov     cx, dx                              ; HIWORD to CX
    36     xchg    dx, ax                              ; LOWORD to DX
    37 
    38     pop     ax
    39     pop     bx
    40     mov     ah, 3                               ; Type code = Hard disk
    41     jmp     Int13h_ReturnWithValueInDL
     31    xor     ah, ah
     32    call    HError_SetErrorCodeToIntpackInSSBPfromAH    ; Store success to BDA and CF
     33    mov     BYTE [bp+INTPACK.ah], 3                     ; Type code = Hard disk
     34    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm

    r116 r148  
    1010; AH1h_HandlerForReadDiskStatus
    1111;   Parameters:
    12 ;       AH:     Bios function 1h
    13 ;       DL:     Drive number (8xh)
    14 ;   Parameters loaded by Int13h_Jump:
    15 ;       DS:     RAMVARS segment
    16 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    1716;       AH:     Int 13h floppy return status
    1817;       CF:     0 if AH = RET_HD_SUCCESS, 1 otherwise (error)
    19 ;       IF:     1
    20 ;   Corrupts registers:
    21 ;       Flags
    2218;--------------------------------------------------------------------
    2319ALIGN JUMP_ALIGN
    2420AH1h_HandlerForReadDiskStatus:
    25     push    ds
    26 
    27     LOAD_BDA_SEGMENT_TO ds, di
    28     mov     ah, [BDA.bHDLastSt]     ; Last error to AH
    29     cmp     ah, 1                   ; Set CF if error code is zero
    30     cmc                             ; Invert CF
    31 
    32     pop     ds
    33     jmp     Int13h_PopDiDsAndReturn
     21    LOAD_BDA_SEGMENT_TO ds, ax, !
     22    xchg    ah, [BDA.bHDLastSt]     ; Load and clear last error
     23    call    HError_SetErrorCodeToIntpackInSSBPfromAH
     24    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r3 r148  
    1 ; File name     :   AH23h_HFeatures.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   28.12.2009
    4 ; Last update   :   12.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=23h,
    73;                   Set Controller Features Register.
     
    1511; AH23h_HandlerForSetControllerFeatures
    1612;   Parameters:
    17 ;       AH:     Bios function 23h
     13;       AL, CX: Same as in INTPACK
     14;       DL:     Translated Drive number
     15;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     16;       SS:BP:  Ptr to INTPACK
     17;   Parameters on INTPACK in SS:BP:
    1818;       AL:     Feature Number (parameter to Features Register = subcommand)
    19 ;       DL:     Drive number (8xh)
    20 ;   Parameters loaded by Int13h_Jump:
    21 ;       DS:     RAMVARS segment
    22 ;   Parameter registers are undocumented, specific for this BIOS:
     19;   (Parameter registers are undocumented, there are specific for this BIOS):
    2320;       BH:     Parameter to Sector Count Register (subcommand specific)
    2421;       BL:     Parameter to Sector Number Register (subcommand specific)
    2522;       CL:     Parameter to Low Cylinder Register (subcommand specific)
    2623;       CH:     Parameter to High Cylinder Register (subcommand specific)
     24;   Returns with INTPACK in SS:BP:
     25;       AH:     Int 13h return status
     26;       CF:     0 if succesfull, 1 if error
     27;--------------------------------------------------------------------
     28ALIGN JUMP_ALIGN
     29AH23h_HandlerForSetControllerFeatures:
     30%ifndef USE_186
     31    call    AH23h_SetControllerFeatures
     32    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     33%else
     34    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     35    ; Fall through to AH23h_SetControllerFeatures
     36%endif
     37
     38
     39;--------------------------------------------------------------------
     40; AH23h_SetControllerFeatures
     41;   Parameters:
     42;       AL:     Feature Number (parameter to Features Register = subcommand)
     43;       BH:     Parameter to Sector Count Register (subcommand specific)
     44;       BL:     Parameter to Sector Number Register (subcommand specific)
     45;       CL:     Parameter to Low Cylinder Register (subcommand specific)
     46;       CH:     Parameter to High Cylinder Register (subcommand specific)
     47;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    2748;   Returns:
    2849;       AH:     Int 13h return status
    2950;       CF:     0 if succesfull, 1 if error
    30 ;       IF:     1
    3151;   Corrupts registers:
    32 ;       Flags
     52;       AX, BX, CX, DX, SI
    3353;--------------------------------------------------------------------
    3454ALIGN JUMP_ALIGN
    35 AH23h_HandlerForSetControllerFeatures:
    36     push    dx
    37     push    cx
    38     push    bx
    39     push    ax
    40     push    si
    41 
     55AH23h_SetControllerFeatures:
    4256    ; Backup AL and BH to SI
    4357    mov     ah, bh
     
    4559
    4660    ; Select Master or Slave and wait until ready
    47     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    4861    call    HDrvSel_SelectDriveAndDisableIRQ
    49     jc      SHORT .Return               ; Return if error
     62    jc      SHORT .ReturnWithErrorCodeInAH
    5063
    5164    ; Output Feature Number
     
    6679    call    HCommand_OutputSectorCountAndCommand
    6780
    68     call    HStatus_WaitBsyDefTime      ; Wait until drive ready
    69 .Return:
    70     pop     si
    71     jmp     Int13h_PopXRegsAndReturn
     81    jmp     HStatus_WaitBsyDefTime      ; Wait until drive ready
     82.ReturnWithErrorCodeInAH:
     83    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r84 r148  
    1 ; File name     :   AH24h_HSetBlocks.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   28.12.2009
    4 ; Last update   :   14.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
     1; Project name  :   XTIDE Universal BIOS
    72; Description   :   Int 13h function AH=24h, Set Multiple Blocks.
    83
     
    1510; AH24h_HandlerForSetMultipleBlocks
    1611;   Parameters:
    17 ;       AH:     Bios function 24h
     12;       AL:     Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1817;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
    19 ;       DL:     Drive number
    20 ;   Parameters loaded by Int13h_Jump:
    21 ;       DS:     RAMVARS segment
    22 ;   Returns:
     18;   Returns with INTPACK in SS:BP:
    2319;       AH:     Int 13h return status
    2420;       CF:     0 if succesfull, 1 if error
    25 ;       IF:     1
    26 ;   Corrupts registers:
    27 ;       Flags
    2821;--------------------------------------------------------------------
    2922ALIGN JUMP_ALIGN
    3023AH24h_HandlerForSetMultipleBlocks:
    31     push    dx
    32     push    cx
    33     push    bx
    34     push    ax
    3524%ifndef USE_186
    3625    call    AH24h_SetBlockSize
    37     jmp     Int13h_PopXRegsAndReturn
     26    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3827%else
    39     push    Int13h_PopXRegsAndReturn
     28    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4029    ; Fall through to AH24h_SetBlockSize
    4130%endif
     
    4837;   Parameters:
    4938;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
    50 ;       DL:     Drive number
    51 ;       DS:     RAMVARS segment
     39;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5240;   Returns:
    53 ;       DS:DI:  Ptr to DPT
    5441;       AH:     Int 13h return status
    5542;       CF:     0 if succesfull, 1 if error
    5643;   Corrupts registers:
    57 ;       AL, BX, CX, DX, DI
     44;       AL, BX, CX, DX
    5845;--------------------------------------------------------------------
    5946ALIGN JUMP_ALIGN
     
    6148    ; Select Master or Slave and wait until ready
    6249    mov     bl, al                              ; Backup block size
    63     call    FindDPT_ForDriveNumber              ; DS:DI now points to DPT
    6450    call    HDrvSel_SelectDriveAndDisableIRQ    ; Select drive and wait until ready
    65     jc      SHORT .Return                       ; Return if error
     51    jc      SHORT .ReturnWithErrorCodeInAH      ; Return if error
    6652
    6753    ; Output block size and command
     
    8066.DisableBlockMode:
    8167    mov     BYTE [di+DPT.bSetBlock], 1          ; Disable block mode
    82 .Return:
     68.ReturnWithErrorCodeInAH:
    8369    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r120 r148  
    1010; AH25h_HandlerForGetDriveInformation
    1111;   Parameters:
    12 ;       AH:     Bios function 25h
    13 ;       DL:     Drive number
     12;       ES:     Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1417;       ES:BX:  Ptr to buffer to receive 512-byte drive information
    15 ;   Parameters loaded by Int13h_Jump:
    16 ;       DS:     RAMVARS segment
    17 ;   Returns:
    18 ;       ES:BX:  Ptr to 512-byte buffer to receive drive Information
     18;   Returns with INTPACK in SS:BP:
    1919;       AH:     Int 13h return status
    2020;       CF:     0 if succesfull, 1 if error
    21 ;       IF:     1
    22 ;   Corrupts registers:
    23 ;       Flags
    2421;--------------------------------------------------------------------
    2522ALIGN JUMP_ALIGN
    2623AH25h_HandlerForGetDriveInformation:
    27     push    dx
    28     push    cx
    29     push    bx
    30     push    ax
    31     push    es
    32 
    3324    ; Wait until previously selected drive is ready
    34     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    3525    call    HDrvSel_SelectDriveAndDisableIRQ
    36     jc      SHORT .Return               ; Return if error
     26    jc      SHORT .ReturnWithErrorCodeInAH      ; Return if error
    3727
    3828    ; Get drive information
     29    mov     bx, [bp+INTPACK.bx]
    3930    call    HPIO_NormalizeDataPointer
    4031    push    bx
     
    4536    pop     di                          ; Pop buffer offset to DI
    4637    call    AH25h_GetDriveInfo          ; Get drive information
    47 .Return:
    48     pop     es
    49     jmp     Int13h_PopXRegsAndReturn
     38.ReturnWithErrorCodeInAH:
     39    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    5040
    5141
     
    8777    eCMOVE  cl, B_TIMEOUT_RESET         ;  If so, load long timeout
    8878    call    HStatus_WaitRdy             ; Wait until ready to accept commands
    89     jc      SHORT .Return               ; Return if error
     79    jc      SHORT .ReturnWithErrorCodeInAH
    9080
    9181    ; Output command
     
    9383    out     dx, al                      ; Output command
    9484    call    HStatus_WaitDrqDefTime      ; Wait until ready to transfer (no IRQ!)
    95     jc      SHORT .Return               ; Return if error
     85    jc      SHORT .ReturnWithErrorCodeInAH
    9686
    9787    ; Transfer data
     
    10292    call    HStatus_WaitRdyDefTime      ; Wait until drive ready
    10393
    104 .Return:
     94.ReturnWithErrorCodeInAH:
    10595    pop     bx
    10696    pop     dx
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm

    r35 r148  
    1 ; File name     :   AH2h_HRead.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   27.9.2007
    4 ; Last update   :   24.8.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=2h, Read Disk Sectors.
    73
     
    1410; AH2h_HandlerForReadDiskSectors
    1511;   Parameters:
    16 ;       AH:     Bios function 2h
     12;       AL, CX, DH, ES: Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1717;       AL:     Number of sectors to read (1...255)
    1818;       CH:     Cylinder number, bits 7...0
     
    2020;               Bits 5...0: Starting sector number (1...63)
    2121;       DH:     Starting head number (0...255)
    22 ;       DL:     Drive number (8xh)
    2322;       ES:BX:  Pointer to buffer recieving data
    24 ;   Parameters loaded by Int13h_Jump:
    25 ;       DS:     RAMVARS segment
    26 ;   Returns:
     23;   Returns with INTPACK in SS:BP:
    2724;       AH:     Int 13h/40h floppy return status
    28 ;       AL:     Burst error length if AH=11h, undefined otherwise
     25;       AL:     Burst error length if AH returns 11h, undefined otherwise
    2926;       CF:     0 if successfull, 1 if error
    30 ;       IF:     1
    31 ;   Corrupts registers:
    32 ;       Flags
    3327;--------------------------------------------------------------------
    3428ALIGN JUMP_ALIGN
     
    3731    jz      SHORT AH2h_ZeroCntErr       ;  If so, return with error
    3832
    39     ; Save registers
    40     push    dx
    41     push    cx
    42     push    bx
    43     push    ax
    44 
    4533    ; Select sector or block mode command
    46     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    4734    mov     ah, HCMD_READ_SECT          ; Load sector mode command
    4835    cmp     BYTE [di+DPT.bSetBlock], 1  ; Block mode enabled?
    49     jbe     SHORT .XferData             ;  If not, jump to transfer
    50     mov     ah, HCMD_READ_MUL           ; Load block mode command
     36    eCMOVA  ah, HCMD_READ_MUL           ; Load block mode command
    5137
    5238    ; Transfer data
    53 ALIGN JUMP_ALIGN
    54 .XferData:
    5539    call    HCommand_OutputCountAndLCHSandCommand
    56     jc      SHORT .Return               ; Return if error
     40    jc      SHORT .ReturnWithErrorCodeInAH
     41    mov     bx, [bp+INTPACK.bx]
    5742    call    HPIO_ReadBlock              ; Read data from IDE-controller
    58 .Return:
    59     jmp     Int13h_PopXRegsAndReturn
     43.ReturnWithErrorCodeInAH:
     44    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    6045
    6146; Invalid sector count (also for AH=3h and AH=4h)
    6247AH2h_ZeroCntErr:
    6348    mov     ah, RET_HD_INVALID          ; Invalid value passed
    64     stc                                 ; Set CF since error
    65     jmp     Int13h_PopDiDsAndReturn
     49    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm

    r3 r148  
    1 ; File name     :   AH3h_HWrite.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   13.10.2007
    4 ; Last update   :   12.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=3h, Write Disk Sectors.
    73
     
    1410; AH3h_HandlerForWriteDiskSectors
    1511;   Parameters:
    16 ;       AH:     Bios function 3h
     12;       AL, CX, DH, ES: Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1717;       AL:     Number of sectors to write
    1818;       CH:     Cylinder number, bits 7...0
     
    2020;               Bits 5...0: Starting sector number (1...63)
    2121;       DH:     Starting head number (0...255)
    22 ;       DL:     Drive number (8xh)
    2322;       ES:BX:  Pointer to source data
    24 ;   Parameters loaded by Int13h_Jump:
    25 ;       DS:     RAMVARS segment
    26 ;   Returns:
     23;   Returns with INTPACK in SS:BP:
    2724;       AH:     Int 13h/40h floppy return status
    2825;       CF:     0 if successfull, 1 if error
    29 ;       IF:     1
    30 ;   Corrupts registers:
    31 ;       Flags
    3226;--------------------------------------------------------------------
    3327ALIGN JUMP_ALIGN
     
    3630    jz      SHORT AH2h_ZeroCntErr       ;  If so, return with error
    3731
    38     ; Save registers
    39     push    dx
    40     push    cx
    41     push    bx
    42     push    ax
    43 
    4432    ; Select sector or block mode command
    45     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    4633    mov     ah, HCMD_WRITE_SECT         ; Load sector mode command
    4734    cmp     BYTE [di+DPT.bSetBlock], 1  ; Block mode enabled?
    48     jbe     SHORT .XferData             ;  If not, jump to transfer
    49     mov     ah, HCMD_WRITE_MUL          ; Load block mode command
     35    eCMOVA  ah, HCMD_WRITE_MUL          ; Load block mode command
    5036
    5137    ; Transfer data
    52 ALIGN JUMP_ALIGN
    53 .XferData:
    5438    call    HCommand_OutputCountAndLCHSandCommand
    55     jc      SHORT .Return               ; Return if error
     39    jc      SHORT .ReturnWithErrorCodeInAH
     40    mov     bx, [bp+INTPACK.bx]
    5641    call    HPIO_WriteBlock             ; Write data to IDE-controller
    57 .Return:
    58     jmp     Int13h_PopXRegsAndReturn
     42.ReturnWithErrorCodeInAH:
     43    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm

    r84 r148  
    1 ; File name     :   AH4h_HVerify.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   13.10.2007
    4 ; Last update   :   14.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
     1; Project name  :   XTIDE Universal BIOS
    72; Description   :   Int 13h function AH=4h, Verify Disk Sectors.
    83
     
    1510; AH4h_HandlerForVerifyDiskSectors
    1611;   Parameters:
    17 ;       AH:     Bios function 4h
     12;       AL, CX, DH: Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1817;       AL:     Number of sectors to verify
    1918;       CH:     Cylinder number, bits 7...0
     
    2120;               Bits 5...0: Starting sector number (1...63)
    2221;       DH:     Starting head number (0...255)
    23 ;       DL:     Drive number
    24 ;       ES:BX:  Pointer to source data (not used)
    25 ;   Parameters loaded by Int13h_Jump:
    26 ;       DS:     RAMVARS segment
    27 ;   Returns:
     22;   Returns with INTPACK in SS:BP:
    2823;       AH:     Int 13h/40h floppy return status
    2924;       CF:     0 if successfull, 1 if error
    30 ;       IF:     1
    31 ;   Corrupts registers:
    32 ;       Flags
    3325;--------------------------------------------------------------------
    3426ALIGN JUMP_ALIGN
     
    3628    test    al, al                      ; Invalid sector count?
    3729    jz      SHORT AH2h_ZeroCntErr       ;  If so, return with error
    38     push    dx
    39     push    cx
    40     push    bx
    41     push    ax
    42 %ifndef USE_186
    43     call    AH4h_VerifySectors
    44     jmp     Int13h_PopXRegsAndReturn
    45 %else
    46     push    Int13h_PopXRegsAndReturn
    47     ; Fall through to AH4h_VerifySectors
    48 %endif
    4930
    50 
    51 ;--------------------------------------------------------------------
    52 ; Verifies hard disk sectors.
    53 ;
    54 ; AH4h_VerifySectors
    55 ;   Parameters:
    56 ;       AL:     Number of sectors to verify
    57 ;       CH:     Cylinder number, bits 7...0
    58 ;       CL:     Bits 7...6: Cylinder number bits 9 and 8
    59 ;               Bits 5...0: Starting sector number (1...63)
    60 ;       DH:     Starting head number (0...255)
    61 ;       DL:     Drive number
    62 ;       DS:     RAMVARS segment
    63 ;   Returns:
    64 ;       DS:DI:  Ptr to DPT
    65 ;       AH:     Int 13h/40h floppy return status
    66 ;       CF:     0 if successfull, 1 if error
    67 ;   Corrupts registers:
    68 ;       AL, BX, CX, DX
    69 ;--------------------------------------------------------------------
    70 ALIGN JUMP_ALIGN
    71 AH4h_VerifySectors:
    72     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    7331    mov     ah, HCMD_VERIFY_SECT        ; Load command to AH
    7432    call    HCommand_OutputCountAndLCHSandCommand
    75     jc      SHORT .Return               ; Return if error
     33    jc      SHORT .ReturnWithErrorCodeInAH
    7634    mov     bx, di                      ; DS:BX now points to DPT
    77     jmp     HStatus_WaitIrqOrRdy        ; Wait for IRQ or RDY
    78 .Return:
    79     ret
     35    call    HStatus_WaitIrqOrRdy        ; Wait for IRQ or RDY
     36.ReturnWithErrorCodeInAH:
     37    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm

    r93 r148  
    1010; AH8h_HandlerForReadDiskDriveParameters
    1111;   Parameters:
    12 ;       AH:     Bios function 8h
    13 ;       DL:     Drive number
    14 ;   Parameters loaded by Int13h_Jump:
    15 ;       DS:     RAMVARS segment
    16 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    1716;       CH:     Maximum cylinder number, bits 7...0
    1817;       CL:     Bits 7...6: Cylinder number bits 9...8
     
    2221;       AH:     Int 13h/40h floppy return status
    2322;       CF:     0 if successfull, 1 if error
    24 ;       IF:     1
    25 ;   Corrupts registers:
    26 ;       Flags
    2723;--------------------------------------------------------------------
    2824ALIGN JUMP_ALIGN
     
    3026    call    RamVars_IsDriveHandledByThisBIOS
    3127    jnc     SHORT .GetDriveParametersForForeignHardDiskInDL
     28    call    AH8h_GetDriveParameters
     29    jmp     SHORT .ReturnAfterStoringValuesToIntpack
    3230
    33     push    bx
    34     call    AH8h_GetDriveParameters
    35     pop     bx
    36     jmp     Int13h_ReturnWithValueInDL
    37 
    38 ALIGN JUMP_ALIGN
    3931.GetDriveParametersForForeignHardDiskInDL:
    4032    call    Int13h_CallPreviousInt13hHandler
    4133    jc      SHORT .ReturnErrorFromPreviousInt13hHandler
    4234    call    RamVars_GetCountOfKnownDrivesToDL
    43     jmp     Int13h_ReturnWithValueInDL
     35.ReturnAfterStoringValuesToIntpack:
     36    mov     [bp+INTPACK.cx], cx
     37    mov     [bp+INTPACK.dx], dx
     38    xor     ah, ah
    4439.ReturnErrorFromPreviousInt13hHandler:
    45     jmp     Int13h_PopDiDsAndReturn
     40    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4641
    4742
     
    5146; AH8h_GetDriveParameters
    5247;   Parameters:
    53 ;       DL:     Drive number
    54 ;       DS:     RAMVARS segment
     48;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5549;   Returns:
    5650;       CH:     Maximum cylinder number, bits 7...0
     
    5953;       DH:     Maximum head number (0...255)
    6054;       DL:     Number of drives
    61 ;       DS:DI:  Ptr to DPT
    62 ;       AH:     Int 13h/40h floppy return status
    63 ;       CF:     0 if successfull, 1 if error
    6455;   Corrupts registers:
    65 ;       AL, BX
     56;       AX, BX
    6657;--------------------------------------------------------------------
    6758ALIGN JUMP_ALIGN
    6859AH8h_GetDriveParameters:
    69     call    FindDPT_ForDriveNumber
    7060    call    AccessDPT_GetLCHSfromPCHS   ; AX=sectors, BX=cylinders, DX=heads
    71     call    AH8h_PackReturnValues
    72     xor     ax, ax                      ; Clear AH and CF
    73     ret
    74 
     61    ; Fall to .PackReturnValues
    7562
    7663;--------------------------------------------------------------------
    7764; Packs L-CHS values to INT 13h, AH=08h return values.
    7865;
    79 ; AH8h_PackReturnValues
     66; .PackReturnValues
    8067;   Parameters:
    8168;       AX:     Number of L-CHS sectors per track (1...63)
     
    9279;       AX, BX
    9380;--------------------------------------------------------------------
    94 ALIGN JUMP_ALIGN
    95 AH8h_PackReturnValues:
     81.PackReturnValues:
    9682    dec     bx                      ; Cylinder count to last cylinder
    9783    dec     dx                      ; Head count to max head number
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r84 r148  
    1 ; File name     :   AH9h_HInit.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   9.12.2007
    4 ; Last update   :   14.1.2011
    5 ; Author        :   Tomi Tilli,
    6 ;               :   Krister Nordvall (optimizations)
     1; Project name  :   XTIDE Universal BIOS
    72; Description   :   Int 13h function AH=9h, Initialize Drive Parameters.
    83
     
    1510; AH9h_HandlerForInitializeDriveParameters
    1611;   Parameters:
    17 ;       AH:     Bios function 9h
    18 ;       DL:     Drive number
    19 ;   Parameters loaded by Int13h_Jump:
    20 ;       DS:     RAMVARS segment
    21 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    2216;       AH:     Int 13h return status
    2317;       CF:     0 if succesfull, 1 if error
    24 ;       IF:     1
    25 ;   Corrupts registers:
    26 ;       Flags
    2718;--------------------------------------------------------------------
    2819ALIGN JUMP_ALIGN
    2920AH9h_HandlerForInitializeDriveParameters:
    30     push    dx
    31     push    cx
    32     push    bx
    33     push    ax
    3421%ifndef USE_186
    3522    call    AH9h_InitializeDriveForUse
    36     jmp     Int13h_PopXRegsAndReturn
     23    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3724%else
    38     push    Int13h_PopXRegsAndReturn
     25    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3926    ; Fall through to AH9h_InitializeDriveForUse
    4027%endif
     
    4633; AH9h_InitializeDriveForUse
    4734;   Parameters:
    48 ;       DL:     Drive number
    49 ;       DS:     RAMVARS segment
     35;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5036;   Returns:
    51 ;       DS:DI:  Ptr to DPT
    5237;       AH:     Int 13h return status
    5338;       CF:     0 if succesfull, 1 if error
    5439;   Corrupts registers:
    55 ;       AL, BX
     40;       AL, BX, DX
    5641;--------------------------------------------------------------------
    5742ALIGN JUMP_ALIGN
    5843AH9h_InitializeDriveForUse:
    59     push    dx
    6044    push    cx
    6145
    6246    ; Try to select drive and wait until ready
    63     call    FindDPT_ForDriveNumber
    6447    or      BYTE [di+DPT.bReset], MASK_RESET_ALL        ; Everything uninitialized
    6548    call    HDrvSel_SelectDriveAndDisableIRQ
     
    7659.RecalibrateDrive:
    7760    call    AH11h_RecalibrateDrive
    78     mov     dl, [di+DPT.bDrvNum]        ; Restore DL
    7961    jc      SHORT .InitializeBlockMode
    8062    and     BYTE [di+DPT.bReset], ~FLG_RESET_nRECALIBRATE
    8163
    8264    ; Initialize block mode transfers
    83 ALIGN JUMP_ALIGN
    8465.InitializeBlockMode:
    8566    call    AH9h_InitializeBlockMode
    86     ;mov        dl, [di+DPT.bDrvNum]        ; Restore DL
    8767    jc      SHORT .ReturnNotSuccessfull
    88     and     BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK
     68    and     BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK  ; Keeps CF clear
    8969
    9070.ReturnNotSuccessfull:
    9171    pop     cx
    92     pop     dx
    9372    ret
    9473
     
    135114; AH9h_InitializeBlockMode
    136115;   Parameters:
    137 ;       DL:     Drive number
    138116;       DS:DI:  Ptr to DPT
    139117;   Returns:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm

    r116 r148  
    1010; AHCh_HandlerForSeek
    1111;   Parameters:
    12 ;       AH:     Bios function Ch
     12;       CX, DH: Same as in INTPACK
     13;       DL:     Translated Drive number
     14;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     15;       SS:BP:  Ptr to INTPACK
     16;   Parameters on INTPACK in SS:BP:
    1317;       CH:     Cylinder number, bits 7...0
    1418;       CL:     Bits 7...6: Cylinder number bits 9 and 8
    1519;               Bits 5...0: Starting sector number (1...63)
    1620;       DH:     Starting head number (0...255)
    17 ;       DL:     Drive number
    18 ;   Parameters loaded by Int13h_Jump:
    19 ;       DS:     RAMVARS segment
    20 ;   Returns:
     21;   Returns with INTPACK in SS:BP:
    2122;       AH:     BIOS Error code
    2223;       CF:     0 if succesfull, 1 if error
    23 ;       IF:     1
    24 ;   Corrupts registers:
    25 ;       Flags
    2624;--------------------------------------------------------------------
    2725ALIGN JUMP_ALIGN
    2826AHCh_HandlerForSeek:
    29     push    dx
    30     push    cx
    31     push    bx
    32     push    ax
    3327%ifndef USE_186
    3428    call    AHCh_SeekToCylinder
    35     jmp     Int13h_PopXRegsAndReturn
     29    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3630%else
    37     push    Int13h_PopXRegsAndReturn
     31    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    3832    ; Fall through to AHCh_SeekToCylinder
    3933%endif
     
    4135
    4236;--------------------------------------------------------------------
    43 ; Seeks to a cylinder.
    44 ;
    4537; AHCh_SeekToCylinder
    4638;   Parameters:
     
    4941;               Bits 5...0: Starting sector number (1...63)
    5042;       DH:     Starting head number (0...255)
    51 ;       DL:     Drive Number
    52 ;       DS:     RAMVARS segment
     43;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5344;   Returns:
    54 ;       DS:DI:  Ptr to DPT
    5545;       AH:     BIOS Error code
    5646;       CF:     0 if succesfull, 1 if error
     
    5848;       AL, BX, CX, DX
    5949;--------------------------------------------------------------------
    60 ALIGN JUMP_ALIGN
    6150AHCh_SeekToCylinder:
    62     call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
    6351    mov     ax, HCMD_SEEK<<8            ; Load cmd to AH, AL=zero sector cnt
    6452    call    HCommand_OutputCountAndLCHSandCommand
    65     jc      SHORT .Return               ; Return if error
     53    jc      SHORT .ReturnWithErrorCodeInAH
    6654    mov     bx, di                      ; DS:BX now points to DPT
    6755    jmp     HStatus_WaitIrqOrRdy        ; Wait for IRQ or RDY
    68 .Return:
     56.ReturnWithErrorCodeInAH:
    6957    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r143 r148  
    1010; AHDh_HandlerForResetHardDisk
    1111;   Parameters:
    12 ;       AH:     Bios function Dh
    13 ;       DL:     Drive number
    14 ;   Returns:
     12;       DL:     Translated Drive number
     13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     14;       SS:BP:  Ptr to INTPACK
     15;   Returns with INTPACK in SS:BP:
    1516;       AH:     Int 13h return status
    1617;       CF:     0 if succesfull, 1 if error
    17 ;       IF:     1
    18 ;   Corrupts registers:
    19 ;       Flags
    2018;--------------------------------------------------------------------
    2119ALIGN JUMP_ALIGN
     
    2321%ifndef USE_186
    2422    call    AHDh_ResetDrive
    25     jmp     Int13h_PopDiDsAndReturn
     23    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    2624%else
    27     push    Int13h_PopDiDsAndReturn
     25    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    2826    ; Fall through to AHDh_ResetDrive
    2927%endif
     
    4139;       CF:     0 if succesfull, 1 if error
    4240;   Corrupts registers:
    43 ;       DI
     41;       AL, CX, DI
    4442;--------------------------------------------------------------------
    4543ALIGN JUMP_ALIGN
    4644AHDh_ResetDrive:
    4745    push    dx
    48     push    cx
    4946    push    bx
    50     push    ax
    5147
    5248    call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
     
    6056    call    AHDh_InitializeMasterAndSlave
    6157
    62     pop     bx                          ; Pop old AX
    63     mov     al, bl                      ; Restore AL
    6458    pop     bx
    65     pop     cx
    6659    pop     dx
    6760    ret
     
    9083    call    HDrvSel_OutputDeviceControlByte
    9184    mov     ax, 5                       ; Delay at least 5us
    92     call    HTimer_MicrosecondsFromAX
     85    call    HTimer_DelayMicrosecondsFromAX
    9386
    9487    ; HSR1: Clear_wait
     
    9689    out     dx, al                      ; End Reset
    9790    mov     ax, 2000                    ; Delay at least 2ms
    98     call    HTimer_MicrosecondsFromAX
     91    call    HTimer_DelayMicrosecondsFromAX
    9992
    10093    ; HSR2: Check_status
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCapacity.asm

    r117 r148  
    1313;       DL:     Drive number
    1414;       DS:     RAMVARS segment
     15;       DS:DI:  Ptr to DPT (HCapacity_GetSectorCountFromOurAH08h)
    1516;   Returns:
    1617;       DX:AX:  Total sector count
     
    2122ALIGN JUMP_ALIGN
    2223HCapacity_GetSectorCountFromForeignAH08h:
    23     mov     ah, 08h         ; Get Drive Parameters
     24    mov     ah, GET_DRIVE_PARAMETERS
    2425    call    Int13h_CallPreviousInt13hHandler
    25     jmp     SHORT HCapacity_ConvertAH08hReturnValuesToSectorCount
     26    jmp     SHORT ConvertAH08hReturnValuesToSectorCount
    2627
    2728ALIGN JUMP_ALIGN
    2829HCapacity_GetSectorCountFromOurAH08h:
    29     push    di
    3030    call    AH8h_GetDriveParameters
    31     pop     di
    32     ; Fall to HCapacity_ConvertAH08hReturnValuesToSectorCount
     31    ; Fall to ConvertAH08hReturnValuesToSectorCount
    3332
    34 ALIGN JUMP_ALIGN
    35 HCapacity_ConvertAH08hReturnValuesToSectorCount:
     33ConvertAH08hReturnValuesToSectorCount:
    3634    call    HAddress_ExtractLCHSFromBiosParams
    3735    xor     ax, ax          ; Zero AX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HDrvSel.asm

    r88 r148  
    44; Section containing code
    55SECTION .text
     6
     7;--------------------------------------------------------------------
     8; Selects Master or Slave drive and disables interrupts. Interrupts should
     9; be disabled for commands that do not transfer data.
     10; This function returns after drive is ready to accept commands.
     11;
     12; HDrvSel_SelectDriveAndDisableIRQ
     13;   Parameters:
     14;       DS:DI:  Ptr to DPT
     15;   Returns:
     16;       AH:     BIOS Error code
     17;       CF:     0 if drive selected successfully
     18;               1 if any error
     19;   Corrupts registers:
     20;       AL
     21;--------------------------------------------------------------------
     22ALIGN JUMP_ALIGN
     23HDrvSel_SelectDriveAndDisableIRQ:
     24    push    bx
     25    mov     al, [di+DPT.bDrvCtrl]   ; Load Device Control Byte
     26    or      al, FLG_IDE_CTRL_nIEN   ; Disable interrupts
     27    call    HDrvSel_SelectDriveAndSetControlByte
     28    pop     bx
     29    ret
     30
    631
    732;--------------------------------------------------------------------
     
    81106    out     dx, al                          ; Output Device Control byte
    82107    ret
    83 
    84 
    85 ;--------------------------------------------------------------------
    86 ; Selects Master or Slave drive and disables interrupts. Interrupts should
    87 ; be disabled for commands that do not transfer data.
    88 ; This function returns after drive is ready to accept commands.
    89 ;
    90 ; HDrvSel_SelectDriveAndDisableIRQ
    91 ;   Parameters:
    92 ;       DS:DI:  Ptr to DPT
    93 ;   Returns:
    94 ;       AH:     BIOS Error code
    95 ;       CF:     0 if drive selected successfully
    96 ;               1 if any error
    97 ;   Corrupts registers:
    98 ;       AL
    99 ;--------------------------------------------------------------------
    100 ALIGN JUMP_ALIGN
    101 HDrvSel_SelectDriveAndDisableIRQ:
    102     push    bx
    103     mov     al, [di+DPT.bDrvCtrl]   ; Load Device Control Byte
    104     or      al, FLG_IDE_CTRL_nIEN   ; Disable interrupts
    105     call    HDrvSel_SelectDriveAndSetControlByte
    106     pop     bx
    107     ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm

    r86 r148  
    1 ; Project name  :   IDE BIOS
     1; Project name  :   XTIDE Universal BIOS
    22; Description   :   Error checking functions for BIOS Hard disk functions.
    33
     
    66
    77;--------------------------------------------------------------------
    8 ; HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
    9 ; HError_ProcessErrorsAfterPollingBSY
     8; HError_GetErrorCodeToAHforTimeoutWhenPolling
    109;   Parameters:
    1110;       DS:     RAMVARS segment
     
    1817;--------------------------------------------------------------------
    1918ALIGN JUMP_ALIGN
    20 HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit:
    21     call    HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
    22     call    GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
     19HError_GetErrorCodeToAHforTimeoutWhenPolling:
     20    call    HError_GetErrorCodeToAHafterPolling
    2321    jc      SHORT .ReturnErrorCodeInAH
    2422    mov     ah, RET_HD_TIMEOUT          ; Force timeout since no actual error...
     
    2826
    2927
     28;--------------------------------------------------------------------
     29; HError_GetErrorCodeToAHafterPolling
     30;   Parameters:
     31;       DS:     RAMVARS segment
     32;   Returns:
     33;       AH:     BIOS error code
     34;       CF:     Set if error
     35;               Cleared if no error
     36;   Corrupts registers:
     37;       AL
     38;--------------------------------------------------------------------
    3039ALIGN JUMP_ALIGN
    31 HError_ProcessErrorsAfterPollingBSY:
     40HError_GetErrorCodeToAHafterPolling:
    3241%ifndef USE_186
    3342    call    HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA
     
    131140    db  RET_HD_BADSECTOR    ; Bit7=BBK, Bad Block Detected
    132141    db  RET_HD_STATUSERR    ; When Error Register is zero
     142
     143
     144;--------------------------------------------------------------------
     145; HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH
     146; HError_SetErrorCodeToIntpackInSSBPfromAH
     147;   Parameters:
     148;       AH:     BIOS error code (00h = no error)
     149;       SS:BP:  Ptr to INTPACK
     150;   Returns:
     151;       SS:BP:  Ptr to INTPACK with error condition set
     152;   Corrupts registers:
     153;       DS, DI
     154;--------------------------------------------------------------------
     155ALIGN JUMP_ALIGN
     156HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH:
     157    ; Store error code to BDA
     158    LOAD_BDA_SEGMENT_TO ds, di
     159    mov     [BDA.bHDLastSt], ah
     160
     161    ; Store error code to INTPACK
     162HError_SetErrorCodeToIntpackInSSBPfromAH:
     163    mov     [bp+INTPACK.ah], ah
     164    test    ah, ah
     165    jnz     SHORT .SetCFtoIntpack
     166    and     BYTE [bp+INTPACK.flags], ~FLG_FLAGS_CF
     167    ret
     168.SetCFtoIntpack:
     169    or      BYTE [bp+INTPACK.flags], FLG_FLAGS_CF
     170    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm

    r116 r148  
    88; HIRQ_WaitForIRQ
    99;   Parameters:
    10 ;       DS:     RAMVARS segment
     10;       DS:BX:  Ptr to DPT
    1111;   Returns:
    1212;       CF:     Set if wait done by operating system
     
    3636
    3737    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Zero AX
     38    mov     ah, OS_HOOK_DEVICE_BUSY     ; Hard disk busy (AX=9000h)
    3839    cli                                 ; Disable interrupts
    3940    cmp     al, [BDA.bHDTaskFlg]        ; Task flag already set?
    4041    jc      SHORT .ReturnFromWaitNotify ;  If so, skip OS notification
    41 
    42     mov     ah, 90h                     ; Hard disk busy (AX=9000h)
    43     int     INTV_SYSTEM_SERVICES        ; OS hook, device busy
     42    int     BIOS_SYSTEM_INTERRUPT_15h   ; OS hook, device busy
    4443    jnc     SHORT .ReturnFromWaitNotify ; CF cleared, BIOS handles waiting
    4544
     
    106105
    107106    ; Issue Int 15h, function AX=9100h (Interrupt ready)
    108     mov     ax, 9100h                   ; Interrupt ready, device 0 (HD)
    109     int     INTV_SYSTEM_SERVICES
     107    mov     ax, OS_HOOK_DEVICE_POST<<8  ; Interrupt ready, device 0 (HD)
     108    int     BIOS_SYSTEM_INTERRUPT_15h
    110109
    111110    pop     ax                          ; Restore AX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm

    r140 r148  
    2121ALIGN JUMP_ALIGN
    2222HStatus_WaitIrqOrRdy:
    23     call    HIRQ_WaitForIRQ
     23    call    HIRQ_WaitForIRQ         ; For OS hook (we still need error processing)
    2424    jnc     SHORT .PollRdySinceNoWaitingOnOsHook
    25     jmp     HError_ProcessErrorsAfterPollingBSY
     25    jmp     HError_GetErrorCodeToAHafterPolling
    2626
    2727ALIGN JUMP_ALIGN
     
    4848    call    HIRQ_WaitForIRQ
    4949    jnc     SHORT .PollDrqSinceNoWaitingOnOsHook
    50     jmp     HError_ProcessErrorsAfterPollingBSY
     50    jmp     HError_GetErrorCodeToAHafterPolling
    5151
    5252ALIGN JUMP_ALIGN
     
    185185.UpdateTimeout:
    186186    call    HTimer_SetCFifTimeout
    187     jnc     SHORT .PollLoop                         ; Loop if time left (sets CF on timeout)
    188     jmp     HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
     187    jnc     SHORT .PollLoop                         ; Loop if time left
     188    jmp     HError_GetErrorCodeToAHforTimeoutWhenPolling
    189189
    190190;--------------------------------------------------------------------
     
    218218ALIGN JUMP_ALIGN
    219219GetErrorCodeFromPollingToAH:
    220     jmp     HError_ProcessErrorsAfterPollingBSY
     220    jmp     HError_GetErrorCodeToAHafterPolling
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HTimer.asm

    r143 r148  
    4545; RTC resolution is 977 microsecs.
    4646;
    47 ; HTimer_MicrosecondsFromAX
     47; HTimer_DelayMicrosecondsFromAX
    4848;   Parameters:
    4949;       AX:     Number of microsecs to wait
     
    5353;       AX
    5454;--------------------------------------------------------------------
    55 HTimer_MicrosecondsFromAX:
     55HTimer_DelayMicrosecondsFromAX:
    5656%ifndef USE_AT
    5757    mov     ax, 1
     
    6262
    6363    xor     cx, cx
    64     xchg    dx, ax                          ; Microsecs now in CX:DX
     64    xchg    dx, ax                      ; Microsecs now in CX:DX
    6565    mov     ah, EVENT_WAIT
    6666    int     BIOS_SYSTEM_INTERRUPT_15h
    67     sti                                     ; XT BIOSes return with interrupt disabled
     67    sti                                 ; XT BIOSes return with interrupt disabled
    6868
    6969    pop     cx
    7070    pop     dx
    71     mov     ax, 1                           ; Prepare to wait 1 timer tick
    72     jc      SHORT HTimer_TimerTicksFromAX   ; Event Wait was unsupported or busy
     71    mov     ax, 1                               ; Prepare to wait 1 timer tick
     72    jc      SHORT HTimer_DelayTimerTicksFromAX  ; Event Wait was unsupported or busy
    7373    ret
    7474%endif
     
    7979; will occur at 54.9 ms intervals.
    8080;
    81 ; HTimer_TimerTicksFromAX
     81; HTimer_DelayTimerTicksFromAX
    8282;   Parameters:
    8383;       AX:     Number of timer ticks to wait
     
    8787;       AX
    8888;--------------------------------------------------------------------
    89 HTimer_TimerTicksFromAX:
     89HTimer_DelayTimerTicksFromAX:
    9090    sti                             ; Make sure that interrupts are enabled
    9191    call    ReadTimeFromBdaToCX
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm

    r128 r148  
    66
    77;--------------------------------------------------------------------
    8 ; Translates drive number when entering INT 13h.
    9 ;
    10 ; DriveXlate_WhenEnteringInt13h
    11 ;   Parameters:
    12 ;       DL:     Drive number to be possibly translated
    13 ;       DS:     RAMVARS segment
    14 ;   Returns:
    15 ;       DL:     Translated drive number
    16 ;   Corrupts registers:
    17 ;       DI
    18 ;--------------------------------------------------------------------
    19 ALIGN JUMP_ALIGN
    20 DriveXlate_WhenEnteringInt13h:
    21     inc     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    22     cmp     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 1
    23     je      SHORT DriveXlate_ToOrBack
    24     ret
    25 
    26 
    27 ;--------------------------------------------------------------------
    28 ; DriveXlate_WhenLeavingInt13hWithReturnValueInDL
    29 ;   Parameters:
    30 ;       DS:     RAMVARS segment
    31 ;   Returns:
    32 ;       Nothing
    33 ;   Corrupts registers:
    34 ;       DI
    35 ;--------------------------------------------------------------------
    36 ALIGN JUMP_ALIGN
    37 DriveXlate_WhenLeavingInt13hWithReturnValueInDL:
    38     dec     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    39     ret
    40 
    41 ;--------------------------------------------------------------------
    42 ; Translates drive number when leaving INT 13h.
    43 ;
    44 ; DriveXlate_WhenLeavingInt13h
    45 ;   Parameters:
    46 ;       DL:     Drive number to be possibly translated
    47 ;       DS:     RAMVARS segment
    48 ;   Returns:
    49 ;       DL:     Translated drive number
    50 ;   Corrupts registers:
    51 ;       DI
    52 ;--------------------------------------------------------------------
    53 ALIGN JUMP_ALIGN
    54 DriveXlate_WhenLeavingInt13h:
    55     dec     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]
    56     jz      SHORT DriveXlate_ToOrBack
    57     ret
    58 
    59 
    60 ;--------------------------------------------------------------------
    61 ; Translates drive number to or back.
    62 ;
    638; DriveXlate_ToOrBack
    649;   Parameters:
     
    7520    jz      SHORT .Return           ; Return if translation disabled
    7621    xchg    di, ax                  ; Backup AX
    77     call    DriveXlate_SwapFloppyDriveOrHardDisk
     22    call    SwapFloppyDriveOrHardDisk
    7823    xchg    ax, di
    7924.Return:
     
    8227
    8328;--------------------------------------------------------------------
    84 ; Swaps Floppy Drive or Hard Disk number.
    85 ;
    86 ; DriveXlate_SwapFloppyDriveOrHardDisk
     29; SwapFloppyDriveOrHardDisk
    8730;   Parameters:
    8831;       DL:     Drive number to be possibly swapped
     
    9437;--------------------------------------------------------------------
    9538ALIGN JUMP_ALIGN
    96 DriveXlate_SwapFloppyDriveOrHardDisk:
     39SwapFloppyDriveOrHardDisk:
    9740    mov     ah, 80h                 ; Assume hard disk
    9841    mov     al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
     
    14588DriveXlate_Reset:
    14689    mov     WORD [RAMVARS.xlateVars], 8000h ; .bFDSwap and .bHDSwap
    147     mov     BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 0
    14890    ret
    14991
     
    172114    mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
    173115    ret
    174 
    175 
    176 ;--------------------------------------------------------------------
    177 ; Checks if INT 13h function returns some value in DL
    178 ; (other than the drive number that was also parameter).
    179 ;
    180 ; DriveXlate_DoesFunctionReturnSomethingInDL
    181 ;   Parameters:
    182 ;       AH:     INT 13h BIOS Function
    183 ;       DL:     Drive number
    184 ;   Returns:
    185 ;       CF:     Set if something is returned in DL
    186 ;               Cleared if only drive number parameter is returned in DL
    187 ;   Corrupts registers:
    188 ;       Nothing
    189 ;--------------------------------------------------------------------
    190 ALIGN JUMP_ALIGN
    191 DriveXlate_DoesFunctionReturnSomethingInDL:
    192     cmp     ah, 08h         ; AH=08h, Read Disk Drive Parameters?
    193     je      SHORT DriveXlate_FunctionReturnsSomethingInDL
    194     test    dl, dl
    195     jns     SHORT DriveXlate_DoesFloppyFunctionReturnSomethingInDL
    196     ; Fall to DriveXlate_DoesHardDiskFunctionReturnSomethingInDL
    197 
    198 ;--------------------------------------------------------------------
    199 ; Checks if INT 13h hard disk or floppy drive function returns some
    200 ; value in DL other than the drive number that was also parameter).
    201 ; Some functions return different values for hard disks and floppy drives.
    202 ;
    203 ; DriveXlate_DoesHardDiskFunctionReturnSomethingInDL
    204 ; DriveXlate_DoesFloppyFunctionReturnSomethingInDL
    205 ;   Parameters:
    206 ;       AH:     INT 13h BIOS Function
    207 ;       DL:     Hard Disk number
    208 ;   Returns:
    209 ;       CF:     Set if something is returned in DL
    210 ;               Cleared if only drive number parameter is returned in DL
    211 ;   Corrupts registers:
    212 ;       Nothing
    213 ;--------------------------------------------------------------------
    214 ; ALIGN JUMP_ALIGN
    215 DriveXlate_DoesHardDiskFunctionReturnSomethingInDL:
    216     cmp     ah, 15h         ; AH=15h, Read Disk Drive Size?
    217     je      SHORT DriveXlate_FunctionReturnsSomethingInDL
    218 DriveXlate_DoesFloppyFunctionReturnSomethingInDL:
    219     clc
    220     ret
    221 
    222 ALIGN JUMP_ALIGN
    223 DriveXlate_FunctionReturnsSomethingInDL:
    224     stc
    225     ret
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r123 r148  
    3434    mov     [RAMVARS.fpOldI13h+2], dx           ; Store old INT 13h segment
    3535    mov     bx, INTV_DISK_FUNC                  ; INT 13h interrupt vector offset
    36     mov     si, Int13h_DiskFunctions            ; Interrupt handler offset
     36    mov     si, Int13h_DiskFunctionsHandler     ; Interrupt handler offset
    3737    call    Interrupts_InstallHandlerToVectorInBXFromCSSI
    3838
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r145 r148  
    149149;               Cleared if drive belongs to some other BIOS
    150150;   Corrupts registers:
    151 ;       DI
     151;       Nothing
    152152;--------------------------------------------------------------------
    153153ALIGN JUMP_ALIGN
    154154RamVars_IsDriveHandledByThisBIOS:
    155     xchg    di, ax                              ; Backup AX
     155    push    ax
    156156    mov     ax, [RAMVARS.wDrvCntAndFirst]       ; Drive count to AL, First number to AH
    157157    add     al, ah                              ; One past last drive to AL
     
    161161    ja      SHORT .DriveNotHandledByThisBIOS
    162162    stc
    163 ALIGN JUMP_ALIGN
    164163.DriveNotHandledByThisBIOS:
    165     xchg    ax, di
     164    pop     ax
    166165    ret
    167166
Note: See TracChangeset for help on using the changeset viewer.