1 | ; Project name : Assembly Library
|
---|
2 | ; Description : Functions for initializing menu system.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
17 | ALIGN JUMP_ALIGN
|
---|
18 | MenuInit_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 | ;--------------------------------------------------------------------
|
---|
50 | ALIGN JUMP_ALIGN
|
---|
51 | MenuInit_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 | ;--------------------------------------------------------------------
|
---|
77 | ALIGN JUMP_ALIGN
|
---|
78 | MenuInit_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_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
|
---|
95 | ALIGN JUMP_ALIGN
|
---|
96 | MenuInit_CloseMenuIfExitEventAllows:
|
---|
97 | call MenuEvent_ExitMenu
|
---|
98 | jc SHORT MenuInit_CloseMenuWindow
|
---|
99 | ret
|
---|
100 | %endif
|
---|
101 |
|
---|
102 |
|
---|
103 | ;--------------------------------------------------------------------
|
---|
104 | ; MenuInit_CloseMenuWindow
|
---|
105 | ; Parameters
|
---|
106 | ; SS:BP: Ptr to MENU
|
---|
107 | ; Returns:
|
---|
108 | ; Nothing
|
---|
109 | ; Corrupts registers:
|
---|
110 | ; Nothing
|
---|
111 | ;--------------------------------------------------------------------
|
---|
112 | ALIGN JUMP_ALIGN
|
---|
113 | MenuInit_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 | ;--------------------------------------------------------------------
|
---|
128 | ALIGN JUMP_ALIGN
|
---|
129 | MenuInit_HighlightItemFromAX:
|
---|
130 | sub ax, [bp+MENUINIT.wHighlightedItem]
|
---|
131 | jmp MenuScrollbars_MoveHighlightedItemByAX
|
---|
132 |
|
---|
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 | ;--------------------------------------------------------------------
|
---|
142 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
143 | ALIGN JUMP_ALIGN
|
---|
144 | MenuInit_GetHighlightedItemToAX:
|
---|
145 | mov ax, [bp+MENUINIT.wHighlightedItem]
|
---|
146 | ret
|
---|
147 | %endif
|
---|
148 |
|
---|
149 |
|
---|
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 | ;--------------------------------------------------------------------
|
---|
162 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
163 | ALIGN JUMP_ALIGN
|
---|
164 | MenuInit_SetTitleHeightFromAL:
|
---|
165 | mov [bp+MENUINIT.bTitleLines], al
|
---|
166 | ret
|
---|
167 |
|
---|
168 | ALIGN JUMP_ALIGN
|
---|
169 | MenuInit_SetInformationHeightFromAL:
|
---|
170 | mov [bp+MENUINIT.bInfoLines], al
|
---|
171 | ret
|
---|
172 |
|
---|
173 | ALIGN JUMP_ALIGN
|
---|
174 | MenuInit_SetTotalItemsFromAX:
|
---|
175 | mov [bp+MENUINIT.wItems], ax
|
---|
176 | ret
|
---|
177 | %endif
|
---|
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 | ;--------------------------------------------------------------------
|
---|
191 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
192 | ALIGN JUMP_ALIGN
|
---|
193 | MenuInit_SetUserDataFromDSSI:
|
---|
194 | mov [bp+MENU.dwUserData], si
|
---|
195 | mov [bp+MENU.dwUserData+2], ds
|
---|
196 | ret
|
---|
197 |
|
---|
198 | ALIGN JUMP_ALIGN
|
---|
199 | MenuInit_GetUserDataToDSSI:
|
---|
200 | lds si, [bp+MENU.dwUserData]
|
---|
201 | ret
|
---|
202 | %endif
|
---|