1 | ; Project name : XTIDE Universal BIOS |
---|
2 | ; Description : Displays Boot Menu. |
---|
3 | |
---|
4 | ; |
---|
5 | ; XTIDE Universal BIOS and Associated Tools |
---|
6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team. |
---|
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. |
---|
12 | ; |
---|
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 |
---|
16 | ; GNU General Public License for more details. |
---|
17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
18 | ; |
---|
19 | |
---|
20 | ; Section containing code |
---|
21 | SECTION .text |
---|
22 | |
---|
23 | ;-------------------------------------------------------------------- |
---|
24 | ; Displays Boot Menu and returns Drive or Function number. |
---|
25 | ; |
---|
26 | ; BootMenu_DisplayAndReturnSelectionInDX |
---|
27 | ; Parameters: |
---|
28 | ; DS: RAMVARS segment |
---|
29 | ; Returns: |
---|
30 | ; Nothing, selected drive is converted to hotkey |
---|
31 | ; Corrupts registers: |
---|
32 | ; All General Purpose Registers |
---|
33 | ;-------------------------------------------------------------------- |
---|
34 | BootMenu_DisplayAndStoreSelectionAsHotkey: |
---|
35 | call DriveXlate_Reset |
---|
36 | |
---|
37 | mov bx, BootMenuEvent_Handler |
---|
38 | CALL_MENU_LIBRARY DisplayWithHandlerInBXandUserDataInDXAX |
---|
39 | |
---|
40 | ; Clear Boot Menu from screen |
---|
41 | mov ax, ' ' | (MONO_NORMAL<<8) |
---|
42 | CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH |
---|
43 | ret |
---|
44 | |
---|
45 | |
---|
46 | ;-------------------------------------------------------------------- |
---|
47 | ; BootMenu_GetDriveToDXforMenuitemInCX |
---|
48 | ; Parameters: |
---|
49 | ; CX: Index of menuitem selected from Boot Menu |
---|
50 | ; Returns: |
---|
51 | ; DX: Drive number to be used for booting |
---|
52 | ; DS: RAMVARS segment |
---|
53 | ; CF: Set: There is a selected menu item, DL is valid |
---|
54 | ; Clear: There is no selected menu item, DL is not valid |
---|
55 | ; Corrupts registers: |
---|
56 | ; AX, DI |
---|
57 | ;-------------------------------------------------------------------- |
---|
58 | BootMenu_GetDriveToDXforMenuitemInCX: |
---|
59 | cmp cl, NO_ITEM_HIGHLIGHTED |
---|
60 | je SHORT .ReturnFloppyDriveInDX ; Clear CF if branch taken |
---|
61 | |
---|
62 | mov dl, cl ; Copy menuitem index to DX |
---|
63 | call FloppyDrive_GetCountToAX |
---|
64 | cmp dl, al ; Floppy drive? |
---|
65 | jb SHORT .ReturnFloppyDriveInDX ; Set CF if branch taken |
---|
66 | or al, 80h ; Or 80h into AL before the sub |
---|
67 | ; to cause CF to be set after |
---|
68 | ; and result has high order bit set |
---|
69 | sub dl, al ; Remove floppy drives from index |
---|
70 | |
---|
71 | .ReturnFloppyDriveInDX: |
---|
72 | ret |
---|