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

Last change on this file since 183 was 183, checked in by gregli@…, 13 years ago

Space optimization, added option to inline offsets for MENUEVENT structure, for situations (such as the XTIDE bios) where only one menu is needed. Ifdef'd change (set in main.asm) so either method can be used.

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