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 | TEMPORARY_VECTOR_FOR_SYSTEM_INT13h EQU 32h ; Unused by BIOS
|
---|
25 |
|
---|
26 |
|
---|
27 | ;--------------------------------------------------------------------
|
---|
28 | ; Int 13h software interrupt handler.
|
---|
29 | ; This handler captures boot sector read from foreign drive when our
|
---|
30 | ; INT 19h is not called. This way we can force XTIDE Universal BIOS
|
---|
31 | ; initialization even without INT 19h being called.
|
---|
32 | ;
|
---|
33 | ; Int13hBiosInit_Handler
|
---|
34 | ; Parameters:
|
---|
35 | ; AH: Bios function
|
---|
36 | ; READ_SECTORS_INTO_MEMORY will initialize XTIDE Universal BIOS
|
---|
37 | ;--------------------------------------------------------------------
|
---|
38 | Int13hBiosInit_Handler:
|
---|
39 | ; Initialize XTIDE Universal BIOS only if Int13hBiosInit_Handler is still at
|
---|
40 | ; vector 13h. Otherwise some other BIOS has hooked us and our very late
|
---|
41 | ; initialization is not possible.
|
---|
42 | push ds
|
---|
43 | push ax
|
---|
44 | LOAD_BDA_SEGMENT_TO ds, ax
|
---|
45 | pop ax
|
---|
46 | cmp WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
|
---|
47 | pop ds
|
---|
48 | jne SHORT .VeryLateInitFailed ; XTIDE Universal BIOS does not work
|
---|
49 |
|
---|
50 | ; Ignore all but read command (assumed to read boot sector)
|
---|
51 | cmp ah, READ_SECTORS_INTO_MEMORY
|
---|
52 | je SHORT Int19h_BootLoaderHandler
|
---|
53 |
|
---|
54 | ; Call system INT 13h since not trying to read boot sector
|
---|
55 | int TEMPORARY_VECTOR_FOR_SYSTEM_INT13h
|
---|
56 | retf 2
|
---|
57 |
|
---|
58 | .VeryLateInitFailed:
|
---|
59 | mov ah, RET_HD_INVALID
|
---|
60 | stc
|
---|
61 | retf 2
|
---|