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


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/Handlers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r417 r492  
    104104;--------------------------------------------------------------------
    105105SelectDriveToBootFrom:
    106 %ifdef MODULE_HOTKEYS
    107     call    HotkeyBar_UpdateDuringDriveDetection
    108 
     106
     107; The following macro could be easily inlined below.  Why a macro?  Depending on the combination
     108; of MODULE_HOTKEYS or MODULE_BOOT_MENU, this code needs to either come before or after the
     109; call to the boot menu. 
     110;
     111%macro TRY_TO_BOOT_DL_AND_DH_DRIVES 0
     112    push    dx                                  ; it's OK if this is left on the stack, if we are
     113                                                ; are successful, the following call does not return
     114    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     115    pop     dx
     116    mov     dl, dh
     117    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     118%endmacro
     119               
     120%ifdef MODULE_HOTKEYS
     121    call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars       
     122    cmp     al, ROM_BOOT_HOTKEY_SCANCODE
     123    jz      JumpToBootSector_or_RomBoot         ; CF clear so ROM boot
    109124%ifdef MODULE_BOOT_MENU
    110     mov     di, BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode
    111     cmp     BYTE [es:di], BOOT_MENU_HOTKEY_SCANCODE
    112     jne     SHORT .DoNotDisplayBootMenu
    113 
    114     ; Stop blinking the Boot Menu hotkey and display menu
    115     mov     BYTE [es:di], 0
    116     call    HotkeyBar_DrawToTopOfScreen
    117     call    BootMenu_DisplayAndStoreSelectionAsHotkey
    118 .DoNotDisplayBootMenu:
    119 %endif
    120 
    121     ; Check if ROM boot (INT 18h) wanted
    122     cmp     BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ROM_BOOT_HOTKEY_SCANCODE
    123     je      SHORT JumpToBootSector_or_RomBoot   ; CF clear so ROM boot
    124 
    125     ; Get Primary boot drive number to DL
    126     call    HotkeyBar_GetPrimaryBootDriveNumberToDL
     125    cmp     al, BOOT_MENU_HOTKEY_SCANCODE
     126    jz      .BootMenu
     127%endif
     128    call    HotkeyBar_GetBootDriveNumbersToDX
     129.TryUsingHotKeysCode:
     130    TRY_TO_BOOT_DL_AND_DH_DRIVES
     131    ;; falls through to boot menu, if it is present.  If not present, falls through to rom boot.
     132%endif
     133
     134%ifdef MODULE_BOOT_MENU
     135.BootMenu:     
     136    call    BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
     137    jnc     JumpToBootSector_or_RomBoot         ; CF clear so ROM boot
     138
     139    mov     dh, dl                              ; Setup for secondary drive
     140    not     dh                                  ; Floppy goes to HD, or vice veras
     141    and     dh, 080h                            ; Go to first drive of the floppy or HD set
     142
     143%ifdef MODULE_HOTKEYS
     144    jmp     .TryUsingHotKeysCode
    127145%else
     146    TRY_TO_BOOT_DL_AND_DH_DRIVES       
     147    jmp     .BootMenu
     148%endif
     149%endif
     150
     151%ifndef MODULE_HOTKEYS
     152%ifndef MODULE_BOOT_MENU
    128153    xor     dl, dl          ; Try to boot from Floppy Drive A
    129 %endif  ; MODULE_HOTKEYS
    130 
    131     ; Try to boot from Primary boot drive (00h by default)
    132     call    TryToBootFromPrimaryOrSecondaryBootDevice
    133     jc      SHORT JumpToBootSector_or_RomBoot
    134 
    135     ; Try to boot from Secondary boot device (80h by default)
    136 %ifdef MODULE_HOTKEYS
    137     call    HotkeyBar_GetSecondaryBootDriveNumberToDL
    138 %else
     154    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    139155    mov     dl, 80h         ; Try to boot from Hard Drive C
    140 %endif
    141     call    TryToBootFromPrimaryOrSecondaryBootDevice
    142 
    143 %ifdef MODULE_BOOT_MENU
    144     ; Force Boot Menu hotkey to display boot menu
    145     mov     BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], BOOT_MENU_HOTKEY_SCANCODE
    146     jnc     SHORT SelectDriveToBootFrom
    147 %endif
    148     ; Fall to JumpToBootSector_or_RomBoot
    149 
     156    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     157%endif
     158%endif
     159
     160%ifndef MODULE_BOOT_MENU
     161    clc     ;  fall through with flag for ROM boot.  Boot Menu goes back to menu and doesn't fall through.
     162%endif     
    150163
    151164;--------------------------------------------------------------------
     
    203216;       AX, CX, DH, SI, DI, (DL if failed to read boot sector)
    204217;--------------------------------------------------------------------
    205 %ifndef MODULE_HOTKEYS
    206 TryToBootFromPrimaryOrSecondaryBootDevice   EQU     BootSector_TryToLoadFromDriveDL
     218%ifndef MODULE_DRIVEXLATE
     219TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot   EQU     BootSector_TryToLoadFromDriveDL_AndBoot
    207220
    208221%else
    209 TryToBootFromPrimaryOrSecondaryBootDevice:
     222TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot:
    210223    call    DriveXlate_SetDriveToSwap
    211224    call    DriveXlate_ToOrBack
    212     jmp     BootSector_TryToLoadFromDriveDL
    213 %endif
     225    ; fall through to TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot
     226
     227TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot:
     228; fall through to BootSector_TryToLoadFromDriveDL_AndBoot               
     229%endif
     230       
     231
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm

    r428 r492  
    3333;       AX, CX, DH, SI, DI, (DL if failed to read boot sector)
    3434;--------------------------------------------------------------------
    35 BootSector_TryToLoadFromDriveDL:
     35BootSector_TryToLoadFromDriveDL_AndBoot:
    3636    call    DetectPrint_TryToBootFromDL
    3737    call    LoadFirstSectorFromDriveDL
     
    4444.AlwaysBootFromFloppyDriveForBooterGames:
    4545    stc
    46     ret
     46    jmp     SHORT JumpToBootSector_or_RomBoot       
    4747.FailedToLoadFirstSector:
    4848    call    DetectPrint_FailedToLoadFirstSector
    49     clc
    5049    ret
    5150.FirstHardDiskSectorNotBootable:
    5251    mov     si, g_szBootSectorNotFound
    5352    call    DetectPrint_NullTerminatedStringFromCSSIandSetCF
    54     clc
    5553    ret
     54
     55%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS       
     56  %ifdef MODULE_DRIVEXLATE
     57    %if TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot
     58      %error "TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot, BootSector must come immediately after int19h.asm"
     59    %endif
     60  %endif
     61%endif
    5662
    5763;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.