source: xtideuniversalbios/trunk/Assembly_Library/Inc/Menu.inc@ 561

Last change on this file since 561 was 525, checked in by krille_n_@…, 12 years ago

Changes:

  • Made some improvements to the stack switching in Int13h.asm.
  • Added a tail-call optimized variant of the CALL_MENU_LIBRARY macro (JMP_MENU_LIBRARY).
  • Other optimizations and fixes.
File size: 5.0 KB
Line 
1; Project name : Assembly Library
2; Description : Defines for Menu library.
3%ifndef MENU_INC
4%define MENU_INC
5
6;--------------------------------------------------------------------
7; Menu Library users need to use these macros since it will provide
8; compatibility with future library versions.
9;
10; CALL_MENU_LIBRARY
11; JMP_MENU_LIBRARY
12; Parameters:
13; %1: Function to call (functionName from MENU_LIB)
14; BP: Menu handle
15; Registers: Depends on function to call
16; Returns:
17; Depends on function to call
18; Corrupts registers:
19; AX (unless used as a return register), DI
20;--------------------------------------------------------------------
21%macro CALL_MENU_LIBRARY 1
22 %ifidn %1, CloseMenuIfExitEventAllows
23 call MenuInit_CloseMenuIfExitEventAllows
24 %elifidn %1, Close
25 call MenuInit_CloseMenuWindow
26 %elifidn %1, SetUserDataFromDSSI
27 call MenuInit_SetUserDataFromDSSI
28 %elifidn %1, GetUserDataToDSSI
29 call MenuInit_GetUserDataToDSSI
30 %elifidn %1, SetTitleHeightFromAL
31 call MenuInit_SetTitleHeightFromAL
32 %elifidn %1, GetHighlightedItemToAX
33 call MenuInit_GetHighlightedItemToAX
34 %elifidn %1, SetTotalItemsFromAX
35 call MenuInit_SetTotalItemsFromAX
36 %elifidn %1, SetInformationHeightFromAL
37 call MenuInit_SetInformationHeightFromAL
38 %elifidn %1, SetTimeoutValueFromAX
39 call MenuTime_SetSelectionTimeoutValueFromAX
40 %else
41 mov di, %1
42 call Menu_FunctionFromDI
43 %endif
44%endmacro
45
46%macro JMP_MENU_LIBRARY 1
47 %ifidn %1, CloseMenuIfExitEventAllows
48 jmp MenuInit_CloseMenuIfExitEventAllows
49 %elifidn %1, Close
50 jmp MenuInit_CloseMenuWindow
51 %elifidn %1, SetUserDataFromDSSI
52 jmp MenuInit_SetUserDataFromDSSI
53 %elifidn %1, GetUserDataToDSSI
54 jmp MenuInit_GetUserDataToDSSI
55 %elifidn %1, SetTitleHeightFromAL
56 jmp MenuInit_SetTitleHeightFromAL
57 %elifidn %1, GetHighlightedItemToAX
58 jmp MenuInit_GetHighlightedItemToAX
59 %elifidn %1, SetTotalItemsFromAX
60 jmp MenuInit_SetTotalItemsFromAX
61 %elifidn %1, SetInformationHeightFromAL
62 jmp MenuInit_SetInformationHeightFromAL
63 %elifidn %1, SetTimeoutValueFromAX
64 jmp MenuTime_SetSelectionTimeoutValueFromAX
65 %else
66 mov di, %1
67 jmp Menu_FunctionFromDI
68 %endif
69%endmacro
70
71%if 0
72;;;
73;;; struc no longer needed with direct call to function
74;;;
75
76; Menu library functions
77struc MENU_LIB
78 .DisplayWithHandlerInBXandUserDataInDXAX resb 2
79 .SendExitMenuEvent:
80 .Close:
81 .RefreshWindow resb 2
82
83 .SetUserDataFromDSSI:
84 .GetUserDataToDSSI:
85
86 .SetTitleHeightFromAL:
87 .ClearTitleArea resb 2
88 .RefreshTitle resb 2
89
90 .GetHighlightedItemToAX:
91 .HighlightItemFromAX resb 2
92 .SetTotalItemsFromAX:
93 .RefreshItemFromAX resb 2
94
95 .SetInformationHeightFromAL:
96 .ClearInformationArea resb 2
97 .RefreshInformation resb 2
98
99%ifndef EXCLUDE_FROM_XTIDECFG
100 .StartSelectionTimeoutWithTicksInAX resb 2
101%endif
102
103%ifdef INCLUDE_MENU_DIALOGS
104 .StartProgressTaskWithIoInDSSIandParamInDXAX resb 2
105 .SetProgressValueFromAX resb 2
106
107 .DisplayMessageWithInputInDSSI resb 2
108 .GetSelectionToAXwithInputInDSSI resb 2
109 .GetWordWithIoInDSSI resb 2
110 .GetStringWithIoInDSSI resb 2
111 .GetFileNameWithIoInDSSI resb 2
112 .GetDriveWithIoInDSSI resb 2
113%endif
114endstruc
115%endif
116
117; Menu initialization parameters
118struc MENUINIT
119 .wItems resb 2 ; Number of items in menu
120 .wHighlightedItem resb 2 ; Index for highlighted item
121
122 .wTitleAndInfoLines:
123 .bTitleLines resb 1 ; Number of title lines
124 .bInfoLines resb 1 ; Number of information lines
125
126 .wWidthAndHeight:
127 .bWidth resb 1 ; Menu width in characters
128 .bHeight resb 1 ; Menu height in characters
129endstruc
130
131
132; All menu parameters
133struc MENU
134 .menuInit resb MENUINIT_size ; Must be first
135 .fnEventHandler resb 2 ; Offset to Menu event handler
136 .dwUserData resb 4 ; User specified data
137
138 .bFlags resb 1 ; Menu flags
139 resb 1
140 .wTimeoutCounter resb 2
141 .wFirstVisibleItem resb 2 ; Index for first visible item on the menu
142endstruc
143
144; Flags for MENU.wFlags
145FLG_MENU_EXIT EQU (1<<0) ; Close and exit menu
146FLG_MENU_NOHIGHLIGHT EQU (1<<1) ; Never highlight items
147FLG_MENU_USER_HANDLES_SCROLLING EQU (1<<2)
148FLG_MENU_TIMEOUT_COUNTDOWN EQU (1<<3) ; Timeout countdown in progress
149
150
151MENU_VERTICAL_BORDER_LINES EQU 5 ; Title top and bottom + Info top and bottom + bottom shadow
152MENU_HORIZONTAL_BORDER_LINES EQU 3 ; Left + Right borders + Right shadow
153MENU_TEXT_ROW_OFFSET EQU 1
154MENU_TEXT_COLUMN_OFFSET EQU 2
155MENU_TIMEOUT_STRING_CHARACTERS EQU 19
156MENU_TIMEOUT_SECONDS_FOR_HURRY EQU 3
157
158SCROLL_TRACK_CHARACTER EQU BLOCK_EVEN_BACKGROUND_AND_FOREGROUND
159SCROLL_THUMB_CHARACTER EQU BLOCK_FULL_FOREGROUND
160
161NO_ITEM_SELECTED EQU -1
162NO_ITEM_HIGHLIGHTED EQU -1
163NO_TIMEOUT_USED EQU 0
164
165
166; Keyboard keys (scan codes) used by menu library
167;MENU_KEY_ENTER EQU 1Ch
168;MENU_KEY_ESC EQU 01h
169MENU_KEY_UP EQU 48h
170MENU_KEY_DOWN EQU 50h
171MENU_KEY_PGUP EQU 49h
172MENU_KEY_PGDN EQU 51h
173MENU_KEY_HOME EQU 47h
174MENU_KEY_END EQU 4Fh
175
176
177%endif ; MENU_INC
Note: See TracBrowser for help on using the repository browser.