source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13hMFMcompatibility.asm @ 594

Last change on this file since 594 was 594, checked in by aitotat, 6 years ago

Previosly committed flash fix for configurator was incomplete. Now fixed properly.
Added MODULE_MFM_COMPATIBILITY.

File size: 2.4 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 13h handler that is used by MODULE_MFM_COMPATIBILITY.
3;                   It is placed between XTUB Int 13h hander and system INT 13h hander
4;                   to hide XTUB from MFM controllers whose BIOS assumes they handler
5;                   all hard drives on the system.
6
7;
8; XTIDE Universal BIOS and Associated Tools
9; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
10;
11; This program is free software; you can redistribute it and/or modify
12; it under the terms of the GNU General Public License as published by
13; the Free Software Foundation; either version 2 of the License, or
14; (at your option) any later version.
15;
16; This program is distributed in the hope that it will be useful,
17; but WITHOUT ANY WARRANTY; without even the implied warranty of
18; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19; GNU General Public License for more details.
20; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21;
22
23; Section containing code
24SECTION .text
25
26
27;--------------------------------------------------------------------
28; Int 13h software interrupt handler for MFM compatibility.
29;
30; Some MDM controllers require that BDA drive count is what they have set.
31; The purpose for this handler is to restore BDA drive count to what MFM controller
32; expects and then call MFM controller INT 13h.
33;
34; Int13hMFMcompatibilityHandler
35;   Parameters:
36;       Any INT 13h function and parameters
37;--------------------------------------------------------------------
38ALIGN JUMP_ALIGN
39Int13hMFMcompatibilityHandler:
40    eENTER  6, 0
41    push    es
42    push    ds
43    push    di
44
45    LOAD_BDA_SEGMENT_TO es, di
46    call    RamVars_GetSegmentToDS
47
48    ; Remove our drives from BDA drive count
49    push    ax
50    mov     al, [RAMVARS.bDrvCnt]
51    mov     [bp-2], al          ; Store our drive count for later use
52    sub     [es:HDBDA.bHDCount], al
53    pop     ax
54
55    ; Copy MFM controller INT 13h address to stack
56    les     di, [RAMVARS.fpMFMint13h]
57    mov     [bp-4], es
58    mov     [bp-6], di
59
60    ; Restore registers so we can call MFM int 13h
61    pop     di
62    pop     ds
63    pop     es
64
65    pushf   ; Push flags to simulate INT
66    call far [bp-6]
67
68    ; Now we can restore BDA drive count
69    push    ds
70    push    ax
71    lahf                    ; Get return flags to AH
72    mov     [bp-12], ah     ; Store return flags to be popped by iret
73    LOAD_BDA_SEGMENT_TO ds, ax
74    mov     al, [bp-2]
75    add     [HDBDA.bHDCount], al
76    pop     ax
77    pop     ds
78
79    ; Return from this handler
80    eLEAVE
81    iret
Note: See TracBrowser for help on using the repository browser.