Changeset 492 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
- Timestamp:
- Dec 21, 2012, 1:01:55 AM (12 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm
r491 r492 32 32 ;-------------------------------------------------------------------- 33 33 HotkeyBar_UpdateDuringDriveDetection: 34 call ScanHotkeysFromKeyBufferAndStoreToBootvars34 call HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars 35 35 ; Fall to HotkeyBar_DrawToTopOfScreen 36 37 36 37 38 38 ;-------------------------------------------------------------------- 39 39 ; HotkeyBar_DrawToTopOfScreen … … 66 66 ;-------------------------------------------------------------------- 67 67 .PrintFloppyDriveHotkeys: 68 mov cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters] 69 68 70 call FloppyDrive_GetCountToAX 69 71 test ax, ax ; Any Floppy Drives? 70 72 jz SHORT .SkipFloppyDriveHotkeys 71 73 72 mov di, DEFAULT_FLOPPY_DRIVE_LETTER | (ANGLE_QUOTE_RIGHT<<8) 73 mov cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFddLetter] 74 mov si, g_szFDD 74 mov ax, (ANGLE_QUOTE_RIGHT << 8) | DEFAULT_FLOPPY_DRIVE_LETTER 75 mov di, g_szFDD 75 76 call FormatDriveHotkeyString 76 77 … … 88 89 ; AX, CX, DX, SI, DI 89 90 ;-------------------------------------------------------------------- 90 call HotkeyBar_GetLetterForFirstHardDriveToAX91 call DriveXlate_GetLetterForFirstHardDriveToAX 91 92 mov ah, ANGLE_QUOTE_RIGHT 92 xchg di, ax 93 mov cl, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bHddLetter] 94 mov si, g_szHDD 93 mov cl, ch 94 mov di, g_szHDD 95 95 call FormatDriveHotkeyString 96 96 ; Fall to .PrintBootMenuHotkey … … 107 107 .PrintBootMenuHotkey: 108 108 %ifdef MODULE_BOOT_MENU 109 mov ah, BOOT_MENU_HOTKEY_SCANCODE 110 mov di, 'F' | ('2'<<8) ; F2 111 mov si, g_szBootMenu 109 mov ax, BOOT_MENU_HOTKEY_SCANCODE | ('2' << 8) 110 mov di, g_szBootMenu 112 111 call FormatFunctionHotkeyString 113 112 %endif 114 ; Fall to .PrintRomBootHotkey 113 ; Fall to .PrintComDetectHotkey 114 115 ;-------------------------------------------------------------------- 116 ; .PrintComDetectHotkey 117 ; Parameters: 118 ; ES: BDA segment (zero) 119 ; Returns: 120 ; Nothing 121 ; Corrupts registers: 122 ; AX, CX, DX, SI, DI 123 ;-------------------------------------------------------------------- 124 .PrintComDetectHotkey: 125 %ifdef MODULE_SERIAL 126 mov ax, COM_DETECT_HOTKEY_SCANCODE | ('6' << 8) 127 mov di, g_szHotComDetect 128 call FormatFunctionHotkeyString 129 %endif 130 ; Fall to .PrintRomBootHotkey 115 131 116 132 ;-------------------------------------------------------------------- … … 124 140 ;-------------------------------------------------------------------- 125 141 .PrintRomBootHotkey: 126 mov ah, ROM_BOOT_HOTKEY_SCANCODE 127 mov di, 'F' | ('8'<<8) ; F8 128 mov si, g_szRomBoot 142 mov ax, ROM_BOOT_HOTKEY_SCANCODE | ('8' << 8) 143 mov di, g_szRomBoot 129 144 call FormatFunctionHotkeyString 130 145 ; Fall to .EndHotkeyBarRendering … … 168 183 ; Parameters: 169 184 ; CL: Drive letter hotkey from BOOTVARS 170 ; DI low:First character for drive key string171 ; DI high:Second character for drive key string (ANGLE_QUOTE_RIGHT)185 ; AL: First character for drive key string 186 ; AH: Second character for drive key string (ANGLE_QUOTE_RIGHT) 172 187 ; SI: Offset to hotkey description string 173 188 ; ES: BDA segment (zero) … … 177 192 ; AX, CX, DX, SI, DI 178 193 ;-------------------------------------------------------------------- 179 FormatDriveHotkeyString: 180 ePUSH_T ax, PushHotkeyParamsAndFormat 181 jmp SHORT GetNonSelectedHotkeyDescriptionAttributeToDX 182 194 ;; No work to do before going into FormatFunctionHotkeyString 195 FormatDriveHotkeyString equ GetNonSelectedHotkeyDescriptionAttributeToDX 183 196 184 197 ;-------------------------------------------------------------------- 185 198 ; FormatFunctionHotkeyString 186 199 ; Parameters: 187 ; AH: Hotkey scancode to compare with BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode 200 ; AL: Scancode of function key, to know which if any to show as selected 201 ; Later replaced with an 'F' for the call to the output routine 202 ; AH: Second character for drive key string 188 203 ; SI: Offset to hotkey description string 189 ; DI low: First character for drive key string190 ; DI high: Second character for drive key string191 204 ; ES: BDA segment (zero) 192 205 ; Returns: … … 196 209 ;-------------------------------------------------------------------- 197 210 FormatFunctionHotkeyString: 198 ePUSH_T ax, PushHotkeyParamsAndFormat 199 mov cx, g_szBoot ; Description parameter string 200 cmp [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ah 201 jne SHORT GetNonSelectedHotkeyDescriptionAttributeToDX 202 ; Fall to GetSelectedHotkeyDescriptionAttributeToDX 203 204 205 ;-------------------------------------------------------------------- 206 ; GetSelectedHotkeyDescriptionAttributeToDX 207 ; GetNonSelectedHotkeyDescriptionAttributeToDX 208 ; Parameters: 209 ; CF: Set if selected hotkey 210 ; Cleared if unselected hotkey 211 ; ES: BDA segment (zero) 212 ; Returns: 213 ; DX: Description Attribute 214 ; Corrupts registers: 215 ; AX 216 ;-------------------------------------------------------------------- 211 xor cx, cx ; Null character, eaten in output routines 212 213 cmp [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], al 214 mov al, 'F' ; Replace scancode with character for output 215 217 216 %ifdef MODULE_BOOT_MENU 218 GetSelectedHotkeyDescriptionAttributeToDX: 219 push si 217 220 218 mov si, ATTRIBUTE_CHARS.cHurryTimeout ; Selected hotkey 221 j mp SHORT GetDescriptionAttributeToDX219 jz SHORT GetDescriptionAttributeToDX ; From compare with bScancode above 222 220 223 221 GetNonSelectedHotkeyDescriptionAttributeToDX: 224 push si225 222 mov si, ATTRIBUTE_CHARS.cHighlightedItem ; Unselected hotkey 226 223 227 224 ; Display Library should not be called like this 228 225 GetDescriptionAttributeToDX: 226 xchg dx, ax 229 227 call MenuAttribute_GetToAXfromTypeInSI 230 pop si231 228 xchg dx, ax ; DX = Description attribute 232 ret 233 234 %else ; No boot menu so use simpler attributes 235 236 GetSelectedHotkeyDescriptionAttributeToDX: 229 ;; fall through to PushHotkeyParamsAndFormat 230 231 %else ; MODULE_BOOT_MENU - No boot menu so use simpler attributes 232 237 233 mov dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK 238 j mp SHORT SelectAttributeFromDHorDLbasedOnVideoMode234 jz SHORT SelectAttributeFromDHorDLbasedOnVideoMode ; From compare with bScancode above 239 235 240 236 GetNonSelectedHotkeyDescriptionAttributeToDX: 241 237 mov dx, (COLOR_ATTRIBUTE(COLOR_BLACK, COLOR_CYAN) << 8) | MONO_REVERSE 238 242 239 SelectAttributeFromDHorDLbasedOnVideoMode: 243 240 mov al, [es:BDA.bVidMode] … … 248 245 mov dl, dh 249 246 .AttributeLoadedToDL: 250 ret251 252 %endif 247 ;; fall through to PushHotkeyParamsAndFormat 248 249 %endif ; MODULE_BOOT_MENU 253 250 254 251 … … 256 253 ; PushHotkeyParamsAndFormat 257 254 ; Parameters: 258 ; DI low:First character259 ; DI high:Second character255 ; BL: First character 256 ; BH: Second character 260 257 ; DX: Description Attribute 261 258 ; CX: Description string parameter 262 ; CS: SI: Description string259 ; CS:DI: Description string 263 260 ; Returns: 264 261 ; Nothing … … 270 267 mov bp, sp 271 268 272 mov ax, MONO_BRIGHT273 push ax ; Key attribute 274 xchg ax, di275 push ax ; First character276 xchgal, ah277 push ax ; Second character269 mov si, MONO_BRIGHT 270 271 push si ; Key attribute 272 push ax ; First Character 273 mov al, ah 274 push ax ; Second Character 278 275 279 276 push dx ; Description attribute 280 push si ; Description string277 push di ; Description string 281 278 push cx ; Description string parameter 282 283 push di ; Key attribute for last space 279 280 push si ; Key attribute for last space 281 284 282 mov si, g_szHotkey 285 283 jmp DetectPrint_FormatCSSIfromParamsInSSBP … … 332 330 333 331 ;-------------------------------------------------------------------- 334 ; ScanHotkeysFromKeyBufferAndStoreToBootvars335 ; Parameters: 336 ; DS: RAMVARS segment 337 ; ES: BDA segment (zero) 338 ; Returns: 339 ; Nothing340 ; Corrupts registers: 341 ; A X, CX342 ;-------------------------------------------------------------------- 343 ScanHotkeysFromKeyBufferAndStoreToBootvars:332 ; HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars 333 ; Parameters: 334 ; DS: RAMVARS segment 335 ; ES: BDA segment (zero) 336 ; Returns: 337 ; AL: Last scancode value 338 ; Corrupts registers: 339 ; AH, CX 340 ;-------------------------------------------------------------------- 341 HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars: 344 342 call Keyboard_GetKeystrokeToAX 345 343 jz SHORT NoHotkeyToProcess 346 344 347 ePUSH_T cx, ScanHotkeysFromKeyBufferAndStoreToBootvars345 ePUSH_T cx, HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars 348 346 ; Fall to HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX 349 347 … … 357 355 ; ES: BDA segment (zero) 358 356 ; Returns: 359 ; CF: Set if valid keystroke 360 ; Clear if invalid keystroke 361 ; Corrupts registers: 362 ; AX, CX, DI 357 ; AL: Last scancode seen 358 ; Corrupts registers: 359 ; AH, CX, DI 363 360 ;-------------------------------------------------------------------- 364 361 HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX: 365 ; Boot menu 366 %ifdef MODULE_BOOT_MENU 367 cmp ah, BOOT_MENU_HOTKEY_SCANCODE ; Display Boot Menu? 368 je SHORT .StoreFunctionHotkeyFromAH 369 %endif 370 371 ; ROM Boot 372 cmp ah, ROM_BOOT_HOTKEY_SCANCODE ; ROM Boot? 373 je SHORT .StoreFunctionHotkeyFromAH 374 362 mov di, BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode 363 364 ; All scancodes are saved, even if it wasn't a drive letter, 365 ; which also covers our function key case. Invalid function keys 366 ; will not do anything (won't be printed, won't be accepted as input) 367 mov [es:di], ah 368 375 369 ; Drive letter hotkeys remaining, allow 'a' to 'z' 376 370 call Char_IsLowerCaseLetterInAL 377 jnc SHORT .KeystrokeIsNotValid Hotkey371 jnc SHORT .KeystrokeIsNotValidDriveLetter 378 372 xor al, 32 ; We want to print upper case letters 379 373 380 374 ; Clear HD First flag to assume Floppy Drive hotkey 381 mov di, BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags375 dec di 382 376 and BYTE [es:di], ~FLG_HOTKEY_HD_FIRST 383 377 384 378 ; Determine if Floppy or Hard Drive hotkey 385 379 eMOVZX cx, al ; Clear CH to clear scancode 386 call HotkeyBar_GetLetterForFirstHardDriveToAX380 call DriveXlate_GetLetterForFirstHardDriveToAX 387 381 cmp cl, al 388 382 jb SHORT .StoreDriveLetter ; Store Floppy Drive letter … … 392 386 393 387 .StoreDriveLetter: 394 adc di, BYTE 1 ; AddCF if Floppy Drive388 sbb di, BYTE 1 ; Sub CF if Floppy Drive 395 389 xchg ax, cx 396 390 mov [es:di], al ; AH = zero to clear function hotkey 397 391 398 .StoreFunctionHotkeyFromAH: 399 mov [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ah 400 stc ; Valid hotkey 401 402 .KeystrokeIsNotValidHotkey: 392 .KeystrokeIsNotValidDriveLetter: 403 393 NoHotkeyToProcess: 394 mov al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode] 404 395 ret 405 396 406 407 ;-------------------------------------------------------------------- 408 ; HotkeyBar_GetSecondaryBootDriveNumberToDL 409 ; HotkeyBar_GetPrimaryBootDriveNumberToDL 410 ; Parameters: 411 ; DS: RAMVARS segment 412 ; ES: BDA segment (zero) 413 ; Returns: 414 ; DL: Drive selected as boot device 415 ; Corrupts registers: 416 ; AX, DH 417 ;-------------------------------------------------------------------- 418 HotkeyBar_GetSecondaryBootDriveNumberToDL: 397 ;-------------------------------------------------------------------- 398 ; HotkeyBar_GetBootDriveNumbersToDX 399 ; Parameters: 400 ; DS: RAMVARS segment 401 ; ES: BDA segment (zero) 402 ; Returns: 403 ; DX: Drives selected as boot device, DL is primary 404 ; Corrupts registers: 405 ; AX 406 ;-------------------------------------------------------------------- 407 HotkeyBar_GetBootDriveNumbersToDX: 419 408 mov dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters] 409 test BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST 410 jnz .noflip 420 411 xchg dl, dh 421 jmp SHORT GetBootDriveNumberFromLettersInDX 422 423 HotkeyBar_GetPrimaryBootDriveNumberToDL: 424 mov dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters] 425 GetBootDriveNumberFromLettersInDX: 426 test BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST 427 eCMOVZ dl, dh 428 ; Fall to HotkeyBar_ConvertDriveLetterInDLtoDriveNumber 429 430 431 ;-------------------------------------------------------------------- 432 ; HotkeyBar_ConvertDriveLetterInDLtoDriveNumber 433 ; Parameters: 434 ; DS: RAMVARS segment 435 ; DL: Drive letter ('A'...) 436 ; Returns: 437 ; DL: Drive number (0xh for Floppy Drives, 8xh for Hard Drives) 438 ; Corrupts registers: 439 ; AX, DH 440 ;-------------------------------------------------------------------- 441 HotkeyBar_ConvertDriveLetterInDLtoDriveNumber: 442 call HotkeyBar_GetLetterForFirstHardDriveToAX 443 cmp dl, al 444 jb SHORT .ConvertLetterInDLtoFloppyDriveNumber 445 446 ; Convert letter in DL to Hard Drive number 447 sub dl, al 448 or dl, 80h 449 ret 450 451 .ConvertLetterInDLtoFloppyDriveNumber: 452 sub dl, DEFAULT_FLOPPY_DRIVE_LETTER 453 ret 454 455 456 ;-------------------------------------------------------------------- 457 ; HotkeyBar_ConvertDriveNumberFromDLtoDriveLetter 458 ; Parameters: 459 ; DL: Drive number (0xh for Floppy Drives, 8xh for Hard Drives) 460 ; DS: RAMVARS Segment 461 ; Returns: 462 ; DL: Drive letter ('A'...) 463 ; CF: Set if Hard Drive 464 ; Clear if Floppy Drive 465 ; Corrupts registers: 466 ; AX 467 ;-------------------------------------------------------------------- 468 HotkeyBar_ConvertDriveNumberFromDLtoDriveLetter: 469 test dl, dl 470 jns SHORT .GetDefaultFloppyDrive 471 472 ; Store default hard drive to boot from 473 call HotkeyBar_GetLetterForFirstHardDriveToAX 474 sub dl, 80h 475 add dl, al 476 stc 477 ret 478 479 .GetDefaultFloppyDrive: 480 add dl, DEFAULT_FLOPPY_DRIVE_LETTER ; Clears CF 481 ret 482 483 484 ;-------------------------------------------------------------------- 485 ; Returns letter for first hard disk. Usually it will be 'C' but it 486 ; can be higher if more than two floppy drives are found. 487 ; 488 ; HotkeyBar_GetLetterForFirstHardDriveToAX 489 ; Parameters: 490 ; DS: RAMVARS segment 491 ; Returns: 492 ; AX: Upper case letter for first hard disk 493 ; Corrupts registers: 494 ; Nothing 495 ;-------------------------------------------------------------------- 496 HotkeyBar_GetLetterForFirstHardDriveToAX: 497 call FloppyDrive_GetCountToAX 498 add al, DEFAULT_FLOPPY_DRIVE_LETTER 499 MAX_U al, DEFAULT_HARD_DRIVE_LETTER 500 ret 412 .noflip: 413 call DriveXlate_ConvertDriveLetterInDLtoDriveNumber 414 xchg dl, dh 415 ; Fall to HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber 416 417 HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber: 418
Note:
See TracChangeset
for help on using the changeset viewer.