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

Last change on this file since 241 was 205, checked in by aitotat@…, 13 years ago

Changes to Assembly Library:

  • Menu Exit event can now be send when closing menu.
File size: 5.3 KB
RevLine 
[41]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
[116]21 LOAD_BDA_SEGMENT_TO ds, cx, !
[41]22 push WORD [BDA.wVidCurShape]
[104]23 mov cl, MENU_size
24 eENTER_STRUCT cx
[41]25
[46]26 call Memory_ZeroSSBPwithSizeInCX
[41]27 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
[129]28 mov dx, [bp+MENUINIT.wHighlightedItem]
[41]29
30 eLEAVE_STRUCT MENU_size
31 pop ax
32 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
[129]33 xchg ax, dx ; Return highlighted item in AX
[41]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
[104]58 call MenuEvent_InitializeMenuinit ; User initialization
[133]59%ifndef USE_186
[41]60 call MenuInit_RefreshMenuWindow
61 jmp MenuLoop_Enter
[133]62%else
63 push MenuLoop_Enter
64 ; Fall to MenuInit_RefreshMenuWindow
65%endif
[41]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
[116]82 jmp MenuText_RefreshInformation ; Draw information strings
[41]83
84
85;--------------------------------------------------------------------
[205]86; MenuInit_CloseMenuIfExitEventAllows
87; Parameters
88; SS:BP: Ptr to MENU
89; Returns:
90; Nothing
91; Corrupts registers:
92; AX, BX, DX
93;--------------------------------------------------------------------
94%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
95ALIGN JUMP_ALIGN
96MenuInit_CloseMenuIfExitEventAllows:
97 call MenuEvent_ExitMenu
98 jc SHORT MenuInit_CloseMenuWindow
99 ret
100%endif
101
102
103;--------------------------------------------------------------------
[41]104; MenuInit_CloseMenuWindow
105; Parameters
106; SS:BP: Ptr to MENU
107; Returns:
108; Nothing
109; Corrupts registers:
110; Nothing
111;--------------------------------------------------------------------
112ALIGN JUMP_ALIGN
113MenuInit_CloseMenuWindow:
114 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
115 ret
116
117
118;--------------------------------------------------------------------
119; MenuInit_HighlightItemFromAX
120; Parameters
121; AX: Item to highlight
122; SS:BP: Ptr to MENU
123; Returns:
124; Nothing
125; Corrupts registers:
126; AX, BX, CX, DX, SI, DI
127;--------------------------------------------------------------------
128ALIGN JUMP_ALIGN
129MenuInit_HighlightItemFromAX:
[52]130 sub ax, [bp+MENUINIT.wHighlightedItem]
[41]131 jmp MenuScrollbars_MoveHighlightedItemByAX
132
[48]133;--------------------------------------------------------------------
134; MenuInit_GetHighlightedItemToAX
135; Parameters
136; SS:BP: Ptr to MENU
137; Returns:
138; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
139; Corrupts registers:
140; Nothing
141;--------------------------------------------------------------------
[133]142%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[48]143ALIGN JUMP_ALIGN
144MenuInit_GetHighlightedItemToAX:
[52]145 mov ax, [bp+MENUINIT.wHighlightedItem]
[48]146 ret
[133]147%endif
[41]148
[48]149
[41]150;--------------------------------------------------------------------
151; MenuInit_SetTitleHeightFromAL
152; MenuInit_SetInformationHeightFromAL
153; MenuInit_SetTotalItemsFromAX
154; Parameters
155; AX/AL: Parameter
156; SS:BP: Ptr to MENU
157; Returns:
158; Nothing
159; Corrupts registers:
160; Nothing
161;--------------------------------------------------------------------
[133]162%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[41]163ALIGN JUMP_ALIGN
164MenuInit_SetTitleHeightFromAL:
165 mov [bp+MENUINIT.bTitleLines], al
166 ret
167
168ALIGN JUMP_ALIGN
169MenuInit_SetInformationHeightFromAL:
170 mov [bp+MENUINIT.bInfoLines], al
171 ret
172
173ALIGN JUMP_ALIGN
174MenuInit_SetTotalItemsFromAX:
175 mov [bp+MENUINIT.wItems], ax
176 ret
[133]177%endif
[41]178
179
180;--------------------------------------------------------------------
181; MenuInit_SetUserDataFromDSSI
182; MenuInit_GetUserDataToDSSI
183; Parameters
184; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
185; SS:BP: Ptr to MENU
186; Returns:
187; DS:SI: User data (MenuInit_GetUserDataToDSSI)
188; Corrupts registers:
189; Nothing
190;--------------------------------------------------------------------
[133]191%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[41]192ALIGN JUMP_ALIGN
193MenuInit_SetUserDataFromDSSI:
194 mov [bp+MENU.dwUserData], si
195 mov [bp+MENU.dwUserData+2], ds
196 ret
197
198ALIGN JUMP_ALIGN
199MenuInit_GetUserDataToDSSI:
200 lds si, [bp+MENU.dwUserData]
201 ret
[133]202%endif
Note: See TracBrowser for help on using the repository browser.