[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 |
|
---|
[599] | 23 |
|
---|
[392] | 24 | ;--------------------------------------------------------------------
|
---|
[599] | 25 | ; Handler for INT 1Ch System Timer Tick.
|
---|
| 26 | ; Reads key presses and draws hotkey bar.
|
---|
| 27 | ;
|
---|
| 28 | ; HotkeyBar_TimerTickHandler
|
---|
| 29 | ; Parameters:
|
---|
| 30 | ; DS: RAMVARS segment
|
---|
| 31 | ; ES: BDA segment (zero)
|
---|
| 32 | ; Returns:
|
---|
| 33 | ; Nothing
|
---|
| 34 | ; Corrupts registers:
|
---|
[601] | 35 | ; Nothing
|
---|
[599] | 36 | ;--------------------------------------------------------------------
|
---|
[601] | 37 | ALIGN JUMP_ALIGN
|
---|
[599] | 38 | HotkeyBar_TimerTickHandler:
|
---|
| 39 | push es
|
---|
| 40 | push ds
|
---|
| 41 | %ifdef USE_186
|
---|
| 42 | ePUSHA
|
---|
| 43 | %else
|
---|
| 44 | push di
|
---|
| 45 | push si
|
---|
| 46 | push dx
|
---|
| 47 | push cx
|
---|
| 48 | push ax
|
---|
| 49 | %endif
|
---|
| 50 |
|
---|
[600] | 51 | ;!!! Keep interrupts disabled so there won't be another
|
---|
| 52 | ; timer tick call before we are ready
|
---|
| 53 |
|
---|
[599] | 54 | LOAD_BDA_SEGMENT_TO es, ax
|
---|
| 55 | call RamVars_GetSegmentToDS
|
---|
| 56 |
|
---|
| 57 | ; Call previous handler
|
---|
| 58 | pushf
|
---|
[601] | 59 | call FAR [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
|
---|
[599] | 60 |
|
---|
[600] | 61 | ; Update Hotkeybar (process key input and draw) every fourth tick
|
---|
| 62 | test BYTE [es:BDA.dwTimerTicks], 11b
|
---|
[599] | 63 | jnz SHORT .ReturnFromHandler
|
---|
| 64 | call UpdateDuringDriveDetection
|
---|
| 65 |
|
---|
| 66 | .ReturnFromHandler:
|
---|
| 67 | %ifdef USE_186
|
---|
| 68 | ePOPA
|
---|
| 69 | %else
|
---|
| 70 | pop ax
|
---|
| 71 | pop cx
|
---|
| 72 | pop dx
|
---|
| 73 | pop si
|
---|
| 74 | pop di
|
---|
| 75 | %endif
|
---|
| 76 | pop ds
|
---|
| 77 | pop es
|
---|
| 78 | iret
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | ;--------------------------------------------------------------------
|
---|
[528] | 82 | ; Scans key presses and draws any hotkey changes.
|
---|
| 83 | ;
|
---|
[392] | 84 | ; HotkeyBar_UpdateDuringDriveDetection
|
---|
| 85 | ; Parameters:
|
---|
| 86 | ; DS: RAMVARS segment
|
---|
| 87 | ; ES: BDA segment (zero)
|
---|
| 88 | ; Returns:
|
---|
| 89 | ; Nothing
|
---|
| 90 | ; Corrupts registers:
|
---|
| 91 | ; AX, CX, DX, SI, DI
|
---|
| 92 | ;--------------------------------------------------------------------
|
---|
[599] | 93 | UpdateDuringDriveDetection:
|
---|
[528] | 94 | call ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[599] | 95 |
|
---|
| 96 | ; If ESC pressed, abort detection by forcing timeout
|
---|
| 97 | cmp al, ESC_SCANCODE
|
---|
| 98 | jne SHORT .ContinueDrawing
|
---|
| 99 | mov BYTE [RAMVARS.bTimeoutTicksLeft], 0
|
---|
| 100 | .ContinueDrawing:
|
---|
[392] | 101 | ; Fall to HotkeyBar_DrawToTopOfScreen
|
---|
[505] | 102 |
|
---|
| 103 |
|
---|
[392] | 104 | ;--------------------------------------------------------------------
|
---|
| 105 | ; HotkeyBar_DrawToTopOfScreen
|
---|
| 106 | ; Parameters:
|
---|
| 107 | ; DS: RAMVARS segment
|
---|
| 108 | ; ES: BDA segment (zero)
|
---|
| 109 | ; Returns:
|
---|
| 110 | ; Nothing
|
---|
| 111 | ; Corrupts registers:
|
---|
| 112 | ; AX, CX, DX, SI, DI
|
---|
| 113 | ;--------------------------------------------------------------------
|
---|
| 114 | HotkeyBar_DrawToTopOfScreen:
|
---|
| 115 | ; Store current screen coordinates to be restored
|
---|
| 116 | ; when Hotkey Bar is rendered
|
---|
| 117 | call DetectPrint_GetSoftwareCoordinatesToAX
|
---|
| 118 | push ax
|
---|
| 119 |
|
---|
| 120 | call MoveCursorToScreenTopLeftCorner
|
---|
| 121 | ; Fall to .PrintFloppyDriveHotkeys
|
---|
| 122 |
|
---|
| 123 | ;--------------------------------------------------------------------
|
---|
| 124 | ; .PrintFloppyDriveHotkeys
|
---|
| 125 | ; Parameters:
|
---|
| 126 | ; DS: RAMVARS segment
|
---|
| 127 | ; ES: BDA segment (zero)
|
---|
| 128 | ; Returns:
|
---|
| 129 | ; Nothing
|
---|
| 130 | ; Corrupts registers:
|
---|
| 131 | ; AX, CX, DX, SI, DI
|
---|
| 132 | ;--------------------------------------------------------------------
|
---|
| 133 | .PrintFloppyDriveHotkeys:
|
---|
| 134 | call FloppyDrive_GetCountToAX
|
---|
[568] | 135 | xchg cx, ax ; Any Floppy Drives?
|
---|
| 136 | jcxz .SkipFloppyDriveHotkeys
|
---|
[392] | 137 |
|
---|
[492] | 138 | mov ax, (ANGLE_QUOTE_RIGHT << 8) | DEFAULT_FLOPPY_DRIVE_LETTER
|
---|
[500] | 139 | mov cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFddLetter]
|
---|
[492] | 140 | mov di, g_szFDD
|
---|
[593] | 141 |
|
---|
| 142 | ; Clear CH if floppy drive is selected for boot
|
---|
[601] | 143 | %if 0 ; Not needed until more flags added
|
---|
| 144 | mov ch, FLG_HOTKEY_HD_FIRST
|
---|
| 145 | and ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
|
---|
| 146 | %else
|
---|
[593] | 147 | mov ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
|
---|
[601] | 148 | %endif
|
---|
[392] | 149 | call FormatDriveHotkeyString
|
---|
| 150 |
|
---|
| 151 | .SkipFloppyDriveHotkeys:
|
---|
| 152 | ; Fall to .PrintHardDriveHotkeys
|
---|
| 153 |
|
---|
| 154 | ;--------------------------------------------------------------------
|
---|
| 155 | ; .PrintHardDriveHotkeys
|
---|
| 156 | ; Parameters:
|
---|
| 157 | ; DS: RAMVARS segment
|
---|
| 158 | ; ES: BDA segment (zero)
|
---|
| 159 | ; Returns:
|
---|
| 160 | ; Nothing
|
---|
| 161 | ; Corrupts registers:
|
---|
| 162 | ; AX, CX, DX, SI, DI
|
---|
| 163 | ;--------------------------------------------------------------------
|
---|
[547] | 164 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
[392] | 165 | mov ah, ANGLE_QUOTE_RIGHT
|
---|
[596] | 166 | mov cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddLetterAndFlags] ; Letter to CL, flags to CH
|
---|
[600] | 167 | ;and ch, FLG_HOTKEY_HD_FIRST ; Not needed until more flags added
|
---|
[593] | 168 | xor ch, FLG_HOTKEY_HD_FIRST ; Clear CH if HD is selected for boot, set otherwise
|
---|
[492] | 169 | mov di, g_szHDD
|
---|
[392] | 170 | call FormatDriveHotkeyString
|
---|
| 171 | ; Fall to .PrintBootMenuHotkey
|
---|
| 172 |
|
---|
| 173 | ;--------------------------------------------------------------------
|
---|
| 174 | ; .PrintBootMenuHotkey
|
---|
| 175 | ; Parameters:
|
---|
| 176 | ; ES: BDA segment (zero)
|
---|
| 177 | ; Returns:
|
---|
| 178 | ; Nothing
|
---|
| 179 | ; Corrupts registers:
|
---|
| 180 | ; AX, CX, DX, SI, DI
|
---|
| 181 | ;--------------------------------------------------------------------
|
---|
| 182 | .PrintBootMenuHotkey:
|
---|
| 183 | %ifdef MODULE_BOOT_MENU
|
---|
[492] | 184 | mov ax, BOOT_MENU_HOTKEY_SCANCODE | ('2' << 8)
|
---|
| 185 | mov di, g_szBootMenu
|
---|
[392] | 186 | call FormatFunctionHotkeyString
|
---|
| 187 | %endif
|
---|
[492] | 188 | ; Fall to .PrintComDetectHotkey
|
---|
[392] | 189 |
|
---|
| 190 | ;--------------------------------------------------------------------
|
---|
[492] | 191 | ; .PrintComDetectHotkey
|
---|
| 192 | ; Parameters:
|
---|
| 193 | ; ES: BDA segment (zero)
|
---|
| 194 | ; Returns:
|
---|
| 195 | ; Nothing
|
---|
| 196 | ; Corrupts registers:
|
---|
| 197 | ; AX, CX, DX, SI, DI
|
---|
| 198 | ;--------------------------------------------------------------------
|
---|
| 199 | .PrintComDetectHotkey:
|
---|
| 200 | %ifdef MODULE_SERIAL
|
---|
| 201 | mov ax, COM_DETECT_HOTKEY_SCANCODE | ('6' << 8)
|
---|
| 202 | mov di, g_szHotComDetect
|
---|
| 203 | call FormatFunctionHotkeyString
|
---|
| 204 | %endif
|
---|
[505] | 205 | ; Fall to .PrintRomBootHotkey
|
---|
[492] | 206 |
|
---|
| 207 | ;--------------------------------------------------------------------
|
---|
[392] | 208 | ; .PrintRomBootHotkey
|
---|
| 209 | ; Parameters:
|
---|
| 210 | ; ES: BDA segment (zero)
|
---|
| 211 | ; Returns:
|
---|
| 212 | ; Nothing
|
---|
| 213 | ; Corrupts registers:
|
---|
| 214 | ; AX, CX, DX, SI, DI
|
---|
| 215 | ;--------------------------------------------------------------------
|
---|
| 216 | .PrintRomBootHotkey:
|
---|
[492] | 217 | mov ax, ROM_BOOT_HOTKEY_SCANCODE | ('8' << 8)
|
---|
| 218 | mov di, g_szRomBoot
|
---|
[392] | 219 | call FormatFunctionHotkeyString
|
---|
| 220 | ; Fall to .EndHotkeyBarRendering
|
---|
| 221 |
|
---|
| 222 | ;--------------------------------------------------------------------
|
---|
| 223 | ; .EndHotkeyBarRendering
|
---|
| 224 | ; Parameters:
|
---|
| 225 | ; Stack: Screen coordinates before drawing Hotkey Bar
|
---|
| 226 | ; Returns:
|
---|
| 227 | ; Nothing
|
---|
| 228 | ; Corrupts registers:
|
---|
| 229 | ; AX, CX, DI
|
---|
| 230 | ;--------------------------------------------------------------------
|
---|
| 231 | .EndHotkeyBarRendering:
|
---|
| 232 | call HotkeyBar_ClearRestOfTopRow
|
---|
| 233 | pop ax
|
---|
| 234 | jmp SHORT HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 235 |
|
---|
| 236 |
|
---|
| 237 | ;--------------------------------------------------------------------
|
---|
| 238 | ; HotkeyBar_ClearRestOfTopRow
|
---|
| 239 | ; Parameters:
|
---|
| 240 | ; Nothing
|
---|
| 241 | ; Returns:
|
---|
| 242 | ; Nothing
|
---|
| 243 | ; Corrupts registers:
|
---|
| 244 | ; AX, CX, DI
|
---|
| 245 | ;--------------------------------------------------------------------
|
---|
| 246 | HotkeyBar_ClearRestOfTopRow:
|
---|
[505] | 247 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
|
---|
[392] | 248 | eMOVZX cx, al
|
---|
[505] | 249 | CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
|
---|
[392] | 250 | sub cl, al
|
---|
| 251 | mov al, ' '
|
---|
[505] | 252 | JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
|
---|
[392] | 253 |
|
---|
| 254 |
|
---|
| 255 | ;--------------------------------------------------------------------
|
---|
| 256 | ; FormatDriveHotkeyString
|
---|
| 257 | ; Parameters:
|
---|
[593] | 258 | ; CH: Zero if letter in CL is selected for boot
|
---|
[392] | 259 | ; CL: Drive letter hotkey from BOOTVARS
|
---|
[492] | 260 | ; AL: First character for drive key string
|
---|
| 261 | ; AH: Second character for drive key string (ANGLE_QUOTE_RIGHT)
|
---|
[392] | 262 | ; SI: Offset to hotkey description string
|
---|
| 263 | ; ES: BDA segment (zero)
|
---|
| 264 | ; Returns:
|
---|
| 265 | ; Nothing
|
---|
| 266 | ; Corrupts registers:
|
---|
| 267 | ; AX, CX, DX, SI, DI
|
---|
| 268 | ;--------------------------------------------------------------------
|
---|
[593] | 269 | FormatDriveHotkeyString:
|
---|
| 270 | ; Invalid scancodes are filtered on HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 271 | ; so here we have either drive letter or function key pressed. If latter, draw
|
---|
| 272 | ; drive letters as unselected
|
---|
| 273 | cmp BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], FIRST_FUNCTION_KEY_SCANCODE
|
---|
| 274 | jae SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
|
---|
[392] | 275 |
|
---|
[593] | 276 | ; Drive selected to boot from?
|
---|
| 277 | test ch, ch
|
---|
| 278 | jnz SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
|
---|
| 279 | jmp SHORT GetSelectedHotkeyDescriptionAttributeToDX
|
---|
| 280 |
|
---|
| 281 |
|
---|
[392] | 282 | ;--------------------------------------------------------------------
|
---|
| 283 | ; FormatFunctionHotkeyString
|
---|
| 284 | ; Parameters:
|
---|
[492] | 285 | ; AL: Scancode of function key, to know which if any to show as selected
|
---|
| 286 | ; Later replaced with an 'F' for the call to the output routine
|
---|
| 287 | ; AH: Second character for drive key string
|
---|
[392] | 288 | ; SI: Offset to hotkey description string
|
---|
| 289 | ; ES: BDA segment (zero)
|
---|
| 290 | ; Returns:
|
---|
| 291 | ; Nothing
|
---|
| 292 | ; Corrupts registers:
|
---|
| 293 | ; AX, CX, DX, SI, DI
|
---|
| 294 | ;--------------------------------------------------------------------
|
---|
| 295 | FormatFunctionHotkeyString:
|
---|
[492] | 296 | xor cx, cx ; Null character, eaten in output routines
|
---|
[392] | 297 |
|
---|
[492] | 298 | cmp [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], al
|
---|
| 299 | mov al, 'F' ; Replace scancode with character for output
|
---|
[392] | 300 |
|
---|
| 301 | %ifdef MODULE_BOOT_MENU
|
---|
[492] | 302 |
|
---|
[593] | 303 | GetSelectedHotkeyDescriptionAttributeToDX:
|
---|
[596] | 304 | mov si, ATTRIBUTE_CHARS.cHighlightedItem ; Selected hotkey
|
---|
[593] | 305 | je SHORT GetDescriptionAttributeToDX ; From compare with bScancode above and from FormatDriveHotkeyString
|
---|
[392] | 306 |
|
---|
| 307 | GetNonSelectedHotkeyDescriptionAttributeToDX:
|
---|
[596] | 308 | mov si, ATTRIBUTE_CHARS.cItem ; Unselected hotkey
|
---|
[392] | 309 |
|
---|
| 310 | ; Display Library should not be called like this
|
---|
| 311 | GetDescriptionAttributeToDX:
|
---|
[492] | 312 | xchg dx, ax
|
---|
[392] | 313 | call MenuAttribute_GetToAXfromTypeInSI
|
---|
| 314 | xchg dx, ax ; DX = Description attribute
|
---|
[505] | 315 | ;; fall through to PushHotkeyParamsAndFormat
|
---|
[392] | 316 |
|
---|
| 317 |
|
---|
[500] | 318 | %else ; if no MODULE_BOOT_MENU - No boot menu so use simpler attributes
|
---|
| 319 |
|
---|
[593] | 320 | GetSelectedHotkeyDescriptionAttributeToDX:
|
---|
[410] | 321 | mov dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
|
---|
[593] | 322 | je SHORT SelectAttributeFromDHorDLbasedOnVideoMode ; From compare with bScancode above and from FormatDriveHotkeyString
|
---|
[392] | 323 |
|
---|
| 324 | GetNonSelectedHotkeyDescriptionAttributeToDX:
|
---|
[410] | 325 | mov dx, (COLOR_ATTRIBUTE(COLOR_BLACK, COLOR_CYAN) << 8) | MONO_REVERSE
|
---|
[492] | 326 |
|
---|
[410] | 327 | SelectAttributeFromDHorDLbasedOnVideoMode:
|
---|
[500] | 328 | mov ch, [es:BDA.bVidMode] ; We only need to preserve CL
|
---|
| 329 | shr ch, 1
|
---|
[410] | 330 | jnc SHORT .AttributeLoadedToDL ; Black & White modes
|
---|
[500] | 331 | shr ch, 1
|
---|
[410] | 332 | jnz SHORT .AttributeLoadedToDL ; MDA
|
---|
| 333 | mov dl, dh
|
---|
| 334 | .AttributeLoadedToDL:
|
---|
[505] | 335 | ;; fall through to PushHotkeyParamsAndFormat
|
---|
[410] | 336 |
|
---|
[492] | 337 | %endif ; MODULE_BOOT_MENU
|
---|
[392] | 338 |
|
---|
| 339 |
|
---|
| 340 | ;--------------------------------------------------------------------
|
---|
| 341 | ; PushHotkeyParamsAndFormat
|
---|
| 342 | ; Parameters:
|
---|
[500] | 343 | ; AL: First character
|
---|
| 344 | ; AH: Second character
|
---|
[392] | 345 | ; DX: Description Attribute
|
---|
| 346 | ; CX: Description string parameter
|
---|
[492] | 347 | ; CS:DI: Description string
|
---|
[392] | 348 | ; Returns:
|
---|
| 349 | ; Nothing
|
---|
| 350 | ; Corrupts registers:
|
---|
| 351 | ; AX, SI, DI
|
---|
| 352 | ;--------------------------------------------------------------------
|
---|
| 353 | PushHotkeyParamsAndFormat:
|
---|
| 354 | push bp
|
---|
| 355 | mov bp, sp
|
---|
| 356 |
|
---|
[492] | 357 | mov si, MONO_BRIGHT
|
---|
[392] | 358 |
|
---|
[492] | 359 | push si ; Key attribute
|
---|
| 360 | push ax ; First Character
|
---|
| 361 | mov al, ah
|
---|
| 362 | push ax ; Second Character
|
---|
| 363 |
|
---|
[392] | 364 | push dx ; Description attribute
|
---|
[492] | 365 | push di ; Description string
|
---|
[392] | 366 | push cx ; Description string parameter
|
---|
[505] | 367 |
|
---|
[492] | 368 | push si ; Key attribute for last space
|
---|
[392] | 369 |
|
---|
| 370 | mov si, g_szHotkey
|
---|
| 371 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
| 372 |
|
---|
| 373 |
|
---|
| 374 | ;--------------------------------------------------------------------
|
---|
| 375 | ; MoveCursorToScreenTopLeftCorner
|
---|
| 376 | ; Parameters:
|
---|
| 377 | ; Nothing
|
---|
| 378 | ; Returns:
|
---|
| 379 | ; Nothing
|
---|
| 380 | ; Corrupts registers:
|
---|
| 381 | ; AX, DI
|
---|
| 382 | ;--------------------------------------------------------------------
|
---|
| 383 | MoveCursorToScreenTopLeftCorner:
|
---|
| 384 | xor ax, ax ; Top left corner (0, 0)
|
---|
| 385 | ; Fall to HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 386 |
|
---|
| 387 |
|
---|
| 388 | ;--------------------------------------------------------------------
|
---|
| 389 | ; HotkeyBar_RestoreCursorCoordinatesFromAX
|
---|
| 390 | ; Parameters:
|
---|
| 391 | ; Nothing
|
---|
| 392 | ; Returns:
|
---|
| 393 | ; Nothing
|
---|
| 394 | ; Corrupts registers:
|
---|
| 395 | ; AX, DI
|
---|
| 396 | ;--------------------------------------------------------------------
|
---|
| 397 | HotkeyBar_RestoreCursorCoordinatesFromAX:
|
---|
[505] | 398 | JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
|
---|
[392] | 399 |
|
---|
| 400 |
|
---|
| 401 | ;--------------------------------------------------------------------
|
---|
[599] | 402 | ; HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
|
---|
| 403 | ; Parameters:
|
---|
| 404 | ; ES: BDA Segment
|
---|
| 405 | ; Returns:
|
---|
| 406 | ; Nothing
|
---|
| 407 | ; Corrupts registers:
|
---|
| 408 | ; AX
|
---|
| 409 | ;--------------------------------------------------------------------
|
---|
| 410 | HotkeyBar_StoreDefaultDriveLettersToHotkeyVars:
|
---|
| 411 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
| 412 | mov ah, DEFAULT_FLOPPY_DRIVE_LETTER
|
---|
| 413 | xchg al, ah
|
---|
| 414 | mov [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], ax
|
---|
| 415 | ret
|
---|
| 416 |
|
---|
| 417 |
|
---|
| 418 | ;--------------------------------------------------------------------
|
---|
| 419 | ; HotkeyBar_InitializeVariables
|
---|
| 420 | ; Parameters:
|
---|
| 421 | ; DS: RAMVARS Segment
|
---|
| 422 | ; ES: BDA Segment
|
---|
| 423 | ; Returns:
|
---|
| 424 | ; Nothing
|
---|
| 425 | ; Corrupts registers:
|
---|
| 426 | ; AX, CX, DX, DI
|
---|
| 427 | ;--------------------------------------------------------------------
|
---|
| 428 | HotkeyBar_InitializeVariables:
|
---|
| 429 | push ds
|
---|
| 430 | push es
|
---|
| 431 | pop ds
|
---|
| 432 |
|
---|
| 433 | ; Store system 1Ch Timer Tick handler and install our hotkeybar handler
|
---|
[601] | 434 | mov ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4]
|
---|
[599] | 435 | mov [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler], ax
|
---|
[601] | 436 | mov ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4+2]
|
---|
[599] | 437 | mov [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2], ax
|
---|
[601] | 438 | mov al, BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch
|
---|
[599] | 439 | mov si, HotkeyBar_TimerTickHandler
|
---|
| 440 | call Interrupts_InstallHandlerToVectorInALFromCSSI
|
---|
| 441 |
|
---|
| 442 | ; Store time when hotkeybar is displayed
|
---|
| 443 | ; (it will be displayed after initialization is complete)
|
---|
| 444 | call TimerTicks_ReadFromBdaToAX
|
---|
| 445 | mov [BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
|
---|
| 446 |
|
---|
| 447 | pop ds
|
---|
| 448 |
|
---|
| 449 | ; Initialize HOTKEYVARS by storing default drives to boot from
|
---|
| 450 | call HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
|
---|
| 451 | mov dl, [cs:ROMVARS.bBootDrv]
|
---|
| 452 | ; Fall to HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
|
---|
| 453 |
|
---|
| 454 |
|
---|
| 455 | ;--------------------------------------------------------------------
|
---|
[528] | 456 | ; HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
|
---|
[395] | 457 | ; Parameters:
|
---|
| 458 | ; DS: RAMVARS segment
|
---|
| 459 | ; ES: BDA segment (zero)
|
---|
[528] | 460 | ; DL: Drive Number
|
---|
| 461 | ; Returns:
|
---|
| 462 | ; Nothing
|
---|
| 463 | ; Corrupts registers:
|
---|
| 464 | ; AX, CX, DL, DI
|
---|
| 465 | ;--------------------------------------------------------------------
|
---|
| 466 | HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL:
|
---|
| 467 | call DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
|
---|
| 468 | ; Fall to StoreHotkeyToBootvarsForDriveLetterInDL
|
---|
| 469 |
|
---|
| 470 |
|
---|
| 471 | ;--------------------------------------------------------------------
|
---|
| 472 | ; StoreHotkeyToBootvarsForDriveLetterInDL
|
---|
| 473 | ; Parameters:
|
---|
| 474 | ; DS: RAMVARS segment
|
---|
| 475 | ; ES: BDA segment (zero)
|
---|
[395] | 476 | ; DL: Drive Letter ('A'...)
|
---|
| 477 | ; Returns:
|
---|
| 478 | ; Nothing
|
---|
| 479 | ; Corrupts registers:
|
---|
| 480 | ; AX, CX, DI
|
---|
| 481 | ;--------------------------------------------------------------------
|
---|
[528] | 482 | StoreHotkeyToBootvarsForDriveLetterInDL:
|
---|
[395] | 483 | eMOVZX ax, dl
|
---|
[505] | 484 | or al, 32 ; Upper case drive letter to lower case keystroke
|
---|
[395] | 485 | jmp SHORT HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 486 |
|
---|
| 487 |
|
---|
| 488 | ;--------------------------------------------------------------------
|
---|
[528] | 489 | ; ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[392] | 490 | ; Parameters:
|
---|
| 491 | ; DS: RAMVARS segment
|
---|
| 492 | ; ES: BDA segment (zero)
|
---|
| 493 | ; Returns:
|
---|
[492] | 494 | ; AL: Last scancode value
|
---|
[392] | 495 | ; Corrupts registers:
|
---|
[492] | 496 | ; AH, CX
|
---|
[392] | 497 | ;--------------------------------------------------------------------
|
---|
[528] | 498 | ScanHotkeysFromKeyBufferAndStoreToBootvars:
|
---|
[392] | 499 | call Keyboard_GetKeystrokeToAX
|
---|
| 500 | jz SHORT NoHotkeyToProcess
|
---|
| 501 |
|
---|
[528] | 502 | ; Prepare to read another key from buffer
|
---|
| 503 | ePUSH_T cx, ScanHotkeysFromKeyBufferAndStoreToBootvars
|
---|
[392] | 504 | ; Fall to HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 505 |
|
---|
| 506 |
|
---|
| 507 | ;--------------------------------------------------------------------
|
---|
| 508 | ; HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
|
---|
| 509 | ; Parameters:
|
---|
| 510 | ; AL: Hotkey ASCII code
|
---|
| 511 | ; AH: Hotkey Scancode
|
---|
| 512 | ; DS: RAMVARS segment
|
---|
| 513 | ; ES: BDA segment (zero)
|
---|
| 514 | ; Returns:
|
---|
[567] | 515 | ; AL: Last scancode seen
|
---|
[528] | 516 | ; CF: Set if valid hotkey in AL
|
---|
| 517 | ; Clear if scancode in AL is not for any hotkey
|
---|
[392] | 518 | ; Corrupts registers:
|
---|
[492] | 519 | ; AH, CX, DI
|
---|
[392] | 520 | ;--------------------------------------------------------------------
|
---|
| 521 | HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX:
|
---|
[492] | 522 | mov di, BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode
|
---|
[392] | 523 |
|
---|
[492] | 524 | ; All scancodes are saved, even if it wasn't a drive letter,
|
---|
| 525 | ; which also covers our function key case. Invalid function keys
|
---|
[505] | 526 | ; will not do anything (won't be printed, won't be accepted as input)
|
---|
[492] | 527 | mov [es:di], ah
|
---|
[505] | 528 |
|
---|
[392] | 529 | ; Drive letter hotkeys remaining, allow 'a' to 'z'
|
---|
| 530 | call Char_IsLowerCaseLetterInAL
|
---|
[492] | 531 | jnc SHORT .KeystrokeIsNotValidDriveLetter
|
---|
[505] | 532 | and al, ~32 ; We want to print upper case letters
|
---|
[392] | 533 |
|
---|
| 534 | ; Clear HD First flag to assume Floppy Drive hotkey
|
---|
[492] | 535 | dec di
|
---|
[392] | 536 | and BYTE [es:di], ~FLG_HOTKEY_HD_FIRST
|
---|
| 537 |
|
---|
| 538 | ; Determine if Floppy or Hard Drive hotkey
|
---|
[505] | 539 | xchg cx, ax
|
---|
[547] | 540 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
[392] | 541 | cmp cl, al
|
---|
| 542 | jb SHORT .StoreDriveLetter ; Store Floppy Drive letter
|
---|
| 543 |
|
---|
| 544 | ; Store Hard Drive letter
|
---|
| 545 | or BYTE [es:di], FLG_HOTKEY_HD_FIRST
|
---|
| 546 |
|
---|
| 547 | .StoreDriveLetter:
|
---|
[505] | 548 | sbb di, BYTE 1 ; Sub CF if Floppy Drive
|
---|
[392] | 549 | xchg ax, cx
|
---|
[592] | 550 | stosb
|
---|
[528] | 551 | stc ; Valid hotkey scancode returned in AL
|
---|
[392] | 552 |
|
---|
[505] | 553 | .KeystrokeIsNotValidDriveLetter:
|
---|
[392] | 554 | NoHotkeyToProcess:
|
---|
[492] | 555 | mov al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
|
---|
[392] | 556 | ret
|
---|
| 557 |
|
---|
[528] | 558 |
|
---|
[392] | 559 | ;--------------------------------------------------------------------
|
---|
[492] | 560 | ; HotkeyBar_GetBootDriveNumbersToDX
|
---|
[392] | 561 | ; Parameters:
|
---|
| 562 | ; DS: RAMVARS segment
|
---|
| 563 | ; ES: BDA segment (zero)
|
---|
| 564 | ; Returns:
|
---|
[492] | 565 | ; DX: Drives selected as boot device, DL is primary
|
---|
[392] | 566 | ; Corrupts registers:
|
---|
[492] | 567 | ; AX
|
---|
[392] | 568 | ;--------------------------------------------------------------------
|
---|
[492] | 569 | HotkeyBar_GetBootDriveNumbersToDX:
|
---|
[500] | 570 | mov dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters]
|
---|
[600] | 571 |
|
---|
| 572 | ; HotkeyBar_GetBootDriveNumbersToDX is called when all drives are detected and
|
---|
| 573 | ; drive letters are known.
|
---|
| 574 | ; Replace unavailable hard drive letter with first hard drive.
|
---|
| 575 | ; If we have boot menu, it will be displayed instead.
|
---|
| 576 | %ifndef MODULE_BOOT_MENU
|
---|
| 577 | call BootVars_GetLetterForFirstHardDriveToAX
|
---|
| 578 | mov ah, al
|
---|
| 579 | add al, [es:BDA.bHDCount] ; AL now contains first unavailable HD letter
|
---|
| 580 | cmp dh, al ; Unavailable drive?
|
---|
| 581 | jb SHORT .ValidHardDriveLetterInDH
|
---|
| 582 | mov dh, ah ; Replace unavailable drive with first drive
|
---|
| 583 | .ValidHardDriveLetterInDH:
|
---|
| 584 | %endif
|
---|
| 585 |
|
---|
[505] | 586 | test BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST
|
---|
[600] | 587 | jnz SHORT .noflip
|
---|
[392] | 588 | xchg dl, dh
|
---|
[505] | 589 | .noflip:
|
---|
[492] | 590 | call DriveXlate_ConvertDriveLetterInDLtoDriveNumber
|
---|
| 591 | xchg dl, dh
|
---|
[505] | 592 | ; Fall to HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber
|
---|
[392] | 593 |
|
---|
[505] | 594 | HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
|
---|
| 595 |
|
---|