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: |
---|
25 | ; Get ATA Drive Information and total sector count from it |
---|
26 | push ds |
---|
27 | pop es ; ES now points RAMVARS segment |
---|
28 | mov si, [cs:ROMVARS.bStealSize] |
---|
29 | and si, BYTE 7Fh |
---|
30 | eSHL_IM si, 10 ; Kilobytes to bytes |
---|
31 | sub si, 512 ; Subtract buffer size for offset in RAMVARS |
---|
32 | call AH25h_GetDriveInformationToBufferInESSIfromDriveInDL |
---|
33 | call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI |
---|
34 | xchg cx, ax |
---|
35 | |
---|
36 | ; Point ES:DI to Destination buffer |
---|
37 | mov di, [bp+IDEPACK.intpack+INTPACK.si] |
---|
38 | mov es, [bp+IDEPACK.intpack+INTPACK.ds] |
---|
39 | cmp WORD [es:di+EDRIVE_INFO.wSize], MINIMUM_EDRIVEINFO_SIZE |
---|
40 | jb SHORT .BufferTooSmall |
---|
41 | |
---|
42 | ; Fill Extended Drive Information Table in ES:DI |
---|
43 | mov ax, MINIMUM_EDRIVEINFO_SIZE |
---|
44 | stosw |
---|
45 | mov al, FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS |
---|
46 | stosw |
---|
47 | add di, BYTE 12 ; Skip CHS parameters |
---|
48 | xchg ax, cx |
---|
49 | stosw ; LBA WORD 0 |
---|
50 | xchg ax, dx |
---|
51 | stosw ; LBA WORD 1 |
---|
52 | xchg ax, bx |
---|
53 | stosw ; LBA WORD 2 |
---|
54 | xor ax, ax |
---|
55 | stosw ; LBA WORD 3 always zero since 48-bit address |
---|
56 | mov ah, 512>>8 |
---|
57 | stosw ; Always 512-byte sectors |
---|
58 | |
---|
59 | ; Return with success |
---|
60 | xor ah, ah |
---|
61 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
62 | |
---|
63 | .BufferTooSmall: |
---|
64 | mov ah, RET_HD_INVALID |
---|
65 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|