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

Last change on this file since 624 was 527, checked in by aitotat@…, 11 years ago

Changes to Assembly Library:

  • Menu system KeyStroke event related code now always included since the %ifdef did not seem to work.
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-2013 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;--------------------------------------------------------------------
157ALIGN MENU_JUMP_ALIGN
158MenuEvent_KeyStrokeInAX:
159 mov bl, MENUEVENT_KeyStrokeInAX
160 SKIP2B dx ; mov dx, <next instruction>
161
162;--------------------------------------------------------------------
163; MenuEvent_ItemSelectedFromCX
164; Parameters
165; CX: Index of selected item
166; SS:BP: Ptr to MENU
167; Returns:
168; CF: Set if event processed
169; Cleared if event not processed
170; Corrupts registers:
171; AX, BX, DX
172;--------------------------------------------------------------------
173MenuEvent_ItemSelectedFromCX:
174 mov bl, MENUEVENT_ItemSelectedFromCX
175 ; Fall to MenuEvent_SendFromBX
176
177
178;--------------------------------------------------------------------
179; MenuEvent_SendFromBX
180; Parameters
181; BL: Menu event to send
182; SS:BP: Ptr to MENU
183; Other registers: Event specific parameters
184; Returns:
185; AX, DX: Event specific return values
186; CF: Set if event processed
187; Cleared if event not processed
188; Corrupts registers:
189; BX
190;--------------------------------------------------------------------
191ALIGN MENU_JUMP_ALIGN
192MenuEvent_SendFromBX:
193 push es
194 push ds
195 push di
196 push si
197 push cx
198 xor bh, bh
199 call [bp+MENU.fnEventHandler]
200 pop cx
201 pop si
202 pop di
203 pop ds
204 pop es
205 ret
Note: See TracBrowser for help on using the repository browser.