Changeset 421 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
- Timestamp:
- May 9, 2012, 7:12:53 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r411 r421 36 36 mov bx, [cs:bx+IDEVARS.wPort] 37 37 ret 38 39 %endif 38 %endif ; MODULE_ADVANCED_ATA 40 39 41 40 42 41 ;-------------------------------------------------------------------- 43 ; AccessDPT_GetDriveSelectByteToAL 42 ; AccessDPT_GetDriveSelectByteForOldInt13hToAL 43 ; AccessDPT_GetDriveSelectByteForEbiosToAL 44 44 ; Parameters: 45 45 ; DS:DI: Ptr to Disk Parameter Table … … 50 50 ;-------------------------------------------------------------------- 51 51 ALIGN JUMP_ALIGN 52 AccessDPT_GetDriveSelectByteToAL: 52 AccessDPT_GetDriveSelectByteForOldInt13hToAL: 53 mov al, [di+DPT.bFlagsLow] 54 test al, FLGL_DPT_ASSISTED_LBA 55 jnz SHORT GetDriveSelectByteForAssistedLBAtoAL 56 57 and al, FLG_DRVNHEAD_DRV ; Clear all but drive select bit 58 or al, MASK_DRVNHEAD_SET ; Bits set to 1 for old drives 59 ret 60 61 %ifdef MODULE_EBIOS 62 ALIGN JUMP_ALIGN 63 AccessDPT_GetDriveSelectByteForEbiosToAL: 53 64 mov al, [di+DPT.wFlags] 54 and al, FLG_DRVNHEAD_LBA | FLG_DRVNHEAD_DRV 55 or al, MASK_DRVNHEAD_SET ; Bits set to 1 for old drives 65 ; Fall to GetDriveSelectByteForAssistedLBAtoAL 66 %endif ; MODULE_EBIOS 67 68 ALIGN JUMP_ALIGN 69 GetDriveSelectByteForAssistedLBAtoAL: 70 and al, FLG_DRVNHEAD_DRV ; Master / Slave select 71 or al, FLG_DRVNHEAD_LBA | MASK_DRVNHEAD_SET 56 72 ret 57 73 … … 89 105 ; BH: Number of L-CHS sectors per track 90 106 ; Corrupts registers: 91 ; CX, DX107 ; Nothing 92 108 ;-------------------------------------------------------------------- 93 109 AccessDPT_GetLCHStoAXBLBH: 94 ; Return LBA-assisted CHS if LBA addressing used 95 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA 96 jz SHORT .ConvertPchsToLchs 97 98 call AccessDPT_GetLbaSectorCountToBXDXAX 99 call LbaAssist_ConvertSectorCountFromBXDXAXtoLbaAssistedCHSinDXAXBLBH 100 LIMIT_LBA_CYLINDERS_IN_DXAX_TO_LCHS_CYLINDERS 101 ret 102 103 .ConvertPchsToLchs: 104 mov ax, [di+DPT.wPchsCylinders] 105 mov bx, [di+DPT.wPchsHeadsAndSectors] 106 ; Fall to AccessDPT_ShiftPCHinAXBLtoLCH 107 108 109 ;-------------------------------------------------------------------- 110 ; AccessDPT_ShiftPCHinAXBLtoLCH 111 ; Parameters: 112 ; AX: P-CHS cylinders (1...16383) 113 ; BL: P-CHS heads (1...16) 114 ; Returns: 115 ; AX: Number of L-CHS cylinders (1...1024) 116 ; BL: Number of L-CHS heads (1...255) 117 ; CX: Number of bits shifted (4 at most) 118 ; Corrupts registers: 119 ; Nothing 120 ;-------------------------------------------------------------------- 121 AccessDPT_ShiftPCHinAXBLtoLCH: 122 xor cx, cx 123 .ShiftLoop: 124 cmp ax, MAX_LCHS_CYLINDERS ; Need to shift? 125 jbe SHORT .Return ; If not, return 126 inc cx ; Increment shift count 127 shr ax, 1 ; Halve cylinders 128 shl bl, 1 ; Double heads 129 jnz SHORT .ShiftLoop ; Falls through only on the last (4th) iteration and only if BL was 16 on entry 130 dec bl ; DOS doesn't support drives with 256 heads so we limit heads to 255 131 ; We can save a byte here by using DEC BX if we don't care about BH 132 .Return: 110 mov ax, [di+DPT.wLchsCylinders] 111 mov bx, [di+DPT.wLchsHeadsAndSectors] 133 112 ret 134 113 135 114 115 %ifdef MODULE_EBIOS 136 116 ;-------------------------------------------------------------------- 137 117 ; AccessDPT_GetLbaSectorCountToBXDXAX … … 148 128 mov bx, [di+DPT.twLbaSectors+4] 149 129 ret 130 %endif ; MODULE_EBIOS 150 131 151 132 … … 171 152 ret 172 153 154 173 155 ;-------------------------------------------------------------------- 174 ; A ccessDPT_GetUnshiftedAddressModeToALZF156 ; ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF 175 157 ; Parameters: 176 158 ; DS:DI: Ptr to Disk Parameter Table 177 159 ; Returns: 178 ; A L: Addressing Mode (L-CHS, P-CHS, LBA28, LBA48)160 ; AX: Addressing Mode (ADDRESSING_MODE_NORMAL, ADDRESSING_MODE_LARGE or ADDRESSING_MODE_ASSISTED_LBA) 179 161 ; unshifted (still shifted where it is in bFlagsLow) 180 162 ; ZF: Set based on value in AL 181 163 ; Corrupts registers: 182 ; AL164 ; Nothing 183 165 ;-------------------------------------------------------------------- 184 166 ; … … 186 168 ; is not worth it for these two instructions (4 bytes total) 187 169 ; 188 %macro A ccessDPT_GetUnshiftedAddressModeToALZF 0170 %macro ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF 0 189 171 mov al, [di+DPT.bFlagsLow] 190 and a l,MASKL_DPT_ADDRESSING_MODE172 and ax, BYTE MASKL_DPT_ADDRESSING_MODE 191 173 %endmacro
Note:
See TracChangeset
for help on using the changeset viewer.