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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.