Changeset 358 in xtideuniversalbios
- Timestamp:
- Mar 19, 2012, 2:20:32 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r294 r358 85 85 86 86 87 ;-------------------------------------------------------------------- 88 ; LIMIT_LBA_CYLINDERS_IN_DXAX_TO_LCHS_CYLINDERS 89 ; Parameters: 90 ; DX:AX: Number of LBA cylinders 91 ; Returns: 92 ; AX: Number of L-CHS cylinders 93 ; Corrupts registers: 94 ; Nothing 95 ;-------------------------------------------------------------------- 96 %macro LIMIT_LBA_CYLINDERS_IN_DXAX_TO_LCHS_CYLINDERS 0 97 test dx, dx 98 jnz SHORT %%LoadMaxValueToAX 99 cmp ax, MAX_LCHS_CYLINDERS 100 jbe SHORT %%NoNeedToModify 101 %%LoadMaxValueToAX: 102 mov ax, MAX_LCHS_CYLINDERS 103 %%NoNeedToModify: 104 %endmacro 105 106 87 107 %endif ; CUSTOMDPT_INC -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r334 r358 19 19 ; Included .inc files 20 20 %include "AssemblyLibrary.inc" ; Assembly Library. Must be included first! 21 %include "Version.inc" 21 22 %include "IntController.inc" ; For Interrupt Controller equates 22 23 %include "ATA_ID.inc" ; For ATA Drive Information structs … … 44 45 at ROMVARS.bRomSize, db CNT_ROM_BLOCKS ; ROM size in 512B blocks 45 46 at ROMVARS.rgbJump, jmp Initialize_FromMainBiosRomSearch 46 at ROMVARS.rgbSign, db "XTIDE200" ; Signature for flash program 47 at ROMVARS.szTitle 48 db "-=XTIDE Universal BIOS" 49 %ifdef USE_AT 50 db " (AT)=-",NULL 51 %elifdef USE_186 52 db " (XT+)=-",NULL 53 %else 54 db " (XT)=-",NULL 55 %endif 56 at ROMVARS.szVersion, db "v2.0.0",BETA,"1 (",__DATE__,")",NULL 47 at ROMVARS.rgbSign, db FLASH_SIGNATURE 48 at ROMVARS.szTitle, db TITLE_STRING 49 at ROMVARS.szVersion, db ROM_VERSION_STRING 57 50 58 51 ;;; For OR'ing into wFlags below … … 187 180 %include "FindDPT.asm" ; For finding DPTs 188 181 %include "AccessDPT.asm" ; For accessing DPTs 182 %include "LbaAssist.asm" ; For generating L-CHS parameters to LBA drives 189 183 %include "BootMenuInfo.asm" ; For creating BOOTMENUINFO structs 190 184 %include "AtaID.asm" ; For ATA Identify Device information -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r324 r358 58 58 59 59 call AccessDPT_GetLbaSectorCountToBXDXAX 60 call AccessDPT_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH 61 test dx, dx 62 jnz SHORT .LimitAXtoMaxLCHScylinders 63 cmp ax, MAX_LCHS_CYLINDERS 64 jb SHORT .returnLCHS 65 .LimitAXtoMaxLCHScylinders: 66 mov ax, MAX_LCHS_CYLINDERS 67 .returnLCHS: 60 call LbaAssist_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH 61 LIMIT_LBA_CYLINDERS_IN_DXAX_TO_LCHS_CYLINDERS 68 62 ret 69 63 … … 157 151 and al, MASKL_DPT_ADDRESSING_MODE 158 152 %endmacro 159 160 161 ;--------------------------------------------------------------------162 ; LBA assist calculation:163 ; this is how to fit a big drive into INT13's skimpy size requirements,164 ; with a maximum of 8.4G available.165 ;166 ; total LBAs (as obtained by words 60+61)167 ; divided by 63 (sectors per track) (save as value A)168 ; Sub 1 from A169 ; divide A by 1024 + truncate.170 ; == total number of heads to use.171 ; add 1172 ; this value must be either 16, 32, 64, 128, or 256 (round up)173 ; then take the value A above and divide by # of heads174 ; to get the # of cylinders to use.175 ;176 ;177 ; so a LBA28 drive will have 268,435,456 as maximum LBAs178 ;179 ; 10000000h / 63 = 410410h (total cylinders or tracks)180 ; 410410h / 1024 = 1041h, which is way more than 256 heads, but 256 is max.181 ; 410410h / 256 = 4104h cylinders182 ;183 ; there's a wealth of information at: http://www.mossywell.com/boot-sequence184 ; they show a slightly different approach to LBA assist calulations, but185 ; the method here provides compatibility with phoenix BIOS186 ;187 ; we're using the values from 60+61 here because we're topping out at 8.4G188 ; anyway, so there's no need to use the 48bit LBA values.189 ;190 ; AccessDPT_ConvertSectorCountFromBXDXAXtoLbaAssistedCHStoDXAXBLBH:191 ; Parameters:192 ; BX:DX:AX: Total number of sectors193 ; Returns:194 ; DX:AX: Number of cylinders195 ; BH: Number of sectors per track (always 63)196 ; BL: Number of heads (16, 32, 64, 128 or 255)197 ; Corrupts registers:198 ; CX199 ;--------------------------------------------------------------------200 AccessDPT_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH:201 push bp202 push si203 204 ; Value A = Total sector count / 63205 xor cx, cx206 push cx ; Push zero for bits 48...63207 push bx208 push dx209 push ax ; 64-bit sector count now in stack210 mov cl, LBA_ASSIST_SPT211 mov bp, sp ; SS:BP now points sector count212 call Math_DivQWatSSBPbyCX ; Temporary value A now in stack213 214 ; BX = Number of heads = A / 1024215 mov ax, [bp]216 mov dx, [bp+2]217 mov bx, [bp+4]218 call Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX219 220 ; Heads must be 16, 32, 64, 128 or 256 (round up)221 mov bx, 256 ; Max number of heads222 test dx, dx ; 65536 or more heads?223 jnz SHORT .GetNumberOfCylinders224 mov cx, 128 ; Half BX for rounding up225 .FindMostSignificantBitForHeadSize:226 cmp ax, cx227 jae SHORT .GetNumberOfCylinders228 shr cx, 1229 shr bx, 1 ; Halve number of heads230 jmp SHORT .FindMostSignificantBitForHeadSize231 232 ; DX:AX = Number of cylinders = A / number of heads233 .GetNumberOfCylinders:234 mov cx, bx235 call Math_DivQWatSSBPbyCX236 mov ax, [bp]237 mov dx, [bp+2] ; Cylinders now in DX:AX238 239 ; Return LBA assisted CHS240 add sp, BYTE 8 ; Clean stack241 sub bl, bh ; Limit heads to 255242 mov bh, LBA_ASSIST_SPT243 pop si244 pop bp245 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r346 r358 113 113 .KeepTotalSectorsFromAtaID: 114 114 mov bx, [di+DPT.twLbaSectors+4] ; Restore BX 115 call AccessDPT_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH115 call LbaAssist_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH 116 116 mov [di+DPT.bLbaHeads], bl 117 117 jmp SHORT .StoreBlockMode
Note:
See TracChangeset
for help on using the changeset viewer.