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

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

Changes to XTIDE Universal BIOS:

  • Old Int 13h transfer functions work again.
  • Fixes to eINT13h (EBIOS) support.
File size: 2.4 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    call    AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
37    xchg    cx, ax      ; Sector count now in BX:DX:CX
38
39    ; Point ES:DI to Destination buffer
40    mov     di, [bp+IDEPACK.intpack+INTPACK.si]
41    mov     es, [bp+IDEPACK.intpack+INTPACK.ds]
42    mov     ax, MINIMUM_EDRIVEINFO_SIZE
43    cmp     WORD [es:di+EDRIVE_INFO.wSize], ax
44    jb      SHORT .BufferTooSmall
45    je      SHORT .SkipEddConfigurationParameters
46
47    ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
48    xor     ax, ax
49    dec     ax          ; AX = FFFFh
50    mov     [es:di+EDRIVE_INFO.fpEDDparams], ax
51    mov     [es:di+EDRIVE_INFO.fpEDDparams+2], ax
52    mov     ax, EDRIVE_INFO_size
53
54    ; Fill Extended Drive Information Table in ES:DI
55.SkipEddConfigurationParameters:
56    stosw               ; Store Extended Drive Information Table size
57    mov     al, FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS
58    stosw
59    add     di, BYTE 12 ; Skip CHS parameters
60    xchg    ax, cx
61    stosw               ; LBA WORD 0
62    xchg    ax, dx
63    stosw               ; LBA WORD 1
64    xchg    ax, bx
65    stosw               ; LBA WORD 2
66    xor     ax, ax
67    stosw               ; LBA WORD 3 always zero since 48-bit address
68    mov     ah, 512>>8
69    stosw               ; Always 512-byte sectors
70
71    ; Return with success
72    xor     ah, ah
73    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
74
75.BufferTooSmall:
76    mov     ah, RET_HD_INVALID
77.ReturnWithError:
78    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
Note: See TracBrowser for help on using the repository browser.