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

Last change on this file since 531 was 526, checked in by krille_n_@…, 12 years ago

Changes:

  • Update of the copyright notices to include the year 2013.
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-2013 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 JMP_MENU_LIBRARY RefreshWindow
42
43
44;--------------------------------------------------------------------
45; SetActiveMenupageFromDSDI
46; Parameters:
47; DS:DI: Ptr to MENUPAGE to set active
48; SS:BP: Menu handle
49; Returns:
50; Nothing
51; Corrupts registers:
52; Nothing
53;--------------------------------------------------------------------
54ALIGN JUMP_ALIGN
55Menupage_SetActiveMenupageFromDSDI:
56 mov [g_cfgVars+CFGVARS.pMenupage], di
57 ret
58
59
60;--------------------------------------------------------------------
61; Menupage_GetActiveMenupageToDSDI:
62; Parameters:
63; SS:BP: Menu handle
64; Returns:
65; DS:DI: Ptr to MENUPAGE
66; Corrupts registers:
67; Nothing
68;--------------------------------------------------------------------
69ALIGN JUMP_ALIGN
70Menupage_GetActiveMenupageToDSDI:
71 push cs
72 pop ds
73 mov di, [g_cfgVars+CFGVARS.pMenupage]
74 ret
75
76
77;--------------------------------------------------------------------
78; Menupage_GetVisibleMenuitemsToAXfromDSDI
79; Parameters:
80; DS:DI: Ptr to MENUPAGE
81; Returns:
82; AX: Number of visible MENUITEMs in MENUPAGE
83; Corrupts registers:
84; BX, CX
85;--------------------------------------------------------------------
86ALIGN JUMP_ALIGN
87Menupage_GetVisibleMenuitemsToAXfromDSDI:
88 xor ax, ax
89 mov cx, [di+MENUPAGE.wMenuitems]
90 lea bx, [di+MENUPAGE.rgMenuitem]
91
92ALIGN JUMP_ALIGN
93.CheckVisibilityFromNextMenuitem:
94 test BYTE [bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
95 jz SHORT .PrepareToLoop
96 inc ax
97.PrepareToLoop:
98 add bx, BYTE MENUITEM_size
99 loop .CheckVisibilityFromNextMenuitem
100 ret
101
102
103;--------------------------------------------------------------------
104; Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI
105; Parameters:
106; CX: nth visible MENUITEM to find
107; DS:DI: Ptr to MENUPAGE
108; Returns:
109; DS:SI: Ptr to CXth visible MENUITEM
110; CF: Set if MENUITEM found
111; Cleared if MENUITEM not found
112; Corrupts registers:
113; AX, CX
114;--------------------------------------------------------------------
115ALIGN JUMP_ALIGN
116Menupage_GetCXthVisibleMenuitemToDSSIfromDSDI:
117 mov ax, [di+MENUPAGE.wMenuitems]
118 cmp cx, ax
119 jae SHORT .MenuitemNotFound
120 xchg ax, cx
121 inc ax
122 lea si, [di+MENUPAGE.rgMenuitem]
123ALIGN JUMP_ALIGN
124.CheckNextMenuitem:
125 test BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
126 jz SHORT .PrepareToLoop
127 dec ax
128 jz SHORT .MenuitemFound
129.PrepareToLoop:
130 add si, BYTE MENUITEM_size
131 loop .CheckNextMenuitem
132.MenuitemNotFound:
133 clc
134 ret
135ALIGN JUMP_ALIGN
136.MenuitemFound:
137 stc
138 ret
Note: See TracBrowser for help on using the repository browser.