[552] | 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 21h ; MS-DOS |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | Int13hBiosInit_Handler: |
---|
[559] | 28 | ; Ignore all but read command (assumed to read boot sector) |
---|
| 29 | cmp ah, READ_SECTORS_INTO_MEMORY |
---|
| 30 | jne SHORT .MainBiosStillInInitializationMode |
---|
| 31 | |
---|
[552] | 32 | LOAD_BDA_SEGMENT_TO ds, ax |
---|
| 33 | |
---|
| 34 | ; Now install our handler and call 19h since non-standard motherboard BIOS did not |
---|
| 35 | ; do that or our INT 19h hander was replaced by other BIOS. |
---|
| 36 | mov WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler |
---|
| 37 | mov [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs |
---|
| 38 | int BIOS_BOOT_LOADER_INTERRUPT_19h ; Does not return |
---|
[553] | 39 | |
---|
[559] | 40 | ; Main BIOS might reset floppy drives etc. so let's wait longer |
---|
| 41 | ; before installing our INT 19h handler. |
---|
| 42 | .MainBiosStillInInitializationMode: |
---|
| 43 | int TEMPORARY_VECTOR_FOR_SYSTEM_INT13h |
---|
| 44 | retf 2 |
---|
[553] | 45 | |
---|
[559] | 46 | |
---|
[553] | 47 | ;-------------------------------------------------------------------- |
---|
| 48 | ; Int13hBiosInit_RestoreSystemHandler |
---|
| 49 | ; Parameters: |
---|
| 50 | ; Nothing |
---|
| 51 | ; Returns: |
---|
| 52 | ; Nothing |
---|
| 53 | ; Corrupts registers: |
---|
| 54 | ; AX, DS, ES |
---|
| 55 | ;-------------------------------------------------------------------- |
---|
| 56 | Int13hBiosInit_RestoreSystemHandler: |
---|
| 57 | LOAD_BDA_SEGMENT_TO ds, ax |
---|
| 58 | |
---|
| 59 | ; Is our very late init handler in place |
---|
| 60 | cmp WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler |
---|
| 61 | jne SHORT .SystemHandlerAlreadyInPlace |
---|
| 62 | |
---|
| 63 | les ax, [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4] |
---|
| 64 | mov [BIOS_DISK_INTERRUPT_13h*4], ax |
---|
| 65 | mov [BIOS_DISK_INTERRUPT_13h*4+2], es |
---|
| 66 | .SystemHandlerAlreadyInPlace: |
---|
| 67 | ret |
---|