source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupage.asm@ 480

Last change on this file since 480 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: 3.9 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : Functions for accessing MENUPAGE structs.
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; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Menupage_ChangeToNewMenupageInDSSI
25; Parameters:
26; DS:SI: Ptr to new MENUPAGE
27; SS:BP: Menu handle
28; Returns:
29; Nothing
30; Corrupts registers:
31; AX, DI
32;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34Menupage_ChangeToNewMenupageInDSSI:
35 mov di, si
36 call Menupage_SetActiveMenupageFromDSDI
37 call Menupage_GetVisibleMenuitemsToAXfromDSDI
38 CALL_MENU_LIBRARY SetTotalItemsFromAX
39 xor ax, ax
40 CALL_MENU_LIBRARY HighlightItemFromAX
41 CALL_MENU_LIBRARY RefreshWindow
42 ret
43
44
45;--------------------------------------------------------------------
46; SetActiveMenupageFromDSDI
47; Parameters:
48; DS:DI: Ptr to MENUPAGE to set active
49; SS:BP: Menu handle
50; Returns:
51; Nothing
52; Corrupts registers:
53; Nothing
54;--------------------------------------------------------------------
55ALIGN JUMP_ALIGN
56Menupage_SetActiveMenupageFromDSDI:
57 mov [g_cfgVars+CFGVARS.pMenupage], di
58 ret
59
60
61;--------------------------------------------------------------------
62; Menupage_GetActiveMenupageToDSDI:
63; Parameters:
64; SS:BP: Menu handle
65; Returns:
66; DS:DI: Ptr to MENUPAGE
67; Corrupts registers:
68; Nothing
69;--------------------------------------------------------------------
70ALIGN JUMP_ALIGN
71Menupage_GetActiveMenupageToDSDI:
72 push cs
73 pop ds
74 mov di, [g_cfgVars+CFGVARS.pMenupage]
75 ret
76
77
78;--------------------------------------------------------------------
79; Menupage_GetVisibleMenuitemsToAXfromDSDI
80; Parameters:
81; DS:DI: Ptr to MENUPAGE
82; Returns:
83; AX: Number of visible MENUITEMs in MENUPAGE
84; Corrupts registers:
85; BX, CX
86;--------------------------------------------------------------------
87ALIGN JUMP_ALIGN
88Menupage_GetVisibleMenuitemsToAXfromDSDI:
89 xor ax, ax
90 mov cx, [di+MENUPAGE.wMenuitems]
91 lea bx, [di+MENUPAGE.rgMenuitem]
92
93ALIGN JUMP_ALIGN
94.CheckVisibilityFromNextMenuitem:
95 test BYTE [bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
96 jz SHORT .PrepareToLoop
97 inc ax
98.PrepareToLoop:
99 add bx, BYTE MENUITEM_size
100 loop .CheckVisibilityFromNextMenuitem
101 ret
102
103
104;--------------------------------------------------------------------
105; Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI
106; Parameters:
107; CX: nth visible MENUITEM to find
108; DS:DI: Ptr to MENUPAGE
109; Returns:
110; DS:SI: Ptr to CXth visible MENUITEM
111; CF: Set if MENUITEM found
112; Cleared if MENUITEM not found
113; Corrupts registers:
114; AX, CX
115;--------------------------------------------------------------------
116ALIGN JUMP_ALIGN
117Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI:
118 mov ax, [di+MENUPAGE.wMenuitems]
119 cmp cx, ax
120 jae SHORT .MenuitemNotFound
121 xchg ax, cx
122 inc ax
123 lea si, [di+MENUPAGE.rgMenuitem]
124ALIGN JUMP_ALIGN
125.CheckNextMenuitem:
126 test BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
127 jz SHORT .PrepareToLoop
128 dec ax
129 jz SHORT .MenuitemFound
130.PrepareToLoop:
131 add si, BYTE MENUITEM_size
132 loop .CheckNextMenuitem
133.MenuitemNotFound:
134 clc
135 ret
136ALIGN JUMP_ALIGN
137.MenuitemFound:
138 stc
139 ret
Note: See TracBrowser for help on using the repository browser.