source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuInit.asm@ 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: 6.4 KB
RevLine 
[41]1; Project name : Assembly Library
2; Description : Functions for initializing menu system.
3
[376]4;
[526]5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
[526]12;
[376]13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[526]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
[526]20
[41]21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
26; Parameters
27; DX:AX: User specified data
28; BX: Menu event handler
29; Returns:
30; AX: Index of selected item or NO_ITEM_SELECTED
31; Corrupts registers:
32; All except segments
33;--------------------------------------------------------------------
[369]34ALIGN MENU_JUMP_ALIGN
[41]35MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX:
36 push es
37 push ds
[390]38 xchg cx, ax ; Backup user data
39 CALL_DISPLAY_LIBRARY PushDisplayContext
[41]40
[390]41 ; Create MENU struct to stack
42 mov ax, MENU_size
43 eENTER_STRUCT ax
44 xchg ax, cx ; Restore user data to AX
[46]45 call Memory_ZeroSSBPwithSizeInCX
[390]46
47 ; Display menu
[391]48 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
[390]49
50 ; Get menu selection and destroy menu variables from stack
[129]51 mov dx, [bp+MENUINIT.wHighlightedItem]
[390]52 eLEAVE_STRUCT MENU_size
[41]53
[390]54 CALL_DISPLAY_LIBRARY PopDisplayContext
[129]55 xchg ax, dx ; Return highlighted item in AX
[41]56 pop ds
57 pop es
58 ret
59
60
61;--------------------------------------------------------------------
[390]62; EnterMenuWithHandlerInBXandUserDataInDXAX
[41]63; Parameters
64; DX:AX: User specified data
65; BX: Menu event handler
66; SS:BP: Ptr to MENU
67; Returns:
68; Nothing
69; Corrupts registers:
70; All, except SS:BP
71;--------------------------------------------------------------------
[369]72ALIGN MENU_JUMP_ALIGN
[391]73MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
[41]74 mov [bp+MENU.fnEventHandler], bx
75 mov [bp+MENU.dwUserData], ax
76 mov [bp+MENU.dwUserData+2], dx
77
78 mov ax, CURSOR_HIDDEN
79 CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
[104]80 call MenuEvent_InitializeMenuinit ; User initialization
[133]81%ifndef USE_186
[41]82 call MenuInit_RefreshMenuWindow
83 jmp MenuLoop_Enter
[133]84%else
85 push MenuLoop_Enter
86 ; Fall to MenuInit_RefreshMenuWindow
87%endif
[41]88
89
90;--------------------------------------------------------------------
91; MenuInit_RefreshMenuWindow
92; Parameters
93; SS:BP: Ptr to MENU
94; Returns:
95; Nothing
96; Corrupts registers:
97; AX, BX, CX, DX, SI, DI
98;--------------------------------------------------------------------
[369]99ALIGN MENU_JUMP_ALIGN
[41]100MenuInit_RefreshMenuWindow:
101 call MenuBorders_RefreshAll ; Draw borders
102 call MenuText_RefreshTitle ; Draw title strings
103 call MenuText_RefreshAllItems ; Draw item strings
[116]104 jmp MenuText_RefreshInformation ; Draw information strings
[41]105
106
107;--------------------------------------------------------------------
[205]108; MenuInit_CloseMenuIfExitEventAllows
109; Parameters
110; SS:BP: Ptr to MENU
111; Returns:
112; Nothing
113; Corrupts registers:
114; AX, BX, DX
115;--------------------------------------------------------------------
[592]116%ifndef EXCLUDE_FROM_XUB
[369]117ALIGN MENU_JUMP_ALIGN
[205]118MenuInit_CloseMenuIfExitEventAllows:
119 call MenuEvent_ExitMenu
120 jc SHORT MenuInit_CloseMenuWindow
121 ret
122%endif
123
124
125;--------------------------------------------------------------------
[41]126; MenuInit_CloseMenuWindow
127; Parameters
128; SS:BP: Ptr to MENU
129; Returns:
130; Nothing
131; Corrupts registers:
132; Nothing
133;--------------------------------------------------------------------
[369]134ALIGN MENU_JUMP_ALIGN
[41]135MenuInit_CloseMenuWindow:
136 or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
137 ret
138
[526]139
[592]140%ifndef EXCLUDE_FROM_XUB
[41]141;--------------------------------------------------------------------
142; MenuInit_HighlightItemFromAX
143; Parameters
144; AX: Item to highlight
145; SS:BP: Ptr to MENU
146; Returns:
147; Nothing
148; Corrupts registers:
149; AX, BX, CX, DX, SI, DI
150;--------------------------------------------------------------------
[369]151ALIGN MENU_JUMP_ALIGN
[41]152MenuInit_HighlightItemFromAX:
[52]153 sub ax, [bp+MENUINIT.wHighlightedItem]
[41]154 jmp MenuScrollbars_MoveHighlightedItemByAX
155
[526]156
[48]157;--------------------------------------------------------------------
158; MenuInit_GetHighlightedItemToAX
159; Parameters
160; SS:BP: Ptr to MENU
161; Returns:
162; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
163; Corrupts registers:
164; Nothing
165;--------------------------------------------------------------------
[369]166ALIGN MENU_JUMP_ALIGN
[48]167MenuInit_GetHighlightedItemToAX:
[52]168 mov ax, [bp+MENUINIT.wHighlightedItem]
[48]169 ret
[592]170%endif ; EXCLUDE_FROM_XUB
[41]171
[48]172
[41]173;--------------------------------------------------------------------
174; MenuInit_SetTitleHeightFromAL
175; MenuInit_SetInformationHeightFromAL
176; MenuInit_SetTotalItemsFromAX
177; Parameters
178; AX/AL: Parameter
179; SS:BP: Ptr to MENU
180; Returns:
181; Nothing
182; Corrupts registers:
183; Nothing
184;--------------------------------------------------------------------
[592]185%ifndef EXCLUDE_FROM_XUB
186%ifndef EXCLUDE_FROM_XTIDECFG
[369]187ALIGN MENU_JUMP_ALIGN
[41]188MenuInit_SetTitleHeightFromAL:
189 mov [bp+MENUINIT.bTitleLines], al
190 ret
191
[369]192ALIGN MENU_JUMP_ALIGN
[41]193MenuInit_SetInformationHeightFromAL:
194 mov [bp+MENUINIT.bInfoLines], al
195 ret
[592]196%endif ; EXCLUDE_FROM_XTIDECFG
[41]197
[369]198ALIGN MENU_JUMP_ALIGN
[41]199MenuInit_SetTotalItemsFromAX:
200 mov [bp+MENUINIT.wItems], ax
201 ret
[592]202%endif ; EXCLUDE_FROM_XUB
[41]203
204
205;--------------------------------------------------------------------
206; MenuInit_SetUserDataFromDSSI
207; MenuInit_GetUserDataToDSSI
208; Parameters
209; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
210; SS:BP: Ptr to MENU
211; Returns:
212; DS:SI: User data (MenuInit_GetUserDataToDSSI)
213; Corrupts registers:
214; Nothing
215;--------------------------------------------------------------------
[592]216%ifndef EXCLUDE_FROM_XUB
217%ifndef EXCLUDE_FROM_XTIDECFG
[369]218ALIGN MENU_JUMP_ALIGN
[41]219MenuInit_SetUserDataFromDSSI:
220 mov [bp+MENU.dwUserData], si
221 mov [bp+MENU.dwUserData+2], ds
222 ret
[592]223%endif ; EXCLUDE_FROM_XTIDECFG
[41]224
[369]225ALIGN MENU_JUMP_ALIGN
[41]226MenuInit_GetUserDataToDSSI:
227 lds si, [bp+MENU.dwUserData]
228 ret
[592]229%endif ; EXCLUDE_FROM_XUB
Note: See TracBrowser for help on using the repository browser.