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

Last change on this file since 49 was 48, checked in by Tomi Tilli, 14 years ago

Changes to Assembly Library:
Added functions to clear Menu Title and Information areas.
Implemented automatic line change when writing Menu Title and Information areas.
CGA snow related functions have been moved to CgaSnow.asm.
Keyboard input functions no longer produce beep for backspace.

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