Changeset 148 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common


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

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.