[392] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
| 2 | ; Description : Hotkey Bar related functions.
|
---|
| 3 |
|
---|
| 4 | ;
|
---|
[399] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
[392] | 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.
|
---|
[399] | 12 | ;
|
---|
[392] | 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.
|
---|
[399] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
[392] | 19 |
|
---|
| 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
| 23 | ;--------------------------------------------------------------------
|
---|
[528] | 24 | ; Scans key presses and draws any hotkey changes.
|
---|
| 25 | ;
|
---|
[392] | 26 | ; HotkeyBar_UpdateDuringDriveDetection
|
---|
| 27 | ; Parameters:
|
---|
| 28 | ; DS: RAMVARS segment
|
---|
| 29 | ; ES: BDA segment (zero)
|
---|
| 30 | ; Returns:
|
---|
| 31 | ; Nothing
|
---|
| 32 | ; Corrupts registers:
|
---|
| 33 | ; AX, CX, DX, SI, DI
|
---|
| 34 | ;--------------------------------------------------------------------
|
---|
| 35 | HotkeyBar_UpdateDuringDriveDetection:
|
---|
[528] | 36 | call ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[392] | 37 | ; Fall to HotkeyBar_DrawToTopOfScreen
|
---|
[505] | 38 |
|
---|
| 39 |
|
---|
[392] | 40 | ;--------------------------------------------------------------------
|
---|
| 41 | ; HotkeyBar_DrawToTopOfScreen
|
---|
| 42 | ; Parameters:
|
---|
| 43 | ; DS: RAMVARS segment
|
---|
| 44 | ; ES: BDA segment (zero)
|
---|
| 45 | ; Returns:
|
---|
| 46 | ; Nothing
|
---|
| 47 | ; Corrupts registers:
|
---|
| 48 | ; AX, CX, DX, SI, DI
|
---|
| 49 | ;--------------------------------------------------------------------
|
---|
| 50 | HotkeyBar_DrawToTopOfScreen:
|
---|
| 51 | ; Store current screen coordinates to be restored
|
---|
| 52 | ; when Hotkey Bar is rendered
|
---|
| 53 | call DetectPrint_GetSoftwareCoordinatesToAX
|
---|
| 54 | push ax
|
---|
| 55 |
|
---|
| 56 | call MoveCursorToScreenTopLeftCorner
|
---|
| 57 | ; Fall to .PrintFloppyDriveHotkeys
|
---|
| 58 |
|
---|
| 59 | ;--------------------------------------------------------------------
|
---|
| 60 | ; .PrintFloppyDriveHotkeys
|
---|
| 61 | ; Parameters:
|
---|
| 62 | ; DS: RAMVARS segment
|
---|
| 63 | ; ES: BDA segment (zero)
|
---|
| 64 | ; Returns:
|
---|
| 65 | ; Nothing
|
---|
| 66 | ; Corrupts registers:
|
---|
| 67 | ; AX, CX, DX, SI, DI
|
---|
| 68 | ;--------------------------------------------------------------------
|
---|
| 69 | .PrintFloppyDriveHotkeys:
|
---|
| 70 | call FloppyDrive_GetCountToAX
|
---|
[568] | 71 | xchg cx, ax ; Any Floppy Drives?
|
---|
| 72 | jcxz .SkipFloppyDriveHotkeys
|
---|
[392] | 73 |
|
---|
[492] | 74 | mov ax, (ANGLE_QUOTE_RIGHT << 8) | DEFAULT_FLOPPY_DRIVE_LETTER
|
---|
[500] | 75 | mov cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFddLetter]
|
---|
[492] | 76 | mov di, g_szFDD
|
---|
[593] | 77 |
|
---|
| 78 | ; Clear CH if floppy drive is selected for boot
|
---|
| 79 | mov ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
|
---|
[596] | 80 | ; and ch, FLG_HOTKEY_HD_FIRST ; Needed if more flags are added
|
---|
[392] | 81 | call FormatDriveHotkeyString
|
---|
| 82 |
|
---|
| 83 | .SkipFloppyDriveHotkeys:
|
---|
| 84 | ; Fall to .PrintHardDriveHotkeys
|
---|
| 85 |
|
---|
| 86 | ;--------------------------------------------------------------------
|
---|
| 87 | ; .PrintHardDriveHotkeys
|
---|
| 88 | ; Parameters:
|
---|
| 89 | ; DS: RAMVARS segment
|
---|
| 90 | ; ES: BDA segment (zero)
|
---|
| 91 | ; Returns:
|
---|
| 92 | ; Nothing
|
---|
| 93 | ; Corrupts registers:
|
---|
| 94 | ; AX, CX, DX, SI, DI
|
---|
| 95 | ;--------------------------------------------------------------------
|
---|
[547] | 96 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
[392] | 97 | mov ah, ANGLE_QUOTE_RIGHT
|
---|
[596] | 98 | mov cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddLetterAndFlags] ; Letter to CL, flags to CH
|
---|
| 99 | ; and ch, FLG_HOTKEY_HD_FIRST ; Needed if more flags are added
|
---|
[593] | 100 | xor ch, FLG_HOTKEY_HD_FIRST ; Clear CH if HD is selected for boot, set otherwise
|
---|
[492] | 101 | mov di, g_szHDD
|
---|
[392] | 102 | call FormatDriveHotkeyString
|
---|
| 103 | ; Fall to .PrintBootMenuHotkey
|
---|
| 104 |
|
---|
| 105 | ;--------------------------------------------------------------------
|
---|
| 106 | ; .PrintBootMenuHotkey
|
---|
| 107 | ; Parameters:
|
---|
| 108 | ; ES: BDA segment (zero)
|
---|
| 109 | ; Returns:
|
---|
| 110 | ; Nothing
|
---|
| 111 | ; Corrupts registers:
|
---|
| 112 | ; AX, CX, DX, SI, DI
|
---|
| 113 | ;--------------------------------------------------------------------
|
---|
| 114 | .PrintBootMenuHotkey:
|
---|
| 115 | %ifdef MODULE_BOOT_MENU
|
---|
[492] | 116 | mov ax, BOOT_MENU_HOTKEY_SCANCODE | ('2' << 8)
|
---|
| 117 | mov di, g_szBootMenu
|
---|
[392] | 118 | call FormatFunctionHotkeyString
|
---|
| 119 | %endif
|
---|
[492] | 120 | ; Fall to .PrintComDetectHotkey
|
---|
[392] | 121 |
|
---|
| 122 | ;--------------------------------------------------------------------
|
---|
[492] | 123 | ; .PrintComDetectHotkey
|
---|
| 124 | ; Parameters:
|
---|
| 125 | ; ES: BDA segment (zero)
|
---|
| 126 | ; Returns:
|
---|
| 127 | ; Nothing
|
---|
| 128 | ; Corrupts registers:
|
---|
| 129 | ; AX, CX, DX, SI, DI
|
---|
| 130 | ;--------------------------------------------------------------------
|
---|
| 131 | .PrintComDetectHotkey:
|
---|
| 132 | %ifdef MODULE_SERIAL
|
---|
| 133 | mov ax, COM_DETECT_HOTKEY_SCANCODE | ('6' << 8)
|
---|
| 134 | mov di, g_szHotComDetect
|
---|
| 135 | call FormatFunctionHotkeyString
|
---|
| 136 | %endif
|
---|
[505] | 137 | ; Fall to .PrintRomBootHotkey
|
---|
[492] | 138 |
|
---|
| 139 | ;--------------------------------------------------------------------
|
---|
[392] | 140 | ; .PrintRomBootHotkey
|
---|
| 141 | ; Parameters:
|
---|
| 142 | ; ES: BDA segment (zero)
|
---|
| 143 | ; Returns:
|
---|
| 144 | ; Nothing
|
---|
| 145 | ; Corrupts registers:
|
---|
| 146 | ; AX, CX, DX, SI, DI
|
---|
| 147 | ;--------------------------------------------------------------------
|
---|
| 148 | .PrintRomBootHotkey:
|
---|
[492] | 149 | mov ax, ROM_BOOT_HOTKEY_SCANCODE | ('8' << 8)
|
---|
| 150 | mov di, g_szRomBoot
|
---|
[392] | 151 | call FormatFunctionHotkeyString
|
---|
| 152 | ; Fall to .EndHotkeyBarRendering
|
---|
| 153 |
|
---|
| 154 | ;--------------------------------------------------------------------
|
---|
| 155 | ; .EndHotkeyBarRendering
|
---|
| 156 | ; Parameters:
|
---|
| 157 | ; Stack: Screen coordinates before drawing Hotkey Bar
|
---|
| 158 | ; Returns:
|
---|
| 159 | ; Nothing
|
---|
| 160 | ; Corrupts registers:
|
---|
| 161 | ; AX, CX, DI
|
---|
| 162 | ;--------------------------------------------------------------------
|
---|
| 163 | .EndHotkeyBarRendering:
|
---|
| 164 | call HotkeyBar_ClearRestOfTopRow
|
---|
| 165 | pop ax
|
---|
| 166 | jmp SHORT HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 167 |
|
---|
| 168 |
|
---|
| 169 | ;--------------------------------------------------------------------
|
---|
| 170 | ; HotkeyBar_ClearRestOfTopRow
|
---|
| 171 | ; Parameters:
|
---|
| 172 | ; Nothing
|
---|
| 173 | ; Returns:
|
---|
| 174 | ; Nothing
|
---|
| 175 | ; Corrupts registers:
|
---|
| 176 | ; AX, CX, DI
|
---|
| 177 | ;--------------------------------------------------------------------
|
---|
| 178 | HotkeyBar_ClearRestOfTopRow:
|
---|
[505] | 179 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
|
---|
[392] | 180 | eMOVZX cx, al
|
---|
[505] | 181 | CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
|
---|
[392] | 182 | sub cl, al
|
---|
| 183 | mov al, ' '
|
---|
[505] | 184 | JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
|
---|
[392] | 185 |
|
---|
| 186 |
|
---|
| 187 | ;--------------------------------------------------------------------
|
---|
| 188 | ; FormatDriveHotkeyString
|
---|
| 189 | ; Parameters:
|
---|
[593] | 190 | ; CH: Zero if letter in CL is selected for boot
|
---|
[392] | 191 | ; CL: Drive letter hotkey from BOOTVARS
|
---|
[492] | 192 | ; AL: First character for drive key string
|
---|
| 193 | ; AH: Second character for drive key string (ANGLE_QUOTE_RIGHT)
|
---|
[392] | 194 | ; SI: Offset to hotkey description string
|
---|
| 195 | ; ES: BDA segment (zero)
|
---|
| 196 | ; Returns:
|
---|
| 197 | ; Nothing
|
---|
| 198 | ; Corrupts registers:
|
---|
| 199 | ; AX, CX, DX, SI, DI
|
---|
| 200 | ;--------------------------------------------------------------------
|
---|
[593] | 201 | FormatDriveHotkeyString:
|
---|
| 202 | ; Invalid scancodes are filtered on HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 203 | ; so here we have either drive letter or function key pressed. If latter, draw
|
---|
| 204 | ; drive letters as unselected
|
---|
| 205 | cmp BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], FIRST_FUNCTION_KEY_SCANCODE
|
---|
| 206 | jae SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
|
---|
[392] | 207 |
|
---|
[593] | 208 | ; Drive selected to boot from?
|
---|
| 209 | test ch, ch
|
---|
| 210 | jnz SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
|
---|
| 211 | jmp SHORT GetSelectedHotkeyDescriptionAttributeToDX
|
---|
| 212 |
|
---|
| 213 |
|
---|
[392] | 214 | ;--------------------------------------------------------------------
|
---|
| 215 | ; FormatFunctionHotkeyString
|
---|
| 216 | ; Parameters:
|
---|
[492] | 217 | ; AL: Scancode of function key, to know which if any to show as selected
|
---|
| 218 | ; Later replaced with an 'F' for the call to the output routine
|
---|
| 219 | ; AH: Second character for drive key string
|
---|
[392] | 220 | ; SI: Offset to hotkey description string
|
---|
| 221 | ; ES: BDA segment (zero)
|
---|
| 222 | ; Returns:
|
---|
| 223 | ; Nothing
|
---|
| 224 | ; Corrupts registers:
|
---|
| 225 | ; AX, CX, DX, SI, DI
|
---|
| 226 | ;--------------------------------------------------------------------
|
---|
| 227 | FormatFunctionHotkeyString:
|
---|
[492] | 228 | xor cx, cx ; Null character, eaten in output routines
|
---|
[392] | 229 |
|
---|
[492] | 230 | cmp [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], al
|
---|
| 231 | mov al, 'F' ; Replace scancode with character for output
|
---|
[392] | 232 |
|
---|
| 233 | %ifdef MODULE_BOOT_MENU
|
---|
[492] | 234 |
|
---|
[593] | 235 | GetSelectedHotkeyDescriptionAttributeToDX:
|
---|
[596] | 236 | mov si, ATTRIBUTE_CHARS.cHighlightedItem ; Selected hotkey
|
---|
[593] | 237 | je SHORT GetDescriptionAttributeToDX ; From compare with bScancode above and from FormatDriveHotkeyString
|
---|
[392] | 238 |
|
---|
| 239 | GetNonSelectedHotkeyDescriptionAttributeToDX:
|
---|
[596] | 240 | mov si, ATTRIBUTE_CHARS.cItem ; Unselected hotkey
|
---|
[392] | 241 |
|
---|
| 242 | ; Display Library should not be called like this
|
---|
| 243 | GetDescriptionAttributeToDX:
|
---|
[492] | 244 | xchg dx, ax
|
---|
[392] | 245 | call MenuAttribute_GetToAXfromTypeInSI
|
---|
| 246 | xchg dx, ax ; DX = Description attribute
|
---|
[505] | 247 | ;; fall through to PushHotkeyParamsAndFormat
|
---|
[392] | 248 |
|
---|
| 249 |
|
---|
[500] | 250 | %else ; if no MODULE_BOOT_MENU - No boot menu so use simpler attributes
|
---|
| 251 |
|
---|
[593] | 252 | GetSelectedHotkeyDescriptionAttributeToDX:
|
---|
[410] | 253 | mov dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
|
---|
[593] | 254 | je SHORT SelectAttributeFromDHorDLbasedOnVideoMode ; From compare with bScancode above and from FormatDriveHotkeyString
|
---|
[392] | 255 |
|
---|
| 256 | GetNonSelectedHotkeyDescriptionAttributeToDX:
|
---|
[410] | 257 | mov dx, (COLOR_ATTRIBUTE(COLOR_BLACK, COLOR_CYAN) << 8) | MONO_REVERSE
|
---|
[492] | 258 |
|
---|
[410] | 259 | SelectAttributeFromDHorDLbasedOnVideoMode:
|
---|
[500] | 260 | mov ch, [es:BDA.bVidMode] ; We only need to preserve CL
|
---|
| 261 | shr ch, 1
|
---|
[410] | 262 | jnc SHORT .AttributeLoadedToDL ; Black & White modes
|
---|
[500] | 263 | shr ch, 1
|
---|
[410] | 264 | jnz SHORT .AttributeLoadedToDL ; MDA
|
---|
| 265 | mov dl, dh
|
---|
| 266 | .AttributeLoadedToDL:
|
---|
[505] | 267 | ;; fall through to PushHotkeyParamsAndFormat
|
---|
[410] | 268 |
|
---|
[492] | 269 | %endif ; MODULE_BOOT_MENU
|
---|
[392] | 270 |
|
---|
| 271 |
|
---|
| 272 | ;--------------------------------------------------------------------
|
---|
| 273 | ; PushHotkeyParamsAndFormat
|
---|
| 274 | ; Parameters:
|
---|
[500] | 275 | ; AL: First character
|
---|
| 276 | ; AH: Second character
|
---|
[392] | 277 | ; DX: Description Attribute
|
---|
| 278 | ; CX: Description string parameter
|
---|
[492] | 279 | ; CS:DI: Description string
|
---|
[392] | 280 | ; Returns:
|
---|
| 281 | ; Nothing
|
---|
| 282 | ; Corrupts registers:
|
---|
| 283 | ; AX, SI, DI
|
---|
| 284 | ;--------------------------------------------------------------------
|
---|
| 285 | PushHotkeyParamsAndFormat:
|
---|
| 286 | push bp
|
---|
| 287 | mov bp, sp
|
---|
| 288 |
|
---|
[492] | 289 | mov si, MONO_BRIGHT
|
---|
[392] | 290 |
|
---|
[492] | 291 | push si ; Key attribute
|
---|
| 292 | push ax ; First Character
|
---|
| 293 | mov al, ah
|
---|
| 294 | push ax ; Second Character
|
---|
| 295 |
|
---|
[392] | 296 | push dx ; Description attribute
|
---|
[492] | 297 | push di ; Description string
|
---|
[392] | 298 | push cx ; Description string parameter
|
---|
[505] | 299 |
|
---|
[492] | 300 | push si ; Key attribute for last space
|
---|
[392] | 301 |
|
---|
| 302 | mov si, g_szHotkey
|
---|
| 303 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
| 304 |
|
---|
| 305 |
|
---|
| 306 | ;--------------------------------------------------------------------
|
---|
| 307 | ; MoveCursorToScreenTopLeftCorner
|
---|
| 308 | ; Parameters:
|
---|
| 309 | ; Nothing
|
---|
| 310 | ; Returns:
|
---|
| 311 | ; Nothing
|
---|
| 312 | ; Corrupts registers:
|
---|
| 313 | ; AX, DI
|
---|
| 314 | ;--------------------------------------------------------------------
|
---|
| 315 | MoveCursorToScreenTopLeftCorner:
|
---|
| 316 | xor ax, ax ; Top left corner (0, 0)
|
---|
| 317 | ; Fall to HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 318 |
|
---|
| 319 |
|
---|
| 320 | ;--------------------------------------------------------------------
|
---|
| 321 | ; HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 322 | ; Parameters:
|
---|
| 323 | ; Nothing
|
---|
| 324 | ; Returns:
|
---|
| 325 | ; Nothing
|
---|
| 326 | ; Corrupts registers:
|
---|
| 327 | ; AX, DI
|
---|
| 328 | ;--------------------------------------------------------------------
|
---|
| 329 | HotkeyBar_RestoreCursorCoordinatesFromAX:
|
---|
[505] | 330 | JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
|
---|
[392] | 331 |
|
---|
| 332 |
|
---|
| 333 | ;--------------------------------------------------------------------
|
---|
[528] | 334 | ; HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
|
---|
[395] | 335 | ; Parameters:
|
---|
| 336 | ; DS: RAMVARS segment
|
---|
| 337 | ; ES: BDA segment (zero)
|
---|
[528] | 338 | ; DL: Drive Number
|
---|
| 339 | ; Returns:
|
---|
| 340 | ; Nothing
|
---|
| 341 | ; Corrupts registers:
|
---|
| 342 | ; AX, CX, DL, DI
|
---|
| 343 | ;--------------------------------------------------------------------
|
---|
| 344 | HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL:
|
---|
| 345 | call DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
|
---|
| 346 | ; Fall to StoreHotkeyToBootvarsForDriveLetterInDL
|
---|
| 347 |
|
---|
| 348 |
|
---|
| 349 | ;--------------------------------------------------------------------
|
---|
| 350 | ; StoreHotkeyToBootvarsForDriveLetterInDL
|
---|
| 351 | ; Parameters:
|
---|
| 352 | ; DS: RAMVARS segment
|
---|
| 353 | ; ES: BDA segment (zero)
|
---|
[395] | 354 | ; DL: Drive Letter ('A'...)
|
---|
| 355 | ; Returns:
|
---|
| 356 | ; Nothing
|
---|
| 357 | ; Corrupts registers:
|
---|
| 358 | ; AX, CX, DI
|
---|
| 359 | ;--------------------------------------------------------------------
|
---|
[528] | 360 | StoreHotkeyToBootvarsForDriveLetterInDL:
|
---|
[395] | 361 | eMOVZX ax, dl
|
---|
[505] | 362 | or al, 32 ; Upper case drive letter to lower case keystroke
|
---|
[395] | 363 | jmp SHORT HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 364 |
|
---|
| 365 |
|
---|
| 366 | ;--------------------------------------------------------------------
|
---|
[528] | 367 | ; ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[392] | 368 | ; Parameters:
|
---|
| 369 | ; DS: RAMVARS segment
|
---|
| 370 | ; ES: BDA segment (zero)
|
---|
| 371 | ; Returns:
|
---|
[492] | 372 | ; AL: Last scancode value
|
---|
[392] | 373 | ; Corrupts registers:
|
---|
[492] | 374 | ; AH, CX
|
---|
[392] | 375 | ;--------------------------------------------------------------------
|
---|
[528] | 376 | ScanHotkeysFromKeyBufferAndStoreToBootvars:
|
---|
[392] | 377 | call Keyboard_GetKeystrokeToAX
|
---|
| 378 | jz SHORT NoHotkeyToProcess
|
---|
| 379 |
|
---|
[528] | 380 | ; Prepare to read another key from buffer
|
---|
| 381 | ePUSH_T cx, ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[392] | 382 | ; Fall to HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 383 |
|
---|
| 384 |
|
---|
| 385 | ;--------------------------------------------------------------------
|
---|
| 386 | ; HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 387 | ; Parameters:
|
---|
| 388 | ; AL: Hotkey ASCII code
|
---|
| 389 | ; AH: Hotkey Scancode
|
---|
| 390 | ; DS: RAMVARS segment
|
---|
| 391 | ; ES: BDA segment (zero)
|
---|
| 392 | ; Returns:
|
---|
[567] | 393 | ; AL: Last scancode seen
|
---|
[528] | 394 | ; CF: Set if valid hotkey in AL
|
---|
| 395 | ; Clear if scancode in AL is not for any hotkey
|
---|
[392] | 396 | ; Corrupts registers:
|
---|
[492] | 397 | ; AH, CX, DI
|
---|
[392] | 398 | ;--------------------------------------------------------------------
|
---|
| 399 | HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX:
|
---|
[492] | 400 | mov di, BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode
|
---|
[392] | 401 |
|
---|
[492] | 402 | ; All scancodes are saved, even if it wasn't a drive letter,
|
---|
| 403 | ; which also covers our function key case. Invalid function keys
|
---|
[505] | 404 | ; will not do anything (won't be printed, won't be accepted as input)
|
---|
[492] | 405 | mov [es:di], ah
|
---|
[505] | 406 |
|
---|
[392] | 407 | ; Drive letter hotkeys remaining, allow 'a' to 'z'
|
---|
| 408 | call Char_IsLowerCaseLetterInAL
|
---|
[492] | 409 | jnc SHORT .KeystrokeIsNotValidDriveLetter
|
---|
[505] | 410 | and al, ~32 ; We want to print upper case letters
|
---|
[392] | 411 |
|
---|
| 412 | ; Clear HD First flag to assume Floppy Drive hotkey
|
---|
[492] | 413 | dec di
|
---|
[392] | 414 | and BYTE [es:di], ~FLG_HOTKEY_HD_FIRST
|
---|
| 415 |
|
---|
| 416 | ; Determine if Floppy or Hard Drive hotkey
|
---|
[505] | 417 | xchg cx, ax
|
---|
[547] | 418 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
[392] | 419 | cmp cl, al
|
---|
| 420 | jb SHORT .StoreDriveLetter ; Store Floppy Drive letter
|
---|
| 421 |
|
---|
| 422 | ; Store Hard Drive letter
|
---|
| 423 | or BYTE [es:di], FLG_HOTKEY_HD_FIRST
|
---|
| 424 |
|
---|
| 425 | .StoreDriveLetter:
|
---|
[505] | 426 | sbb di, BYTE 1 ; Sub CF if Floppy Drive
|
---|
[392] | 427 | xchg ax, cx
|
---|
[592] | 428 | stosb
|
---|
[528] | 429 | stc ; Valid hotkey scancode returned in AL
|
---|
[392] | 430 |
|
---|
[505] | 431 | .KeystrokeIsNotValidDriveLetter:
|
---|
[392] | 432 | NoHotkeyToProcess:
|
---|
[492] | 433 | mov al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
|
---|
[392] | 434 | ret
|
---|
| 435 |
|
---|
[528] | 436 |
|
---|
[392] | 437 | ;--------------------------------------------------------------------
|
---|
[492] | 438 | ; HotkeyBar_GetBootDriveNumbersToDX
|
---|
[392] | 439 | ; Parameters:
|
---|
| 440 | ; DS: RAMVARS segment
|
---|
| 441 | ; ES: BDA segment (zero)
|
---|
| 442 | ; Returns:
|
---|
[492] | 443 | ; DX: Drives selected as boot device, DL is primary
|
---|
[392] | 444 | ; Corrupts registers:
|
---|
[492] | 445 | ; AX
|
---|
[392] | 446 | ;--------------------------------------------------------------------
|
---|
[492] | 447 | HotkeyBar_GetBootDriveNumbersToDX:
|
---|
[500] | 448 | mov dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters]
|
---|
[505] | 449 | test BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST
|
---|
[492] | 450 | jnz .noflip
|
---|
[392] | 451 | xchg dl, dh
|
---|
[505] | 452 | .noflip:
|
---|
[492] | 453 | call DriveXlate_ConvertDriveLetterInDLtoDriveNumber
|
---|
| 454 | xchg dl, dh
|
---|
[505] | 455 | ; Fall to HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber
|
---|
[392] | 456 |
|
---|
[505] | 457 | HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
|
---|
| 458 |
|
---|