[245] | 1 | ; Project name : Assembly Library |
---|
| 2 | ; Description : Functions for rebooting computer. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
[376] | 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. |
---|
[526] | 12 | ; |
---|
[376] | 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 |
---|
[526] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[526] | 18 | ; |
---|
[376] | 19 | |
---|
[245] | 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
| 24 | ; Reboot_ComputerWithBootFlagInAX |
---|
| 25 | ; Parameters: |
---|
| 26 | ; AX: Boot Flag |
---|
| 27 | ; Returns: |
---|
| 28 | ; Nothing, function never returns |
---|
| 29 | ;-------------------------------------------------------------------- |
---|
| 30 | Reboot_ComputerWithBootFlagInAX: |
---|
[251] | 31 | LOAD_BDA_SEGMENT_TO ds, bx |
---|
[245] | 32 | mov [BDA.wBoot], ax ; Store boot flag |
---|
| 33 | ; Fall to Reboot_AT |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | ;-------------------------------------------------------------------- |
---|
| 37 | ; Reboot_AT |
---|
| 38 | ; Parameters: |
---|
| 39 | ; Nothing |
---|
| 40 | ; Returns: |
---|
| 41 | ; Nothing, function never returns |
---|
| 42 | ;-------------------------------------------------------------------- |
---|
| 43 | Reboot_AT: |
---|
| 44 | mov al, 0FEh ; System reset (AT+ keyboard controller) |
---|
| 45 | out 64h, al ; Reset computer (AT+) |
---|
[247] | 46 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS |
---|
[323] | 47 | %ifdef INCLUDE_TIME_LIBRARY |
---|
| 48 | mov ax, 10 |
---|
| 49 | call Delay_MicrosecondsFromAX |
---|
| 50 | %else |
---|
| 51 | JMP_DELAY |
---|
| 52 | %endif |
---|
[247] | 53 | %else |
---|
| 54 | JMP_DELAY |
---|
| 55 | %endif |
---|
[245] | 56 | ; Fall to Reboot_XT |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | ;-------------------------------------------------------------------- |
---|
| 60 | ; Reboot_XT |
---|
| 61 | ; Parameters: |
---|
| 62 | ; Nothing |
---|
| 63 | ; Returns: |
---|
| 64 | ; Nothing, function never returns |
---|
| 65 | ;-------------------------------------------------------------------- |
---|
| 66 | Reboot_XT: |
---|
| 67 | xor ax, ax |
---|
| 68 | push ax |
---|
| 69 | popf ; Clear FLAGS (disables interrupt) |
---|
| 70 | mov ds, ax |
---|
| 71 | mov es, ax |
---|
| 72 | mov ss, ax |
---|
[251] | 73 | jmp 0FFFFh:0 ; XT reset |
---|