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

Last change on this file since 528 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
RevLine 
[41]1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
3
[376]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.
[376]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;
[376]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
[505]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
[505]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
[41]60
[505]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;--------------------------------------------------------------------
[369]157ALIGN MENU_JUMP_ALIGN
[41]158MenuEvent_KeyStrokeInAX:
[183]159 mov bl, MENUEVENT_KeyStrokeInAX
[133]160 SKIP2B dx ; mov dx, <next instruction>
[41]161
162;--------------------------------------------------------------------
163; MenuEvent_ItemSelectedFromCX
164; Parameters
165; CX: Index of selected item
[48]166; SS:BP: Ptr to MENU
[41]167; Returns:
168; CF: Set if event processed
169; Cleared if event not processed
170; Corrupts registers:
171; AX, BX, DX
172;--------------------------------------------------------------------
173MenuEvent_ItemSelectedFromCX:
[183]174 mov bl, MENUEVENT_ItemSelectedFromCX
[133]175 ; Fall to MenuEvent_SendFromBX
[41]176
177
178;--------------------------------------------------------------------
179; MenuEvent_SendFromBX
180; Parameters
[133]181; BL: Menu event to send
[41]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;--------------------------------------------------------------------
[369]191ALIGN MENU_JUMP_ALIGN
[41]192MenuEvent_SendFromBX:
193 push es
194 push ds
195 push di
196 push si
197 push cx
[133]198 xor bh, bh
[41]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.