Changeset 568 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- Dec 21, 2014, 5:37:53 PM (10 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r567 r568 58 58 59 59 %ifdef USE_UNDOC_INTEL 60 eSALC; Clears AL using CF while preserving flags60 salc ; Clears AL using CF while preserving flags 61 61 %endif 62 62 … … 163 163 ;-------------------------------------------------------------------- 164 164 AccessDPT_GetIdevarsToCSBX: 165 eMOVZX bx, BYTE[di+DPT.bIdevarsOffset]165 eMOVZX bx, [di+DPT.bIdevarsOffset] 166 166 ret 167 167 168 169 ;--------------------------------------------------------------------170 ; ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF171 ; Parameters:172 ; DS:DI: Ptr to Disk Parameter Table173 ; Returns:174 ; AX: Translate Mode (TRANSLATEMODE_NORMAL, TRANSLATEMODE_LARGE or TRANSLATEMODE_ASSISTED_LBA)175 ; unshifted (still shifted where it is in bFlagsLow)176 ; ZF: Set based on value in AL177 ; Corrupts registers:178 ; Nothing179 ;--------------------------------------------------------------------180 ;181 ; Converted to a macro since only called in two places, and the call/ret overhead182 ; is not worth it for these two instructions (4 bytes total)183 ;184 %macro ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 0185 mov al, [di+DPT.bFlagsLow]186 and ax, BYTE MASKL_DPT_TRANSLATEMODE187 %endmacro -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
r567 r568 142 142 ; GetSectorCountToDXAXfromCHSinAXBLBH 143 143 ; Parameters: 144 ; ES:SI: Ptr to 512-byte ATA information read from the drive145 144 ; AX: Number of cylinders (1...16383) 146 145 ; BL: Number of heads (1...255) … … 328 327 cmp ax, cx 329 328 jbe SHORT .NumberOfHeadsNowInCX 330 eSHL_IM c l, 1 ; Double number of heads331 j nzSHORT .CompareNextValidNumberOfHeads ; Reached 256 heads?332 dec c l; If so, limit heads to 255329 eSHL_IM cx, 1 ; Double number of heads 330 jpo SHORT .CompareNextValidNumberOfHeads ; Reached 256 heads? 331 dec cx ; If so, limit heads to 255 333 332 .NumberOfHeadsNowInCX: 334 333 mov bx, cx ; Number of heads are returned in BL -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm
r558 r568 114 114 ;-------------------------------------------------------------------- 115 115 FillTranslatedDPTtoESDIfromDPTinDSSI: 116 xor dx, dx; Clear for checksum116 cwd ; Clear for checksum 117 117 call StoswThenAddALandAHtoDL ; Bytes 0 and 1 (Logical number of cylinders) 118 118 119 mov al, BYTE[si+DPT.bLchsHeads]119 mov al, [si+DPT.bLchsHeads] 120 120 mov ah, TRANSLATED_DPT_SIGNATURE 121 121 call StoswThenAddALandAHtoDL ; Bytes 2 (Logical number of heads) and 3 (Axh signature to indicate Translated DPT) 122 122 123 eMOVZX ax, BYTE[si+DPT.bPchsSectorsPerTrack]123 eMOVZX ax, [si+DPT.bPchsSectorsPerTrack] 124 124 call StoswThenAddALandAHtoDL ; Bytes 4 (Physical sectors per track) and 5 (Write Precompensation Cylinder low) 125 125 126 mov al, ah 127 call StoswThenAddALandAHtoDL; Bytes 6 (Write Precompensation Cylinder high) and 7128 129 xchg ax, cx ; Device Control byte to AL126 mov al, ah ; Zero AX 127 stosw ; Bytes 6 (Write Precompensation Cylinder high) and 7 128 129 xchg cx, ax ; Device Control byte to AL, zero to CX 130 130 mov ah, [si+DPT.wPchsCylinders] 131 131 call StoswThenAddALandAHtoDL ; Bytes 8 (Drive Control Byte) and 9 (Physical number of cylinders low) … … 135 135 call StoswThenAddALandAHtoDL ; Bytes 10 (Physical number of cylinders high) and 11 (Physical number of heads) 136 136 137 x or ax, ax138 call StoswThenAddALandAHtoDL; Bytes 12 and 13 (Landing Zone Cylinder)137 xchg cx, ax ; Zero to AX 138 stosw ; Bytes 12 and 13 (Landing Zone Cylinder) 139 139 140 140 mov al, [si+DPT.bLchsSectorsPerTrack] … … 158 158 ; DI: Incremented by 2 159 159 ; Corrupts registers: 160 ; Nothing160 ; AH 161 161 ;-------------------------------------------------------------------- 162 162 StoswALandChecksumFromDL: … … 182 182 FillStandardDPTtoESDIfromDPTinDSSI: 183 183 stosw ; Bytes 0 and 1 (Physical number of cylinders) 184 eMOVZX ax, BYTE[si+DPT.bLchsHeads]184 eMOVZX ax, [si+DPT.bLchsHeads] 185 185 stosw ; Bytes 2 (Physical number of heads) and 3 186 %ifdef USE_UNDOC_INTEL 187 %ifdef USE_386 188 xor al, al ; Zero AX and clear CF 189 %else 190 salc ; Zero AX (CF cleared by eMOVZX above) 191 %endif 192 %else 186 193 mov al, ah ; Zero AX 194 %endif 187 195 stosw ; Bytes 4 and 5 (Write Precompensation Cylinder low) 188 196 stosw ; Bytes 6 (Write Precompensation Cylinder high) and 7 189 197 mov al, cl ; Device control byte to AL 190 198 stosw ; Bytes 8 (Drive Control Byte) and 9 199 %ifdef USE_UNDOC_INTEL 200 salc ; Zero AX (CF cleared above) 201 %else 191 202 mov al, ah ; Zero AX 203 %endif 192 204 stosw ; Bytes 10 and 11 193 205 stosw ; Bytes 12 and 13 (Landing Zone Cylinder) … … 208 220 ; ES:BX: Ptr to Device Parameter Table Extension (DPTE) 209 221 ; Corrupts registers: 210 ; AX, CX, D X, DI222 ; AX, CX, DL, DI 211 223 ;-------------------------------------------------------------------- 212 224 CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI: 213 call GetTemporaryBufferForDPTEtoESDI ; valid until next AH=48h call225 call GetTemporaryBufferForDPTEtoESDI ; Valid until next AH=48h call 214 226 215 227 ; Set 32-bit flag for 32-bit controllers … … 218 230 eCMOVE cl, FLG_LBA_TRANSLATION_ENABLED | FLG_32BIT_XFER_MODE 219 231 232 xor dl, dl ; Clear DL for checksum 233 220 234 ; DPTE.wBasePort 221 235 mov ax, [si+DPT.wBasePort] … … 223 237 224 238 ; DPTE.wControlBlockPort 225 eMOVZX bx, BYTE[si+DPT.bIdevarsOffset]239 eMOVZX bx, [si+DPT.bIdevarsOffset] 226 240 mov ax, [cs:bx+IDEVARS.wControlBlockPort] 227 241 call StoswThenAddALandAHtoDL ; Bytes 2 and 3 … … 244 258 ; DPTE.bDmaChannelAndType and DPTE.bPioMode 245 259 xor ax, ax 246 %ifdef MODULE_ADVANCED_ATA 260 %ifndef MODULE_ADVANCED_ATA 261 stosw ; Bytes 8 and 9 262 %else 247 263 or ah, [si+DPT_ADVANCED_ATA.bPioMode] 248 264 jz SHORT .DoNotSetFastPioFlag 249 cmp WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0 250 je SHORT .DoNotSetFastPioFlag 251 inc cx ; FLG_FAST_PIO_ENABLED 265 cmp WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 1 266 sbb cl, -1 ; FLG_FAST_PIO_ENABLED (if .wControllerID > 0) 252 267 .DoNotSetFastPioFlag: 253 %endif254 268 call StoswThenAddALandAHtoDL ; Bytes 8 and 9 269 %endif 255 270 256 271 ; Set CHS translation flags and store DPTE.wFlags … … 261 276 test al, FLGL_DPT_ASSISTED_LBA 262 277 jz SHORT .NoChsTranslationOrBitShiftTranslationSet 263 or c x, LBA_ASSISTED_TRANSLATION << TRANSLATION_TYPE_FIELD_POSITION278 or ch, LBA_ASSISTED_TRANSLATION << (TRANSLATION_TYPE_FIELD_POSITION - 8) 264 279 .NoChsTranslationOrBitShiftTranslationSet: 265 280 xchg ax, cx … … 268 283 ; DPTE.wReserved (must be zero) 269 284 xor ax, ax 270 call StoswThenAddALandAHtoDL; Bytes 12 and 13285 stosw ; Bytes 12 and 13 271 286 272 287 ; DPTE.bRevision and DPTE.bChecksum 273 288 mov al, DPTE_REVISION 274 call StoswALandChecksumFromDL ; Bytes 14 and 15 275 lea bx, [di-DPTE_size] 276 ret 289 lea bx, [di+2-DPTE_size] ; The +2 compensates for the last WORD yet to be stored 290 jmp StoswALandChecksumFromDL ; Bytes 14 and 15 277 291 %endif ; MODULE_EBIOS 278 292 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r567 r568 116 116 jnz SHORT .NothingToChange 117 117 118 .LimitHeadsForLargeAddressingMode:119 118 ; We cannot have 16 P-Heads heads in Revised ECHS mode (8193 or more cylinders) 120 119 ; but 16 heads are allowed when there are 8192 or less cylinders (ECHS). 121 120 ; Both of these are LARGE modes so do not confuse with NORMAL mode. 122 121 call AtaGeometry_IsDriveSmallEnoughForECHS 123 jc SHORT .NothingToChange 124 dec bx ; Adjust 16 P-Heads to 15 122 adc bx, -1 ; Adjust 16 P-Heads to 15 if needed 125 123 126 124 .NothingToChange:
Note:
See TracChangeset
for help on using the changeset viewer.