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

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

Initial commit (Work in progress).

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