source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm @ 472

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

Changes to XTIDE Universal BIOS:

  • Implemented AH=1Eh, XT-CF Features.
File size: 3.8 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 13h function AH=1Eh, Lo-tech XT-CF features.
3
4;
5; XTIDE Universal BIOS and Associated Tools 
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
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.
12; 
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.     
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;       
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Int 13h function AH=1Eh, Lo-tech XT-CF features.
25; This function is supported only by XTIDE Universal BIOS.
26;
27; AH1Eh_HandlerForXTCFfeatures
28;   Parameters:
29;       AL, CX: Same as in INTPACK
30;       DL:     Translated Drive number
31;       DS:DI:  Ptr to DPT (in RAMVARS segment)
32;       SS:BP:  Ptr to IDEPACK
33;   Parameters on INTPACK:
34;       AL:     XT-CF subcommand (see XTCF.inc for more info)
35;   Returns with INTPACK:
36;       AH:     Int 13h return status
37;       CF:     0 if successful, 1 if error
38;--------------------------------------------------------------------
39AH1Eh_HandlerForXTCFfeatures:
40    xor     ah, ah      ; Subcommand now in AX
41%ifndef USE_186
42    call    AH1Eh_ProcessXTCFsubcommandFromAX
43    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
44%else
45    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
46    ; Fall to AH1Eh_ProcessXTCFsubcommandFromAX
47%endif
48
49
50;--------------------------------------------------------------------
51; AH1Eh_ProcessXTCFsubcommandFromAX
52;   Parameters:
53;       AX:     XT-CF subcommand (see XTCF.inc for more info)
54;       DS:DI:  Ptr to DPT (in RAMVARS segment)
55;       SS:BP:  Ptr to IDEPACK
56;   Returns:
57;       AH:     Int 13h return status
58;       CF:     0 if successful, 1 if error
59;   Corrupts registers:
60;       AL, BX, CX, DX
61;--------------------------------------------------------------------
62AH1Eh_ProcessXTCFsubcommandFromAX:
63    ; IS_THIS_DRIVE_XTCF. We check this for all commands.
64    dec     ax      ; Subcommand
65    mov     dx, [di+DPT.wXTCFport]
66    test    dx, dx  ; Never zero for XT-CF, Always zero for other devices
67    jz      SHORT XTCFnotFound
68
69    ; READ_XTCF_CONTROL_REGISTER_TO_DH
70    add     dl, XTCF_CONTROL_REGISTER   ; DX to Control Register
71    dec     ax      ; Subcommand
72    jnz     SHORT .SkipReadXtcfControlRegisterToDH
73    in      al, dx
74    mov     [bp+IDEPACK.intpack+INTPACK.dh], al
75    jmp     SHORT .ReturnWithSuccess
76.SkipReadXtcfControlRegisterToDH:
77
78    ; WRITE_DH_TO_XTCF_CONTROL_REGISTER
79    dec     ax      ; Subcommand
80    jnz     SHORT XTCFnotFound          ; Invalid subcommand
81    mov     al, [bp+IDEPACK.intpack+INTPACK.dh]
82    out     dx, al
83.ReturnWithSuccess:
84    xor     ah, ah
85    ret
86
87
88;--------------------------------------------------------------------
89; AH1Eh_DetectXTCFwithBasePortInDX
90;   Parameters:
91;       DX:     Base I/O port address to check
92;   Returns:
93;       AH:     RET_HD_SUCCESS if XT-CF is found from port
94;               RET_HD_INVALID if XT-CF is not found
95;       CF:     Cleared if XT-CF found
96;               Set if XT-CF not found
97;   Corrupts registers:
98;       AL, DX
99;--------------------------------------------------------------------
100AH1Eh_DetectXTCFwithBasePortInDX:
101    add     dl, XTCT_CONTROL_REGISTER_INVERTED_in   ; set DX to XT-CF config register (inverted)
102    in      al, dx      ; get value
103    mov     ah, al      ; save in ah
104    inc     dx          ; set DX to XT-CF config register (non-inverted)
105    in      al, dx      ; get value
106    not     al          ; invert it
107    sub     ah, al      ; do they match? (clear AH if they do)
108    jz      SHORT XTCFfound
109
110XTCFnotFound:
111    stc                 ; set carry flag since XT-CF not found
112    mov     ah, RET_HD_INVALID
113XTCFfound:
114    ret                 ; and return
Note: See TracBrowser for help on using the repository browser.