source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm@ 531

Last change on this file since 531 was 530, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • AT builds again copy old INT 13h handler to 40h. It turned out it is needed, by XTIDE Universal BIOS at least (fixes disappearing floppy drive hotkey button when booting starts).
  • AH=48h no longer returns P-CHS parameteres for drives with more than 15,482,880 sectors (now works like described on Phoenix specification).
File size: 3.3 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Int 13h function AH=48h, Get Extended Drive Parameters.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
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.
12;
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.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .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
37; CF: 0 if successful, 1 if error
38;--------------------------------------------------------------------
39AH48h_HandlerForGetExtendedDriveParameters:
40 call AccessDPT_GetLbaSectorCountToBXDXAX
41
42 ; Point DS:SI to Extended Drive Information Table to fill
43 push ds
44 pop es ; DPT now in ES:DI
45 mov ds, [bp+IDEPACK.intpack+INTPACK.ds]
46 mov cx, MINIMUM_EDRIVEINFO_SIZE
47 cmp [si+EDRIVE_INFO.wSize], cx
48 jb Prepare_ReturnFromInt13hWithInvalidFunctionError
49 je SHORT .SkipEddConfigurationParameters
50
51 ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
52 sub cx, BYTE MINIMUM_EDRIVEINFO_SIZE+1 ; CX => FFFFh
53 mov [si+EDRIVE_INFO.fpEDDparams], cx
54 mov [si+EDRIVE_INFO.fpEDDparams+2], cx
55 mov cx, EDRIVE_INFO_size
56
57 ; Fill Extended Drive Information Table in DS:SI
58.SkipEddConfigurationParameters:
59 mov [si+EDRIVE_INFO.wSize], cx
60 mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS
61
62 ; Store total sector count
63 mov [si+EDRIVE_INFO.qwTotalSectors], ax
64 mov [si+EDRIVE_INFO.qwTotalSectors+2], dx
65 mov [si+EDRIVE_INFO.qwTotalSectors+4], bx
66 xor cx, cx
67 mov [si+EDRIVE_INFO.qwTotalSectors+6], cx ; Always zero
68 mov WORD [si+EDRIVE_INFO.wSectorSize], 512
69
70 ; Store P-CHS. Based on phoenix specification this is returned only if
71 ; total sector count is 15,482,880 or less.
72 sub ax, 4001h
73 sbb dx, 0ECh
74 sbb bx, cx ; Zero
75 jnc SHORT .ReturnWithSuccess ; More than EC4000h
76 or WORD [si+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID
77
78 eMOVZX dx, BYTE [es:di+DPT.bPchsHeads]
79 mov [si+EDRIVE_INFO.dwHeads], dx
80 mov [si+EDRIVE_INFO.dwHeads+2], cx
81
82 mov dl, [es:di+DPT.bPchsSectorsPerTrack]
83 mov [si+EDRIVE_INFO.dwSectorsPerTrack], dx
84 mov [si+EDRIVE_INFO.dwSectorsPerTrack+2], cx
85
86 mov dx, [es:di+DPT.wPchsCylinders]
87 mov [si+EDRIVE_INFO.dwCylinders], dx
88 mov [si+EDRIVE_INFO.dwCylinders+2], cx
89
90.ReturnWithSuccess:
91 xor ax, ax
92.ReturnWithError:
93 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
Note: See TracBrowser for help on using the repository browser.