source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuLoop.asm@ 616

Last change on this file since 616 was 589, checked in by Krister Nordvall, 9 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 5.7 KB
Line 
1; Project name : Assembly Library
2; Description : Menu loop for waiting keystrokes.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
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.
12;
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
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20
21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; MenuLoop_Enter
26; Parameters
27; SS:BP: Ptr to MENU
28; Returns:
29; Nothing
30; Corrupts registers:
31; AX, BX, CX, DX, SI, DI
32;--------------------------------------------------------------------
33ALIGN MENU_JUMP_ALIGN
34MenuLoop_Enter:
35 call KeystrokeProcessing
36 call TimeoutProcessing
37%ifdef MENUEVENT_IDLEPROCESSING_ENABLE
38 call MenuEvent_IdleProcessing ; User idle processing
39%endif
40 test BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
41 jz SHORT MenuLoop_Enter
42 ret
43
44
45;--------------------------------------------------------------------
46; KeystrokeProcessing
47; TimeoutProcessing
48; Parameters
49; SS:BP: Ptr to MENU
50; Returns:
51; Nothing
52; Corrupts registers:
53; All, except SS:BP
54;--------------------------------------------------------------------
55ALIGN MENU_JUMP_ALIGN
56KeystrokeProcessing:
57 call Keyboard_GetKeystrokeToAX
58 jnz SHORT ProcessKeystrokeFromAX
59NoKeystrokeToProcess:
60 ret
61
62ALIGN MENU_JUMP_ALIGN
63TimeoutProcessing:
64 call MenuTime_UpdateSelectionTimeout
65 jnc NoKeystrokeToProcess
66 mov al, CR ; Fake ENTER to select item
67 ; Fall to ProcessKeystrokeFromAX
68
69
70;--------------------------------------------------------------------
71; ProcessKeystrokeFromAX
72; Parameters
73; AL: ASCII character
74; AH: BIOS scan code
75; SS:BP: Ptr to MENU
76; Returns:
77; Nothing
78; Corrupts registers:
79; AX, BX, CX, DX, SI, DI
80;--------------------------------------------------------------------
81ALIGN MENU_JUMP_ALIGN
82ProcessKeystrokeFromAX:
83 xchg cx, ax
84 call MenuTime_StopSelectionTimeout
85 xchg ax, cx
86 call .ProcessMenuSystemKeystrokeFromAX
87 jc SHORT NoKeystrokeToProcess
88 jmp MenuEvent_KeyStrokeInAX
89
90;--------------------------------------------------------------------
91; .ProcessMenuSystemKeystrokeFromAX
92; Parameters
93; AL: ASCII character
94; AH: BIOS scan code
95; SS:BP: Ptr to MENU
96; Returns:
97; CF: Set if keystroke processed
98; Cleared if keystroke not processed
99; AL: ASCII character (if CF cleared)
100; AH: BIOS scan code (if CF cleared)
101; Corrupts registers:
102; BX, CX, DX, SI, DI
103;--------------------------------------------------------------------
104ALIGN MENU_JUMP_ALIGN
105.ProcessMenuSystemKeystrokeFromAX:
106%ifndef MENU_NO_ESC
107 cmp al, ESC
108 jne SHORT .NotEscape
109
110 ; Leave menu without selecting item
111 call MenuEvent_ExitMenu
112 jnc SHORT .CancelMenuExit
113 call MenuInit_CloseMenuWindow
114 mov WORD [bp+MENUINIT.wHighlightedItem], NO_ITEM_HIGHLIGHTED
115.CancelMenuExit:
116 stc
117 ret
118%endif
119
120ALIGN MENU_JUMP_ALIGN
121.NotEscape:
122 cmp al, CR
123 jne SHORT .NotCarriageReturn
124
125 ; Select item
126 mov cx, [bp+MENUINIT.wHighlightedItem]
127 call MenuEvent_ItemSelectedFromCX
128 stc
129.Return:
130 ret
131
132ALIGN MENU_JUMP_ALIGN
133.NotCarriageReturn:
134 test BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING
135 jnz SHORT .Return ; With CF cleared since keystroke not processed
136 ; Fall to MenuLoop_ProcessScrollingKeysFromAX
137
138
139;--------------------------------------------------------------------
140; MenuLoop_ProcessScrollingKeysFromAX
141; Parameters
142; AL: ASCII character
143; AH: BIOS scan code
144; SS:BP: Ptr to MENU
145; Returns:
146; CF: Set if keystroke processed
147; Cleared if keystroke not processed
148; AL: ASCII character (if CF cleared)
149; AH: BIOS scan code (if CF cleared)
150; Corrupts registers:
151; BX, CX, DX, SI, DI
152;--------------------------------------------------------------------
153ALIGN MENU_JUMP_ALIGN
154MenuLoop_ProcessScrollingKeysFromAX:
155 xchg ah, al
156 cmp al, MENU_KEY_PGUP
157 je SHORT .ChangeToPreviousPage
158 cmp al, MENU_KEY_PGDN
159 je SHORT .ChangeToNextPage
160 cmp al, MENU_KEY_HOME
161 je SHORT .SelectFirstItem
162 cmp al, MENU_KEY_END
163 je SHORT .SelectLastItem
164
165 cmp al, MENU_KEY_UP
166 je SHORT .DecrementSelectedItem
167 cmp al, MENU_KEY_DOWN
168 je SHORT .IncrementSelectedItem
169 clc ; Clear CF since keystroke not processed
170 xchg ah, al
171 ret
172
173ALIGN MENU_JUMP_ALIGN
174.ChangeToPreviousPage:
175 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX
176 neg cx
177 mov ax, cx
178 add cx, [bp+MENUINIT.wHighlightedItem]
179 jge SHORT .MoveHighlightedItemByAX ; No rotation for PgUp
180 ; Fall to .SelectFirstItem
181ALIGN MENU_JUMP_ALIGN
182.SelectFirstItem:
183 mov ax, [bp+MENUINIT.wHighlightedItem]
184 neg ax
185 jmp SHORT .MoveHighlightedItemByAX
186
187ALIGN MENU_JUMP_ALIGN
188.ChangeToNextPage:
189 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX
190 mov ax, cx
191 add cx, [bp+MENUINIT.wHighlightedItem]
192 cmp cx, [bp+MENUINIT.wItems]
193 jb SHORT .MoveHighlightedItemByAX ; No rotation for PgDn
194 ; Fall to .SelectLastItem
195ALIGN MENU_JUMP_ALIGN
196.SelectLastItem:
197 stc
198 mov ax, [bp+MENUINIT.wItems]
199 sbb ax, [bp+MENUINIT.wHighlightedItem]
200 jmp SHORT .MoveHighlightedItemByAX
201
202ALIGN MENU_JUMP_ALIGN
203.DecrementSelectedItem:
204 mov al, -1
205 SKIP2B cx
206.IncrementSelectedItem:
207 mov al, 1
208 cbw
209ALIGN MENU_JUMP_ALIGN
210.MoveHighlightedItemByAX:
211 call MenuScrollbars_MoveHighlightedItemByAX
212 stc
213 ret
Note: See TracBrowser for help on using the repository browser.