source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuInit.asm@ 379

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

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 6.2 KB
RevLine 
[41]1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
3
[376]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
[41]21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
26; Parameters
27; DX:AX: User specified data
28; BX: Menu event handler
29; Returns:
30; AX: Index of selected item or NO_ITEM_SELECTED
31; Corrupts registers:
32; All except segments
33;--------------------------------------------------------------------
[369]34ALIGN MENU_JUMP_ALIGN
[41]35MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX:
36 push es
37 push ds
[116]38 LOAD_BDA_SEGMENT_TO ds, cx, !
[41]39 push WORD [BDA.wVidCurShape]
[104]40 mov cl, MENU_size
41 eENTER_STRUCT cx
[41]42
[46]43 call Memory_ZeroSSBPwithSizeInCX
[41]44 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
[129]45 mov dx, [bp+MENUINIT.wHighlightedItem]
[41]46
47 eLEAVE_STRUCT MENU_size
48 pop ax
49 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
[289]50 CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware
[129]51 xchg ax, dx ; Return highlighted item in AX
[41]52 pop ds
53 pop es
54 ret
55
56
57;--------------------------------------------------------------------
58; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
59; Parameters
60; DX:AX: User specified data
61; BX: Menu event handler
62; SS:BP: Ptr to MENU
63; Returns:
64; Nothing
65; Corrupts registers:
66; All, except SS:BP
67;--------------------------------------------------------------------
[369]68ALIGN MENU_JUMP_ALIGN
[41]69MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
70 mov [bp+MENU.fnEventHandler], bx
71 mov [bp+MENU.dwUserData], ax
72 mov [bp+MENU.dwUserData+2], dx
73
74 mov ax, CURSOR_HIDDEN
75 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
[104]76 call MenuEvent_InitializeMenuinit ; User initialization
[133]77%ifndef USE_186
[41]78 call MenuInit_RefreshMenuWindow
79 jmp MenuLoop_Enter
[133]80%else
81 push MenuLoop_Enter
82 ; Fall to MenuInit_RefreshMenuWindow
83%endif
[41]84
85
86;--------------------------------------------------------------------
87; MenuInit_RefreshMenuWindow
88; Parameters
89; SS:BP: Ptr to MENU
90; Returns:
91; Nothing
92; Corrupts registers:
93; AX, BX, CX, DX, SI, DI
94;--------------------------------------------------------------------
[369]95ALIGN MENU_JUMP_ALIGN
[41]96MenuInit_RefreshMenuWindow:
97 call MenuBorders_RefreshAll ; Draw borders
98 call MenuText_RefreshTitle ; Draw title strings
99 call MenuText_RefreshAllItems ; Draw item strings
[116]100 jmp MenuText_RefreshInformation ; Draw information strings
[41]101
102
103;--------------------------------------------------------------------
[205]104; MenuInit_CloseMenuIfExitEventAllows
105; Parameters
106; SS:BP: Ptr to MENU
107; Returns:
108; Nothing
109; Corrupts registers:
110; AX, BX, DX
111;--------------------------------------------------------------------
112%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]113ALIGN MENU_JUMP_ALIGN
[205]114MenuInit_CloseMenuIfExitEventAllows:
115 call MenuEvent_ExitMenu
116 jc SHORT MenuInit_CloseMenuWindow
117 ret
118%endif
119
120
121;--------------------------------------------------------------------
[41]122; MenuInit_CloseMenuWindow
123; Parameters
124; SS:BP: Ptr to MENU
125; Returns:
126; Nothing
127; Corrupts registers:
128; Nothing
129;--------------------------------------------------------------------
[369]130ALIGN MENU_JUMP_ALIGN
[41]131MenuInit_CloseMenuWindow:
132 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
133 ret
134
135
136;--------------------------------------------------------------------
137; MenuInit_HighlightItemFromAX
138; Parameters
139; AX: Item to highlight
140; SS:BP: Ptr to MENU
141; Returns:
142; Nothing
143; Corrupts registers:
144; AX, BX, CX, DX, SI, DI
145;--------------------------------------------------------------------
[369]146ALIGN MENU_JUMP_ALIGN
[41]147MenuInit_HighlightItemFromAX:
[52]148 sub ax, [bp+MENUINIT.wHighlightedItem]
[41]149 jmp MenuScrollbars_MoveHighlightedItemByAX
150
[48]151;--------------------------------------------------------------------
152; MenuInit_GetHighlightedItemToAX
153; Parameters
154; SS:BP: Ptr to MENU
155; Returns:
156; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
157; Corrupts registers:
158; Nothing
159;--------------------------------------------------------------------
[133]160%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]161ALIGN MENU_JUMP_ALIGN
[48]162MenuInit_GetHighlightedItemToAX:
[52]163 mov ax, [bp+MENUINIT.wHighlightedItem]
[48]164 ret
[133]165%endif
[41]166
[48]167
[41]168;--------------------------------------------------------------------
169; MenuInit_SetTitleHeightFromAL
170; MenuInit_SetInformationHeightFromAL
171; MenuInit_SetTotalItemsFromAX
172; Parameters
173; AX/AL: Parameter
174; SS:BP: Ptr to MENU
175; Returns:
176; Nothing
177; Corrupts registers:
178; Nothing
179;--------------------------------------------------------------------
[133]180%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]181ALIGN MENU_JUMP_ALIGN
[41]182MenuInit_SetTitleHeightFromAL:
183 mov [bp+MENUINIT.bTitleLines], al
184 ret
185
[369]186ALIGN MENU_JUMP_ALIGN
[41]187MenuInit_SetInformationHeightFromAL:
188 mov [bp+MENUINIT.bInfoLines], al
189 ret
190
[369]191ALIGN MENU_JUMP_ALIGN
[41]192MenuInit_SetTotalItemsFromAX:
193 mov [bp+MENUINIT.wItems], ax
194 ret
[133]195%endif
[41]196
197
198;--------------------------------------------------------------------
199; MenuInit_SetUserDataFromDSSI
200; MenuInit_GetUserDataToDSSI
201; Parameters
202; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
203; SS:BP: Ptr to MENU
204; Returns:
205; DS:SI: User data (MenuInit_GetUserDataToDSSI)
206; Corrupts registers:
207; Nothing
208;--------------------------------------------------------------------
[133]209%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]210ALIGN MENU_JUMP_ALIGN
[41]211MenuInit_SetUserDataFromDSSI:
212 mov [bp+MENU.dwUserData], si
213 mov [bp+MENU.dwUserData+2], ds
214 ret
215
[369]216ALIGN MENU_JUMP_ALIGN
[41]217MenuInit_GetUserDataToDSSI:
218 lds si, [bp+MENU.dwUserData]
219 ret
[133]220%endif
Note: See TracBrowser for help on using the repository browser.