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

Last change on this file since 372 was 369, checked in by gregli@…, 13 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 5.5 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;--------------------------------------------------------------------
[369]17ALIGN MENU_JUMP_ALIGN
[41]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
[289]33 CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware
[129]34 xchg ax, dx ; Return highlighted item in AX
[41]35 pop ds
36 pop es
37 ret
38
39
40;--------------------------------------------------------------------
41; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
42; Parameters
43; DX:AX: User specified data
44; BX: Menu event handler
45; SS:BP: Ptr to MENU
46; Returns:
47; Nothing
48; Corrupts registers:
49; All, except SS:BP
50;--------------------------------------------------------------------
[369]51ALIGN MENU_JUMP_ALIGN
[41]52MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
53 mov [bp+MENU.fnEventHandler], bx
54 mov [bp+MENU.dwUserData], ax
55 mov [bp+MENU.dwUserData+2], dx
56
57 mov ax, CURSOR_HIDDEN
58 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
[104]59 call MenuEvent_InitializeMenuinit ; User initialization
[133]60%ifndef USE_186
[41]61 call MenuInit_RefreshMenuWindow
62 jmp MenuLoop_Enter
[133]63%else
64 push MenuLoop_Enter
65 ; Fall to MenuInit_RefreshMenuWindow
66%endif
[41]67
68
69;--------------------------------------------------------------------
70; MenuInit_RefreshMenuWindow
71; Parameters
72; SS:BP: Ptr to MENU
73; Returns:
74; Nothing
75; Corrupts registers:
76; AX, BX, CX, DX, SI, DI
77;--------------------------------------------------------------------
[369]78ALIGN MENU_JUMP_ALIGN
[41]79MenuInit_RefreshMenuWindow:
80 call MenuBorders_RefreshAll ; Draw borders
81 call MenuText_RefreshTitle ; Draw title strings
82 call MenuText_RefreshAllItems ; Draw item strings
[116]83 jmp MenuText_RefreshInformation ; Draw information strings
[41]84
85
86;--------------------------------------------------------------------
[205]87; MenuInit_CloseMenuIfExitEventAllows
88; Parameters
89; SS:BP: Ptr to MENU
90; Returns:
91; Nothing
92; Corrupts registers:
93; AX, BX, DX
94;--------------------------------------------------------------------
95%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]96ALIGN MENU_JUMP_ALIGN
[205]97MenuInit_CloseMenuIfExitEventAllows:
98 call MenuEvent_ExitMenu
99 jc SHORT MenuInit_CloseMenuWindow
100 ret
101%endif
102
103
104;--------------------------------------------------------------------
[41]105; MenuInit_CloseMenuWindow
106; Parameters
107; SS:BP: Ptr to MENU
108; Returns:
109; Nothing
110; Corrupts registers:
111; Nothing
112;--------------------------------------------------------------------
[369]113ALIGN MENU_JUMP_ALIGN
[41]114MenuInit_CloseMenuWindow:
115 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
116 ret
117
118
119;--------------------------------------------------------------------
120; MenuInit_HighlightItemFromAX
121; Parameters
122; AX: Item to highlight
123; SS:BP: Ptr to MENU
124; Returns:
125; Nothing
126; Corrupts registers:
127; AX, BX, CX, DX, SI, DI
128;--------------------------------------------------------------------
[369]129ALIGN MENU_JUMP_ALIGN
[41]130MenuInit_HighlightItemFromAX:
[52]131 sub ax, [bp+MENUINIT.wHighlightedItem]
[41]132 jmp MenuScrollbars_MoveHighlightedItemByAX
133
[48]134;--------------------------------------------------------------------
135; MenuInit_GetHighlightedItemToAX
136; Parameters
137; SS:BP: Ptr to MENU
138; Returns:
139; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
140; Corrupts registers:
141; Nothing
142;--------------------------------------------------------------------
[133]143%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]144ALIGN MENU_JUMP_ALIGN
[48]145MenuInit_GetHighlightedItemToAX:
[52]146 mov ax, [bp+MENUINIT.wHighlightedItem]
[48]147 ret
[133]148%endif
[41]149
[48]150
[41]151;--------------------------------------------------------------------
152; MenuInit_SetTitleHeightFromAL
153; MenuInit_SetInformationHeightFromAL
154; MenuInit_SetTotalItemsFromAX
155; Parameters
156; AX/AL: Parameter
157; SS:BP: Ptr to MENU
158; Returns:
159; Nothing
160; Corrupts registers:
161; Nothing
162;--------------------------------------------------------------------
[133]163%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]164ALIGN MENU_JUMP_ALIGN
[41]165MenuInit_SetTitleHeightFromAL:
166 mov [bp+MENUINIT.bTitleLines], al
167 ret
168
[369]169ALIGN MENU_JUMP_ALIGN
[41]170MenuInit_SetInformationHeightFromAL:
171 mov [bp+MENUINIT.bInfoLines], al
172 ret
173
[369]174ALIGN MENU_JUMP_ALIGN
[41]175MenuInit_SetTotalItemsFromAX:
176 mov [bp+MENUINIT.wItems], ax
177 ret
[133]178%endif
[41]179
180
181;--------------------------------------------------------------------
182; MenuInit_SetUserDataFromDSSI
183; MenuInit_GetUserDataToDSSI
184; Parameters
185; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
186; SS:BP: Ptr to MENU
187; Returns:
188; DS:SI: User data (MenuInit_GetUserDataToDSSI)
189; Corrupts registers:
190; Nothing
191;--------------------------------------------------------------------
[133]192%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
[369]193ALIGN MENU_JUMP_ALIGN
[41]194MenuInit_SetUserDataFromDSSI:
195 mov [bp+MENU.dwUserData], si
196 mov [bp+MENU.dwUserData+2], ds
197 ret
198
[369]199ALIGN MENU_JUMP_ALIGN
[41]200MenuInit_GetUserDataToDSSI:
201 lds si, [bp+MENU.dwUserData]
202 ret
[133]203%endif
Note: See TracBrowser for help on using the repository browser.