source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuInit.asm@ 181

Last change on this file since 181 was 133, checked in by krille_n_@…, 14 years ago

Size optimizations in various files in the Assembly Library. Also a very small change to a string in XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

File size: 4.9 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
9; Parameters
10; DX:AX: User specified data
11; BX: Menu event handler
12; Returns:
13; AX: Index of selected item or NO_ITEM_SELECTED
14; Corrupts registers:
15; All except segments
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX:
19 push es
20 push ds
21 LOAD_BDA_SEGMENT_TO ds, cx, !
22 push WORD [BDA.wVidCurShape]
23 mov cl, MENU_size
24 eENTER_STRUCT cx
25
26 call Memory_ZeroSSBPwithSizeInCX
27 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
28 mov dx, [bp+MENUINIT.wHighlightedItem]
29
30 eLEAVE_STRUCT MENU_size
31 pop ax
32 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
33 xchg ax, dx ; Return highlighted item in AX
34 pop ds
35 pop es
36 ret
37
38
39;--------------------------------------------------------------------
40; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
41; Parameters
42; DX:AX: User specified data
43; BX: Menu event handler
44; SS:BP: Ptr to MENU
45; Returns:
46; Nothing
47; Corrupts registers:
48; All, except SS:BP
49;--------------------------------------------------------------------
50ALIGN JUMP_ALIGN
51MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
52 mov [bp+MENU.fnEventHandler], bx
53 mov [bp+MENU.dwUserData], ax
54 mov [bp+MENU.dwUserData+2], dx
55
56 mov ax, CURSOR_HIDDEN
57 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
58 call MenuEvent_InitializeMenuinit ; User initialization
59%ifndef USE_186
60 call MenuInit_RefreshMenuWindow
61 jmp MenuLoop_Enter
62%else
63 push MenuLoop_Enter
64 ; Fall to MenuInit_RefreshMenuWindow
65%endif
66
67
68;--------------------------------------------------------------------
69; MenuInit_RefreshMenuWindow
70; Parameters
71; SS:BP: Ptr to MENU
72; Returns:
73; Nothing
74; Corrupts registers:
75; AX, BX, CX, DX, SI, DI
76;--------------------------------------------------------------------
77ALIGN JUMP_ALIGN
78MenuInit_RefreshMenuWindow:
79 call MenuBorders_RefreshAll ; Draw borders
80 call MenuText_RefreshTitle ; Draw title strings
81 call MenuText_RefreshAllItems ; Draw item strings
82 jmp MenuText_RefreshInformation ; Draw information strings
83
84
85;--------------------------------------------------------------------
86; MenuInit_CloseMenuWindow
87; Parameters
88; SS:BP: Ptr to MENU
89; Returns:
90; Nothing
91; Corrupts registers:
92; Nothing
93;--------------------------------------------------------------------
94ALIGN JUMP_ALIGN
95MenuInit_CloseMenuWindow:
96 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
97 ret
98
99
100;--------------------------------------------------------------------
101; MenuInit_HighlightItemFromAX
102; Parameters
103; AX: Item to highlight
104; SS:BP: Ptr to MENU
105; Returns:
106; Nothing
107; Corrupts registers:
108; AX, BX, CX, DX, SI, DI
109;--------------------------------------------------------------------
110ALIGN JUMP_ALIGN
111MenuInit_HighlightItemFromAX:
112 sub ax, [bp+MENUINIT.wHighlightedItem]
113 jmp MenuScrollbars_MoveHighlightedItemByAX
114
115;--------------------------------------------------------------------
116; MenuInit_GetHighlightedItemToAX
117; Parameters
118; SS:BP: Ptr to MENU
119; Returns:
120; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
121; Corrupts registers:
122; Nothing
123;--------------------------------------------------------------------
124%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
125ALIGN JUMP_ALIGN
126MenuInit_GetHighlightedItemToAX:
127 mov ax, [bp+MENUINIT.wHighlightedItem]
128 ret
129%endif
130
131
132;--------------------------------------------------------------------
133; MenuInit_SetTitleHeightFromAL
134; MenuInit_SetInformationHeightFromAL
135; MenuInit_SetTotalItemsFromAX
136; Parameters
137; AX/AL: Parameter
138; SS:BP: Ptr to MENU
139; Returns:
140; Nothing
141; Corrupts registers:
142; Nothing
143;--------------------------------------------------------------------
144%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
145ALIGN JUMP_ALIGN
146MenuInit_SetTitleHeightFromAL:
147 mov [bp+MENUINIT.bTitleLines], al
148 ret
149
150ALIGN JUMP_ALIGN
151MenuInit_SetInformationHeightFromAL:
152 mov [bp+MENUINIT.bInfoLines], al
153 ret
154
155ALIGN JUMP_ALIGN
156MenuInit_SetTotalItemsFromAX:
157 mov [bp+MENUINIT.wItems], ax
158 ret
159%endif
160
161
162;--------------------------------------------------------------------
163; MenuInit_SetUserDataFromDSSI
164; MenuInit_GetUserDataToDSSI
165; Parameters
166; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
167; SS:BP: Ptr to MENU
168; Returns:
169; DS:SI: User data (MenuInit_GetUserDataToDSSI)
170; Corrupts registers:
171; Nothing
172;--------------------------------------------------------------------
173%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
174ALIGN JUMP_ALIGN
175MenuInit_SetUserDataFromDSSI:
176 mov [bp+MENU.dwUserData], si
177 mov [bp+MENU.dwUserData+2], ds
178 ret
179
180ALIGN JUMP_ALIGN
181MenuInit_GetUserDataToDSSI:
182 lds si, [bp+MENU.dwUserData]
183 ret
184%endif
Note: See TracBrowser for help on using the repository browser.