Ignore:
Timestamp:
May 9, 2012, 7:12:53 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Addressing modes are now NORMAL, LARGE and LBA.
  • L-CHS parameters are now generated differently for drives with 8192 or less cylinders.
File:
1 edited

Legend:

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

    r376 r421  
    4747
    4848;---------------------------------------------------------------------
    49 ; Converts LCHS parameters to IDE P-CHS parameters.
     49; Converts LARGE addressing mode LCHS parameters to IDE P-CHS parameters.
    5050; PCylinder = (LCylinder << n) + (LHead / PHeadCount)
    5151; PHead     = LHead % PHeadCount
    5252; PSector   = LSector
    5353;
    54 ; Address_ConvertLCHStoPCHS:
     54; ConvertLargeModeLCHStoPCHS:
    5555;   Parameters:
    5656;       BL:     Sector number (1...63)
    57 ;       BH:     Head number (0...255)
     57;       BH:     Head number (0...239)
    5858;       CX:     Cylinder number (0...1023)
    5959;       DS:DI:  Ptr to Disk Parameter Table
     
    6666;--------------------------------------------------------------------
    6767ALIGN JUMP_ALIGN
    68 ConvertLCHStoPCHS:
     68ConvertLargeModeLCHStoPCHS:
    6969    ; LHead / PHeadCount and LHead % PHeadCount
    7070    eMOVZX  ax, bh                  ; Copy L-CHS Head number to AX
     
    8282DoNotConvertLCHS:
    8383    ret
     84
    8485
    8586;--------------------------------------------------------------------
     
    102103Address_OldInt13hAddressToIdeAddress:
    103104        call    Address_ExtractLCHSparametersFromOldInt13hAddress
     105        ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF
    104106
    105         AccessDPT_GetUnshiftedAddressModeToALZF
     107;;; 0: ADDRESSING_MODE_NORMAL
     108        jz      SHORT DoNotConvertLCHS
    106109
    107 ;;; 0: ADDR_DPT_LCHS
    108         jz      DoNotConvertLCHS
     110;;; 1: ADDRESSING_MODE_LARGE
     111        test    al, FLGL_DPT_ASSISTED_LBA
     112        jz      SHORT ConvertLargeModeLCHStoPCHS
    109113
    110 ;;; 1: ADDR_DPT_PCHS
    111         ;
    112         ; Since we are only checking for zero, we can do our math in the high order bits,
    113         ; in this case effectively subtracting 1 from the address mode.
    114         ;
    115         sub     al,(1<<ADDRESSING_MODE_FIELD_POSITION)
    116         jz      ConvertLCHStoPCHS
     114;;; 2: ADDRESSING_MODE_ASSISTED_LBA
     115        ; Fall through to ConvertAssistedLBAModeLCHStoLBARegisterValues
    117116
    118 ;;; 2: ADDR_DPT_LBA28 and 3: ADDR_DPT_LBA48
    119         ; Fall through to ConvertLCHStoLBARegisterValues
    120117
    121118;---------------------------------------------------------------------
     
    125122;
    126123; Returned address is in same registers that
    127 ; Address_DoNotConvertLCHS and Address_ConvertLCHStoPCHS returns.
     124; DoNotConvertLCHS and ConvertLargeModeLCHStoPCHS returns.
    128125;
    129 ; ConvertLCHStoLBARegisterValues:
     126; ConvertAssistedLBAModeLCHStoLBARegisterValues:
    130127;   Parameters:
    131128;       BL:     Sector number (1...63)
    132 ;       BH:     Head number (0...255)
     129;       BH:     Head number (0...254)
    133130;       CX:     Cylinder number (0...1023)
    134131;       DS:DI:  Ptr to Disk Parameter Table
     
    141138;       AX, DX
    142139;--------------------------------------------------------------------
    143 ALIGN JUMP_ALIGN
    144 ConvertLCHStoLBARegisterValues:
     140ConvertAssistedLBAModeLCHStoLBARegisterValues:
    145141    ; cylToSeek*headsPerCyl (18-bit result)
     142    ; Max = 1023 * 255 = 260,865 = 3FB01h
    146143    mov     ax, LBA_ASSIST_SPT      ; Load Sectors per Track
    147144    xchg    cx, ax                  ; Cylinder number to AX, Sectors per Track to CX
    148 
    149145%ifdef USE_386
    150     movzx   dx, [di+DPT.bLbaHeads]
     146    movzx   dx, [di+DPT.bLchsHeads]
    151147%else
    152148    cwd
    153     mov     dl, [di+DPT.bLbaHeads]
     149    mov     dl, [di+DPT.bLchsHeads]
    154150%endif
    155151    mul     dx                      ; DX:AX = cylToSeek*headsPerCyl
    156152
    157153    ; +=headToSeek (18-bit result)
     154    ; Max = 260,865 + 254 = 261,119 = 3FBFFh
    158155    add     al, bh                  ; Add Head number to DX:AX
    159156    adc     ah, dh                  ; DH = Zero after previous multiplication
     
    161158
    162159    ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result)
     160    ; Max = 261,119 * 63 = 16,450,497 = FB03C1h
    163161    xchg    ax, dx                  ; Hiword to AX, loword to DX
    164162    mul     cl                      ; AX = hiword * Sectors per Track
     
    169167
    170168    ; +=sectToSeek-1 (24-bit result)
     169    ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh
    171170    xor     bh, bh                  ; Sector number now in BX
    172171    dec     bx                      ; sectToSeek-=1
Note: See TracChangeset for help on using the changeset viewer.