Changeset 422 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
- Timestamp:
- May 12, 2012, 1:58:25 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r421 r422 55 55 ;-------------------------------------------------------------------- 56 56 .InitializeDPT: 57 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM57 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM 58 58 ; Fall to .StoreDriveSelectAndDriveControlByte 59 59 … … 95 95 .StoreCHSparametersAndAddressingMode: 96 96 ; Check if CHS defined in ROMVARS 97 call AccessDPT_GetPointerToDRVPARAMStoCSBX98 test byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS ; User specified P-CHS?97 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 98 test cl, FLG_DRVPARAMS_USERCHS 99 99 jz SHORT .AutodetectPCHSvalues 100 100 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 105 103 jmp SHORT .StoreLCHStoDPT 106 107 ; Get L-CHS parameters and addressing mode108 104 .AutodetectPCHSvalues: 109 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI 105 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 110 106 111 107 .StoreLCHStoDPT: 112 eSHL_IM dl, ADDRESSING_MODE_FIELD_POSITION108 eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION 113 109 or cl, dl 114 110 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode … … 144 140 145 141 ; Load user defined LBA 146 call AccessDPT_GetPointerToDRVPARAMStoCSBX147 test BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA142 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 143 test cl, FLG_DRVPARAMS_USERLBA 148 144 jz SHORT .KeepTotalSectorsFromAtaID 149 mov ax, [cs:bx+DRVPARAMS.dwMaximumLBA]150 mov dx, [cs:bx+DRVPARAMS.dwMaximumLBA+2]151 xor bx, bx152 145 153 146 ; 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 154 149 cmp bx, [di+DPT.twLbaSectors+4] 155 150 jb SHORT .StoreUserDefinedSectorCountToDPT … … 160 155 jae SHORT .KeepTotalSectorsFromAtaID 161 156 .StoreUserDefinedSectorCountToDPT: 162 xor cx, cx ; Always LBA28 for user defined values157 ; CL bit FLGL_DPT_LBA48 is clear at this point 163 158 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 164 159 … … 234 229 235 230 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 ;-------------------------------------------------------------------- 245 GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS: 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 236 261 %ifdef MODULE_EBIOS 237 262 ;--------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.