Changeset 542 in xtideuniversalbios
- Timestamp:
- Apr 15, 2013, 4:03:33 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r540 r542 37 37 .bLchsHeads resb 1 ; (1...255) 38 38 .bLchsSectorsPerTrack resb 1 ; (1...63) 39 .wPchsHeadsAndSectors: 39 40 .bPchsHeads resb 1 ; (1...16) 41 .bPchsSectorsPerTrack resb 1 ; (1...63) 40 42 41 43 ; LBA and remaining P-CHS variables 42 44 %ifdef MODULE_EBIOS 43 .bPchsSectorsPerTrack resb 144 45 .wPchsCylinders resb 2 45 46 .twLbaSectors resb 6 ; 48-bit sector count for LBA addressing … … 56 57 FLGL_DPT_ENABLE_IRQ EQU (1<<5) ; Bit 5, Enable IRQ 57 58 %endif 59 FLGL_DPT_LBA EQU FLG_DRVNHEAD_LBA ; Bit 6, Drive supports LBA and so EBIOS functions can be supported 58 60 %ifdef MODULE_EBIOS 59 FLGL_DPT_LBA_AND_EBIOS_SUPPORTED EQU FLG_DRVNHEAD_LBA ; Bit 6, Drive supports LBA and so EBIOS functions can be supported60 61 FLGL_DPT_LBA48 EQU (1<<7) ; Bit 7, Drive supports 48-bit LBA (Must be bit 7!) 61 62 %endif -
trunk/XTIDE_Universal_BIOS/Inc/EBIOS.inc
r541 r542 44 44 endstruc 45 45 46 MINIMUM_EDRIVEINFO_SIZE EQU 26 ; 26 bytes does not include EDD pointer 47 EDRIVEINFO_SIZE_WITH_DPTE EQU EDRIVE_INFO_size 46 MINIMUM_EDRIVEINFO_SIZE EQU 26 ; 26 bytes does not include EDD pointer 47 EDRIVEINFO_SIZE_WITH_DPTE EQU EDRIVE_INFO_size 48 MAX_SECTOR_COUNT_TO_RETURN_PCHS EQU 15482880 48 49 49 50 ; Flags for EDRIVE_INFO.wFlags -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r536 r542 194 194 MAX_USER_HEADS EQU 16 195 195 MAX_USER_SECTORS_PER_TRACK EQU 63 196 MAX_USER_CHS_COUNT EQU (MAX_USER_CYLINDERS * MAX_USER_HEADS * MAX_USER_SECTORS_PER_TRACK) 196 197 FLG_DRVPARAMS_USERLBA EQU (1<<6) ; User specified LBA value 197 MIN_USER_LBA_COUNT EQU ( (MAX_USER_CYLINDERS*MAX_USER_HEADS*MAX_USER_SECTORS_PER_TRACK)+1)198 MIN_USER_LBA_COUNT EQU (MAX_USER_CHS_COUNT+1) 198 199 MAX_USER_LBA_COUNT EQU ((2^28)-1) 199 200 -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r526 r542 70 70 71 71 and ah, 0Fh ; Limit bits for LBA28 72 call AccessDPT_GetDriveSelectByte ForEbiosToAL72 call AccessDPT_GetDriveSelectByteToAL 73 73 or al, ah 74 74 mov [bp+IDEPACK.bDrvAndHead], al … … 108 108 push bx 109 109 call Address_OldInt13hAddressToIdeAddress 110 call AccessDPT_GetDriveSelectByte ForOldInt13hToAL110 call AccessDPT_GetDriveSelectByteToAL 111 111 or al, bh ; AL now has Drive and Head Select Byte 112 112 mov [bp+IDEPACK.bDrvAndHead], al … … 150 150 ; Drive and Head select byte 151 151 and ah, MASK_DRVNHEAD_HEAD ; Keep head bits only 152 call AccessDPT_GetDriveSelectByte ForOldInt13hToAL152 call AccessDPT_GetDriveSelectByteToAL 153 153 or al, ah 154 154 mov [bp+IDEPACK.bDrvAndHead], al -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r540 r542 123 123 ALIGN JUMP_ALIGN 124 124 .JumpToEbiosFunction: 125 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA _AND_EBIOS_SUPPORTED125 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA 126 126 jz SHORT UnsupportedFunction ; No eINT 13h for CHS drives 127 127 sub bl, 41h<<1 ; BX = Offset to eINT 13h jump table -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r526 r542 99 99 ;;; SelectDrive 100 100 ; Try to select drive and wait until ready 101 call AccessDPT_GetDriveSelectByte ForOldInt13hToAL101 call AccessDPT_GetDriveSelectByteToAL 102 102 mov [bp+IDEPACK.bDrvAndHead], al 103 103 call Device_SelectDrive … … 130 130 131 131 ;;; InitializeDeviceParameters 132 ; Initialize CHS parameters if LBA is not used and133 ; user has specified P-CHS parameters134 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_ASSISTED_LBA135 jnz SHORT .SkipInitializeDeviceParameters ; No need to initialize CHS parameters if LBA mode enabled136 call AccessDPT_GetPointerToDRVPARAMStoCSBX137 test BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS ; User specified P-CHS?138 jz SHORT .SkipInitializeDeviceParameters139 140 132 ; Initialize Logical Sectors per Track and Max Head number 141 mov ax, [ cs:bx+DRVPARAMS.wHeadsAndSectors]133 mov ax, [di+DPT.wPchsHeadsAndSectors] 142 134 dec ax ; Max Head number 143 xchg a l, ah ; Heads now in AH144 mov d x, ax ; Sectors per Track now in DL135 xchg ah, al 136 mov dl, al ; Sectors per track 145 137 mov al, COMMAND_INITIALIZE_DEVICE_PARAMETERS 146 138 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r541 r542 52 52 ; AH=48h Total Sector Count: 11873* 16*63 = 11,967,984 53 53 ; 54 ; Notice how AH=48h returns lesser total sector count than AH= 8h! The only54 ; Notice how AH=48h returns lesser total sector count than AH=08h! The only 55 55 ; way I could think of to get 11873 cylinders is to divide AH=08h sector 56 56 ; count with P-CHS heads and sectors: (745*255*63) / (16*63) = 11873 57 57 ; 58 ; I have no idea what is the reasoning behind it but at least there is one 59 ; BIOS that does just that. 60 ; 61 ; I decided that we multiply P-CHS values and do not waste space like the 62 ; Award BIOS does. 58 ; The only reason I can think of is that the Award BIOS has a bug and 59 ; uses L-CHS when it should use P-CHS values in the calculation. 63 60 ; 64 61 ; … … 139 136 ; Store P-CHS. Based on phoenix specification this is returned only if 140 137 ; total sector count is 15,482,880 or less. 141 sub ax, 4001h142 sbb dx, 0ECh138 sub ax, MAX_SECTOR_COUNT_TO_RETURN_PCHS & 0FFFFh 139 sbb dx, MAX_SECTOR_COUNT_TO_RETURN_PCHS >> 16 143 140 sbb bx, cx ; Zero 144 j nc SHORT .ReturnWithSuccess ; More than EC4000h145 or WORD[di+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID141 ja SHORT .ReturnWithSuccess 142 or BYTE [di+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID 146 143 147 144 eMOVZX dx, BYTE [es:si+DPT.bPchsHeads] -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm
r526 r542 120 120 ; Only 24-bits are used since LHCS to LBA28 conversion has 8.4GB limit. 121 121 ; LBA = ((cylToSeek*headsPerCyl+headToSeek)*sectPerTrack)+sectToSeek-1 122 ; headsPerCyl and sectPerTrack are the current translation values (L-CHS). 122 123 ; 123 124 ; Returned address is in same registers that -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
r534 r542 41 41 in al, QD65XX_BASE_PORT + QD65XX_CONFIG_REGISTER_in 42 42 43 %if 043 %ifdef DANGEROUS_DETECTION 44 44 ; Checking alternative base port is currently commented away 45 45 ; since Intel PIIX4 south bridge mirrors Interrupt Controller registers … … 51 51 or dl, QD65XX_ALTERNATIVE_BASE_PORT 52 52 in al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in 53 %endif ; 053 %endif ; DANGEROUS_DETECTION 54 54 ; Fall to IsConfigRegisterWithIDinAL 55 55 … … 65 65 ; Nothing 66 66 ;-------------------------------------------------------------------- 67 ;IsConfigRegisterWithIDinAL:67 IsConfigRegisterWithIDinAL: 68 68 mov ah, al 69 69 and al, MASK_QDCONFIG_CONTROLLER_ID -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
r526 r542 95 95 96 96 97 ;-------------------------------------------------------------------- 98 ; Writes user defined limits from ROMVARS to ATA ID read from the drive. 99 ; Modifying the ATA ID reduces code and possibilites for bugs since 100 ; only little furher checks are needed elsewhere. 101 ; 102 ; AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX 103 ; Parameters: 104 ; DS:DI: Ptr to incomplete Disk Parameter Table 105 ; ES:SI: Ptr to 512-byte ATA information read from the drive 106 ; CS:BP: Ptr to IDEVARS for the controller 107 ; Returns: 108 ; DX: User defined P-CHS to L-CHS translate mode 109 ; Corrupts registers: 110 ; AX, BX, CX 111 ;-------------------------------------------------------------------- 112 AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX: 113 call AccessDPT_GetPointerToDRVPARAMStoCSBX 114 push ds 115 push es 116 pop ds ; DS:SI now points to ATA information 117 118 ; Load User Defined CHS or LBA to CX:AX 119 mov dx, [cs:bx+DRVPARAMS.wFlags] 120 mov ax, [cs:bx+DRVPARAMS.wCylinders] ; Or .dwMaximumLBA 121 mov cx, [cs:bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2 122 123 ; * User defined CHS * 124 test dl, FLG_DRVPARAMS_USERCHS 125 jz SHORT .NoUserDefinedCHS 126 127 ; Apply new CHS and disable LBA (we also want to set CHS addressing) 128 mov [si+ATA1.wCylCnt], ax 129 eMOVZX ax, cl 130 mov [si+ATA1.wHeadCnt], ax 131 mov al, ch 132 mov [si+ATA1.wSPT], ax 133 and BYTE [si+ATA1.wCaps+1], ~(A1_wCaps_LBA>>8) 134 and BYTE [si+ATA6.wSetSup83+1], ~(A6_wSetSup83_LBA48>>8) 135 .NoUserDefinedCHS: 136 137 ; * User defined LBA * 138 test dl, FLG_DRVPARAMS_USERLBA 139 jz SHORT .NoUserDefinedLBA 140 141 ; Apply new LBA and disable LBA48 142 cmp cx, [si+ATA1.dwLBACnt+2] 143 ja SHORT .NoUserDefinedLBA ; Do not set larger than drive 144 jb SHORT .StoreNewLBA 145 cmp ax, [si+ATA1.dwLBACnt] 146 ja SHORT .NoUserDefinedLBA ; Allow same size to disable LBA48 147 .StoreNewLBA: 148 mov [si+ATA1.dwLBACnt], ax 149 mov [si+ATA1.dwLBACnt+2], cx 150 and BYTE [si+ATA6.wSetSup83+1], ~(A6_wSetSup83_LBA48>>8) 151 .NoUserDefinedLBA: 152 153 ; * Disable Block Mode transfers * 154 test dl, FLG_DRVPARAMS_BLOCKMODE 155 jnz SHORT .NoNeedToDisableBlockMode 156 mov BYTE [si+ATA1.bBlckSize], 1 ; sectors 157 .NoNeedToDisableBlockMode: 158 159 ; * Load P-CHS to L-CHS translate mode to DX * 160 and dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE 161 eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION 162 163 pop ds 164 ret 165 166 97 167 %ifdef MODULE_ADVANCED_ATA 98 168 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r541 r542 95 95 ;-------------------------------------------------------------------- 96 96 .StoreDptPointersToIntVectors: 97 %ifndef USE_AT 98 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 99 jz SHORT .CompatibleDPTsCreated ; Only Full operating mode has extra RAM to spare 100 %endif 101 97 102 mov dl, 80h 98 103 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r526 r542 22 22 23 23 ;-------------------------------------------------------------------- 24 ; AccessDPT_GetDriveSelectByteForOldInt13hToAL 25 ; AccessDPT_GetDriveSelectByteForEbiosToAL 24 ; AccessDPT_GetDriveSelectByteToAL 26 25 ; Parameters: 27 26 ; DS:DI: Ptr to Disk Parameter Table … … 32 31 ;-------------------------------------------------------------------- 33 32 ALIGN JUMP_ALIGN 34 AccessDPT_GetDriveSelectByte ForOldInt13hToAL:33 AccessDPT_GetDriveSelectByteToAL: 35 34 mov al, [di+DPT.bFlagsLow] 36 test al, FLGL_DPT_ASSISTED_LBA 37 jnz SHORT GetDriveSelectByteForAssistedLBAtoAL 38 39 and al, FLG_DRVNHEAD_DRV ; Clear all but drive select bit 35 and al, FLGL_DPT_SLAVE | FLGL_DPT_LBA 40 36 or al, MASK_DRVNHEAD_SET ; Bits set to 1 for old drives 41 ret42 43 %ifdef MODULE_EBIOS44 ALIGN JUMP_ALIGN45 AccessDPT_GetDriveSelectByteForEbiosToAL:46 mov al, [di+DPT.bFlagsLow]47 ; Fall to GetDriveSelectByteForAssistedLBAtoAL48 %endif ; MODULE_EBIOS49 50 ALIGN JUMP_ALIGN51 GetDriveSelectByteForAssistedLBAtoAL:52 and al, FLG_DRVNHEAD_DRV ; Master / Slave select53 or al, FLG_DRVNHEAD_LBA | MASK_DRVNHEAD_SET54 37 ret 55 38 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
r526 r542 66 66 ;-------------------------------------------------------------------- 67 67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 68 ; AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX69 68 ; Parameters: 70 69 ; DX: Wanted translate mode or TRANSLATEMODE_AUTO to autodetect … … 81 80 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX: 82 81 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 83 ; Fall to AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX 84 85 AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX: 82 86 83 ; Check if user defined translate mode 87 84 dec dx ; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm
r541 r542 107 107 xor dx, dx ; Clear for checksum 108 108 mov ax, [si+DPT.wLchsCylinders] 109 MIN_U ax, MAX_LCHS_CYLINDERS ; Our DPT can have up to 1027109 ;MIN_U ax, MAX_LCHS_CYLINDERS ; Our DPT can have up to 1027 110 110 call StoswThenAddALandAHtoDL ; Bytes 0 and 1 (Logical number of cylinders) 111 111 … … 201 201 ; DPTE.bDrvnhead and DPTE.bBiosVendor 202 202 xchg di, si 203 call AccessDPT_GetDriveSelectByte ForEbiosToAL203 call AccessDPT_GetDriveSelectByteToAL 204 204 xchg si, di 205 205 call StoswThenAddALandAHtoDL ; Bytes 4 and 5 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r535 r542 38 38 ; Set if any error 39 39 ; Corrupts registers: 40 ; AX, BX, CX, D H40 ; AX, BX, CX, DX 41 41 ;-------------------------------------------------------------------- 42 42 CreateDPT_FromAtaInformation: … … 96 96 ;-------------------------------------------------------------------- 97 97 .StoreCHSparametersAndAddressingMode: 98 ; Check if CHS defined in ROMVARS 99 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 100 test cl, FLG_DRVPARAMS_USERCHS 101 jz SHORT .AutodetectPCHSvalues 98 ; Apply any user limited values to ATA ID 99 call AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX 102 100 103 101 ; Translate P-CHS to L-CHS 104 call AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX105 jmp SHORT .StoreLCHStoDPT106 .AutodetectPCHSvalues:107 102 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 108 109 .StoreLCHStoDPT:110 eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION111 or cl, dl112 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode113 103 mov [di+DPT.wLchsCylinders], ax 114 104 mov [di+DPT.wLchsHeadsAndSectors], bx 115 116 ; Store P-CHS to DPT 105 mov al, dl 106 eSHL_IM al, TRANSLATEMODE_FIELD_POSITION 107 or cl, al 108 109 ; Store P-CHS and flags 117 110 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 118 mov [di+DPT.bPchsHeads], bl 111 dec dx ; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL 112 js SHORT .NothingToChange 113 jz SHORT .LimitHeadsForLargeAddressingMode 114 115 or cl, FLGL_DPT_LBA ; Set LBA bit for Assisted LBA 116 jmp SHORT .NothingToChange 117 .LimitHeadsForLargeAddressingMode: 118 MIN_U bl, 15 ; Cannot have 16 P-Heads in LARGE addressing mode 119 .NothingToChange: 120 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode 121 mov [di+DPT.wPchsHeadsAndSectors], bx 122 119 123 %ifdef MODULE_EBIOS 120 mov [di+DPT.bPchsSectorsPerTrack], bh 121 122 ; This is what Award BIOS from 1997 Pentium motherboard does. I can't think 123 ; of any good reason to do the same but let's keep this here just in case, 124 ; at least for a while. 125 %if 0 126 %ifdef RESERVE_DIAGNOSTIC_CYLINDER 127 ; Do not store P-Cylinders, instead calculate it from L-CHS total sector count. 128 ; Read AH=48h_GetExtendedDriveParameters.asm for more info. 129 xchg ax, bx 130 mul ah 131 push ax ; P-Heads * P-Sectors per track 132 call AH15h_GetSectorCountToBXDXAX 133 pop bx 134 div bx ; AX = Calculated cylinders 135 %endif ; RESERVE_DIAGNOSTIC_CYLINDER 136 %endif ; 0 137 124 test cl, FLGL_DPT_LBA 125 jz SHORT .NoLbaSoNoEBIOS 126 127 ; Store P-Cylinders but only if we have 15,482,880 or less sectors since 128 ; we only need P-Cylinders so we can return it from AH=48h 129 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 130 sub ax, MAX_SECTOR_COUNT_TO_RETURN_PCHS & 0FFFFh 131 sbb dx, MAX_SECTOR_COUNT_TO_RETURN_PCHS >> 16 132 sbb bx, BYTE 0 133 ja SHORT .StoreNumberOfLbaSectors 134 135 ; Since we might have altered the default P-CHS parameters to be 136 ; presented to the drive (AH=09h), we need to calculate new 137 ; P-Cylinders. It could be read from the ATA ID after 138 ; COMMAND_INITIALIZE_DEVICE_PARAMETERS but that is too much trouble. 139 ; P-Cyls = MIN(16383*16*63, LBA sector count) / (P-Heads * P-Sectors per track) 140 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 141 xchg cx, ax ; Sector count to DX:CX 142 mov al, [di+DPT.bPchsHeads] 143 mul BYTE [di+DPT.bPchsSectorsPerTrack] 144 xchg cx, ax 145 div cx ; AX = new P-Cylinders 138 146 mov [di+DPT.wPchsCylinders], ax 147 148 ; Store CHS sector count as total sector count 149 mul cx 150 xor bx, bx 151 xor cx, cx ; Clear LBA48 flag 152 jmp SHORT .StoreTotalSectorsFromBXDXAXandLBA48flagFromCL 139 153 ; Fall to .StoreNumberOfLbaSectors 140 154 … … 150 164 ; AX, BX, CX, DX 151 165 ;-------------------------------------------------------------------- 152 ; Check if LBA supported 153 test BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8 154 jz SHORT .NoLbaSupportedSoNoEBIOS 155 166 .StoreNumberOfLbaSectors: 156 167 ; Store LBA 28/48 total sector count 157 168 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 158 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 159 160 ; If we have 15,482,880 or less sectors, we multiply P-CHS values 161 ; and use that as total sector count. 162 ; Read AH=48h_GetExtendedDriveParameters.asm for more info. 163 sub ax, 4001h 164 sbb dx, 0ECh 165 sbb bx, BYTE 0 166 jnc SHORT .NoNeedToUseCHSsectorCount ; More than EC4000h 167 168 mov al, [di+DPT.bPchsHeads] 169 mul BYTE [di+DPT.bPchsSectorsPerTrack] 170 mul WORD [di+DPT.wPchsCylinders] 171 xor bx, bx 172 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 173 174 ; Load user defined LBA 175 .NoNeedToUseCHSsectorCount: 176 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 177 test cl, FLG_DRVPARAMS_USERLBA 178 jz SHORT .KeepTotalSectorsFromAtaID 179 180 ; Compare user defined and ATA-ID sector count and select smaller 181 mov dx, bx 182 xor bx, bx ; User defined LBA now in BX:DX:AX 183 cmp bx, [di+DPT.twLbaSectors+4] 184 jb SHORT .StoreUserDefinedSectorCountToDPT 185 cmp dx, [di+DPT.twLbaSectors+2] 186 jb SHORT .StoreUserDefinedSectorCountToDPT 187 ja SHORT .KeepTotalSectorsFromAtaID 188 cmp ax, [di+DPT.twLbaSectors] 189 jae SHORT .KeepTotalSectorsFromAtaID 190 .StoreUserDefinedSectorCountToDPT: 191 ; CL bit FLGL_DPT_LBA48 is clear at this point 192 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 193 194 .KeepTotalSectorsFromAtaID: 195 .NoLbaSupportedSoNoEBIOS: 169 .StoreTotalSectorsFromBXDXAXandLBA48flagFromCL: 170 or [di+DPT.bFlagsLow], cl 171 mov [di+DPT.twLbaSectors], ax 172 mov [di+DPT.twLbaSectors+2], dx 173 mov [di+DPT.twLbaSectors+4], bx 174 .NoLbaSoNoEBIOS: 196 175 %endif ; MODULE_EBIOS 197 176 ; Fall to .StoreBlockMode … … 288 267 mov [di+DPT.wBasePort], ax 289 268 ret 290 291 292 ;--------------------------------------------------------------------293 ; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS294 ; Parameters:295 ; DS:DI: Ptr to Disk Parameter Table296 ; Returns:297 ; AX: User defined P-CHS Cylinders or LBA low word298 ; BX: User defined P-CHS Heads and Sectors or LBA high word299 ; DX: Translate mode or TRANSLATEMODE_AUTO300 ; CX: FLG_DRVPARAMS_USERCHS if user defined CHS in BX:AX301 ; FLG_DRVPARAMS_USERLBA if user defined LBA in BX:AX302 ; Zero if user has not defined capacity303 ; Corrupts registers:304 ; Nothing305 ;--------------------------------------------------------------------306 GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS:307 call AccessDPT_GetPointerToDRVPARAMStoCSBX308 309 ; Get settings310 mov cx, [cs:bx+DRVPARAMS.wFlags]311 mov dx, cx312 and cx, BYTE FLG_DRVPARAMS_USERCHS | FLG_DRVPARAMS_USERLBA313 and dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE314 eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION315 316 ; Get capacity317 mov ax, [cs:bx+DRVPARAMS.wCylinders] ; Or .dwMaximumLBA318 mov bx, [cs:bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2319 ret320 321 322 %ifdef MODULE_EBIOS323 ;--------------------------------------------------------------------324 ; StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX325 ; Parameters:326 ; BX:DX:AX: Total Sector Count327 ; CL: FLGL_DPT_LBA48 if LBA48 supported328 ; DS:DI: Ptr to Disk Parameter Table329 ; Returns:330 ; Nothing331 ; Corrupts registers:332 ; CL333 ;--------------------------------------------------------------------334 StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX:335 or cl, FLGL_DPT_LBA_AND_EBIOS_SUPPORTED336 and BYTE [di+DPT.bFlagsLow], ~FLGL_DPT_LBA48337 or [di+DPT.bFlagsLow], cl338 mov [di+DPT.twLbaSectors], ax339 mov [di+DPT.twLbaSectors+2], dx340 mov [di+DPT.twLbaSectors+4], bx341 ret342 %endif ; MODULE_EBIOS
Note:
See TracChangeset
for help on using the changeset viewer.