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


Ignore:
Timestamp:
Dec 21, 2012, 1:01:55 AM (12 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/BootMenu
Files:
3 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
Note: See TracChangeset for help on using the changeset viewer.