[165] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
| 2 | ; Description : Int 13h function AH=48h, Get Extended Drive Parameters.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; Int 13h function AH=48h, Get Extended Drive Parameters.
|
---|
| 9 | ;
|
---|
| 10 | ; AH48h_GetExtendedDriveParameters
|
---|
| 11 | ; Parameters:
|
---|
| 12 | ; SI: Same as in INTPACK
|
---|
| 13 | ; DL: Translated Drive number
|
---|
| 14 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
| 15 | ; SS:BP: Ptr to IDEPACK
|
---|
| 16 | ; Parameters on INTPACK:
|
---|
| 17 | ; DS:SI: Ptr to Extended Drive Information Table to fill
|
---|
| 18 | ; Returns with INTPACK:
|
---|
| 19 | ; AH: Int 13h return status
|
---|
| 20 | ; DS:SI: Ptr to Extended Drive Information Table
|
---|
| 21 | ; CF: 0 if succesfull, 1 if error
|
---|
| 22 | ;--------------------------------------------------------------------
|
---|
| 23 | ALIGN JUMP_ALIGN
|
---|
| 24 | AH48h_HandlerForGetExtendedDriveParameters:
|
---|
[167] | 25 | ; Get our buffer to ES:SI
|
---|
| 26 | push di
|
---|
| 27 | call FindDPT_ForNewDriveToDSDI
|
---|
| 28 | lea si, [di+LARGEST_DPT_SIZE] ; IdeCommand.asm required fake DPT
|
---|
| 29 | pop di
|
---|
[165] | 30 | push ds
|
---|
[167] | 31 | pop es
|
---|
| 32 |
|
---|
| 33 | ; Get Drive ID and total sector count from it
|
---|
| 34 | call AH25h_GetDriveInformationToBufferInESSI
|
---|
| 35 | jc SHORT .ReturnWithError
|
---|
[165] | 36 |
|
---|
[169] | 37 | ; Point DS:DI to Destination buffer
|
---|
[165] | 38 | mov di, [bp+IDEPACK.intpack+INTPACK.si]
|
---|
[169] | 39 | mov ds, [bp+IDEPACK.intpack+INTPACK.ds]
|
---|
[167] | 40 | mov ax, MINIMUM_EDRIVEINFO_SIZE
|
---|
[170] | 41 | cmp [di+EDRIVE_INFO.wSize], ax
|
---|
[169] | 42 | jb SHORT AH42h_ReturnWithInvalidFunctionError
|
---|
[167] | 43 | je SHORT .SkipEddConfigurationParameters
|
---|
[165] | 44 |
|
---|
[167] | 45 | ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
|
---|
[170] | 46 | mov ax, -1 ; AX = FFFFh
|
---|
[169] | 47 | mov [di+EDRIVE_INFO.fpEDDparams], ax
|
---|
| 48 | mov [di+EDRIVE_INFO.fpEDDparams+2], ax
|
---|
[167] | 49 | mov ax, EDRIVE_INFO_size
|
---|
| 50 |
|
---|
[169] | 51 | ; Fill Extended Drive Information Table in DS:DI
|
---|
[167] | 52 | .SkipEddConfigurationParameters:
|
---|
[169] | 53 | mov [di+EDRIVE_INFO.wSize], ax
|
---|
| 54 | mov WORD [di+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID
|
---|
[165] | 55 |
|
---|
[169] | 56 | call AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI
|
---|
| 57 | xor cx, cx
|
---|
| 58 | mov [di+EDRIVE_INFO.dwCylinders], ax
|
---|
| 59 | mov [di+EDRIVE_INFO.dwCylinders+2], cx
|
---|
| 60 | eMOVZX ax, bl
|
---|
| 61 | mov [di+EDRIVE_INFO.dwHeads], ax
|
---|
| 62 | mov [di+EDRIVE_INFO.dwHeads+2], cx
|
---|
| 63 | mov al, bh
|
---|
| 64 | mov [di+EDRIVE_INFO.dwSectorsPerTrack], ax
|
---|
| 65 | mov [di+EDRIVE_INFO.dwSectorsPerTrack+2], cx
|
---|
| 66 |
|
---|
| 67 | call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
|
---|
| 68 | mov [di+EDRIVE_INFO.qwTotalSectors], ax
|
---|
| 69 | mov [di+EDRIVE_INFO.qwTotalSectors+2], dx
|
---|
| 70 | mov [di+EDRIVE_INFO.qwTotalSectors+4], bx
|
---|
| 71 | mov [di+EDRIVE_INFO.qwTotalSectors+6], cx
|
---|
| 72 |
|
---|
| 73 | mov WORD [di+EDRIVE_INFO.wSectorSize], 512
|
---|
| 74 |
|
---|
[165] | 75 | ; Return with success
|
---|
| 76 | xor ah, ah
|
---|
[167] | 77 | .ReturnWithError:
|
---|
[165] | 78 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|