Changeset 88 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers


Ignore:
Timestamp:
Jan 27, 2011, 8:14:13 AM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Now uses new libraries (untested)
  • Non-working since code size is too large
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r3 r88  
    1 ; File name     :   AH25h_HDrvID.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   24.10.2009
    4 ; Last update   :   14.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 13h function AH=25h, Get Drive Information.
    73
     
    9187    mov     al, HCMD_ID_DEV             ; Load Identify Device command to AL
    9288    out     dx, al                      ; Output command
    93     call    SoftDelay_BeforePollingStatusRegister
    9489    call    HStatus_WaitDrqDefTime      ; Wait until ready to transfer (no IRQ!)
    9590    jc      SHORT .Return               ; Return if error
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r84 r88  
    1 ; File name     :   AHDh_HReset.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=Dh, Reset Hard Disk (Alternate reset).
    83
     
    9489    or      al, FLG_IDE_CTRL_SRST       ; Set Reset bit
    9590    call    HDrvSel_OutputDeviceControlByte
    96     mov     cx, 5                       ; Delay at least 5us
    97     call    SoftDelay_us
     91    mov     ax, 5                       ; Delay at least 5us
     92    call    Delay_MicrosecondsFromAX
    9893
    9994    ; HSR1: Clear_wait
    100     and     al, ~FLG_IDE_CTRL_SRST      ; Clear Reset bit
     95    mov     al, [di+DPT.bDrvCtrl]       ; Load value for ACR
    10196    out     dx, al                      ; End Reset
    102     mov     cx, 2000                    ; Delay at least 2ms
    103     call    SoftDelay_us
     97    mov     ax, 2000                    ; Delay at least 2ms
     98    call    Delay_MicrosecondsFromAX
    10499
    105100    ; HSR2: Check_status
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCapacity.asm

    r32 r88  
    1 ; File name     :   HCapacity.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   16.3.2010
    4 ; Last update   :   3.8.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for hard disk capacity calculations.
    73
     
    4743    xor     bx, bx          ; Zero BX for 48-bit sector count
    4844    ret
    49 
    50 
    51 ;--------------------------------------------------------------------
    52 ; Converts sector count to hard disk size.
    53 ;
    54 ; HCapacity_ConvertSectorCountToSize:
    55 ;   Parameters:
    56 ;       BX:DX:AX:   Total sector count
    57 ;   Returns:
    58 ;       AX:         Size in magnitude
    59 ;       SI:         Tenths
    60 ;       CX:         Magnitude character:
    61 ;                       'k' = *1024   B = kiB
    62 ;                       'M' = *1024 kiB = MiB
    63 ;                       'G' = *1024 MiB = GiB
    64 ;                       'T' = *1024 GiB = TiB
    65 ;                       'P' = *1024 TiB = PiB
    66 ;   Corrupts registers:
    67 ;       BX, DX
    68 ;--------------------------------------------------------------------
    69 ALIGN JUMP_ALIGN
    70 HCapacity_ConvertSectorCountToSize:
    71     call    HCapacity_ConvertSectorCountToKiB
    72     mov     cx, 1                   ; Magnitude is 1 for kiB
    73 ALIGN JUMP_ALIGN
    74 .MagnitudeLoop:
    75     test    bx, bx                  ; Bits 32...47 in use?
    76     jnz     SHORT .ShiftByMagnitude ;  If so, jump to shift
    77     test    dx, dx                  ; Bits 16...31 in use?
    78     jnz     SHORT .ShiftByMagnitude ;  If so, jump to shift
    79     cmp     ax, 10000               ; 5 digits needed?
    80     jb      SHORT .ShiftComplete    ;  If less, all done
    81 ALIGN JUMP_ALIGN
    82 .ShiftByMagnitude:
    83     call    HCapacity_ShiftForNextMagnitude
    84     jmp     SHORT .MagnitudeLoop
    85 ALIGN JUMP_ALIGN
    86 .ShiftComplete:
    87     mov     bx, cx                  ; Copy shift count to BX
    88     mov     cl, [cs:bx+.rgbMagnitudeToChar]
    89     jmp     SHORT HCapacity_ConvertSizeRemainderToTenths
    90 ALIGN WORD_ALIGN
    91 .rgbMagnitudeToChar:    db  " kMGTP"
    92 
    93 ;--------------------------------------------------------------------
    94 ; Converts 48-bit sector count to size in kiB.
    95 ;
    96 ; HCapacity_ConvertSectorCountToKiB:
    97 ;   Parameters:
    98 ;       BX:DX:AX:   Total sector count
    99 ;   Returns:
    100 ;       BX:DX:AX:   Total size in kiB
    101 ;       CF:         Remainder from division
    102 ;   Corrupts registers:
    103 ;       Nothing
    104 ;--------------------------------------------------------------------
    105 ALIGN JUMP_ALIGN
    106 HCapacity_ConvertSectorCountToKiB:
    107 HCapacity_DivideSizeByTwo:
    108     shr     bx, 1                   ; Divide sector count by 2...
    109     rcr     dx, 1                   ; ...to get disk size in...
    110     rcr     ax, 1                   ; ...kiB
    111     ret
    112 
    113 ;--------------------------------------------------------------------
    114 ; Divides size by 1024 and increments magnitude.
    115 ;
    116 ; HCapacity_ShiftForNextMagnitude:
    117 ;   Parameters:
    118 ;       BX:DX:AX:   Size in magnitude
    119 ;       CX:         Magnitude (0=B, 1=kiB, 2=MiB...)
    120 ;   Returns:
    121 ;       BX:DX:AX:   Size in magnitude
    122 ;       SI:         Remainder (0...1023)
    123 ;       CX:         Magnitude (1=kiB, 2=MiB...)
    124 ;   Corrupts registers:
    125 ;       Nothing
    126 ;--------------------------------------------------------------------
    127 ALIGN JUMP_ALIGN
    128 HCapacity_ShiftForNextMagnitude:
    129     push    cx
    130     xor     si, si                  ; Zero remainder
    131     mov     cl, 10                  ; Divide by 1024
    132 ALIGN JUMP_ALIGN
    133 .ShiftLoop:
    134     call    HCapacity_DivideSizeByTwo
    135     rcr     si, 1                   ; Update remainder
    136     loop    .ShiftLoop
    137     eSHR_IM si, 6                   ; Remainder to SI beginning
    138     pop     cx
    139     inc     cx                      ; Increment shift count
    140     ret
    141 
    142 ;--------------------------------------------------------------------
    143 ; Converts remainder from HCapacity_ShiftForNextMagnitude to tenths.
    144 ;
    145 ; HCapacity_ConvertSizeRemainderToTenths:
    146 ;   Parameters:
    147 ;       BX:DX:AX:   Size in magnitude
    148 ;       SI:         Remainder from last magnitude division (0...1023)
    149 ;   Returns:
    150 ;       BX:DX:AX:   Size in magnitude
    151 ;       SI:         Tenths
    152 ;   Corrupts registers:
    153 ;       Nothing
    154 ;--------------------------------------------------------------------
    155 ALIGN JUMP_ALIGN
    156 HCapacity_ConvertSizeRemainderToTenths:
    157     push    dx
    158     push    ax
    159 
    160     mov     ax, 10
    161     mul     si                  ; DX:AX = remainder * 10
    162     eSHR_IM ax, 10              ; Divide AX by 1024
    163     xchg    si, ax              ; SI = tenths
    164 
    165     pop     ax
    166     pop     dx
    167     ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCommand.asm

    r3 r88  
    1 ; File name     :   HCommand.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   28.3.2010
    4 ; Last update   :   16.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for outputting IDE commands and parameters.
    73
     
    113109    out     dx, al
    114110    mov     al, ah                      ; Restore sector count to AL
    115     jmp     SoftDelay_BeforePollingStatusRegister
     111    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HDrvSel.asm

    r3 r88  
    1 ; File name     :   HDrvSel.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   25.2.2010
    4 ; Last update   :   13.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for selecting Master or Slave drive.
    73
     
    6056
    6157    ; Wait until drive is ready to accept commands
    62     call    SoftDelay_BeforePollingStatusRegister
    6358    call    HStatus_WaitRdyDefTime
    6459    pop     cx
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm

    r34 r88  
    1 ; File name     :   HStatus.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   15.12.2009
    4 ; Last update   :   23.8.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   IDE Status Register polling functions.
    73
     
    176172ALIGN JUMP_ALIGN
    177173HStatus_PollBsyAndFlg:
    178     call    SoftDelay_InitTimeout               ; Initialize timeout counter
     174    call    InitializeTimeoutWithTicksInCL      ; Initialize timeout counter
    179175    in      al, dx                              ; Discard contents for first read
    180176                                                ; (should read Alternate Status Register)
     
    188184ALIGN JUMP_ALIGN
    189185.UpdateTimeout:
    190     call    SoftDelay_UpdTimeout                ; Update timeout counter
     186    call    SetCFifTimeout
    191187    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
    192188    jmp     HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
     
    210206ALIGN JUMP_ALIGN
    211207HStatus_PollBsy:
    212     call    SoftDelay_InitTimeout               ; Initialize timeout counter
     208    call    InitializeTimeoutWithTicksInCL      ; Initialize timeout counter
    213209    in      al, dx                              ; Discard contents for first read
    214210                                                ; (should read Alternate Status Register)
     
    218214    test    al, FLG_IDE_ST_BSY                  ; Controller busy?
    219215    jz      SHORT GetErrorCodeFromPollingToAH   ;  If not, jump to check errors
    220     call    SoftDelay_UpdTimeout                ; Update timeout counter
     216    call    SetCFifTimeout                      ; Update timeout counter
    221217    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
    222218ALIGN JUMP_ALIGN
    223219GetErrorCodeFromPollingToAH:
    224220    jmp     HError_ProcessErrorsAfterPollingBSY
     221
     222
     223;--------------------------------------------------------------------
     224; InitializeTimeoutWithTicksInCL
     225;   Parameters:
     226;       CL:     Timeout value in system timer ticks
     227;       DS:     Segment to RAMVARS
     228;   Returns:
     229;       Nothing
     230;   Corrupts registers:
     231;       CX
     232;--------------------------------------------------------------------
     233ALIGN JUMP_ALIGN
     234InitializeTimeoutWithTicksInCL:
     235    push    bx
     236    xchg    cx, ax
     237
     238    xor     ah, ah      ; Timeout ticks now in AX
     239    mov     bx, RAMVARS.wTimeoutCounter
     240    call    TimerTicks_InitializeTimeoutFromAX
     241
     242    xchg    ax, cx      ; Restore AX
     243    pop     bx
     244    ret
     245
     246;--------------------------------------------------------------------
     247; SetCFifTimeout
     248;   Parameters:
     249;       DS:     Segment to RAMVARS
     250;   Returns:
     251;       Nothing
     252;   Corrupts registers:
     253;       CX
     254;--------------------------------------------------------------------
     255ALIGN JUMP_ALIGN
     256SetCFifTimeout:
     257    push    bx
     258    xchg    cx, ax
     259
     260    mov     bx, RAMVARS.wTimeoutCounter
     261    call    TimerTicks_GetTimeoutTicksLeftToAXfromDSBX
     262
     263    xchg    ax, cx      ; Restore AX
     264    pop     bx
     265    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int18h.asm

    r3 r88  
    1 ; File name     :   Int18h.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   6.1.2010
    4 ; Last update   :   25.3.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Int 18h BIOS functions (ROM boot and Boot error).
    73
     
    2420Int18h_BootError:
    2521    mov     si, g_sz18hCallback
    26     call    PrintString_FromCS      ; No need to clean stack
     22    call    PrintNullTerminatedStringFromCSSIandSetCF
    2723    jmp     Int19hMenu_Display      ; Return to boot menu
Note: See TracChangeset for help on using the changeset viewer.