Changeset 599 in xtideuniversalbios


Ignore:
Timestamp:
Jul 14, 2018, 1:21:16 PM (3 years ago)
Author:
aitotat
Message:

Hotkey bar is now updated and drawn from system timer tick handler 1Ch. This gives much more responsive key input and makes possible to implement some simple detection animation to show that system has not frozen.

Location:
trunk/XTIDE_Universal_BIOS
Files:
8 edited

Legend:

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

    r596 r599  
    4040
    4141struc HOTKEYVARS
     42    .fpPrevTimerHandler resb    4       ; Previous 1Ch timer hander
    4243    .wTimeWhenDisplayed resb    2       ; System time (ticks) when Hotkey bar was first displayed
    4344    .wFddAndHddLetters:
     
    5758; Bit defines for HOTKEYVARS.bFlags
    5859FLG_HOTKEY_HD_FIRST         EQU     (1<<0)  ; First try to boot from HDD, then FDD
     60FLG_HOTKEY_UPDATING         EQU     (1<<1)  ; Hotkeybar update in progress
    5961
    6062%endif ; MODULE_HOTKEYS
  • trunk/XTIDE_Universal_BIOS/Inc/HotkeyBar.inc

    r593 r599  
    2323MIN_TIME_TO_DISPLAY_HOTKEY_BAR          EQU (4000/55)   ; 4000 ms
    2424
     25ESC_SCANCODE                            EQU 1   ; ESC key       
    2526FIRST_FUNCTION_KEY_SCANCODE             EQU 3Bh ; F1 key
    2627
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r597 r599  
    9595    ; Last hard drive might have scrolled Hotkey Bar out of screen.
    9696    ; We want to display it during wait.
    97     call    HotkeyBar_UpdateDuringDriveDetection
     97    ;call   HotkeyBar_UpdateDuringDriveDetection
    9898
    9999.WaitUntilTimeToCloseHotkeyBar:
     
    102102    cmp     ax, MIN_TIME_TO_DISPLAY_HOTKEY_BAR
    103103    jb      SHORT .WaitUntilTimeToCloseHotkeyBar
     104
     105    ; Restore system timer tick handler since hotkeys are no longer needed
     106    cli
     107    mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
     108    mov     [es:SYSTEM_TIMER_TICK*4], ax
     109    mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2]
     110    mov     [es:SYSTEM_TIMER_TICK*4+2], ax
     111    sti
    104112%endif
    105113    ; Fall to .ResetAllDrives
     
    146154SelectDriveToBootFrom:      ; Function starts here
    147155%ifdef MODULE_HOTKEYS
    148     call    HotkeyBar_UpdateDuringDriveDetection
    149156    mov     al, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode]
    150157    cmp     al, ROM_BOOT_HOTKEY_SCANCODE
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r598 r599  
    224224StartDetectionWithDriveSelectByteInBHandStringInCX:
    225225    call    DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
    226 
    227 %ifdef MODULE_HOTKEYS
    228     call    HotkeyBar_UpdateDuringDriveDetection
    229 %endif
    230226    ; Fall to .ReadAtaInfoFromHardDisk
    231227
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r596 r599  
    184184    mul     bl
    185185    xchg    ax, bx
     186    cli
    186187    mov     [es:bx], si             ; Store offset
    187188    mov     [es:bx+2], cs           ; Store segment
     189    sti
    188190.Interrupts_Return:
    189191    ret
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm

    r592 r599  
    169169    ; selections are correctly displayed on Hotkey Bar and on Boot Menu
    170170%ifdef MODULE_HOTKEYS
    171     call    BootVars_StoreDefaultDriveLettersToHotkeyVars
     171    call    HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
    172172%endif
    173173    call    DriveXlate_Reset
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r596 r599  
    2121SECTION .text
    2222
     23
     24;--------------------------------------------------------------------
     25; Handler for INT 1Ch System Timer Tick.
     26; Reads key presses and draws hotkey bar.
     27;
     28; HotkeyBar_TimerTickHandler
     29;   Parameters:
     30;       DS:     RAMVARS segment
     31;       ES:     BDA segment (zero)
     32;   Returns:
     33;       Nothing
     34;   Corrupts registers:
     35;       AX, CX, DX, SI, DI
     36;--------------------------------------------------------------------
     37HotkeyBar_TimerTickHandler:
     38    push    es
     39    push    ds
     40%ifdef USE_186
     41    ePUSHA
     42%else
     43    push    di
     44    push    si
     45    push    dx
     46    push    cx
     47    push    ax
     48%endif
     49    sti         ; Enable interrupts (is this really necessary? Do we lose key inputs if we keep interrupts disabled?)
     50                ; There would be no need for FLG_HOTKEY_UPDATING if we can keep interrupts disabled during whole update.
     51
     52    LOAD_BDA_SEGMENT_TO es, ax
     53    call    RamVars_GetSegmentToDS
     54
     55    ; Call previous handler
     56    pushf
     57    call far [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
     58
     59    ; Do not start updating if update is already in progress (do we need this on AT systems?)
     60    test    BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_UPDATING
     61    jnz     SHORT .ReturnFromHandler
     62
     63    ; Update Hotkeybar (process key input and draw)
     64%ifndef USE_AT  ; Ease XT systems a bit by updating every other timer tick
     65    call    TimerTicks_ReadFromBdaToAX
     66    shr     ax, 1
     67    jnc     SHORT .ReturnFromHandler
     68%endif
     69    or      BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_UPDATING
     70    call    UpdateDuringDriveDetection
     71    and     BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], ~FLG_HOTKEY_UPDATING
     72
     73.ReturnFromHandler:
     74%ifdef USE_186
     75    ePOPA
     76%else
     77    pop     ax
     78    pop     cx
     79    pop     dx
     80    pop     si
     81    pop     di
     82%endif
     83    pop     ds
     84    pop     es
     85    iret
     86
     87
    2388;--------------------------------------------------------------------
    2489; Scans key presses and draws any hotkey changes.
     
    3398;       AX, CX, DX, SI, DI
    3499;--------------------------------------------------------------------
    35 HotkeyBar_UpdateDuringDriveDetection:
     100UpdateDuringDriveDetection:
    36101    call    ScanHotkeysFromKeyBufferAndStoreToBootvars
     102
     103    ; If ESC pressed, abort detection by forcing timeout
     104    cmp     al, ESC_SCANCODE
     105    jne     SHORT .ContinueDrawing
     106    mov     BYTE [RAMVARS.bTimeoutTicksLeft], 0
     107.ContinueDrawing:
     108   
    37109    ; Fall to HotkeyBar_DrawToTopOfScreen
    38110
     
    78150    ; Clear CH if floppy drive is selected for boot
    79151    mov     ch, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags]
    80 ;   and     ch, FLG_HOTKEY_HD_FIRST     ; Needed if more flags are added
     152    and     ch, FLG_HOTKEY_HD_FIRST
    81153    call    FormatDriveHotkeyString
    82154
     
    97169    mov     ah, ANGLE_QUOTE_RIGHT
    98170    mov     cx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddLetterAndFlags]  ; Letter to CL, flags to CH
    99 ;   and     ch, FLG_HOTKEY_HD_FIRST     ; Needed if more flags are added
     171    and     ch, FLG_HOTKEY_HD_FIRST
    100172    xor     ch, FLG_HOTKEY_HD_FIRST     ; Clear CH if HD is selected for boot, set otherwise
    101173    mov     di, g_szHDD
     
    332404
    333405;--------------------------------------------------------------------
     406; HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
     407;   Parameters:
     408;       ES:     BDA Segment
     409;   Returns:
     410;       Nothing
     411;   Corrupts registers:
     412;       AX
     413;--------------------------------------------------------------------
     414HotkeyBar_StoreDefaultDriveLettersToHotkeyVars:
     415    call    BootVars_GetLetterForFirstHardDriveToAX
     416    mov     ah, DEFAULT_FLOPPY_DRIVE_LETTER
     417    xchg    al, ah
     418    mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], ax
     419    ret
     420
     421
     422;--------------------------------------------------------------------
     423; HotkeyBar_InitializeVariables
     424;   Parameters:
     425;       DS:     RAMVARS Segment
     426;       ES:     BDA Segment
     427;   Returns:
     428;       Nothing
     429;   Corrupts registers:
     430;       AX, CX, DX, DI
     431;--------------------------------------------------------------------
     432HotkeyBar_InitializeVariables:
     433    push    ds
     434    push    es
     435    pop     ds
     436
     437    ; Store system 1Ch Timer Tick handler and install our hotkeybar handler
     438    mov     ax, [SYSTEM_TIMER_TICK*4]
     439    mov     [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler], ax
     440    mov     ax, [SYSTEM_TIMER_TICK*4+2]
     441    mov     [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2], ax
     442    mov     al, SYSTEM_TIMER_TICK
     443    mov     si, HotkeyBar_TimerTickHandler
     444    call    Interrupts_InstallHandlerToVectorInALFromCSSI
     445
     446    ; Store time when hotkeybar is displayed
     447    ; (it will be displayed after initialization is complete)
     448    call    TimerTicks_ReadFromBdaToAX
     449    mov     [BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
     450
     451    pop     ds
     452
     453    ; Initialize HOTKEYVARS by storing default drives to boot from
     454    call    HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
     455    mov     dl, [cs:ROMVARS.bBootDrv]
     456    ; Fall to HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
     457
     458
     459;--------------------------------------------------------------------
    334460; HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
    335461;   Parameters:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm

    r593 r599  
    4545    add     cx, BYTE HOTKEYVARS_size
    4646    call    Memory_ZeroESDIwithSizeInCX
    47 
    48     ; Store time when hotkeybar is displayed
    49     ; (it will be displayed after initialization is complete)
    50     call    TimerTicks_ReadFromBdaToAX
    51     mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wTimeWhenDisplayed], ax
    52 
    53     ; Initialize HOTKEYVARS by storing default drives to boot from
    54     call    BootVars_StoreDefaultDriveLettersToHotkeyVars
    55     mov     dl, [cs:ROMVARS.bBootDrv]
    56     jmp     HotkeyBar_StoreHotkeyToBootvarsForDriveNumberInDL
    57 
    58 
    59 ;--------------------------------------------------------------------
    60 ; BootVars_StoreDefaultDriveLettersToHotkeyVars
    61 ;   Parameters:
    62 ;       ES:     BDA Segment
    63 ;   Returns:
    64 ;       Nothing
    65 ;   Corrupts registers:
    66 ;       Nothing
    67 ;--------------------------------------------------------------------
    68 BootVars_StoreDefaultDriveLettersToHotkeyVars:
    69     call    BootVars_GetLetterForFirstHardDriveToAX
    70     mov     ah, DEFAULT_FLOPPY_DRIVE_LETTER
    71     xchg    al, ah
    72     mov     [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wFddAndHddLetters], ax
    73     ret
    74 
     47    jmp     HotkeyBar_InitializeVariables
    7548%endif ; MODULE_HOTKEYS
    7649
Note: See TracChangeset for help on using the changeset viewer.