Ignore:
Timestamp:
May 12, 2012, 1:58:25 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Modified ROMVARS for user defined CHS translation mode.
  • Base DPT struct now includes initialization error flags again.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r421 r422  
    5555;--------------------------------------------------------------------
    5656.InitializeDPT:
    57     mov     [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM
     57    mov     [di+DPT.bIdevarsOffset], bp     ; IDEVARS must start in first 256 bytes of ROM
    5858    ; Fall to .StoreDriveSelectAndDriveControlByte
    5959
     
    9595.StoreCHSparametersAndAddressingMode:
    9696    ; Check if CHS defined in ROMVARS
    97     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    98     test    byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS    ; User specified P-CHS?
     97    call    GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     98    test    cl, FLG_DRVPARAMS_USERCHS
    9999    jz      SHORT .AutodetectPCHSvalues
    100100
    101     ; Use DRVPARAMS P-CHS values instead of autodetected
    102     mov     ax, [cs:bx+DRVPARAMS.wCylinders]
    103     mov     bx, [cs:bx+DRVPARAMS.wHeadsAndSectors]
    104     call    AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH
     101    ; Translate P-CHS to L-CHS
     102    call    AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX
    105103    jmp     SHORT .StoreLCHStoDPT
    106 
    107     ; Get L-CHS parameters and addressing mode
    108104.AutodetectPCHSvalues:
    109     call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI
     105    call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
    110106
    111107.StoreLCHStoDPT:
    112     eSHL_IM dl, ADDRESSING_MODE_FIELD_POSITION
     108    eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION
    113109    or      cl, dl
    114110    or      [di+DPT.bFlagsLow], cl      ; Shift count and addressing mode
     
    144140
    145141    ; Load user defined LBA
    146     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    147     test    BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA
     142    call    GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     143    test    cl, FLG_DRVPARAMS_USERLBA
    148144    jz      SHORT .KeepTotalSectorsFromAtaID
    149     mov     ax, [cs:bx+DRVPARAMS.dwMaximumLBA]
    150     mov     dx, [cs:bx+DRVPARAMS.dwMaximumLBA+2]
    151     xor     bx, bx
    152145
    153146    ; Compare user defined and ATA-ID sector count and select smaller
     147    xor     dx, dx
     148    xchg    bx, dx      ; User defined LBA now in BX:DX:AX
    154149    cmp     bx, [di+DPT.twLbaSectors+4]
    155150    jb      SHORT .StoreUserDefinedSectorCountToDPT
     
    160155    jae     SHORT .KeepTotalSectorsFromAtaID
    161156.StoreUserDefinedSectorCountToDPT:
    162     xor     cx, cx      ; Always LBA28 for user defined values
     157    ; CL bit FLGL_DPT_LBA48 is clear at this point
    163158    call    StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX
    164159
     
    234229
    235230
     231;--------------------------------------------------------------------
     232; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     233;   Parameters:
     234;       DS:DI:      Ptr to Disk Parameter Table
     235;   Returns:
     236;       AX:         User defined P-CHS Cylinders or LBA low word
     237;       BX:         User defined P-CHS Heads and Sectors or LBA high word
     238;       DX:         Translate mode or TRANSLATEMODE_AUTO
     239;       CX:         FLG_DRVPARAMS_USERCHS if user defined CHS in BX:AX
     240;                   FLG_DRVPARAMS_USERLBA if user defined LBA in BX:AX
     241;                   Zero if user has not defined capacity
     242;   Corrupts registers:
     243;       Nothing
     244;--------------------------------------------------------------------
     245GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS:
     246    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
     247
     248    ; Get settings
     249    mov     cx, [cs:bx+DRVPARAMS.wFlags]
     250    mov     dx, cx
     251    and     cx, BYTE FLG_DRVPARAMS_USERCHS | FLG_DRVPARAMS_USERLBA
     252    and     dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE
     253    eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION
     254
     255    ; Get capacity
     256    mov     ax, [cs:bx+DRVPARAMS.wCylinders]        ; Or .dwMaximumLBA
     257    mov     bx, [cs:bx+DRVPARAMS.wHeadsAndSectors]  ; Or .dwMaximumLBA+2
     258    ret
     259
     260
    236261%ifdef MODULE_EBIOS
    237262;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.