Changeset 421 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Timestamp:
- May 9, 2012, 7:12:53 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r376 r421 101 101 AH8h_GetDriveParameters: 102 102 call AccessDPT_GetLCHStoAXBLBH 103 %ifdef RESERVE_DIAGNOSTIC_CYLINDER 104 dec ax 105 %endif 106 MIN_U ax, MAX_LCHS_CYLINDERS 103 107 ; Fall to .PackReturnValues 104 108 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r410 r421 99 99 ;;; SelectDrive 100 100 ; Try to select drive and wait until ready 101 call AccessDPT_GetDriveSelectByte ToAL101 call AccessDPT_GetDriveSelectByteForOldInt13hToAL 102 102 mov [bp+IDEPACK.bDrvAndHead], al 103 103 call Device_SelectDrive … … 109 109 110 110 ;;; InitializeDeviceParameters 111 ; Initialize CHS parameters if LBA is not used 112 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA 111 ; Initialize CHS parameters if LBA is not used and 112 ; user has specified P-CHS parameters 113 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_ASSISTED_LBA 113 114 jnz SHORT .SkipInitializeDeviceParameters ; No need to initialize CHS parameters if LBA mode enabled 115 call AccessDPT_GetPointerToDRVPARAMStoCSBX 116 test BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS ; User specified P-CHS? 117 jz SHORT .SkipInitializeDeviceParameters 114 118 115 119 ; Initialize Logical Sectors per Track and Max Head number 116 mov ah, [di+DPT.bPchsHeads] 117 dec ah ; Max Head number 118 mov dl, [di+DPT.bPchsSectors] ; Sectors per Track 120 mov ax, [cs:bx+DRVPARAMS.wHeadsAndSectors] 121 dec ax ; Max Head number 122 xchg al, ah ; Heads now in AH 123 mov dx, ax ; Sectors per Track now in DL 119 124 mov al, COMMAND_INITIALIZE_DEVICE_PARAMETERS 120 125 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r376 r421 38 38 ;-------------------------------------------------------------------- 39 39 AH48h_HandlerForGetExtendedDriveParameters: 40 call AccessDPT_GetPointerToDRVPARAMStoCSBX41 push bx42 40 call AccessDPT_GetLbaSectorCountToBXDXAX 43 pop di ; CS:DI now points to DRVPARAMS44 41 45 42 ; Point DS:SI to Extended Drive Information Table to fill 43 push ds 44 pop es ; DPT now in ES:DI 46 45 mov ds, [bp+IDEPACK.intpack+INTPACK.ds] 47 46 mov cx, MINIMUM_EDRIVEINFO_SIZE … … 51 50 52 51 ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh 53 mov cx, -1 ;FFFFh52 sub cx, BYTE MINIMUM_EDRIVEINFO_SIZE+1 ; CX => FFFFh 54 53 mov [si+EDRIVE_INFO.fpEDDparams], cx 55 54 mov [si+EDRIVE_INFO.fpEDDparams+2], cx … … 59 58 .SkipEddConfigurationParameters: 60 59 mov [si+EDRIVE_INFO.wSize], cx 61 mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS 60 mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID 62 61 63 62 ; Store total sector count … … 69 68 mov WORD [si+EDRIVE_INFO.wSectorSize], 512 70 69 70 ; Store P-CHS 71 eMOVZX dx, BYTE [es:di+DPT.bPchsHeads] 72 xor ax, ax ; Also a return code 73 mov [si+EDRIVE_INFO.dwHeads], dx 74 mov [si+EDRIVE_INFO.dwHeads+2], ax 75 76 mov dl, [es:di+DPT.bPchsSectorsPerTrack] 77 mov [si+EDRIVE_INFO.dwSectorsPerTrack], dx 78 mov [si+EDRIVE_INFO.dwSectorsPerTrack+2], ax 79 80 mov dx, [es:di+DPT.wPchsCylinders] 81 mov [si+EDRIVE_INFO.dwCylinders], dx 82 mov [si+EDRIVE_INFO.dwCylinders+2], ax 83 71 84 .ReturnWithError: 72 85 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm
r376 r421 47 47 48 48 ;--------------------------------------------------------------------- 49 ; Converts L CHS parameters to IDE P-CHS parameters.49 ; Converts LARGE addressing mode LCHS parameters to IDE P-CHS parameters. 50 50 ; PCylinder = (LCylinder << n) + (LHead / PHeadCount) 51 51 ; PHead = LHead % PHeadCount 52 52 ; PSector = LSector 53 53 ; 54 ; Address_ConvertLCHStoPCHS:54 ; ConvertLargeModeLCHStoPCHS: 55 55 ; Parameters: 56 56 ; BL: Sector number (1...63) 57 ; BH: Head number (0...2 55)57 ; BH: Head number (0...239) 58 58 ; CX: Cylinder number (0...1023) 59 59 ; DS:DI: Ptr to Disk Parameter Table … … 66 66 ;-------------------------------------------------------------------- 67 67 ALIGN JUMP_ALIGN 68 ConvertL CHStoPCHS:68 ConvertLargeModeLCHStoPCHS: 69 69 ; LHead / PHeadCount and LHead % PHeadCount 70 70 eMOVZX ax, bh ; Copy L-CHS Head number to AX … … 82 82 DoNotConvertLCHS: 83 83 ret 84 84 85 85 86 ;-------------------------------------------------------------------- … … 102 103 Address_OldInt13hAddressToIdeAddress: 103 104 call Address_ExtractLCHSparametersFromOldInt13hAddress 105 ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF 104 106 105 AccessDPT_GetUnshiftedAddressModeToALZF 107 ;;; 0: ADDRESSING_MODE_NORMAL 108 jz SHORT DoNotConvertLCHS 106 109 107 ;;; 0: ADDR_DPT_LCHS 108 jz DoNotConvertLCHS 110 ;;; 1: ADDRESSING_MODE_LARGE 111 test al, FLGL_DPT_ASSISTED_LBA 112 jz SHORT ConvertLargeModeLCHStoPCHS 109 113 110 ;;; 1: ADDR_DPT_PCHS 111 ; 112 ; Since we are only checking for zero, we can do our math in the high order bits, 113 ; in this case effectively subtracting 1 from the address mode. 114 ; 115 sub al,(1<<ADDRESSING_MODE_FIELD_POSITION) 116 jz ConvertLCHStoPCHS 114 ;;; 2: ADDRESSING_MODE_ASSISTED_LBA 115 ; Fall through to ConvertAssistedLBAModeLCHStoLBARegisterValues 117 116 118 ;;; 2: ADDR_DPT_LBA28 and 3: ADDR_DPT_LBA48119 ; Fall through to ConvertLCHStoLBARegisterValues120 117 121 118 ;--------------------------------------------------------------------- … … 125 122 ; 126 123 ; Returned address is in same registers that 127 ; Address_DoNotConvertLCHS and Address_ConvertLCHStoPCHS returns.124 ; DoNotConvertLCHS and ConvertLargeModeLCHStoPCHS returns. 128 125 ; 129 ; Convert LCHStoLBARegisterValues:126 ; ConvertAssistedLBAModeLCHStoLBARegisterValues: 130 127 ; Parameters: 131 128 ; BL: Sector number (1...63) 132 ; BH: Head number (0...25 5)129 ; BH: Head number (0...254) 133 130 ; CX: Cylinder number (0...1023) 134 131 ; DS:DI: Ptr to Disk Parameter Table … … 141 138 ; AX, DX 142 139 ;-------------------------------------------------------------------- 143 ALIGN JUMP_ALIGN 144 ConvertLCHStoLBARegisterValues: 140 ConvertAssistedLBAModeLCHStoLBARegisterValues: 145 141 ; cylToSeek*headsPerCyl (18-bit result) 142 ; Max = 1023 * 255 = 260,865 = 3FB01h 146 143 mov ax, LBA_ASSIST_SPT ; Load Sectors per Track 147 144 xchg cx, ax ; Cylinder number to AX, Sectors per Track to CX 148 149 145 %ifdef USE_386 150 movzx dx, [di+DPT.bL baHeads]146 movzx dx, [di+DPT.bLchsHeads] 151 147 %else 152 148 cwd 153 mov dl, [di+DPT.bL baHeads]149 mov dl, [di+DPT.bLchsHeads] 154 150 %endif 155 151 mul dx ; DX:AX = cylToSeek*headsPerCyl 156 152 157 153 ; +=headToSeek (18-bit result) 154 ; Max = 260,865 + 254 = 261,119 = 3FBFFh 158 155 add al, bh ; Add Head number to DX:AX 159 156 adc ah, dh ; DH = Zero after previous multiplication … … 161 158 162 159 ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result) 160 ; Max = 261,119 * 63 = 16,450,497 = FB03C1h 163 161 xchg ax, dx ; Hiword to AX, loword to DX 164 162 mul cl ; AX = hiword * Sectors per Track … … 169 167 170 168 ; +=sectToSeek-1 (24-bit result) 169 ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh 171 170 xor bh, bh ; Sector number now in BX 172 171 dec bx ; sectToSeek-=1 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
r413 r421 53 53 ; Get EBIOS command index to BX 54 54 ; LBA28 or LBA48 command 55 cwd56 mov al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31)57 and al, 0F0h ; Clear LBA28 bits 24...2758 or ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 559 cmp dx, ax ; Set CF if any of bits 28...47 set60 rcl dx, 1 ; DX = 0 for LBA28, DX = 1 for LBA4861 55 call Prepare_GetOldInt13hCommandIndexToBX 62 or bx, dx ; Set block mode / single sector bit 56 mov al, [di+DPT.bFlagsLow] 57 shl al, 1 ; Set CF if LBA48 supported 58 adc bl, bh ; LBA48 EXT commands 63 59 ret 64 %endif 60 %endif ; MODULE_EBIOS 65 61 66 62 … … 116 112 ; Nothing 117 113 ;-------------------------------------------------------------------- 118 ALIGN JUMP_ALIGN119 114 Prepare_ByValidatingSectorsInALforOldInt13h: 120 115 test al, al
Note:
See TracChangeset
for help on using the changeset viewer.