Changeset 492 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus


Ignore:
Timestamp:
Dec 21, 2012, 1:01:55 AM (11 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Removed the dependency between MODULE_BOOT_MENU and MODULE_HOTKEYS. With these changes, 0, 1, or 2 of them can be included in a build. This change also means that the hotkeys don't work while the menu is up. But the most important hotkey there was for Rom Boot, and that has been added to the menu as a choice proper. Lots of changes across the board in the hotkeys code - even if we eventually back this change out (becaue, for example we want hotkeys to work in the menu) we should probably start from this base and add that functionality back in, as these changes results in approximately 120 bytes of savings and includes new functionality, such as the Rom Boot menu item and the Com Detect hotkey.

Location:
trunk/XTIDE_Universal_BIOS/Src/Menus
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm

    r392 r492  
    2424; Displays Boot Menu and returns Drive or Function number.
    2525;
    26 ; BootMenu_DisplayAndReturnSelectionInDX
     26; BootMenu_DisplayAndStoreSelection
    2727;   Parameters:
    2828;       DS:     RAMVARS segment
    2929;   Returns:
    30 ;       Nothing, selected drive is converted to hotkey
     30;       DL:     Drive number selected
     31;       CF:     Set if selected item is an actual drive, DL is valid
     32;               Clear if selected item is Rom Boot, DL is invalid
    3133;   Corrupts registers:
    3234;       All General Purpose Registers
    3335;--------------------------------------------------------------------
    34 BootMenu_DisplayAndStoreSelectionAsHotkey:
     36BootMenu_DisplayAndReturnDriveInDLRomBootClearCF:
    3537    call    DriveXlate_Reset
    3638
     
    3840    CALL_MENU_LIBRARY   DisplayWithHandlerInBXandUserDataInDXAX
    3941
     42    xchg    cx, ax
     43       
    4044    ; Clear Boot Menu from screen
    4145    mov     ax, ' ' | (MONO_NORMAL<<8)
    4246    CALL_DISPLAY_LIBRARY    ClearScreenWithCharInALandAttrInAH
    43     ret
    4447
     48    ; fall through to BootMenu_GetDriveToDXforMenuitemInCX
    4549
    4650;--------------------------------------------------------------------
     
    5256;       DS:     RAMVARS segment
    5357;       CF:     Set: There is a selected menu item, DL is valid
    54 ;               Clear: There is no selected menu item, DL is not valid
     58;               Clear: The item selected is Rom Boot, DL is not valid
    5559;   Corrupts registers:
    56 ;       AX, DI
     60;       AX, BX, DI
     61;
     62; NOTE: We can't use the menu structure in here, as we are falling through
     63; through from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the
     64; menu structure has already been destroyed.
    5765;--------------------------------------------------------------------
    5866BootMenu_GetDriveToDXforMenuitemInCX:
    59     cmp     cl, NO_ITEM_HIGHLIGHTED
    60     je      SHORT .ReturnFloppyDriveInDX    ; Clear CF if branch taken
    61 
    6267    mov     dl, cl                          ; Copy menuitem index to DX
    6368    call    FloppyDrive_GetCountToAX
     
    6570    jb      SHORT .ReturnFloppyDriveInDX    ; Set CF if branch taken
    6671    or      al, 80h                         ; Or 80h into AL before the sub
    67                                             ; to cause CF to be set after
    68                                             ; and result has high order bit set
     72                                            ; shorter instruction than or'ing it in afterward
    6973    sub     dl, al                          ; Remove floppy drives from index
    70 
     74    call    RamVars_GetHardDiskCountFromBDAtoAX
     75    or      al, 80h                         ; Or 80h into AL before the sub             
     76    cmp     dl, al                          ; Set CF if hard disk
     77                                            ; Clear CF if last item, beyond hard disk list, which indicates ROM boot
    7178.ReturnFloppyDriveInDX:
    7279    ret
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm

    r489 r492  
    2121SECTION .text
    2222
    23 
    24 ;--------------------------------------------------------------------
    25 ; GetDefaultMenuitemToDL
    26 ;   Parameters:
    27 ;       DL:     Drive number
    28 ;       ES:     Ptr to BDA (zero)
    29 ;   Returns:
    30 ;       DL:     Menuitem index (assuming drive is available)
    31 ;   Corrupts registers:
    32 ;       AX, DH
    33 ;--------------------------------------------------------------------
    34 GetDefaultMenuitemToDX:
    35     mov     dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters]
    36     test    BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST
    37     eCMOVZ  dl, dh
    38     call    IsDriveDLinSystem
    39     jnc     SHORT BootMenuEvent_Handler.DoNotSetDefaultMenuitem
    40     call    DriveXlate_SetDriveToSwap
    41     ; Fall to GetMenuitemToDXforDriveInDL
    42 
    43 
    4423;--------------------------------------------------------------------
    4524; GetMenuitemToDXforDriveInDL
     
    6342
    6443;--------------------------------------------------------------------
    65 ; IsDriveDLinSystem
    66 ;   Parameters:
    67 ;       DL:     Drive number
    68 ;       DS:     RAMVARS segment
    69 ;   Returns:
    70 ;       CF:     Set if drive number is valid
    71 ;               Clear if drive is not present in system
    72 ;   Corrupts registers:
    73 ;       AX, CX
    74 ;--------------------------------------------------------------------
    75 IsDriveDLinSystem:
    76     test    dl, dl                              ; Floppy drive?
    77     jns     SHORT .IsFloppyDriveInSystem
    78     call    RamVars_GetHardDiskCountFromBDAtoAX ; Hard Disk count to AX
    79     or      al, 80h                             ; Set Hard Disk bit to AX
    80     jmp     SHORT .CompareDriveNumberToDriveCount
    81 .IsFloppyDriveInSystem:
    82     call    FloppyDrive_GetCountToAX
    83 .CompareDriveNumberToDriveCount:
    84     cmp     dl, al                              ; Set CF when DL is smaller
    85     ret
    86 
    87 
    88 ;--------------------------------------------------------------------
    8944; BootMenuEvent_Handler
    9045;   Common parameters for all events:
     
    11570MENUEVENT_ItemHighlightedFromCX equ (EventItemHighlightedFromCX - FirstEvent)
    11671MENUEVENT_ItemSelectedFromCX equ (EventItemSelectedFromCX - FirstEvent)
    117 MENUEVENT_KeyStrokeInAX equ (EventKeyStrokeInAX - FirstEvent)
    11872MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - FirstEvent)
    11973MENUEVENT_RefreshInformation equ (BootMenuPrint_RefreshInformation - FirstEvent)
     
    164118EventInitializeMenuinitFromSSBP:
    165119    ; Store default Menuitem (=default drive to boot from)
    166     call    GetDefaultMenuitemToDX
     120    xor     dx, dx
    167121    mov     [bp+MENUINIT.wHighlightedItem], dx
    168122
     
    172126    call    FloppyDrive_GetCountToAX
    173127    add     ax, cx
     128    inc     ax                              ; extra entry for ROM Boot item
    174129    mov     [bp+MENUINIT.wItems], ax
    175 
     130               
    176131    ; Store menu size
    177132    mov     WORD [bp+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES
     
    180135    xchg    cx, ax
    181136    CALL_DISPLAY_LIBRARY    GetColumnsToALandRowsToAH
    182     sub     ah, MENU_SCREEN_BOTTOM_LINES*2  ; Leave space for Hotkey Bar
    183137    MIN_U   ah, cl
    184138    mov     [bp+MENUINIT.bHeight], ah
     
    207161EventItemHighlightedFromCX:
    208162    push    cx
     163    call    DriveXlate_Reset       
    209164    call    BootMenu_GetDriveToDXforMenuitemInCX       
    210     call    DriveXlate_Reset
     165    jnc     .noDriveSwap       
    211166    call    DriveXlate_SetDriveToSwap
    212 
    213     ; We need to generate keystroke so selection two drives is possible.
    214     ; The secondary boot drive is selected by highlighting it using menu keys
    215     ; and the primary boot drive is selected by pressing drive letter hotkey.
    216     call    BootVars_StoreHotkeyForDriveNumberInDL
    217     call    RedrawHotkeyBarFromInsideMenuEventHandler
    218 
     167.noDriveSwap:   
     168       
    219169    ; Redraw changes in drive numbers
    220170    xor     ax, ax  ; Update first floppy drive (for translated drive number)
     
    230180    ret
    231181
    232 
    233 ;--------------------------------------------------------------------
    234 ; EventKeyStrokeInAX
    235 ;   Parameters
    236 ;       AL:     ASCII character for the key
    237 ;       AH:     Keyboard library scan code for the key
    238 ;       DS:     Ptr to RAMVARS
    239 ;       ES:     Ptr to BDA (zero)
    240 ;       SS:BP:  Menu library handle
    241 ;   Returns:
    242 ;       CF:     Set if event processed
    243 ;               Cleared if event not processed
    244 ;   Corrupts registers:
    245 ;       Does not matter
    246 ;--------------------------------------------------------------------
    247 EventKeyStrokeInAX:
    248     cmp     ah, BOOT_MENU_HOTKEY_SCANCODE
    249     je      SHORT BootMenuEvent_Completed   ; Ignore Boot Menu hotkey
    250     call    HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
    251     jnc     SHORT BootMenuEvent_Completed
    252 
    253     ; Hotkey is now stored to BOOTVARS and menu can be closed
    254     jmp     SHORT CloseBootMenu
    255 
    256 
     182       
    257183;--------------------------------------------------------------------
    258184; EventItemSelectedFromCX
     
    269195;--------------------------------------------------------------------
    270196EventItemSelectedFromCX:
    271     call    BootMenu_GetDriveToDXforMenuitemInCX
    272     jnc     SHORT BootMenuEvent_Completed   ; No menuitem selected
    273 
    274     ; Convert selected drive to hotkey keystroke
    275     call    HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL
    276197    ; Fall to CloseBootMenu
    277198
     
    290211    call    DriveXlate_Reset
    291212    CALL_MENU_LIBRARY   Close
    292     ; Fall to RedrawHotkeyBarFromInsideMenuEventHandler
    293 
    294 
    295 ;--------------------------------------------------------------------
    296 ; RedrawHotkeyBarFromInsideMenuEventHandler
    297 ;   Parameters
    298 ;       DS:     RAMVARS segment
    299 ;       ES:     BDA segment (zero)
    300 ;   Returns:
    301 ;       Nothing
    302 ;   Corrupts registers:
    303 ;       AX, BX, CX, DX, SI, DI
    304 ;--------------------------------------------------------------------
    305 RedrawHotkeyBarFromInsideMenuEventHandler:
    306     mov     al, MONO_NORMAL
    307     CALL_DISPLAY_LIBRARY    SetCharacterAttributeFromAL
    308 
    309     mov     bl, ATTRIBUTES_ARE_USED
    310     mov     ax, TELETYPE_OUTPUT_WITH_ATTRIBUTE
    311     CALL_DISPLAY_LIBRARY    SetCharOutputFunctionFromAXwithAttribFlagInBL
    312     call    HotkeyBar_DrawToTopOfScreen
    313213    ; Fall to BootMenuEvent_Completed
    314214
    315 
     215       
    316216;--------------------------------------------------------------------
    317217; BootMenuEvent_Completed
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm

    r491 r492  
    3333;--------------------------------------------------------------------
    3434BootMenuPrint_RefreshItem:
    35     call    BootMenu_GetDriveToDXforMenuitemInCX
    36     jnc     BootMenuEvent_Completed                 ; if no menu item selected, out we go
    37 
    3835    push    bp
    3936    mov     bp, sp
     37
     38    call    BootMenu_GetDriveToDXforMenuitemInCX
     39    mov     si, g_szRomBootDash                     ; Standard "Rom Boot" but with a "-" at the front
     40    mov     al, 20h                                 ; The space between "Rom" and "Boot"
     41    jnc     .ROMBoot                                ; display "Rom Boot" option for last entry
    4042
    4143    call    FindDPT_ForDriveNumberInDL
     
    5759    mov     ax, dx                                  ; preserve DL for the floppy drive letter addition
    5860    call    DriveXlate_ToOrBack
     61
     62    test    dl, 0f0h                                ; if there is a character in the upper nibble
     63    jnz     .noSpace
     64    dec     si                                      ; backup a character to a leading space
     65.noSpace:
     66
    5967    push    dx                                      ; translated drive number
    6068    push    bx                                      ; sub string
    6169    add     al, 'A'                                 ; floppy drive letter (we always push this although
    62     push    ax                                      ; the hard disks don't ever use it, but it does no harm)
     70                                                    ; the hard disks don't ever use it, but it does no harm)
     71.ROMBoot:       
     72    push    ax                                     
    6373
    6474    jmp     SHORT BootMenuPrint_RefreshInformation.FormatRelay
     
    95105
    96106    call    BootMenu_GetDriveToDXforMenuitemInCX
    97     jnc     BootMenuEvent_Completed                     ; if no menu selection, abort
     107    jnc     BootMenuEvent_Completed                     ; nothing to display if "Rom Boot" option
    98108
    99109    push    bp
  • trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm

    r397 r492  
    2020; Section containing code
    2121SECTION .text
     22
     23;--------------------------------------------------------------------
     24; DriveXlate_ConvertDriveLetterInDLtoDriveNumber
     25;   Parameters:
     26;       DS:     RAMVARS segment
     27;       DL:     Drive letter ('A'...)
     28;   Returns:
     29;       DL:     Drive number (0xh for Floppy Drives, 8xh for Hard Drives)
     30;   Corrupts registers:
     31;       AX
     32;--------------------------------------------------------------------
     33DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
     34    call    DriveXlate_GetLetterForFirstHardDriveToAX
     35    cmp     dl, al
     36    jb      SHORT .ConvertLetterInDLtoFloppyDriveNumber
     37
     38    ; Convert letter in DL to Hard Drive number
     39    sub     dl, al
     40    or      dl, 80h
     41    ret
     42
     43.ConvertLetterInDLtoFloppyDriveNumber:
     44    sub     dl, DEFAULT_FLOPPY_DRIVE_LETTER
     45    ret
     46
     47%ifdef MODULE_HOTKEY
     48%if HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber <> DriveXlate_ConvertDriveLetterInDLtoDriveNumber
     49    %error "DriveXlate_ConvertDriveLetterInDLtoDriveNumber must be at the top of DriveXlate.asm, and that file must immediately follow HotKeys.asm"
     50%endif     
     51%endif
     52       
     53;--------------------------------------------------------------------
     54; DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
     55;   Parameters:
     56;       DL:     Drive number (0xh for Floppy Drives, 8xh for Hard Drives)
     57;       DS:     RAMVARS Segment
     58;   Returns:
     59;       DL:     Drive letter ('A'...)
     60;       CF:     Set if Hard Drive
     61;               Clear if Floppy Drive
     62;   Corrupts registers:
     63;       AX
     64;--------------------------------------------------------------------
     65DriveXlate_ConvertDriveNumberFromDLtoDriveLetter:
     66    test    dl, dl
     67    jns     SHORT .GetDefaultFloppyDrive
     68
     69    ; Store default hard drive to boot from
     70    call    DriveXlate_GetLetterForFirstHardDriveToAX
     71    sub     dl, 80h
     72    add     dl, al
     73    stc
     74    ret
     75
     76.GetDefaultFloppyDrive:
     77    add     dl, DEFAULT_FLOPPY_DRIVE_LETTER     ; Clears CF
     78    ret
     79
     80
     81;--------------------------------------------------------------------
     82; Returns letter for first hard disk. Usually it will be 'C' but it
     83; can be higher if more than two floppy drives are found.
     84;
     85; DriveXlate_GetLetterForFirstHardDriveToAX
     86;   Parameters:
     87;       DS:     RAMVARS segment
     88;   Returns:
     89;       AX:     Upper case letter for first hard disk
     90;   Corrupts registers:
     91;       Nothing
     92;--------------------------------------------------------------------
     93DriveXlate_GetLetterForFirstHardDriveToAX:
     94    call    FloppyDrive_GetCountToAX
     95    add     al, DEFAULT_FLOPPY_DRIVE_LETTER
     96    MAX_U   al, DEFAULT_HARD_DRIVE_LETTER
     97    ret
     98               
    2299
    23100;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r491 r492  
    3232;--------------------------------------------------------------------
    3333HotkeyBar_UpdateDuringDriveDetection:
    34     call    ScanHotkeysFromKeyBufferAndStoreToBootvars
     34    call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
    3535    ; Fall to HotkeyBar_DrawToTopOfScreen
    36 
    37 
     36       
     37       
    3838;--------------------------------------------------------------------
    3939; HotkeyBar_DrawToTopOfScreen
     
    6666;--------------------------------------------------------------------
    6767.PrintFloppyDriveHotkeys:
     68    mov     cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters]
     69       
    6870    call    FloppyDrive_GetCountToAX
    6971    test    ax, ax      ; Any Floppy Drives?
    7072    jz      SHORT .SkipFloppyDriveHotkeys
    7173
    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
    7576    call    FormatDriveHotkeyString
    7677
     
    8889;       AX, CX, DX, SI, DI
    8990;--------------------------------------------------------------------
    90     call    HotkeyBar_GetLetterForFirstHardDriveToAX
     91    call    DriveXlate_GetLetterForFirstHardDriveToAX
    9192    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
    9595    call    FormatDriveHotkeyString
    9696    ; Fall to .PrintBootMenuHotkey
     
    107107.PrintBootMenuHotkey:
    108108%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
    112111    call    FormatFunctionHotkeyString
    113112%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       
    115131
    116132;--------------------------------------------------------------------
     
    124140;--------------------------------------------------------------------
    125141.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
    129144    call    FormatFunctionHotkeyString
    130145    ; Fall to .EndHotkeyBarRendering
     
    168183;   Parameters:
    169184;       CL:         Drive letter hotkey from BOOTVARS
    170 ;       DI low:     First character for drive key string
    171 ;       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)
    172187;       SI:         Offset to hotkey description string
    173188;       ES:         BDA segment (zero)
     
    177192;       AX, CX, DX, SI, DI
    178193;--------------------------------------------------------------------
    179 FormatDriveHotkeyString:
    180     ePUSH_T ax, PushHotkeyParamsAndFormat
    181     jmp     SHORT GetNonSelectedHotkeyDescriptionAttributeToDX
    182 
     194;; No work to do before going into FormatFunctionHotkeyString
     195FormatDriveHotkeyString  equ  GetNonSelectedHotkeyDescriptionAttributeToDX
    183196
    184197;--------------------------------------------------------------------
    185198; FormatFunctionHotkeyString
    186199;   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
    188203;       SI:         Offset to hotkey description string
    189 ;       DI low:     First character for drive key string
    190 ;       DI high:    Second character for drive key string
    191204;       ES:         BDA segment (zero)
    192205;   Returns:
     
    196209;--------------------------------------------------------------------
    197210FormatFunctionHotkeyString:
    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
    217216%ifdef MODULE_BOOT_MENU
    218 GetSelectedHotkeyDescriptionAttributeToDX:
    219     push    si
     217
    220218    mov     si, ATTRIBUTE_CHARS.cHurryTimeout       ; Selected hotkey
    221     jmp     SHORT GetDescriptionAttributeToDX
     219    jz      SHORT GetDescriptionAttributeToDX       ; From compare with bScancode above
    222220
    223221GetNonSelectedHotkeyDescriptionAttributeToDX:
    224     push    si
    225222    mov     si, ATTRIBUTE_CHARS.cHighlightedItem    ; Unselected hotkey
    226223
    227224    ; Display Library should not be called like this
    228225GetDescriptionAttributeToDX:
     226    xchg    dx, ax
    229227    call    MenuAttribute_GetToAXfromTypeInSI
    230     pop     si
    231228    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
    237233    mov     dx, (COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_CYAN) << 8) | MONO_REVERSE_BLINK
    238     jmp     SHORT SelectAttributeFromDHorDLbasedOnVideoMode
     234    jz      SHORT SelectAttributeFromDHorDLbasedOnVideoMode         ; From compare with bScancode above
    239235
    240236GetNonSelectedHotkeyDescriptionAttributeToDX:
    241237    mov     dx, (COLOR_ATTRIBUTE(COLOR_BLACK, COLOR_CYAN) << 8) | MONO_REVERSE
     238
    242239SelectAttributeFromDHorDLbasedOnVideoMode:
    243240    mov     al, [es:BDA.bVidMode]
     
    248245    mov     dl, dh
    249246.AttributeLoadedToDL:
    250     ret
    251 
    252 %endif
     247    ;;  fall through to PushHotkeyParamsAndFormat       
     248
     249%endif ; MODULE_BOOT_MENU
    253250
    254251
     
    256253; PushHotkeyParamsAndFormat
    257254;   Parameters:
    258 ;       DI low:     First character
    259 ;       DI high:    Second character
     255;       BL:         First character
     256;       BH:         Second character
    260257;       DX:         Description Attribute
    261258;       CX:         Description string parameter
    262 ;       CS:SI:      Description string
     259;       CS:DI:      Description string
    263260;   Returns:
    264261;       Nothing
     
    270267    mov     bp, sp
    271268
    272     mov     ax, MONO_BRIGHT
    273     push    ax              ; Key attribute
    274     xchg    ax, di
    275     push    ax              ; First character
    276     xchg    al, ah
    277     push    ax              ; Second character
     269    mov     si, MONO_BRIGHT
     270
     271    push    si              ; Key attribute
     272    push    ax              ; First Character
     273    mov     al, ah
     274    push    ax              ; Second Character
    278275
    279276    push    dx              ; Description attribute
    280     push    si              ; Description string
     277    push    di              ; Description string
    281278    push    cx              ; Description string parameter
    282 
    283     push    di              ; Key attribute for last space
     279       
     280    push    si              ; Key attribute for last space
     281
    284282    mov     si, g_szHotkey
    285283    jmp     DetectPrint_FormatCSSIfromParamsInSSBP
     
    332330
    333331;--------------------------------------------------------------------
    334 ; ScanHotkeysFromKeyBufferAndStoreToBootvars
    335 ;   Parameters:
    336 ;       DS:     RAMVARS segment
    337 ;       ES:     BDA segment (zero)
    338 ;   Returns:
    339 ;       Nothing
    340 ;   Corrupts registers:
    341 ;       AX, CX
    342 ;--------------------------------------------------------------------
    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;--------------------------------------------------------------------
     341HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars:
    344342    call    Keyboard_GetKeystrokeToAX
    345343    jz      SHORT NoHotkeyToProcess
    346344
    347     ePUSH_T cx, ScanHotkeysFromKeyBufferAndStoreToBootvars
     345    ePUSH_T cx, HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
    348346    ; Fall to HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
    349347
     
    357355;       ES:     BDA segment (zero)
    358356;   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
    363360;--------------------------------------------------------------------
    364361HotkeyBar_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       
    375369    ; Drive letter hotkeys remaining, allow 'a' to 'z'
    376370    call    Char_IsLowerCaseLetterInAL
    377     jnc     SHORT .KeystrokeIsNotValidHotkey
     371    jnc     SHORT .KeystrokeIsNotValidDriveLetter
    378372    xor     al, 32                  ; We want to print upper case letters
    379373
    380374    ; Clear HD First flag to assume Floppy Drive hotkey
    381     mov     di, BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags
     375    dec     di
    382376    and     BYTE [es:di], ~FLG_HOTKEY_HD_FIRST
    383377
    384378    ; Determine if Floppy or Hard Drive hotkey
    385379    eMOVZX  cx, al                  ; Clear CH to clear scancode
    386     call    HotkeyBar_GetLetterForFirstHardDriveToAX
     380    call    DriveXlate_GetLetterForFirstHardDriveToAX
    387381    cmp     cl, al
    388382    jb      SHORT .StoreDriveLetter ; Store Floppy Drive letter
     
    392386
    393387.StoreDriveLetter:
    394     adc     di, BYTE 1          ; Add CF if Floppy Drive
     388    sbb     di, BYTE 1          ; Sub CF if Floppy Drive
    395389    xchg    ax, cx
    396390    mov     [es:di], al         ; AH = zero to clear function hotkey
    397391
    398 .StoreFunctionHotkeyFromAH:
    399     mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ah
    400     stc     ; Valid hotkey
    401 
    402 .KeystrokeIsNotValidHotkey:
     392.KeystrokeIsNotValidDriveLetter:       
    403393NoHotkeyToProcess:
     394    mov     al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
    404395    ret
    405396
    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;--------------------------------------------------------------------
     407HotkeyBar_GetBootDriveNumbersToDX:
    419408    mov     dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters]
     409    test    BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST       
     410    jnz     .noflip
    420411    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       
     417HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber:     
     418
Note: See TracChangeset for help on using the changeset viewer.