[392] | 1 | ; Project name : XTIDE Universal BIOS |
---|
| 2 | ; Description : Displays Boot Menu. |
---|
| 3 | |
---|
| 4 | ; |
---|
[505] | 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. |
---|
[505] | 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 |
---|
| 16 | ; GNU General Public License for more details. |
---|
[505] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 18 | ; |
---|
[392] | 19 | |
---|
| 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
| 24 | ; Displays Boot Menu and returns Drive or Function number. |
---|
| 25 | ; |
---|
[505] | 26 | ; BootMenu_DisplayAndReturnDriveInDLRomBootClearCF |
---|
[392] | 27 | ; Parameters: |
---|
| 28 | ; DS: RAMVARS segment |
---|
| 29 | ; Returns: |
---|
[492] | 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 |
---|
[392] | 33 | ; Corrupts registers: |
---|
| 34 | ; All General Purpose Registers |
---|
| 35 | ;-------------------------------------------------------------------- |
---|
[492] | 36 | BootMenu_DisplayAndReturnDriveInDLRomBootClearCF: |
---|
[392] | 37 | call DriveXlate_Reset |
---|
| 38 | |
---|
| 39 | mov bx, BootMenuEvent_Handler |
---|
| 40 | CALL_MENU_LIBRARY DisplayWithHandlerInBXandUserDataInDXAX |
---|
| 41 | |
---|
[492] | 42 | xchg cx, ax |
---|
[505] | 43 | |
---|
[392] | 44 | ; Clear Boot Menu from screen |
---|
| 45 | mov ax, ' ' | (MONO_NORMAL<<8) |
---|
| 46 | CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH |
---|
| 47 | |
---|
[492] | 48 | ; fall through to BootMenu_GetDriveToDXforMenuitemInCX |
---|
[392] | 49 | |
---|
| 50 | ;-------------------------------------------------------------------- |
---|
| 51 | ; BootMenu_GetDriveToDXforMenuitemInCX |
---|
| 52 | ; Parameters: |
---|
| 53 | ; CX: Index of menuitem selected from Boot Menu |
---|
[505] | 54 | ; DS: RAMVARS segment |
---|
[392] | 55 | ; Returns: |
---|
| 56 | ; DX: Drive number to be used for booting |
---|
[567] | 57 | ; CF: Set: There is a selected menu item, DL is valid |
---|
| 58 | ; Clear: The item selected is Rom Boot, DL is not valid |
---|
[392] | 59 | ; Corrupts registers: |
---|
[505] | 60 | ; AX, BX |
---|
[492] | 61 | ; |
---|
| 62 | ; NOTE: We can't use the menu structure in here, as we are falling through |
---|
[505] | 63 | ; from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the |
---|
[492] | 64 | ; menu structure has already been destroyed. |
---|
[392] | 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 |
---|
[492] | 72 | ; shorter instruction than or'ing it in afterward |
---|
[392] | 73 | sub dl, al ; Remove floppy drives from index |
---|
[492] | 74 | call RamVars_GetHardDiskCountFromBDAtoAX |
---|
[505] | 75 | or al, 80h ; Or 80h into AL before the sub |
---|
[492] | 76 | cmp dl, al ; Set CF if hard disk |
---|
| 77 | ; Clear CF if last item, beyond hard disk list, which indicates ROM boot |
---|
[392] | 78 | .ReturnFloppyDriveInDX: |
---|
| 79 | ret |
---|