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

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

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
File size: 4.6 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 ax, [bp+MENUINIT.wHighlightedItem]
29
30 eLEAVE_STRUCT MENU_size
31 pop ax
32 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
33 pop ds
34 pop es
35 ret
36
37
38;--------------------------------------------------------------------
39; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
40; Parameters
41; DX:AX: User specified data
42; BX: Menu event handler
43; SS:BP: Ptr to MENU
44; Returns:
45; Nothing
46; Corrupts registers:
47; All, except SS:BP
48;--------------------------------------------------------------------
49ALIGN JUMP_ALIGN
50MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
51 mov [bp+MENU.fnEventHandler], bx
52 mov [bp+MENU.dwUserData], ax
53 mov [bp+MENU.dwUserData+2], dx
54
55 mov ax, CURSOR_HIDDEN
56 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
57 call MenuEvent_InitializeMenuinit ; User initialization
58 call MenuInit_RefreshMenuWindow
59 jmp MenuLoop_Enter
60
61
62;--------------------------------------------------------------------
63; MenuInit_RefreshMenuWindow
64; Parameters
65; SS:BP: Ptr to MENU
66; Returns:
67; Nothing
68; Corrupts registers:
69; AX, BX, CX, DX, SI, DI
70;--------------------------------------------------------------------
71ALIGN JUMP_ALIGN
72MenuInit_RefreshMenuWindow:
73 call MenuBorders_RefreshAll ; Draw borders
74 call MenuText_RefreshTitle ; Draw title strings
75 call MenuText_RefreshAllItems ; Draw item strings
76 jmp MenuText_RefreshInformation ; Draw information strings
77
78
79;--------------------------------------------------------------------
80; MenuInit_CloseMenuWindow
81; Parameters
82; SS:BP: Ptr to MENU
83; Returns:
84; Nothing
85; Corrupts registers:
86; Nothing
87;--------------------------------------------------------------------
88ALIGN JUMP_ALIGN
89MenuInit_CloseMenuWindow:
90 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
91 ret
92
93
94;--------------------------------------------------------------------
95; MenuInit_HighlightItemFromAX
96; Parameters
97; AX: Item to highlight
98; SS:BP: Ptr to MENU
99; Returns:
100; Nothing
101; Corrupts registers:
102; AX, BX, CX, DX, SI, DI
103;--------------------------------------------------------------------
104ALIGN JUMP_ALIGN
105MenuInit_HighlightItemFromAX:
106 sub ax, [bp+MENUINIT.wHighlightedItem]
107 jmp MenuScrollbars_MoveHighlightedItemByAX
108
109;--------------------------------------------------------------------
110; MenuInit_GetHighlightedItemToAX
111; Parameters
112; SS:BP: Ptr to MENU
113; Returns:
114; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
115; Corrupts registers:
116; Nothing
117;--------------------------------------------------------------------
118ALIGN JUMP_ALIGN
119MenuInit_GetHighlightedItemToAX:
120 mov ax, [bp+MENUINIT.wHighlightedItem]
121 ret
122
123
124;--------------------------------------------------------------------
125; MenuInit_SetTitleHeightFromAL
126; MenuInit_SetInformationHeightFromAL
127; MenuInit_SetTotalItemsFromAX
128; Parameters
129; AX/AL: Parameter
130; SS:BP: Ptr to MENU
131; Returns:
132; Nothing
133; Corrupts registers:
134; Nothing
135;--------------------------------------------------------------------
136ALIGN JUMP_ALIGN
137MenuInit_SetTitleHeightFromAL:
138 mov [bp+MENUINIT.bTitleLines], al
139 ret
140
141ALIGN JUMP_ALIGN
142MenuInit_SetInformationHeightFromAL:
143 mov [bp+MENUINIT.bInfoLines], al
144 ret
145
146ALIGN JUMP_ALIGN
147MenuInit_SetTotalItemsFromAX:
148 mov [bp+MENUINIT.wItems], ax
149 ret
150
151
152;--------------------------------------------------------------------
153; MenuInit_SetUserDataFromDSSI
154; MenuInit_GetUserDataToDSSI
155; Parameters
156; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
157; SS:BP: Ptr to MENU
158; Returns:
159; DS:SI: User data (MenuInit_GetUserDataToDSSI)
160; Corrupts registers:
161; Nothing
162;--------------------------------------------------------------------
163ALIGN JUMP_ALIGN
164MenuInit_SetUserDataFromDSSI:
165 mov [bp+MENU.dwUserData], si
166 mov [bp+MENU.dwUserData+2], ds
167 ret
168
169ALIGN JUMP_ALIGN
170MenuInit_GetUserDataToDSSI:
171 lds si, [bp+MENU.dwUserData]
172 ret
Note: See TracBrowser for help on using the repository browser.