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


Ignore:
Timestamp:
Apr 29, 2011, 7:04:13 PM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
Files:
7 deleted
2 edited

Legend:

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

    r3 r150  
    1 ; File name     :   HAddress.asm
    2 ; Project name  :   IDE BIOS
    3 ; Created date  :   11.3.2010
    4 ; Last update   :   4.4.2010
    5 ; Author        :   Tomi Tilli
     1; Project name  :   XTIDE Universal BIOS
    62; Description   :   Functions for address translations.
    73
     
    95SECTION .text
    106
     7; Jump table for conversion functions
     8ALIGN WORD_ALIGN
     9g_rgfnAddressTranslation:
     10    dw      DoNotConvertLCHS                    ; 0, ADDR_DPT_LCHS
     11    dw      ConvertLCHStoPCHS                   ; 1, ADDR_DPT_PCHS
     12    dw      ConvertLCHStoLBARegisterValues      ; 2, ADDR_DPT_LBA28
     13    dw      ConvertLCHStoLBARegisterValues      ; 3, ADDR_DPT_LBA48
     14
     15
    1116;--------------------------------------------------------------------
    12 ; Outputs sector count, L-CHS address and command to IDE registers.
    13 ; This function does not wait until command has been completed.
    14 ;
    15 ; HAddress_ConvertParamsFromBiosLCHStoIDE
     17; HAddress_OldInt13hAddressToIdeAddress
    1618;   Parameters:
    1719;       CH:     Cylinder number, bits 7...0
     
    2830;       AX, DX
    2931;--------------------------------------------------------------------
    30 ALIGN WORD_ALIGN
    31 g_rgfnAddressTranslation:
    32     dw      HAddress_DoNotConvertLCHS                   ; 0, ADDR_DPT_LCHS
    33     dw      HAddress_ConvertLCHStoPCHS                  ; 1, ADDR_DPT_PCHS
    34     dw      HAddress_ConvertLCHStoLBARegisterValues     ; 2, ADDR_DPT_LBA28
    35     dw      HAddress_ConvertLCHStoLBARegisterValues     ; 3, ADDR_DPT_LBA48
    36 
    3732ALIGN JUMP_ALIGN
    38 HAddress_ConvertParamsFromBiosLCHStoIDE:
    39     mov     bl, [di+DPT.bFlags]
    40     and     bx, BYTE MASK_DPT_ADDR                      ; Addressing mode to BX
     33HAddress_OldInt13hAddressToIdeAddress:
     34    call    AccessDPT_GetAddressingModeForWordLookToBX
    4135    push    WORD [cs:bx+g_rgfnAddressTranslation]       ; Push return address
    42     ; Fall to HAddress_ExtractLCHSFromBiosParams
     36    ; Fall to HAddress_ExtractLCHSparametersFromOldInt13hAddress
    4337
    4438;---------------------------------------------------------------------
    45 ; Extracts L-CHS parameters from BIOS function parameters.
    46 ;
    47 ; HAddress_ExtractLCHSFromBiosParams:
     39; HAddress_ExtractLCHSparametersFromOldInt13hAddress
    4840;   Parameters:
    4941;       CH:     Cylinder number, bits 7...0
     
    5850;       Nothing
    5951;--------------------------------------------------------------------
    60 ALIGN JUMP_ALIGN
    61 HAddress_ExtractLCHSFromBiosParams:
     52HAddress_ExtractLCHSparametersFromOldInt13hAddress:
    6253    mov     bl, cl              ; Copy sector number...
    6354    and     bl, 3Fh             ; ...and limit to 1...63
     
    7061
    7162;---------------------------------------------------------------------
    72 ; Converts BIOS LCHS parameters to IDE P-CHS parameters.
     63; Converts LCHS parameters to IDE P-CHS parameters.
    7364; PCylinder = (LCylinder << n) + (LHead / PHeadCount)
    7465; PHead     = LHead % PHeadCount
     
    8980;--------------------------------------------------------------------
    9081ALIGN JUMP_ALIGN
    91 HAddress_ConvertLCHStoPCHS:
     82ConvertLCHStoPCHS:
    9283    ; LHead / PHeadCount and LHead % PHeadCount
    9384    eMOVZX  ax, bh                  ; Copy L-CHS Head number to AX
    94     div     BYTE [di+DPT.bPHeads]   ; AL = LHead / PHeadCount, AH = LHead % PHeadCount
     85    div     BYTE [di+DPT.bPchsHeads]; AL = LHead / PHeadCount, AH = LHead % PHeadCount
    9586    mov     bh, ah                  ; Copy P-CHS Head number to BH
    9687    xor     ah, ah                  ; AX = LHead / PHeadCount
     
    9889    ; (LCylinder << n) + (LHead / PHeadCount)
    9990    mov     dx, cx                  ; Copy L-CHS Cylinder number to DX
    100     mov     cl, [di+DPT.bShLtoP]    ; Load shift count
     91    mov     cl, [di+DPT.wFlags]     ; Load shift count
     92    and     cl, MASK_DPT_CHS_SHIFT_COUNT
    10193    shl     dx, cl                  ; DX = LCylinder << n
    10294    add     ax, dx                  ; AX = P-CHS Cylinder number
    10395    mov     cx, ax                  ; Copy P-CHS Cylinder number to CX
    104 ALIGN JUMP_ALIGN
    105 HAddress_DoNotConvertLCHS:
     96DoNotConvertLCHS:
    10697    ret
    10798
     
    109100;---------------------------------------------------------------------
    110101; Converts LCHS parameters to 28-bit LBA address.
     102; Only 24-bits are used since LHCS to LBA28 conversion has 8.4GB limit.
     103; LBA = ((cylToSeek*headsPerCyl+headToSeek)*sectPerTrack)+sectToSeek-1
     104;
    111105; Returned address is in same registers that
    112106; HAddress_DoNotConvertLCHS and HAddress_ConvertLCHStoPCHS returns.
    113107;
    114 ; HAddress_ConvertLCHStoLBARegisterValues:
     108; ConvertLCHStoLBARegisterValues:
    115109;   Parameters:
    116110;       BL:     Sector number (1...63)
     
    127121;--------------------------------------------------------------------
    128122ALIGN JUMP_ALIGN
    129 HAddress_ConvertLCHStoLBARegisterValues:
    130     call    HAddress_ConvertLCHStoLBA28
    131     mov     bl, al                  ; Sector Number Register (LBA 7...0)
    132     mov     cl, ah                  ; Low Cylinder Register (LBA 15...8)
    133     mov     ch, dl                  ; High Cylinder Register (LBA 23...16)
    134     mov     bh, dh                  ; Drive and Head Register (LBA 27...24)
    135     ret
    136 
    137 ;---------------------------------------------------------------------
    138 ; Converts LCHS parameters to 28-bit LBA address.
    139 ; Only 24-bits are used since LHCS to LBA28 conversion has 8.4GB limit.
    140 ; LBA = ((cylToSeek*headsPerCyl+headToSeek)*sectPerTrack)+sectToSeek-1
    141 ;
    142 ; HAddress_ConvertLCHStoLBA28:
    143 ;   Parameters:
    144 ;       BL:     Sector number (1...63)
    145 ;       BH:     Head number (0...255)
    146 ;       CX:     Cylinder number (0...1023)
    147 ;       DS:DI:  Ptr to Disk Parameter Table
    148 ;   Returns:
    149 ;       DX:AX:  28-bit LBA address (DH is always zero)
    150 ;   Corrupts registers:
    151 ;       BX, CX
    152 ;--------------------------------------------------------------------
    153 ALIGN JUMP_ALIGN
    154 HAddress_ConvertLCHStoLBA28:
     123ConvertLCHStoLBARegisterValues:
    155124    ; cylToSeek*headsPerCyl (18-bit result)
    156125    mov     ax, cx                  ; Copy Cylinder number to AX
    157     mul     WORD [di+DPT.wLHeads]   ; DX:AX = cylToSeek*headsPerCyl
     126    eMOVZX  dx, BYTE [di+DPT.bLchsHeads]
     127    mul     dx                      ; DX:AX = cylToSeek*headsPerCyl
    158128
    159129    ; +=headToSeek (18-bit result)
     
    163133
    164134    ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result)
    165     eMOVZX  cx, BYTE [di+DPT.bPSect]; Load Sectors per Track
     135    eMOVZX  cx, BYTE [di+DPT.bPchsSectors]  ; Load Sectors per Track
    166136    xchg    ax, dx                  ; Hiword to AX, loword to DX
    167137    mul     cl                      ; AX = hiword * Sectors per Track
     
    176146    add     ax, bx                  ; Add to loword
    177147    adc     dl, bh                  ; Add possible carry to byte2, BH=zero
     148
     149    ; Copy DX:AX to proper return registers
     150    xchg    bx, ax                  ; BL = Sector Number Register (LBA 7...0)
     151    mov     cl, bh                  ; Low Cylinder Register (LBA 15...8)
     152    mov     ch, dl                  ; High Cylinder Register (LBA 23...16)
     153    mov     bh, dh                  ; Drive and Head Register (LBA 27...24)
    178154    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HTimer.asm

    r148 r150  
    66
    77;--------------------------------------------------------------------
    8 ; HTimer_InitializeTimeoutWithTicksInCL
     8; HTimer_InitializeTimeoutWithTicksInCX
    99;   Parameters:
    10 ;       CL:     Timeout value in system timer ticks
     10;       CX:     Timeout value in system timer ticks
    1111;       DS:     Segment to RAMVARS
    1212;   Returns:
     
    1616;--------------------------------------------------------------------
    1717ALIGN JUMP_ALIGN
    18 HTimer_InitializeTimeoutWithTicksInCL:
    19     xor     ch, ch                          ; Timeout ticks now in CX
     18HTimer_InitializeTimeoutWithTicksInCX:
    2019    mov     [RAMVARS.wTimeoutCounter], cx   ; Store timeout ticks
    2120    call    ReadTimeFromBdaToCX
     
    5554HTimer_DelayMicrosecondsFromAX:
    5655%ifndef USE_AT
    57     mov     ax, 1
     56    mov     ax, 2
    5857    ; Fall to Delay_TimerTicksFromAX
    5958%else
Note: See TracChangeset for help on using the changeset viewer.