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

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

Initial commit for Assembly Library.

File size: 4.4 KB
RevLine 
[41]1; File name : MenuInit.asm
2; Project name : Assembly Library
3; Created date : 13.7.2010
4; Last update : 16.9.2010
5; Author : Tomi Tilli
6; Description : Functions for initializing menu system.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
13; Parameters
14; DX:AX: User specified data
15; BX: Menu event handler
16; Returns:
17; AX: Index of selected item or NO_ITEM_SELECTED
18; Corrupts registers:
19; All except segments
20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX:
23 push es
24 push ds
25 LOAD_BDA_SEGMENT_TO ds, cx
26 push WORD [BDA.wVidCurShape]
27 eENTER_STRUCT MENU_size
28
29 mov cx, MENU_size / 2
30 call Memory_ZeroSSBPbyWordsInCX
31 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
32 mov ax, [bp+MENU.wHighlightedItem]
33
34 eLEAVE_STRUCT MENU_size
35 pop ax
36 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
37 pop ds
38 pop es
39 ret
40
41
42;--------------------------------------------------------------------
43; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
44; Parameters
45; DX:AX: User specified data
46; BX: Menu event handler
47; SS:BP: Ptr to MENU
48; Returns:
49; Nothing
50; Corrupts registers:
51; All, except SS:BP
52;--------------------------------------------------------------------
53ALIGN JUMP_ALIGN
54MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
55 mov [bp+MENU.fnEventHandler], bx
56 mov [bp+MENU.dwUserData], ax
57 mov [bp+MENU.dwUserData+2], dx
58 mov WORD [bp+MENU.wHighlightedItem], NO_ITEM_HIGHLIGHTED
59
60 mov ax, CURSOR_HIDDEN
61 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
62 call MenuEvent_InitializeMenuinit ; User initialization
63 call MenuTime_RestartSelectionTimeout
64 call MenuInit_RefreshMenuWindow
65 jmp MenuLoop_Enter
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+MENU.wHighlightedItem]
113 jmp MenuScrollbars_MoveHighlightedItemByAX
114
115
116;--------------------------------------------------------------------
117; MenuInit_SetTitleHeightFromAL
118; MenuInit_SetInformationHeightFromAL
119; MenuInit_SetTotalItemsFromAX
120; Parameters
121; AX/AL: Parameter
122; SS:BP: Ptr to MENU
123; Returns:
124; Nothing
125; Corrupts registers:
126; Nothing
127;--------------------------------------------------------------------
128ALIGN JUMP_ALIGN
129MenuInit_SetTitleHeightFromAL:
130 mov [bp+MENUINIT.bTitleLines], al
131 ret
132
133ALIGN JUMP_ALIGN
134MenuInit_SetInformationHeightFromAL:
135 mov [bp+MENUINIT.bInfoLines], al
136 ret
137
138ALIGN JUMP_ALIGN
139MenuInit_SetTotalItemsFromAX:
140 mov [bp+MENUINIT.wItems], ax
141 ret
142
143
144;--------------------------------------------------------------------
145; MenuInit_SetUserDataFromDSSI
146; MenuInit_GetUserDataToDSSI
147; Parameters
148; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
149; SS:BP: Ptr to MENU
150; Returns:
151; DS:SI: User data (MenuInit_GetUserDataToDSSI)
152; Corrupts registers:
153; Nothing
154;--------------------------------------------------------------------
155ALIGN JUMP_ALIGN
156MenuInit_SetUserDataFromDSSI:
157 mov [bp+MENU.dwUserData], si
158 mov [bp+MENU.dwUserData+2], ds
159 ret
160
161ALIGN JUMP_ALIGN
162MenuInit_GetUserDataToDSSI:
163 lds si, [bp+MENU.dwUserData]
164 ret
Note: See TracBrowser for help on using the repository browser.