[165] | 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 | AH48h_HandlerForGetExtendedDriveParameters: |
---|
[228] | 24 | call AccessDPT_GetPointerToDRVPARAMStoCSBX |
---|
| 25 | push bx |
---|
[227] | 26 | call AccessDPT_GetLbaSectorCountToBXDXAX |
---|
[228] | 27 | pop di ; CS:DI now points to DRVPARAMS |
---|
[167] | 28 | |
---|
[227] | 29 | ; Point DS:SI to Extended Drive Information Table to fill |
---|
[169] | 30 | mov ds, [bp+IDEPACK.intpack+INTPACK.ds] |
---|
[227] | 31 | mov cx, MINIMUM_EDRIVEINFO_SIZE |
---|
| 32 | cmp [si+EDRIVE_INFO.wSize], cx |
---|
[221] | 33 | jb SHORT Prepare_ReturnFromInt13hWithInvalidFunctionError |
---|
[167] | 34 | je SHORT .SkipEddConfigurationParameters |
---|
[165] | 35 | |
---|
[167] | 36 | ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh |
---|
[227] | 37 | mov cx, -1 ; FFFFh |
---|
| 38 | mov [si+EDRIVE_INFO.fpEDDparams], cx |
---|
| 39 | mov [si+EDRIVE_INFO.fpEDDparams+2], cx |
---|
| 40 | mov cx, EDRIVE_INFO_size |
---|
[167] | 41 | |
---|
[227] | 42 | ; Fill Extended Drive Information Table in DS:SI |
---|
[167] | 43 | .SkipEddConfigurationParameters: |
---|
[227] | 44 | mov [si+EDRIVE_INFO.wSize], cx |
---|
| 45 | mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS |
---|
[165] | 46 | |
---|
[228] | 47 | ; Limit LBA if necessary |
---|
| 48 | test BYTE [cs:di+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA |
---|
| 49 | jz SHORT .StoreTotalSectorsFromBXDXAX |
---|
| 50 | test bx, bx |
---|
| 51 | jnz SHORT .LimitTotalSectors |
---|
| 52 | cmp dx, [cs:di+DRVPARAMS.dwMaximumLBA+2] |
---|
| 53 | jb SHORT .StoreTotalSectorsFromBXDXAX ; Real size less than max |
---|
| 54 | ja SHORT .LimitTotalSectors |
---|
| 55 | cmp ax, [cs:di+DRVPARAMS.dwMaximumLBA] |
---|
| 56 | jbe SHORT .StoreTotalSectorsFromBXDXAX ; Real size less than max |
---|
| 57 | |
---|
| 58 | .LimitTotalSectors: |
---|
| 59 | xor bx, bx |
---|
| 60 | mov ax, [cs:di+DRVPARAMS.dwMaximumLBA] |
---|
| 61 | mov dx, [cs:di+DRVPARAMS.dwMaximumLBA+2] |
---|
| 62 | |
---|
| 63 | .StoreTotalSectorsFromBXDXAX: |
---|
| 64 | mov [si+EDRIVE_INFO.qwTotalSectors], ax |
---|
[227] | 65 | xor ax, ax ; Return with success |
---|
[228] | 66 | mov [si+EDRIVE_INFO.qwTotalSectors+2], dx |
---|
| 67 | mov [si+EDRIVE_INFO.qwTotalSectors+4], bx |
---|
[229] | 68 | mov [si+EDRIVE_INFO.qwTotalSectors+6], ax ; Always zero |
---|
[228] | 69 | mov WORD [si+EDRIVE_INFO.wSectorSize], 512 |
---|
[169] | 70 | |
---|
[167] | 71 | .ReturnWithError: |
---|
[165] | 72 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|