Changeset 419 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- May 6, 2012, 2:34:35 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r417 r419 108 108 .ReadLastBlockFromDrive: 109 109 mov cl, [bp+PIOVARS.bSectorsLeft] ; CH is already zero 110 push cx 110 111 call [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 111 112 … … 115 116 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_BSY) 116 117 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 118 pop cx ; [bp+PIOVARS.bSectorsLeft] 119 jc SHORT ReturnWithTransferErrorInAH 120 121 ; All rectors succesfully transferred 122 add cx, [bp+PIOVARS.bSectorsDone] ; Never sets CF 123 ret 117 124 118 125 ; Return number of successfully read sectors … … 175 182 .WriteLastBlockToDrive: 176 183 mov cl, [bp+PIOVARS.bSectorsLeft] ; CH is already zero 184 push cx 177 185 %ifdef USE_186 178 186 push CheckErrorsAfterTransferringLastBlock -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm
r417 r419 110 110 .ReadLastBlockFromDrive: 111 111 mov cl, [bp+MEMPIOVARS.bSectorsLeft] 112 push cx 112 113 call ReadSingleBlockFromSectorAccessWindowInDSSItoESDI 113 114 … … 117 118 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_BSY) 118 119 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 120 pop cx ; [bp+MEMPIOVARS.bSectorsLeft] 121 jc SHORT ReturnWithMemoryIOtransferErrorInAH 122 123 ; All rectors succesfully transferred 124 add cx, [bp+PIOVARS.bSectorsDone] ; Never sets CF 125 ret 119 126 120 127 ; Return number of successfully transferred sectors … … 175 182 .WriteLastBlockToDrive: 176 183 mov cl, [bp+MEMPIOVARS.bSectorsLeft] 184 push cx 177 185 ePUSH_T bx, CheckErrorsAfterTransferringLastMemoryMappedBlock 178 186 ; Fall to WriteSingleBlockFromDSSIToSectorAccessWindowInESDI -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/LbaAssist.asm
r376 r419 29 29 ; with a maximum of 8.4G available. 30 30 ; 31 ; total LBAs (as obtained by words 60+61) 32 ; divided by 63 (sectors per track) (save as value A) 33 ; Sub 1 from A 34 ; divide A by 1024 + truncate. 35 ; == total number of heads to use. 36 ; add 1 37 ; this value must be either 16, 32, 64, 128, or 256 (round up) 38 ; then take the value A above and divide by # of heads 39 ; to get the # of cylinders to use. 31 ; If cylinders > 8192 32 ; Variable CH = Total Sectors / 63 33 ; Divide (CH 1) by 1024 (as an assembler bitwise right shift) and add 1 34 ; Round the result up to the nearest of 16, 32, 64, 128 and 255. This is the value to be used for the number of heads. 35 ; Divide CH by the number of heads. This is the value to be used for the number of cylinders. 40 36 ; 41 ; 42 ; so a LBA28 drive will have 268,435,456 as maximum LBAs 43 ; 44 ; 10000000h / 63 = 410410h (total cylinders or tracks) 45 ; 410410h / 1024 = 1041h, which is way more than 256 heads, but 256 is max. 46 ; 410410h / 256 = 4104h cylinders 47 ; 48 ; there's a wealth of information at: http://www.mossywell.com/boot-sequence 37 ; There's a wealth of information at: http://www.mossywell.com/boot-sequence 49 38 ; they show a slightly different approach to LBA assist calulations, but 50 ; the method here provides compatibility with phoenix BIOS 51 ; 52 ; we're using the values from 60+61 here because we're topping out at 8.4G 53 ; anyway, so there's no need to use the 48bit LBA values. 39 ; the method here provides compatibility with phoenix BIOS. 54 40 ; 55 41 ; LbaAssist_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH: … … 67 53 push si 68 54 69 ; Value A= Total sector count / 6355 ; Value CH = Total sector count / 63 70 56 xor cx, cx 71 push cx ; Push zero for bits 48...6357 push cx ; Push zero for bits 48...63 72 58 push bx 73 59 push dx 74 push ax ; 64-bit sector count now in stack60 push ax ; 64-bit sector count now in stack 75 61 mov cl, LBA_ASSIST_SPT 76 mov bp, sp ; SS:BP now points sector count77 call Math_DivQWatSSBPbyCX ; Temporary value A now in stack62 mov bp, sp ; SS:BP now points sector count 63 call Math_DivQWatSSBPbyCX ; Temporary value A now in stack 78 64 79 ; BX = Number of heads = A / 102465 ; BX:DX:AX = Value CH - 1 80 66 mov ax, [bp] 81 67 mov dx, [bp+2] 82 68 mov bx, [bp+4] 69 sub ax, BYTE 1 ; Subtract 1 70 sbb dx, BYTE 0 71 sbb bx, BYTE 0 72 73 ; DX:AX = Number of heads = ((Value CH - 1) / 1024) + 1 83 74 call Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 75 add ax, BYTE 1 ; Add 1 76 adc dx, bx ; BX = 0 84 77 85 ; Heads must be 16, 32, 64, 128 or 256 (round up) 86 mov bx, 256 ; Max number of heads 78 ; Heads must be 16, 32, 64, 128 or 255 (round up to the nearest) 87 79 test dx, dx ; 65536 or more heads? 88 jnz SHORT . GetNumberOfCylinders89 mov cx, 1 28 ; Half BX for rounding up90 . FindMostSignificantBitForHeadSize:80 jnz SHORT .LimitHeadsTo255 81 mov cx, 16 ; Min number of heads 82 .CompareNextValidNumberOfHeads: 91 83 cmp ax, cx 92 jae SHORT .GetNumberOfCylinders 93 shr cx, 1 94 shr bx, 1 ; Halve number of heads 95 jmp SHORT .FindMostSignificantBitForHeadSize 84 jbe SHORT .NumberOfHeadsNowInCX 85 shl cx, 1 ; Double number of heads 86 test ch, ch ; Reached 256 heads? 87 jnz SHORT .CompareNextValidNumberOfHeads 88 .LimitHeadsTo255: 89 mov cx, 255 90 .NumberOfHeadsNowInCX: 91 mov bx, cx ; Number of heads are returned in BL 92 mov bh, LBA_ASSIST_SPT ; Sectors per Track 96 93 97 ; DX:AX = Number of cylinders = A / number of heads 98 .GetNumberOfCylinders: 99 mov cx, bx 94 ; DX:AX = Number of cylinders = Value CH (without - 1) / number of heads 100 95 call Math_DivQWatSSBPbyCX 101 96 mov ax, [bp] … … 104 99 ; Return LBA assisted CHS 105 100 add sp, BYTE 8 ; Clean stack 106 sub bl, bh ; Limit heads to 255107 mov bh, LBA_ASSIST_SPT108 101 pop si 109 102 pop bp
Note:
See TracChangeset
for help on using the changeset viewer.