Changeset 227 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
- Timestamp:
- Jan 29, 2012, 1:33:44 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r193 r227 78 78 ; CS:BP: Ptr to IDEVARS for the controller 79 79 ; Returns: 80 ; DX:AX or AX: Number of cylinders 81 ; BH: Number of sectors per track 82 ; BL: Number of heads 83 ; Corrupts registers: 84 ; CX, (DX) 80 ; Nothing 81 ; Corrupts registers: 82 ; AX, BX, CX, DX 85 83 ;-------------------------------------------------------------------- 86 84 .StoreAddressing: … … 88 86 call AccessDPT_GetPointerToDRVPARAMStoCSBX 89 87 test byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS ; User specified CHS? 90 jnz SHORT .StoreUserDefined CHSaddressing88 jnz SHORT .StoreUserDefinedPCHS 91 89 92 90 ; Check if LBA supported 93 91 call AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI 94 92 test BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8 95 jz SHORT .StoreCHS addressing93 jz SHORT .StoreCHSfromAXBHBL ; Small old drive with CHS addressing only 96 94 97 95 ; Check if 48-bit LBA supported … … 102 100 or BYTE [di+DPT.bFlagsLow], ADDRESSING_MODE_LBA28<<ADDRESSING_MODE_FIELD_POSITION 103 101 call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI 102 mov [di+DPT.twLbaSectors], ax 103 mov [di+DPT.twLbaSectors+2], dx 104 mov [di+DPT.twLbaSectors+4], bx 104 105 call AtaID_GetLbaAssistedCHStoDXAXBLBH 105 jmp SHORT .StoreChsFromDXAXBX 106 107 ; Check if P-CHS to L-CHS translation required 108 .StoreUserDefinedCHSaddressing: 106 mov [di+DPT.bLbaHeads], bl 107 jmp SHORT .StoreBlockMode 108 109 ;-------------------------------------------------------------------- 110 ; .StoreUserDefinedPCHS 111 ; Parameters: 112 ; DS:DI: Ptr to Disk Parameter Table 113 ; ES:SI: Ptr to 512-byte ATA information read from the drive 114 ; CS:BP: Ptr to IDEVARS for the controller 115 ; Returns: 116 ; AX: Number of P-CHS cylinders 117 ; BH: Number of P-CHS sectors per track 118 ; BL: Number of P-CHS heads 119 ; Corrupts registers: 120 ; Nothing 121 ;-------------------------------------------------------------------- 122 .StoreUserDefinedPCHS: 109 123 call AccessDPT_GetPointerToDRVPARAMStoCSBX 110 124 mov ax, [cs:bx+DRVPARAMS.wCylinders] 111 125 mov bx, [cs:bx+DRVPARAMS.wHeadsAndSectors] 112 .StoreCHSaddressing: 113 cmp ax, MAX_LCHS_CYLINDERS 114 jbe SHORT .StoreChsFromAXBX ; No translation required 115 116 ; We need to get number of bits to shift for translation 126 ; Fall to .StoreCHSfromAXBHBL 127 128 ;-------------------------------------------------------------------- 129 ; .StoreCHSfromAXBHBL 130 ; Parameters: 131 ; AX: Number of P-CHS cylinders 132 ; BH: Number of P-CHS sectors per track 133 ; BL: Number of P-CHS heads 134 ; DS:DI: Ptr to Disk Parameter Table 135 ; ES:SI: Ptr to 512-byte ATA information read from the drive 136 ; CS:BP: Ptr to IDEVARS for the controller 137 ; Returns: 138 ; AX: Number of P-CHS cylinders 139 ; BH: Number of P-CHS sectors per track 140 ; BL: Number of P-CHS heads 141 ; Corrupts registers: 142 ; CX 143 ;-------------------------------------------------------------------- 144 .StoreCHSfromAXBHBL: 117 145 push ax 118 eMOVZX dx, bl ; Heads now in DX 119 xchg bx, ax ; Cylinders now in BX 120 call AccessDPT_ShiftPCHinBXDXtoLCH ; Leaves AX untouched 121 xchg bx, ax ; Restore HeadsAndSectors to BX 146 push bx 147 call AccessDPT_ShiftPCHinAXBLtoLCH ; Get number of bits to shift 148 pop bx 149 pop ax 150 jcxz .StorePCHSfromAXDX ; Small drive so use L-CHS addressing 151 152 ; Store P-CHS addressing mode and number of bits to shift in L-CHS to P-CHS translation 122 153 or cl, ADDRESSING_MODE_PCHS<<ADDRESSING_MODE_FIELD_POSITION 123 or [di+DPT.bFlagsLow], cl ; Store bits to shift 124 pop ax 125 ; Fall to .StoreChsFromAXBX 126 127 ;-------------------------------------------------------------------- 128 ; .StoreChsFromAXBX 129 ; .StoreChsFromDXAXBX 130 ; Parameters: 131 ; DX:AX or AX: Number of cylinders 132 ; BH: Number of sectors per track 133 ; BL: Number of heads 134 ; DS:DI: Ptr to Disk Parameter Table 135 ; ES:SI: Ptr to 512-byte ATA information read from the drive 136 ; CS:BP: Ptr to IDEVARS for the controller 137 ; Returns: 138 ; Nothing 139 ; Corrupts registers: 140 ; DX 141 ;-------------------------------------------------------------------- 142 .StoreChsFromAXBX: 143 xor dx, dx 144 .StoreChsFromDXAXBX: 145 mov [di+DPT.dwCylinders], ax 146 mov [di+DPT.dwCylinders+2], dx 147 mov [di+DPT.wHeadsAndSectors], bx 154 or [di+DPT.bFlagsLow], cl 155 ; Fall to .StoreChsFromAXBLBH 156 157 ;-------------------------------------------------------------------- 158 ; .StoreChsFromAXBLBH 159 ; Parameters: 160 ; AX: Number of P-CHS cylinders 161 ; BH: Number of P-CHS sectors per track 162 ; BL: Number of P-CHS heads 163 ; DS:DI: Ptr to Disk Parameter Table 164 ; ES:SI: Ptr to 512-byte ATA information read from the drive 165 ; CS:BP: Ptr to IDEVARS for the controller 166 ; Returns: 167 ; Nothing 168 ; Corrupts registers: 169 ; Nothing 170 ;-------------------------------------------------------------------- 171 .StorePCHSfromAXDX: 172 mov [di+DPT.wPchsCylinders], ax 173 mov [di+DPT.wPchsHeadsAndSectors], bx 148 174 ; Fall to .StoreBlockMode 149 175
Note:
See TracChangeset
for help on using the changeset viewer.