source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm@ 502

Last change on this file since 502 was 492, checked in by gregli@…, 12 years ago

Removed the dependency between MODULE_BOOT_MENU and MODULE_HOTKEYS. With these changes, 0, 1, or 2 of them can be included in a build. This change also means that the hotkeys don't work while the menu is up. But the most important hotkey there was for Rom Boot, and that has been added to the menu as a choice proper. Lots of changes across the board in the hotkeys code - even if we eventually back this change out (becaue, for example we want hotkeys to work in the menu) we should probably start from this base and add that functionality back in, as these changes results in approximately 120 bytes of savings and includes new functionality, such as the Rom Boot menu item and the Com Detect hotkey.

File size: 3.0 KB
Line 
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
21SECTION .text
22
23;--------------------------------------------------------------------
24; Displays Boot Menu and returns Drive or Function number.
25;
26; BootMenu_DisplayAndStoreSelection
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;--------------------------------------------------------------------
36BootMenu_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; Returns:
55; DX: Drive number to be used for booting
56; DS: RAMVARS segment
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, DI
61;
62; NOTE: We can't use the menu structure in here, as we are falling through
63; through from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the
64; menu structure has already been destroyed.
65;--------------------------------------------------------------------
66BootMenu_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
Note: See TracBrowser for help on using the repository browser.