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
|
---|
22 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
35 | ALIGN MENU_JUMP_ALIGN
|
---|
36 | MenuEvent_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 | ALIGN MENU_JUMP_ALIGN
|
---|
55 | MenuEvent_ExitMenu:
|
---|
56 | mov bl, MENUEVENT_ExitMenu
|
---|
57 | jmp SHORT MenuEvent_SendFromBX
|
---|
58 |
|
---|
59 |
|
---|
60 | %ifdef MENUEVENT_IDLEPROCESSING_ENABLE
|
---|
61 | ;--------------------------------------------------------------------
|
---|
62 | ; MenuEvent_IdleProcessing
|
---|
63 | ; Parameters
|
---|
64 | ; SS:BP: Ptr to MENU
|
---|
65 | ; Returns:
|
---|
66 | ; CF: Set if event processed
|
---|
67 | ; Cleared if event not processed
|
---|
68 | ; Corrupts registers:
|
---|
69 | ; AX, BX, DX
|
---|
70 | ;--------------------------------------------------------------------
|
---|
71 | ALIGN MENU_JUMP_ALIGN
|
---|
72 | MenuEvent_IdleProcessing:
|
---|
73 | mov bl, MENUEVENT_IdleProcessing
|
---|
74 | jmp SHORT MenuEvent_SendFromBX
|
---|
75 | %endif
|
---|
76 |
|
---|
77 | ;--------------------------------------------------------------------
|
---|
78 | ; MenuEvent_RefreshTitle
|
---|
79 | ; MenuEvent_RefreshInformation
|
---|
80 | ; Parameters
|
---|
81 | ; SS:BP: Ptr to MENU
|
---|
82 | ; Cursor will be positioned to beginning of window
|
---|
83 | ; Returns:
|
---|
84 | ; CF: Set if event processed
|
---|
85 | ; Cleared if event not processed
|
---|
86 | ; Corrupts registers:
|
---|
87 | ; AX, CX, BX, DX
|
---|
88 | ;--------------------------------------------------------------------
|
---|
89 | ALIGN MENU_JUMP_ALIGN
|
---|
90 | MenuEvent_RefreshTitle:
|
---|
91 | mov bl, MENUEVENT_RefreshTitle
|
---|
92 | SKIP2B cx ; mov cx, <next instruction>
|
---|
93 |
|
---|
94 | MenuEvent_RefreshInformation:
|
---|
95 | mov bl, MENUEVENT_RefreshInformation
|
---|
96 | mov cx, [bp+MENUINIT.wHighlightedItem]
|
---|
97 | jmp SHORT MenuEvent_SendFromBX
|
---|
98 |
|
---|
99 |
|
---|
100 | ;--------------------------------------------------------------------
|
---|
101 | ; MenuEvent_RefreshItemFromCX
|
---|
102 | ; Parameters
|
---|
103 | ; CX: Index of item to refresh
|
---|
104 | ; SS:BP: Ptr to MENU
|
---|
105 | ; Cursor has been positioned to the beginning of item line
|
---|
106 | ; Returns:
|
---|
107 | ; CF: Set if event processed
|
---|
108 | ; Cleared if event not processed
|
---|
109 | ; Corrupts registers:
|
---|
110 | ; AX, BX, DX
|
---|
111 | ;--------------------------------------------------------------------
|
---|
112 | ALIGN MENU_JUMP_ALIGN
|
---|
113 | MenuEvent_RefreshItemFromCX:
|
---|
114 | mov bl, MENUEVENT_RefreshItemFromCX
|
---|
115 | jmp SHORT MenuEvent_SendFromBX
|
---|
116 |
|
---|
117 |
|
---|
118 | ;--------------------------------------------------------------------
|
---|
119 | ; MenuEvent_HighlightItemFromCX
|
---|
120 | ; Parameters
|
---|
121 | ; CX: Index of item to highlight
|
---|
122 | ; SS:BP: Ptr to MENU
|
---|
123 | ; Returns:
|
---|
124 | ; Nothing
|
---|
125 | ; Corrupts registers:
|
---|
126 | ; AX, BX, DX, SI, DI
|
---|
127 | ;--------------------------------------------------------------------
|
---|
128 | ALIGN MENU_JUMP_ALIGN
|
---|
129 | MenuEvent_HighlightItemFromCX:
|
---|
130 | mov dx, cx
|
---|
131 | xchg dx, [bp+MENUINIT.wHighlightedItem]
|
---|
132 | push dx
|
---|
133 |
|
---|
134 | mov bl, MENUEVENT_ItemHighlightedFromCX
|
---|
135 | call MenuEvent_SendFromBX
|
---|
136 |
|
---|
137 | pop ax
|
---|
138 | call MenuText_RefreshItemFromAX
|
---|
139 | mov ax, [bp+MENUINIT.wHighlightedItem]
|
---|
140 | jmp MenuText_RefreshItemFromAX
|
---|
141 |
|
---|
142 |
|
---|
143 | ;--------------------------------------------------------------------
|
---|
144 | ; MenuEvent_KeyStrokeInAX
|
---|
145 | ; Parameters
|
---|
146 | ; AL: ASCII character for the key
|
---|
147 | ; AH: Keyboard library scan code for the key
|
---|
148 | ; SS:BP: Ptr to MENU
|
---|
149 | ; Returns:
|
---|
150 | ; CF: Set if event processed
|
---|
151 | ; Cleared if event not processed
|
---|
152 | ; Corrupts registers:
|
---|
153 | ; AX, BX, DX
|
---|
154 | ;--------------------------------------------------------------------
|
---|
155 | ALIGN MENU_JUMP_ALIGN
|
---|
156 | MenuEvent_KeyStrokeInAX:
|
---|
157 | mov bl, MENUEVENT_KeyStrokeInAX
|
---|
158 | SKIP2B dx ; mov dx, <next instruction>
|
---|
159 |
|
---|
160 |
|
---|
161 | ;--------------------------------------------------------------------
|
---|
162 | ; MenuEvent_ItemSelectedFromCX
|
---|
163 | ; Parameters
|
---|
164 | ; CX: Index of selected item
|
---|
165 | ; SS:BP: Ptr to MENU
|
---|
166 | ; Returns:
|
---|
167 | ; CF: Set if event processed
|
---|
168 | ; Cleared if event not processed
|
---|
169 | ; Corrupts registers:
|
---|
170 | ; AX, BX, DX
|
---|
171 | ;--------------------------------------------------------------------
|
---|
172 | MenuEvent_ItemSelectedFromCX:
|
---|
173 | mov bl, MENUEVENT_ItemSelectedFromCX
|
---|
174 | ; Fall to MenuEvent_SendFromBX
|
---|
175 |
|
---|
176 |
|
---|
177 | ;--------------------------------------------------------------------
|
---|
178 | ; MenuEvent_SendFromBX
|
---|
179 | ; Parameters
|
---|
180 | ; BL: Menu event to send
|
---|
181 | ; SS:BP: Ptr to MENU
|
---|
182 | ; Other registers: Event specific parameters
|
---|
183 | ; Returns:
|
---|
184 | ; AX, DX: Event specific return values
|
---|
185 | ; CF: Set if event processed
|
---|
186 | ; Cleared if event not processed
|
---|
187 | ; Corrupts registers:
|
---|
188 | ; BX
|
---|
189 | ;--------------------------------------------------------------------
|
---|
190 | ALIGN MENU_JUMP_ALIGN
|
---|
191 | MenuEvent_SendFromBX:
|
---|
192 | push es
|
---|
193 | push ds
|
---|
194 | push di
|
---|
195 | push si
|
---|
196 | push cx
|
---|
197 | xor bh, bh
|
---|
198 | call [bp+MENU.fnEventHandler]
|
---|
199 | pop cx
|
---|
200 | pop si
|
---|
201 | pop di
|
---|
202 | pop ds
|
---|
203 | pop es
|
---|
204 | ret
|
---|