[165] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
| 2 | ; Description : Int 13h function AH=41h, Check if Extensions Present.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
[376] | 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.
|
---|
[526] | 12 | ;
|
---|
[376] | 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.
|
---|
[526] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
[376] | 19 |
|
---|
[165] | 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
| 23 | ;--------------------------------------------------------------------
|
---|
| 24 | ; Int 13h function AH=41h, Check if Extensions Present.
|
---|
| 25 | ;
|
---|
| 26 | ; AH41h_HandlerForCheckIfExtensionsPresent
|
---|
| 27 | ; Parameters:
|
---|
| 28 | ; DL: Translated Drive number
|
---|
| 29 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
| 30 | ; SS:BP: Ptr to IDEPACK
|
---|
| 31 | ; Parameters on INTPACK:
|
---|
| 32 | ; BX: 55AAh
|
---|
| 33 | ; Returns with INTPACK:
|
---|
| 34 | ; AH: Major version of EBIOS extensions
|
---|
[167] | 35 | ; BX: AA55h
|
---|
[165] | 36 | ; CX: Support bits
|
---|
[294] | 37 | ; CF: 0 if successful, 1 if error
|
---|
[165] | 38 | ;--------------------------------------------------------------------
|
---|
| 39 | AH41h_HandlerForCheckIfExtensionsPresent:
|
---|
| 40 | cmp WORD [bp+IDEPACK.intpack+INTPACK.bx], 55AAh
|
---|
[567] | 41 | %ifdef USE_386
|
---|
| 42 | jne Int13h_DirectCallToAnotherBios
|
---|
| 43 | %else
|
---|
[165] | 44 | jne SHORT .EbiosNotSupported
|
---|
[567] | 45 | %endif
|
---|
[165] | 46 |
|
---|
[167] | 47 | mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], EBIOS_VERSION
|
---|
[592] | 48 | not WORD [bp+IDEPACK.intpack+INTPACK.bx] ; 55AAh = AA55h
|
---|
[535] | 49 |
|
---|
[550] | 50 | %ifdef MODULE_COMPATIBLE_TABLES
|
---|
[535] | 51 | call AH41h_GetSupportBitsToCX
|
---|
| 52 | mov [bp+IDEPACK.intpack+INTPACK.cx], cx
|
---|
| 53 | %else
|
---|
[165] | 54 | mov WORD [bp+IDEPACK.intpack+INTPACK.cx], ENHANCED_DRIVE_ACCESS_SUPPORT
|
---|
[550] | 55 | %endif ; MODULE_COMPATIBLE_TABLES
|
---|
[535] | 56 |
|
---|
[165] | 57 | and BYTE [bp+IDEPACK.intpack+INTPACK.flags], ~FLG_FLAGS_CF ; Return with CF cleared
|
---|
| 58 | jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode
|
---|
[567] | 59 |
|
---|
| 60 | %ifndef USE_386
|
---|
[165] | 61 | .EbiosNotSupported:
|
---|
[417] | 62 | jmp Int13h_DirectCallToAnotherBios
|
---|
[567] | 63 | %endif
|
---|
[535] | 64 |
|
---|
| 65 |
|
---|
[550] | 66 | %ifdef MODULE_COMPATIBLE_TABLES
|
---|
[535] | 67 | ;--------------------------------------------------------------------
|
---|
| 68 | ; AH41h_GetSupportBitsToCX
|
---|
| 69 | ; Parameters:
|
---|
| 70 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
| 71 | ; Returns:
|
---|
| 72 | ; CX: Support bits returned by AH=41h
|
---|
| 73 | ; Corrupts registers:
|
---|
| 74 | ; Nothing
|
---|
| 75 | ;--------------------------------------------------------------------
|
---|
| 76 | AH41h_GetSupportBitsToCX:
|
---|
[592] | 77 | %ifdef USE_AT ; Always in Full mode
|
---|
| 78 | %ifndef MODULE_8BIT_IDE OR MODULE_SERIAL
|
---|
| 79 | mov cx, ENHANCED_DRIVE_ACCESS_SUPPORT | ENHANCED_DISK_DRIVE_SUPPORT
|
---|
| 80 | %else
|
---|
[535] | 81 | mov cx, ENHANCED_DRIVE_ACCESS_SUPPORT
|
---|
[592] | 82 | cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA
|
---|
| 83 | jae SHORT .DoNotSetEDDflag
|
---|
| 84 | or cl, ENHANCED_DISK_DRIVE_SUPPORT
|
---|
| 85 | %endif
|
---|
| 86 | %else ; ~USE_AT
|
---|
| 87 | mov cx, ENHANCED_DRIVE_ACCESS_SUPPORT
|
---|
[535] | 88 |
|
---|
| 89 | ; DPTE needs buffer from RAM so do not return it in lite mode
|
---|
| 90 | test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
|
---|
| 91 | jz SHORT .DoNotSetEDDflag
|
---|
| 92 |
|
---|
| 93 | %ifdef MODULE_8BIT_IDE OR MODULE_SERIAL
|
---|
| 94 | ; DPTE contains information for device drivers. We should not return
|
---|
| 95 | ; DPTE for 8-bit devices since software would think they are 16-bit devices.
|
---|
| 96 | cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA
|
---|
| 97 | jae SHORT .DoNotSetEDDflag
|
---|
| 98 | %endif
|
---|
| 99 |
|
---|
| 100 | or cl, ENHANCED_DISK_DRIVE_SUPPORT ; AH=48h returns DPTE
|
---|
[592] | 101 | %endif ; USE_AT
|
---|
[535] | 102 | .DoNotSetEDDflag:
|
---|
| 103 | ret
|
---|
| 104 |
|
---|
[550] | 105 | %endif ; MODULE_COMPATIBLE_TABLES
|
---|