[392] | 1 | ; Project name : XTIDE Universal BIOS |
---|
| 2 | ; Description : Functions for accessings BOOTVARS. |
---|
| 3 | |
---|
| 4 | ; |
---|
[491] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
[392] | 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. |
---|
[491] | 12 | ; |
---|
[392] | 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 |
---|
[491] | 16 | ; GNU General Public License for more details. |
---|
[392] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[491] | 18 | ; |
---|
[392] | 19 | |
---|
| 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
| 24 | ; BootVars_Initialize |
---|
| 25 | ; Parameters: |
---|
| 26 | ; DS: RAMVARS Segment |
---|
| 27 | ; ES: BDA Segment |
---|
| 28 | ; Returns: |
---|
| 29 | ; Nothing |
---|
| 30 | ; Corrupts registers: |
---|
| 31 | ; AX, CX, DX, DI |
---|
| 32 | ;-------------------------------------------------------------------- |
---|
| 33 | BootVars_Initialize: |
---|
[524] | 34 | ; Clear all DRVDETECTINFO structs to zero |
---|
[397] | 35 | mov al, DRVDETECTINFO_size |
---|
[392] | 36 | mul BYTE [cs:ROMVARS.bIdeCnt] |
---|
| 37 | xchg cx, ax |
---|
[528] | 38 | %ifndef MODULE_HOTKEYS |
---|
[593] | 39 | mov di, BOOTVARS.rgDrvDetectInfo ; We must not initialize anything before this! |
---|
[528] | 40 | jmp Memory_ZeroESDIwithSizeInCX |
---|
[395] | 41 | |
---|
[528] | 42 | %else ; if MODULE_HOTKEYS |
---|
[593] | 43 | ; Also zero HOTKEYVARS located above DRVDETECTINFO structs |
---|
| 44 | mov di, BOOTVARS.hotkeyVars |
---|
| 45 | add cx, BYTE HOTKEYVARS_size |
---|
[392] | 46 | call Memory_ZeroESDIwithSizeInCX |
---|
| 47 | |
---|
[593] | 48 | ; Store time when hotkeybar is displayed |
---|
| 49 | ; (it will be displayed after initialization is complete) |
---|
| 50 | call TimerTicks_ReadFromBdaToAX |
---|
| 51 | mov [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax |
---|
| 52 | |
---|
[524] | 53 | ; Initialize HOTKEYVARS by storing default drives to boot from |
---|
[528] | 54 | call BootVars_StoreDefaultDriveLettersToHotkeyVars |
---|
[395] | 55 | mov dl, [cs:ROMVARS.bBootDrv] |
---|
[528] | 56 | jmp HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL |
---|
[392] | 57 | |
---|
[528] | 58 | |
---|
| 59 | ;-------------------------------------------------------------------- |
---|
| 60 | ; BootVars_StoreDefaultDriveLettersToHotkeyVars |
---|
| 61 | ; Parameters: |
---|
| 62 | ; ES: BDA Segment |
---|
| 63 | ; Returns: |
---|
| 64 | ; Nothing |
---|
| 65 | ; Corrupts registers: |
---|
| 66 | ; Nothing |
---|
| 67 | ;-------------------------------------------------------------------- |
---|
| 68 | BootVars_StoreDefaultDriveLettersToHotkeyVars: |
---|
[547] | 69 | call BootVars_GetLetterForFirstHardDriveToAX |
---|
| 70 | mov ah, DEFAULT_FLOPPY_DRIVE_LETTER |
---|
| 71 | xchg al, ah |
---|
| 72 | mov [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], ax |
---|
[528] | 73 | ret |
---|
| 74 | |
---|
[395] | 75 | %endif ; MODULE_HOTKEYS |
---|
[547] | 76 | |
---|
| 77 | |
---|
| 78 | ;-------------------------------------------------------------------- |
---|
| 79 | ; Returns letter for first hard disk. Usually it will be 'C' but it |
---|
| 80 | ; can be higher if more than two floppy drives are found. |
---|
| 81 | ; |
---|
| 82 | ; BootVars_GetLetterForFirstHardDriveToAX |
---|
| 83 | ; Parameters: |
---|
| 84 | ; DS: RAMVARS segment |
---|
| 85 | ; Returns: |
---|
| 86 | ; AX: Upper case letter for first hard disk |
---|
| 87 | ; Corrupts registers: |
---|
| 88 | ; Nothing |
---|
| 89 | ;-------------------------------------------------------------------- |
---|
| 90 | BootVars_GetLetterForFirstHardDriveToAX: |
---|
| 91 | call FloppyDrive_GetCountToAX |
---|
| 92 | add al, DEFAULT_FLOPPY_DRIVE_LETTER ; First Hard Drive letter comes after last floppy drive letter... |
---|
| 93 | MAX_U al, DEFAULT_HARD_DRIVE_LETTER ; ...but it can never be 'A' or 'B' |
---|
| 94 | ret |
---|