1 | ; Project name : XTIDE Universal BIOS |
---|
2 | ; Description : Int 13h handler that is used to initialize |
---|
3 | ; XTIDE Universal BIOS when our INT 19h was not called. |
---|
4 | |
---|
5 | ; |
---|
6 | ; XTIDE Universal BIOS and Associated Tools |
---|
7 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
8 | ; |
---|
9 | ; This program is free software; you can redistribute it and/or modify |
---|
10 | ; it under the terms of the GNU General Public License as published by |
---|
11 | ; the Free Software Foundation; either version 2 of the License, or |
---|
12 | ; (at your option) any later version. |
---|
13 | ; |
---|
14 | ; This program is distributed in the hope that it will be useful, |
---|
15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | ; GNU General Public License for more details. |
---|
18 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
19 | ; |
---|
20 | |
---|
21 | ; Section containing code |
---|
22 | SECTION .text |
---|
23 | |
---|
24 | |
---|
25 | ;-------------------------------------------------------------------- |
---|
26 | ; Int 13h software interrupt handler. |
---|
27 | ; This handler captures boot sector read from foreign drive when our |
---|
28 | ; INT 19h is not called. This way we can force XTIDE Universal BIOS |
---|
29 | ; initialization even without INT 19h being called. |
---|
30 | ; |
---|
31 | ; Int13hBiosInit_Handler |
---|
32 | ; Parameters: |
---|
33 | ; AH: Bios function |
---|
34 | ; READ_SECTORS_INTO_MEMORY will initialize XTIDE Universal BIOS |
---|
35 | ;-------------------------------------------------------------------- |
---|
36 | Int13hBiosInit_Handler: |
---|
37 | ; Initialize XTIDE Universal BIOS only if Int13hBiosInit_Handler is still at |
---|
38 | ; vector 13h. Otherwise some other BIOS has hooked us and our very late |
---|
39 | ; initialization is not possible. |
---|
40 | push ds |
---|
41 | push ax |
---|
42 | LOAD_BDA_SEGMENT_TO ds, ax |
---|
43 | pop ax |
---|
44 | cmp WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler |
---|
45 | pop ds |
---|
46 | jne SHORT .VeryLateInitFailed ; XTIDE Universal BIOS does not work |
---|
47 | |
---|
48 | ; Ignore all but read command (assumed to read boot sector) |
---|
49 | cmp ah, READ_SECTORS_INTO_MEMORY |
---|
50 | je SHORT Int19h_BootLoaderHandler |
---|
51 | |
---|
52 | ; Call system INT 13h since not trying to read boot sector |
---|
53 | int TEMPORARY_VECTOR_FOR_SYSTEM_INT13h |
---|
54 | retf 2 |
---|
55 | |
---|
56 | .VeryLateInitFailed: |
---|
57 | mov ah, RET_HD_INVALID |
---|
58 | stc |
---|
59 | retf 2 |
---|