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

Last change on this file since 501 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
Line 
1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
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
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;--------------------------------------------------------------------
35ALIGN MENU_JUMP_ALIGN
36MenuEvent_InitializeMenuinit:
37 push ss
38 pop ds
39 mov si, bp
40 mov bl, MENUEVENT_InitializeMenuinitFromDSSI
41 jmp SHORT MenuEvent_SendFromBX
42
43
44;--------------------------------------------------------------------
45; MenuEvent_ExitMenu
46; Parameters
47; SS:BP: Ptr to MENU
48; Returns:
49; CF: Set to exit from menu
50; Cleared to cancel exit
51; Corrupts registers:
52; AX, BX, DX
53;--------------------------------------------------------------------
54%ifndef MENU_NO_ESC
55ALIGN MENU_JUMP_ALIGN
56MenuEvent_ExitMenu:
57 mov bl, MENUEVENT_ExitMenu
58 jmp SHORT MenuEvent_SendFromBX
59%endif
60
61
62%ifdef MENUEVENT_IDLEPROCESSING_ENABLE
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;--------------------------------------------------------------------
73ALIGN MENU_JUMP_ALIGN
74MenuEvent_IdleProcessing:
75 mov bl, MENUEVENT_IdleProcessing
76 jmp SHORT MenuEvent_SendFromBX
77%endif
78
79;--------------------------------------------------------------------
80; MenuEvent_RefreshTitle
81; MenuEvent_RefreshInformation
82; Parameters
83; SS:BP: Ptr to MENU
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:
89; AX, CX, BX, DX
90;--------------------------------------------------------------------
91ALIGN MENU_JUMP_ALIGN
92MenuEvent_RefreshTitle:
93 mov bl, MENUEVENT_RefreshTitle
94 SKIP2B cx ; mov cx, <next instruction>
95
96MenuEvent_RefreshInformation:
97 mov bl, MENUEVENT_RefreshInformation
98 mov cx, [bp+MENUINIT.wHighlightedItem]
99 jmp SHORT MenuEvent_SendFromBX
100
101
102;--------------------------------------------------------------------
103; MenuEvent_RefreshItemFromCX
104; Parameters
105; CX: Index of item to refresh
106; SS:BP: Ptr to MENU
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;--------------------------------------------------------------------
114ALIGN MENU_JUMP_ALIGN
115MenuEvent_RefreshItemFromCX:
116 mov bl, MENUEVENT_RefreshItemFromCX
117 jmp SHORT MenuEvent_SendFromBX
118
119
120;--------------------------------------------------------------------
121; MenuEvent_HighlightItemFromCX
122; Parameters
123; CX: Index of item to highlight
124; SS:BP: Ptr to MENU
125; Returns:
126; Nothing
127; Corrupts registers:
128; AX, BX, DX, SI, DI
129;--------------------------------------------------------------------
130ALIGN MENU_JUMP_ALIGN
131MenuEvent_HighlightItemFromCX:
132 mov dx, cx
133 xchg dx, [bp+MENUINIT.wHighlightedItem]
134 push dx
135
136 mov bl, MENUEVENT_ItemHighlightedFromCX
137 call MenuEvent_SendFromBX
138
139 pop ax
140 call MenuText_RefreshItemFromAX
141 mov ax, [bp+MENUINIT.wHighlightedItem]
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
150; SS:BP: Ptr to MENU
151; Returns:
152; CF: Set if event processed
153; Cleared if event not processed
154; Corrupts registers:
155; AX, BX, DX
156;--------------------------------------------------------------------
157%ifdef MENUEVENT_KeyStrokInAX
158ALIGN MENU_JUMP_ALIGN
159MenuEvent_KeyStrokeInAX:
160 mov bl, MENUEVENT_KeyStrokeInAX
161 SKIP2B dx ; mov dx, <next instruction>
162%endif
163
164;--------------------------------------------------------------------
165; MenuEvent_ItemSelectedFromCX
166; Parameters
167; CX: Index of selected item
168; SS:BP: Ptr to MENU
169; Returns:
170; CF: Set if event processed
171; Cleared if event not processed
172; Corrupts registers:
173; AX, BX, DX
174;--------------------------------------------------------------------
175MenuEvent_ItemSelectedFromCX:
176 mov bl, MENUEVENT_ItemSelectedFromCX
177 ; Fall to MenuEvent_SendFromBX
178
179
180;--------------------------------------------------------------------
181; MenuEvent_SendFromBX
182; Parameters
183; BL: Menu event to send
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;--------------------------------------------------------------------
193ALIGN MENU_JUMP_ALIGN
194MenuEvent_SendFromBX:
195 push es
196 push ds
197 push di
198 push si
199 push cx
200 xor bh, bh
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.