[165] | 1 | ; Project name : XTIDE Universal BIOS |
---|
| 2 | ; Description : Int 13h function AH=48h, Get Extended Drive Parameters. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
[376] | 7 | ; |
---|
| 8 | ; This program is free software; you can redistribute it and/or modify |
---|
| 9 | ; it under the terms of the GNU General Public License as published by |
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ; (at your option) any later version. |
---|
[526] | 12 | ; |
---|
[376] | 13 | ; This program is distributed in the hope that it will be useful, |
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | ; GNU General Public License for more details. |
---|
[526] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 18 | ; |
---|
[376] | 19 | |
---|
[165] | 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
| 24 | ; Int 13h function AH=48h, Get Extended Drive Parameters. |
---|
| 25 | ; |
---|
| 26 | ; AH48h_GetExtendedDriveParameters |
---|
| 27 | ; Parameters: |
---|
| 28 | ; SI: Same as in INTPACK |
---|
| 29 | ; DL: Translated Drive number |
---|
| 30 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
| 31 | ; SS:BP: Ptr to IDEPACK |
---|
| 32 | ; Parameters on INTPACK: |
---|
| 33 | ; DS:SI: Ptr to Extended Drive Information Table to fill |
---|
| 34 | ; Returns with INTPACK: |
---|
| 35 | ; AH: Int 13h return status |
---|
| 36 | ; DS:SI: Ptr to Extended Drive Information Table |
---|
[294] | 37 | ; CF: 0 if successful, 1 if error |
---|
[165] | 38 | ;-------------------------------------------------------------------- |
---|
| 39 | AH48h_HandlerForGetExtendedDriveParameters: |
---|
[227] | 40 | call AccessDPT_GetLbaSectorCountToBXDXAX |
---|
[167] | 41 | |
---|
[227] | 42 | ; Point DS:SI to Extended Drive Information Table to fill |
---|
[421] | 43 | push ds |
---|
| 44 | pop es ; DPT now in ES:DI |
---|
[169] | 45 | mov ds, [bp+IDEPACK.intpack+INTPACK.ds] |
---|
[227] | 46 | mov cx, MINIMUM_EDRIVEINFO_SIZE |
---|
| 47 | cmp [si+EDRIVE_INFO.wSize], cx |
---|
[332] | 48 | jb Prepare_ReturnFromInt13hWithInvalidFunctionError |
---|
[167] | 49 | je SHORT .SkipEddConfigurationParameters |
---|
[165] | 50 | |
---|
[167] | 51 | ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh |
---|
[421] | 52 | sub cx, BYTE MINIMUM_EDRIVEINFO_SIZE+1 ; CX => FFFFh |
---|
[227] | 53 | mov [si+EDRIVE_INFO.fpEDDparams], cx |
---|
| 54 | mov [si+EDRIVE_INFO.fpEDDparams+2], cx |
---|
| 55 | mov cx, EDRIVE_INFO_size |
---|
[167] | 56 | |
---|
[227] | 57 | ; Fill Extended Drive Information Table in DS:SI |
---|
[167] | 58 | .SkipEddConfigurationParameters: |
---|
[227] | 59 | mov [si+EDRIVE_INFO.wSize], cx |
---|
[421] | 60 | mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID |
---|
[165] | 61 | |
---|
[324] | 62 | ; Store total sector count |
---|
[228] | 63 | mov [si+EDRIVE_INFO.qwTotalSectors], ax |
---|
[227] | 64 | xor ax, ax ; Return with success |
---|
[228] | 65 | mov [si+EDRIVE_INFO.qwTotalSectors+2], dx |
---|
| 66 | mov [si+EDRIVE_INFO.qwTotalSectors+4], bx |
---|
[229] | 67 | mov [si+EDRIVE_INFO.qwTotalSectors+6], ax ; Always zero |
---|
[228] | 68 | mov WORD [si+EDRIVE_INFO.wSectorSize], 512 |
---|
[169] | 69 | |
---|
[421] | 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 | |
---|
[167] | 84 | .ReturnWithError: |
---|
[165] | 85 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|