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

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

Changes to Configurator v2:

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