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

Last change on this file since 169 was 169, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Old Int 13h functions can now transfer 256 sectors per call.
  • eINT 13h functions can now transfer 65535 sectors per call.
File size: 2.6 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 13h function AH=48h, Get Extended Drive Parameters.
3
4; Section containing code
5SECTION .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;--------------------------------------------------------------------
23ALIGN JUMP_ALIGN
24AH48h_HandlerForGetExtendedDriveParameters:
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
30    push    ds
31    pop     es
32
33    ; Get Drive ID and total sector count from it
34    call    AH25h_GetDriveInformationToBufferInESSI
35    jc      SHORT .ReturnWithError
36
37    ; Point DS:DI to Destination buffer
38    mov     di, [bp+IDEPACK.intpack+INTPACK.si]
39    mov     ds, [bp+IDEPACK.intpack+INTPACK.ds]
40    mov     ax, MINIMUM_EDRIVEINFO_SIZE
41    cmp     WORD [di+EDRIVE_INFO.wSize], ax
42    jb      SHORT AH42h_ReturnWithInvalidFunctionError
43    je      SHORT .SkipEddConfigurationParameters
44
45    ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
46    xor     ax, ax
47    dec     ax          ; AX = FFFFh
48    mov     [di+EDRIVE_INFO.fpEDDparams], ax
49    mov     [di+EDRIVE_INFO.fpEDDparams+2], ax
50    mov     ax, EDRIVE_INFO_size
51
52    ; Fill Extended Drive Information Table in DS:DI
53.SkipEddConfigurationParameters:
54    mov     [di+EDRIVE_INFO.wSize], ax
55    mov     WORD [di+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID
56
57    call    AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI
58    xor     cx, cx
59    mov     [di+EDRIVE_INFO.dwCylinders], ax
60    mov     [di+EDRIVE_INFO.dwCylinders+2], cx
61    eMOVZX  ax, bl
62    mov     [di+EDRIVE_INFO.dwHeads], ax
63    mov     [di+EDRIVE_INFO.dwHeads+2], cx
64    mov     al, bh
65    mov     [di+EDRIVE_INFO.dwSectorsPerTrack], ax
66    mov     [di+EDRIVE_INFO.dwSectorsPerTrack+2], cx
67
68    call    AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
69    mov     [di+EDRIVE_INFO.qwTotalSectors], ax
70    mov     [di+EDRIVE_INFO.qwTotalSectors+2], dx
71    mov     [di+EDRIVE_INFO.qwTotalSectors+4], bx
72    mov     [di+EDRIVE_INFO.qwTotalSectors+6], cx
73
74    mov     WORD [di+EDRIVE_INFO.wSectorSize], 512
75
76    ; Return with success
77    xor     ah, ah
78.ReturnWithError:
79    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
Note: See TracBrowser for help on using the repository browser.