source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm@ 370

Last change on this file since 370 was 369, checked in by gregli@…, 13 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 5.2 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]2; Description : Boot Menu event handler for menu library callbacks.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; BootMenuEvent_Handler
[88]9; Common parameters for all events:
10; BX: Menu event (anything from MENUEVENT struct)
11; SS:BP: Menu library handle
12; Common return values for all events:
13; CF: Set if event processed
14; Cleared if event not processed
[3]15; Corrupts registers:
[88]16; All
[3]17;--------------------------------------------------------------------
18BootMenuEvent_Handler:
[202]19
[183]20%ifdef MENUEVENT_INLINE_OFFSETS
[202]21
[258]22 add bx, BootMenuEvent_Handler.FirstEvent
[183]23 jmp bx
[3]24
[258]25MENUEVENT_InitializeMenuinitFromDSSI equ (BootMenuEvent_Handler.InitializeMenuinitFromDSSI - BootMenuEvent_Handler.FirstEvent)
26MENUEVENT_ExitMenu equ (BootMenuEvent_EventCompleted - BootMenuEvent_Handler.FirstEvent)
27MENUEVENT_ItemHighlightedFromCX equ (BootMenuEvent_Handler.ItemHighlightedFromCX - BootMenuEvent_Handler.FirstEvent)
28MENUEVENT_ItemSelectedFromCX equ (BootMenuEvent_Handler.ItemSelectedFromCX - BootMenuEvent_Handler.FirstEvent)
29MENUEVENT_KeyStrokeInAX equ (BootMenuEvent_Handler.KeyStrokeInAX - BootMenuEvent_Handler.FirstEvent)
30MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - BootMenuEvent_Handler.FirstEvent)
31MENUEVENT_RefreshInformation equ (BootMenuPrint_RefreshInformation - BootMenuEvent_Handler.FirstEvent)
32MENUEVENT_RefreshItemFromCX equ (BootMenuPrint_RefreshItem - BootMenuEvent_Handler.FirstEvent)
[202]33;
34; Note that there is no entry for MENUEVENT_IdleProcessing. If MENUEVENT_IDLEPROCESSING_ENABLE is not %defined,
[189]35; then the entry point will not be called (saving memory on this end and at the CALL point).
36;
[202]37
[183]38%else
[202]39
[189]40 cmp bx, BYTE MENUEVENT.RefreshItemFromCX ; Above last supported item?
41 ja SHORT .EventNotHandled
42 jmp [cs:bx+.rgfnEventSpecificHandlers]
43
44.EventNotHandled:
45 clc
46 ret
[202]47
[3]48ALIGN WORD_ALIGN
[88]49.rgfnEventSpecificHandlers:
[241]50 dw .InitializeMenuinitFromDSSI ; MENUEVENT.InitializeMenuinitFromDSSI
51 dw BootMenuEvent_EventCompleted ; MENUEVENT.ExitMenu
52 dw .EventNotHandled ; MENUEVENT.IdleProcessing
53 dw .ItemHighlightedFromCX ; MENUEVENT.ItemHighlightedFromCX
54 dw .ItemSelectedFromCX ; MENUEVENT.ItemSelectedFromCX
55 dw .KeyStrokeInAX ; MENUEVENT.KeyStrokeInAX
56 dw BootMenuPrint_TitleStrings ; MENUEVENT.RefreshTitle
57 dw BootMenuPrint_RefreshInformation ; MENUEVENT.RefreshInformation
58 dw BootMenuPrint_RefreshItem ; MENUEVENT.RefreshItemFromCX
[202]59
[183]60%endif
[3]61
62
[88]63; Parameters:
64; DS:SI: Ptr to MENUINIT struct to initialize
65; Returns:
66; DS:SI: Ptr to initialized MENUINIT struct
[258]67.FirstEvent:
[88]68.InitializeMenuinitFromDSSI:
69 push ds
70 call RamVars_GetSegmentToDS
71 call .GetDefaultMenuitemToDX
[124]72 call BootMenu_GetMenuitemCountToAX
[88]73 pop ds
[124]74 mov [si+MENUINIT.wItems], ax
[88]75 mov [si+MENUINIT.wHighlightedItem], dx
76 mov WORD [si+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES
77 mov BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH
[124]78 call BootMenu_GetHeightToAHwithItemCountInAL
[88]79 mov [si+MENUINIT.bHeight], ah
[137]80 mov ax, [cs:ROMVARS.wBootTimeout]
[135]81 CALL_MENU_LIBRARY StartSelectionTimeoutWithTicksInAX
[88]82 stc
[3]83 ret
84
[88]85.GetDefaultMenuitemToDX:
86 mov dl, [cs:ROMVARS.bBootDrv] ; Default boot drive
87 call BootMenu_IsDriveInSystem
88 jnc SHORT .DoNotSetDefaultMenuitem
89 call DriveXlate_SetDriveToSwap
[124]90 jmp BootMenu_GetMenuitemToDXforDriveInDL
[369]91
[88]92.DoNotSetDefaultMenuitem:
93 xor dx, dx ; Whatever appears first on boot menu
94 ret
[3]95
[88]96
97; Parameters:
98; CX: Index of new highlighted item
99; DX: Index of previously highlighted item or NO_ITEM_HIGHLIGHTED
100.ItemHighlightedFromCX:
101 push cx
[241]102 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
[3]103 call DriveXlate_Reset
104 call DriveXlate_SetDriveToSwap
[140]105
106 xor ax, ax ; Update first floppy drive (for translated drive number)
[88]107 CALL_MENU_LIBRARY RefreshItemFromAX
[140]108 mov dl, 80h
109 call BootMenu_GetMenuitemToDXforDriveInDL
110 xchg ax, dx ; Update first hard disk (for translated drive number)
[88]111 CALL_MENU_LIBRARY RefreshItemFromAX
[140]112 pop ax ; Update new item (for translated drive number)
113 CALL_MENU_LIBRARY RefreshItemFromAX
[88]114 CALL_MENU_LIBRARY RefreshInformation
115 stc
[3]116 ret
117
118
[88]119; Parameters:
120; AL: ASCII character for the key
121; AH: Keyboard library scan code for the key
122.KeyStrokeInAX:
[92]123 cmp ah, ROM_BOOT_HOTKEY_SCANCODE
124 jne SHORT .CheckDriveHotkeys
[212]125 ;; NOTE: carry flag will be clear after compare above that resulted in zero
126 jmp Int19hMenu_JumpToBootSector_or_RomBoot
[369]127
[92]128.CheckDriveHotkeys:
[130]129 call BootMenu_GetMenuitemToAXforAsciiHotkeyInAL
130 cmp ax, [bp+MENUINIT.wItems]
[241]131 jae SHORT BootMenuEvent_EventCompleted ; Invalid key
[248]132
133 ; Highlighting new item resets drive translation and we do not want that.
134 ; We must be able to translate both floppy drive and hard drive when using hotkey.
135 call RamVars_GetSegmentToDS
136 mov dx, [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap]
[88]137 CALL_MENU_LIBRARY HighlightItemFromAX
[248]138 or [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], dx
[88]139 ; Fall to .ItemSelectedFromCX
[3]140
141
[88]142; Parameters:
143; CX: Index of selected item
144.ItemSelectedFromCX:
145 CALL_MENU_LIBRARY Close
[248]146
[241]147BootMenuEvent_EventCompleted:
[88]148 stc
[3]149 ret
150
Note: See TracBrowser for help on using the repository browser.