source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuEvent.asm@ 499

Last change on this file since 499 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: 5.8 KB
RevLine 
[41]1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
3
[376]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
[41]21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; MenuEvent_InitializeMenuinit
26; Parameters
27; SS:BP: Ptr to MENU
28; Returns:
29; DS:SI: Ptr to MENU with MENUINIT initialized from user handler
30; CF: Set if event processed
31; Cleared if event not processed
32; Corrupts registers:
33; AX, BX, DX
34;--------------------------------------------------------------------
[369]35ALIGN MENU_JUMP_ALIGN
[41]36MenuEvent_InitializeMenuinit:
37 push ss
38 pop ds
39 mov si, bp
[183]40 mov bl, MENUEVENT_InitializeMenuinitFromDSSI
[41]41 jmp SHORT MenuEvent_SendFromBX
42
43
44;--------------------------------------------------------------------
45; MenuEvent_ExitMenu
46; Parameters
47; SS:BP: Ptr to MENU
48; Returns:
[58]49; CF: Set to exit from menu
50; Cleared to cancel exit
[41]51; Corrupts registers:
52; AX, BX, DX
53;--------------------------------------------------------------------
[492]54%ifndef MENU_NO_ESC
[369]55ALIGN MENU_JUMP_ALIGN
[41]56MenuEvent_ExitMenu:
[183]57 mov bl, MENUEVENT_ExitMenu
[41]58 jmp SHORT MenuEvent_SendFromBX
[492]59%endif
60
[41]61
[189]62%ifdef MENUEVENT_IDLEPROCESSING_ENABLE
[41]63;--------------------------------------------------------------------
64; MenuEvent_IdleProcessing
65; Parameters
66; SS:BP: Ptr to MENU
67; Returns:
68; CF: Set if event processed
69; Cleared if event not processed
70; Corrupts registers:
71; AX, BX, DX
72;--------------------------------------------------------------------
[369]73ALIGN MENU_JUMP_ALIGN
[41]74MenuEvent_IdleProcessing:
[183]75 mov bl, MENUEVENT_IdleProcessing
[41]76 jmp SHORT MenuEvent_SendFromBX
[189]77%endif
[41]78
79;--------------------------------------------------------------------
80; MenuEvent_RefreshTitle
81; MenuEvent_RefreshInformation
82; Parameters
[48]83; SS:BP: Ptr to MENU
[41]84; Cursor will be positioned to beginning of window
85; Returns:
86; CF: Set if event processed
87; Cleared if event not processed
88; Corrupts registers:
[48]89; AX, CX, BX, DX
[41]90;--------------------------------------------------------------------
[369]91ALIGN MENU_JUMP_ALIGN
[41]92MenuEvent_RefreshTitle:
[183]93 mov bl, MENUEVENT_RefreshTitle
[133]94 SKIP2B cx ; mov cx, <next instruction>
[48]95
[41]96MenuEvent_RefreshInformation:
[183]97 mov bl, MENUEVENT_RefreshInformation
[52]98 mov cx, [bp+MENUINIT.wHighlightedItem]
[41]99 jmp SHORT MenuEvent_SendFromBX
100
101
102;--------------------------------------------------------------------
103; MenuEvent_RefreshItemFromCX
104; Parameters
105; CX: Index of item to refresh
[48]106; SS:BP: Ptr to MENU
[41]107; Cursor has been positioned to the beginning of item line
108; Returns:
109; CF: Set if event processed
110; Cleared if event not processed
111; Corrupts registers:
112; AX, BX, DX
113;--------------------------------------------------------------------
[369]114ALIGN MENU_JUMP_ALIGN
[41]115MenuEvent_RefreshItemFromCX:
[183]116 mov bl, MENUEVENT_RefreshItemFromCX
[41]117 jmp SHORT MenuEvent_SendFromBX
118
119
120;--------------------------------------------------------------------
121; MenuEvent_HighlightItemFromCX
122; Parameters
123; CX: Index of item to highlight
[48]124; SS:BP: Ptr to MENU
[41]125; Returns:
126; Nothing
127; Corrupts registers:
128; AX, BX, DX, SI, DI
129;--------------------------------------------------------------------
[369]130ALIGN MENU_JUMP_ALIGN
[41]131MenuEvent_HighlightItemFromCX:
132 mov dx, cx
[52]133 xchg dx, [bp+MENUINIT.wHighlightedItem]
[41]134 push dx
135
[183]136 mov bl, MENUEVENT_ItemHighlightedFromCX
[41]137 call MenuEvent_SendFromBX
138
139 pop ax
140 call MenuText_RefreshItemFromAX
[52]141 mov ax, [bp+MENUINIT.wHighlightedItem]
[41]142 jmp MenuText_RefreshItemFromAX
143
144
145;--------------------------------------------------------------------
146; MenuEvent_KeyStrokeInAX
147; Parameters
148; AL: ASCII character for the key
149; AH: Keyboard library scan code for the key
[48]150; SS:BP: Ptr to MENU
[41]151; Returns:
152; CF: Set if event processed
153; Cleared if event not processed
154; Corrupts registers:
155; AX, BX, DX
156;--------------------------------------------------------------------
[492]157%ifdef MENUEVENT_KeyStrokInAX
[369]158ALIGN MENU_JUMP_ALIGN
[41]159MenuEvent_KeyStrokeInAX:
[183]160 mov bl, MENUEVENT_KeyStrokeInAX
[133]161 SKIP2B dx ; mov dx, <next instruction>
[492]162%endif
[41]163
164;--------------------------------------------------------------------
165; MenuEvent_ItemSelectedFromCX
166; Parameters
167; CX: Index of selected item
[48]168; SS:BP: Ptr to MENU
[41]169; Returns:
170; CF: Set if event processed
171; Cleared if event not processed
172; Corrupts registers:
173; AX, BX, DX
174;--------------------------------------------------------------------
175MenuEvent_ItemSelectedFromCX:
[183]176 mov bl, MENUEVENT_ItemSelectedFromCX
[133]177 ; Fall to MenuEvent_SendFromBX
[41]178
179
180;--------------------------------------------------------------------
181; MenuEvent_SendFromBX
182; Parameters
[133]183; BL: Menu event to send
[41]184; SS:BP: Ptr to MENU
185; Other registers: Event specific parameters
186; Returns:
187; AX, DX: Event specific return values
188; CF: Set if event processed
189; Cleared if event not processed
190; Corrupts registers:
191; BX
192;--------------------------------------------------------------------
[369]193ALIGN MENU_JUMP_ALIGN
[41]194MenuEvent_SendFromBX:
195 push es
196 push ds
197 push di
198 push si
199 push cx
[133]200 xor bh, bh
[41]201 call [bp+MENU.fnEventHandler]
202 pop cx
203 pop si
204 pop di
205 pop ds
206 pop es
207 ret
Note: See TracBrowser for help on using the repository browser.