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

Last change on this file since 593 was 592, checked in by Krister Nordvall, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
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
161;NO_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.