Changeset 599 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm


Ignore:
Timestamp:
Jul 14, 2018, 1:21:16 PM (6 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.

File:
1 edited

Legend:

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