1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
2 | ; Description : Functions for accessing MENUPAGE structs.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
17 | ALIGN JUMP_ALIGN
|
---|
18 | Menupage_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 | ;--------------------------------------------------------------------
|
---|
39 | ALIGN JUMP_ALIGN
|
---|
40 | Menupage_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 | ;--------------------------------------------------------------------
|
---|
54 | ALIGN JUMP_ALIGN
|
---|
55 | Menupage_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 | ;--------------------------------------------------------------------
|
---|
71 | ALIGN JUMP_ALIGN
|
---|
72 | Menupage_GetVisibleMenuitemsToAXfromDSDI:
|
---|
73 | xor ax, ax
|
---|
74 | mov cx, [di+MENUPAGE.wMenuitems]
|
---|
75 | lea bx, [di+MENUPAGE.rgMenuitem]
|
---|
76 |
|
---|
77 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
100 | ALIGN JUMP_ALIGN
|
---|
101 | Menupage_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]
|
---|
108 | ALIGN 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
|
---|
120 | ALIGN JUMP_ALIGN
|
---|
121 | .MenuitemFound:
|
---|
122 | stc
|
---|
123 | ret
|
---|