Changeset 528 in xtideuniversalbios


Ignore:
Timestamp:
Mar 22, 2013, 5:43:54 PM (8 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Swapping Floppy and Hard Drives at the same time work again (broke in r492).
  • Hotkeys again work in boot menu (broke in r492).
Location:
trunk/XTIDE_Universal_BIOS
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r526 r528  
    5757    .wFddAndHddLetters:
    5858    .bFddLetter         resb    1       ; Floppy Drive letter hotkey (upper case)
    59     .bHddLetter         resb    1       ; Hard Drive letter hotkey (upper case)
     59    .bHddLetter         resb    1       ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
    6060    .bFlags             resb    1       ; Must be just after .bHddLetter!  (dependency in Hotkeybar.asm)
    6161    .bScancode          resb    1       ; Function hotkey scancode, must be just after .bFlags!
  • trunk/XTIDE_Universal_BIOS/Inc/HotkeyBar.inc

    r526 r528  
    2121%define HOTKEYBAR_INC
    2222
    23 MIN_TIME_TO_DISPLAY_HOTKEY_BAR          EQU (2000/55)   ; 2000 ms
     23MIN_TIME_TO_DISPLAY_HOTKEY_BAR          EQU (4000/55)   ; 4000 ms
    2424
    2525ROM_BOOT_HOTKEY_SCANCODE                EQU 42h ; F8
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r526 r528  
    103103;       Never returns (loads operating system)
    104104;--------------------------------------------------------------------
    105 SelectDriveToBootFrom:
    106 
    107105; The following macro could be easily inlined below.  Why a macro?  Depending on the combination
    108106; of MODULE_HOTKEYS or MODULE_BOOT_MENU, this code needs to either come before or after the
     
    112110    push    dx                                  ; it's OK if this is left on the stack, if we are
    113111                                                ; successful, the following call does not return
    114     call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     112    call    BootSector_TryToLoadFromDriveDL_AndBoot
    115113    pop     dx
    116114    mov     dl, dh
    117     call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     115    call    BootSector_TryToLoadFromDriveDL_AndBoot
    118116%endmacro
    119117
    120 %ifdef MODULE_HOTKEYS
    121     call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
     118
     119SelectDriveToBootFrom:      ; Function starts here
     120%ifdef MODULE_HOTKEYS
     121    call    HotkeyBar_UpdateDuringDriveDetection
     122    mov     al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
    122123    cmp     al, ROM_BOOT_HOTKEY_SCANCODE
    123     je      .RomBoot                            ; CF clear so ROM boot
     124    je      SHORT .RomBoot                      ; CF clear so ROM boot
    124125%ifdef MODULE_BOOT_MENU
    125126    cmp     al, BOOT_MENU_HOTKEY_SCANCODE
    126     je      .BootMenu
    127 %endif
     127    je      SHORT .BootMenu
     128%endif ; MODULE_BOOT_MENU
     129
     130.TryUsingHotKeysCode:
    128131    call    HotkeyBar_GetBootDriveNumbersToDX
    129 .TryUsingHotKeysCode:
     132    call    DriveXlate_SetDriveToSwap           ; Enable primary boot device translation
     133    xchg    dl, dh
     134    call    DriveXlate_SetDriveToSwap           ; Enable secondary boot device translation
     135    xchg    dl, dh
     136    call    DriveXlate_ToOrBack                 ; Tranlate now so boot device will appear as 00h or 80h to OS
    130137    TRY_TO_BOOT_DL_AND_DH_DRIVES
    131138    ;; falls through to boot menu, if it is present.  If not present, falls through to rom boot.
    132139%endif ; MODULE_HOTKEYS
    133140
     141
    134142%ifdef MODULE_BOOT_MENU
    135143.BootMenu:
    136144    call    BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
    137     jnc     .RomBoot                            ; CF clear so ROM boot
    138 
     145    jnc     SHORT .RomBoot                      ; CF clear so ROM boot
     146
     147    call    DriveXlate_Reset
     148%ifdef MODULE_HOTKEYS
     149    jmp     SHORT .TryUsingHotKeysCode          ; Selected drive stored as hotkey
     150%else ; Boot menu without hotkeys, secondary boot drive is always 00h or 80h
    139151    mov     dh, dl                              ; Setup for secondary drive
    140152    not     dh                                  ; Floppy goes to HD, or vice versa
    141153    and     dh, 80h                             ; Go to first drive of the floppy or HD set
    142 
    143 %ifdef MODULE_HOTKEYS
    144     jmp     .TryUsingHotKeysCode
    145 %else
     154    call    DriveXlate_SetDriveToSwap
     155    call    DriveXlate_ToOrBack
    146156    TRY_TO_BOOT_DL_AND_DH_DRIVES
    147     jmp     .BootMenu
    148 %endif
     157    jmp     SHORT .BootMenu                     ; Show boot menu again
     158%endif ; MODULE_HOTKEYS
     159
    149160%endif ; MODULE_BOOT_MENU
    150161
     162; No hotkeys and no boot menu means fixed "A then C" boot order
    151163%ifndef MODULE_HOTKEYS OR MODULE_BOOT_MENU
    152     xor     dl, dl          ; Try to boot from Floppy Drive A
    153     call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    154     mov     dl, 80h         ; Try to boot from Hard Drive C
    155     call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
     164    xor     dl, dl                          ; Try to boot from Floppy Drive A
     165    call    BootSector_TryToLoadFromDriveDL_AndBoot
     166    mov     dl, DEFAULT_HARD_DRIVE_LETTER   ; Try to boot from Hard Drive C
     167    call    BootSector_TryToLoadFromDriveDL_AndBoot
    156168%endif
    157169
     
    201213.romboot:
    202214    int     BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns
    203 
    204 
    205 ;--------------------------------------------------------------------
    206 ; TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    207 ;   Parameters
    208 ;       DL:     Drive selected as boot device
    209 ;       DS:     RAMVARS segment
    210 ;       ES:     BDA and interrupt vector segment (zero)
    211 ;   Returns:
    212 ;       DL:     Drive to boot from (translated, 00h or 80h)
    213 ;       CF:     Set for Boot Sector Boot
    214 ;               Clear for ROM Boot
    215 ;       ES:BX:  (if CF set) Ptr to boot sector
    216 ;   Corrupts registers:
    217 ;       AX, CX, DH, SI, DI, (DL if failed to read boot sector)
    218 ;--------------------------------------------------------------------
    219 %ifndef MODULE_DRIVEXLATE
    220 TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot   EQU     BootSector_TryToLoadFromDriveDL_AndBoot
    221 
    222 %else
    223 TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot:
    224     call    DriveXlate_SetDriveToSwap
    225     call    DriveXlate_ToOrBack
    226     ; fall through to TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot
    227 
    228 TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot:
    229 ; fall through to BootSector_TryToLoadFromDriveDL_AndBoot
    230 %endif
    231 
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm

    r526 r528  
    7373    ret
    7474
    75 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    76   %ifdef MODULE_DRIVEXLATE
    77     %if TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot
    78       %error "TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot, BootSector must come immediately after int19h.asm"
    79     %endif
    80   %endif
    81 %endif
    8275
    8376;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r526 r528  
    4747    mov     bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV
    4848    call    StartDetectionWithDriveSelectByteInBHandStringInCX
    49 
    50 %ifdef MODULE_HOTKEYS
    51     call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars        ; Done here while CX is still protected
    52 %endif
    5349
    5450    pop     cx
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm

    r526 r528  
    6969MENUEVENT_ExitMenu equ  (BootMenuEvent_Completed - FirstEvent)
    7070MENUEVENT_ItemHighlightedFromCX equ (EventItemHighlightedFromCX - FirstEvent)
     71MENUEVENT_KeyStrokeInAX equ (EventKeyStrokeInAX - FirstEvent)
    7172MENUEVENT_ItemSelectedFromCX equ (EventItemSelectedFromCX - FirstEvent)
    7273MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - FirstEvent)
     
    9495    dw      EventNotHandled                     ; MENUEVENT.IdleProcessing
    9596    dw      EventItemHighlightedFromCX          ; MENUEVENT.ItemHighlightedFromCX
     97   
    9698    dw      EventItemSelectedFromCX             ; MENUEVENT.ItemSelectedFromCX
    9799    dw      EventKeyStrokeInAX                  ; MENUEVENT.KeyStrokeInAX
     
    161163EventItemHighlightedFromCX:
    162164    push    cx
     165
     166    ; Drive number translations and hotkeys must be reset to defaults so highlighted
     167    ; selections are correctly displayed on Hotkey Bar and on Boot Menu
     168%ifdef MODULE_HOTKEYS
     169    call    BootVars_StoreDefaultDriveLettersToHotkeyVars
     170%endif
     171    call    DriveXlate_Reset
     172
     173    ; Set highlighted item to be drive to boot from for visual purposes only
    163174    call    BootMenu_GetDriveToDXforMenuitemInCX
    164     jnc     .noDriveSwap
     175    jnc     SHORT .noDriveSwapSinceRomBootSelected
    165176    call    DriveXlate_SetDriveToSwap
    166 .noDriveSwap:
     177
     178%ifdef MODULE_HOTKEYS
     179    ; Store highlighted drive as hotkey
     180    call    HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
     181    jmp     SHORT .UpdateHotkeyBar
     182.noDriveSwapSinceRomBootSelected:
     183    mov     ah, ROM_BOOT_HOTKEY_SCANCODE
     184    call    HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
     185
     186.UpdateHotkeyBar:
     187    ; Redraw Hotkey Bar for updated boot drive letters
     188    mov     al, MONO_NORMAL
     189    CALL_DISPLAY_LIBRARY    SetCharacterAttributeFromAL
     190
     191    mov     bl, ATTRIBUTES_ARE_USED
     192    mov     ax, TELETYPE_OUTPUT_WITH_ATTRIBUTE
     193    CALL_DISPLAY_LIBRARY    SetCharOutputFunctionFromAXwithAttribFlagInBL
     194    call    HotkeyBar_DrawToTopOfScreen
     195%else
     196.noDriveSwapSinceRomBootSelected:
     197%endif ; MODULE_HOTKEYS
    167198
    168199    ; Redraw changes in drive numbers
     
    181212
    182213;--------------------------------------------------------------------
     214; EventKeyStrokeInAX
     215;   Parameters
     216;       AL:     ASCII character for the key
     217;       AH:     Keyboard library scan code for the key
     218;       DS:     Ptr to RAMVARS
     219;       ES:     Ptr to BDA (zero)
     220;       SS:BP:  Menu library handle
     221;   Returns:
     222;       CF:     Set if event processed
     223;               Cleared if event not processed
     224;   Corrupts registers:
     225;       Does not matter
     226;--------------------------------------------------------------------
     227%ifdef MODULE_HOTKEYS
     228EventKeyStrokeInAX:
     229    ; Keypress will be the primary boot drive
     230    cmp     ah, BOOT_MENU_HOTKEY_SCANCODE
     231    je      SHORT BootMenuEvent_Completed   ; Ignore Boot Menu hotkey
     232    call    HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
     233    jnc     SHORT BootMenuEvent_Completed
     234    ; Fall to CloseBootMenu through EventItemSelectedFromCX
     235%endif
     236
     237
     238;--------------------------------------------------------------------
    183239; EventItemSelectedFromCX
    184240;   Parameters
     
    223279BootMenuEvent_Completed:
    224280    stc
    225     ret
     281%ifndef MODULE_HOTKEYS
     282EventKeyStrokeInAX:
     283%endif
     284    ret
  • trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm

    r526 r528  
    143143;       Nothing
    144144;   Corrupts registers:
    145 ;       AX, DI, DL
     145;       Nothing
    146146;--------------------------------------------------------------------
    147147DriveXlate_Reset:
    148     xor     dl, dl              ; no translation for a floppy
    149     ;; fall through to DriveXlate_SetDriveToSwap
     148    mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
     149    ret
     150
    150151
    151152;--------------------------------------------------------------------
     
    154155; DriveXlate_SetDriveToSwap
    155156;   Parameters:
    156 ;       DL:     Drive to swap to 00h or 80h
     157;       DL:     Hard Drive to swap to first Hard Drive
     158;               Floppy Drive to swap to first Floppy Drive
    157159;       DS:     RAMVARS segment
    158160;   Returns:
    159161;       Nothing
    160162;   Corrupts registers:
    161 ;       AX, DI
     163;       Nothing
    162164;--------------------------------------------------------------------
    163165DriveXlate_SetDriveToSwap:
    164     mov     ax, 8000h           ; Default mapping (no translation)
    165166    test    dl, dl              ; Floppy drive?
    166167    js      SHORT .SetHardDriveToSwap
    167     mov     al, dl              ; Store floppy translation
    168     SKIP2B  di
     168
     169    ; Set Floppy Drive to swap
     170    mov     [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
     171    ret
     172
    169173.SetHardDriveToSwap:
    170     mov     ah, dl              ; Store HD translation
    171     mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], ax
     174    mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
    172175    ret
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r526 r528  
    2222
    2323;--------------------------------------------------------------------
     24; Scans key presses and draws any hotkey changes.
     25;
    2426; HotkeyBar_UpdateDuringDriveDetection
    2527;   Parameters:
     
    3234;--------------------------------------------------------------------
    3335HotkeyBar_UpdateDuringDriveDetection:
    34     call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
     36    call    ScanHotkeysFromKeyBufferAndStoreToBootvars
    3537    ; Fall to HotkeyBar_DrawToTopOfScreen
    3638
     
    311313
    312314;--------------------------------------------------------------------
    313 ; HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL
     315; HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
     316;   Parameters:
     317;       DS:     RAMVARS segment
     318;       ES:     BDA segment (zero)
     319;       DL:     Drive Number
     320;   Returns:
     321;       Nothing
     322;   Corrupts registers:
     323;       AX, CX, DL, DI
     324;--------------------------------------------------------------------
     325HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL:
     326    call    DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
     327    ; Fall to StoreHotkeyToBootvarsForDriveLetterInDL
     328
     329
     330;--------------------------------------------------------------------
     331; StoreHotkeyToBootvarsForDriveLetterInDL
    314332;   Parameters:
    315333;       DS:     RAMVARS segment
     
    321339;       AX, CX, DI
    322340;--------------------------------------------------------------------
    323 HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL:
     341StoreHotkeyToBootvarsForDriveLetterInDL:
    324342    eMOVZX  ax, dl
    325343    or      al, 32  ; Upper case drive letter to lower case keystroke
     
    328346
    329347;--------------------------------------------------------------------
    330 ; HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
     348; ScanHotkeysFromKeyBufferAndStoreToBootvars
    331349;   Parameters:
    332350;       DS:     RAMVARS segment
     
    337355;       AH, CX
    338356;--------------------------------------------------------------------
    339 HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars:
     357ScanHotkeysFromKeyBufferAndStoreToBootvars:
    340358    call    Keyboard_GetKeystrokeToAX
    341359    jz      SHORT NoHotkeyToProcess
    342360
    343     ePUSH_T cx, HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
     361    ; Prepare to read another key from buffer
     362    ePUSH_T cx, ScanHotkeysFromKeyBufferAndStoreToBootvars
    344363    ; Fall to HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX
    345364
     
    354373;   Returns:
    355374;       AL:     Last scancode seen
     375;       CF:     Set if valid hotkey in AL
     376;               Clear if scancode in AL is not for any hotkey
    356377;   Corrupts registers:
    357378;       AH, CX, DI
     
    387408    xchg    ax, cx
    388409    mov     [es:di], al
     410    stc                             ; Valid hotkey scancode returned in AL
    389411
    390412.KeystrokeIsNotValidDriveLetter:
     
    392414    mov     al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
    393415    ret
     416
    394417
    395418;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm

    r526 r528  
    4141    mov     di, BOOTVARS.rgDrvDetectInfo    ; We must not initialize anything before this!
    4242    xchg    cx, ax
     43%ifndef MODULE_HOTKEYS
     44    jmp     Memory_ZeroESDIwithSizeInCX
    4345
    44 %ifdef MODULE_HOTKEYS
     46%else ; if MODULE_HOTKEYS
    4547    call    Memory_ZeroESDIwithSizeInCX
    4648
    4749    ; Initialize HOTKEYVARS by storing default drives to boot from
     50    call    BootVars_StoreDefaultDriveLettersToHotkeyVars
     51    mov     dl, [cs:ROMVARS.bBootDrv]
     52    jmp     HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
     53
     54
     55;--------------------------------------------------------------------
     56; BootVars_StoreDefaultDriveLettersToHotkeyVars
     57;   Parameters:
     58;       ES:     BDA Segment
     59;   Returns:
     60;       Nothing
     61;   Corrupts registers:
     62;       Nothing
     63;--------------------------------------------------------------------
     64BootVars_StoreDefaultDriveLettersToHotkeyVars:
    4865    mov     WORD [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], DEFAULT_FLOPPY_DRIVE_LETTER | (DEFAULT_HARD_DRIVE_LETTER<<8)
    49     mov     dl, [cs:ROMVARS.bBootDrv]
    50     call    DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
    51     jmp     HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL
     66    ret
    5267
    53 %else
    54     jmp     Memory_ZeroESDIwithSizeInCX
    5568%endif ; MODULE_HOTKEYS
Note: See TracChangeset for help on using the changeset viewer.