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-2013 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_DisplayAndReturnDriveInDLRomBootClearCF |
---|
27 | ; Parameters: |
---|
28 | ; DS: RAMVARS segment |
---|
29 | ; Returns: |
---|
30 | ; DL: Drive number selected |
---|
31 | ; CF: Set if selected item is an actual drive, DL is valid |
---|
32 | ; Clear if selected item is Rom Boot, DL is invalid |
---|
33 | ; Corrupts registers: |
---|
34 | ; All General Purpose Registers |
---|
35 | ;-------------------------------------------------------------------- |
---|
36 | BootMenu_DisplayAndReturnDriveInDLRomBootClearCF: |
---|
37 | call DriveXlate_Reset |
---|
38 | |
---|
39 | mov bx, BootMenuEvent_Handler |
---|
40 | CALL_MENU_LIBRARY DisplayWithHandlerInBXandUserDataInDXAX |
---|
41 | |
---|
42 | xchg cx, ax |
---|
43 | |
---|
44 | ; Clear Boot Menu from screen |
---|
45 | mov ax, ' ' | (MONO_NORMAL<<8) |
---|
46 | CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH |
---|
47 | |
---|
48 | ; fall through to BootMenu_GetDriveToDXforMenuitemInCX |
---|
49 | |
---|
50 | ;-------------------------------------------------------------------- |
---|
51 | ; BootMenu_GetDriveToDXforMenuitemInCX |
---|
52 | ; Parameters: |
---|
53 | ; CX: Index of menuitem selected from Boot Menu |
---|
54 | ; DS: RAMVARS segment |
---|
55 | ; Returns: |
---|
56 | ; DX: Drive number to be used for booting |
---|
57 | ; CF: Set: There is a selected menu item, DL is valid |
---|
58 | ; Clear: The item selected is Rom Boot, DL is not valid |
---|
59 | ; Corrupts registers: |
---|
60 | ; AX, BX |
---|
61 | ; |
---|
62 | ; NOTE: We can't use the menu structure in here, as we are falling through |
---|
63 | ; from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the |
---|
64 | ; menu structure has already been destroyed. |
---|
65 | ;-------------------------------------------------------------------- |
---|
66 | BootMenu_GetDriveToDXforMenuitemInCX: |
---|
67 | mov dl, cl ; Copy menuitem index to DX |
---|
68 | call FloppyDrive_GetCountToAX |
---|
69 | cmp dl, al ; Floppy drive? |
---|
70 | jb SHORT .ReturnFloppyDriveInDX ; Set CF if branch taken |
---|
71 | or al, 80h ; Or 80h into AL before the sub |
---|
72 | ; shorter instruction than or'ing it in afterward |
---|
73 | sub dl, al ; Remove floppy drives from index |
---|
74 | call RamVars_GetHardDiskCountFromBDAtoAX |
---|
75 | or al, 80h ; Or 80h into AL before the sub |
---|
76 | cmp dl, al ; Set CF if hard disk |
---|
77 | ; Clear CF if last item, beyond hard disk list, which indicates ROM boot |
---|
78 | .ReturnFloppyDriveInDX: |
---|
79 | ret |
---|