Changeset 603 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus


Ignore:
Timestamp:
Nov 6, 2020, 2:49:32 PM (4 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • Fixed a bug in Strings.asm from r589 where building the BIOS without MODULE_STRINGS_COMPRESSED would fail. Also removed a redundant CR to save a byte when building without MODULE_STRINGS_COMPRESSED.
  • Optimized the code in MODULE_HOTKEYS to reduce ROM space usage, stack usage and time spent in the user timer tick interrupt handler (1Ch). I hope this will fix the problem with hangs introduced in r599.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Menus/HotkeyBar.asm

    r601 r603  
    2323
    2424;--------------------------------------------------------------------
    25 ; Handler for INT 1Ch System Timer Tick.
     25; Handler for INT 1Ch User Timer Tick.
    2626; Reads key presses and draws hotkey bar.
    2727;
    2828; HotkeyBar_TimerTickHandler
    2929;   Parameters:
    30 ;       DS:     RAMVARS segment
    31 ;       ES:     BDA segment (zero)
     30;       Nothing
    3231;   Returns:
    3332;       Nothing
     
    3837HotkeyBar_TimerTickHandler:
    3938    push    es
     39%ifndef USE_186     ; LOAD_BDA_SEGMENT_TO will corrupt AX on 8088/8086
     40    push    ax
     41%endif
     42
     43    ;!!! Keep interrupts disabled so there won't be another
     44    ; timer tick call before we are ready
     45
     46    LOAD_BDA_SEGMENT_TO es, ax
     47
     48    ; Call previous handler
     49    pushf
     50    call    FAR [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
     51
     52    ; Update Hotkeybar (process key input and draw) every fourth tick
     53    test    BYTE [es:BDA.dwTimerTicks], 11b
     54    jnz     SHORT .ReturnFromHandler
     55
    4056    push    ds
    4157%ifdef USE_186
    42     ePUSHA
     58    pusha
    4359%else
    4460    push    di
     
    4662    push    dx
    4763    push    cx
    48     push    ax
    49 %endif
    50 
    51     ;!!! Keep interrupts disabled so there won't be another
    52     ; timer tick call before we are ready
    53 
    54     LOAD_BDA_SEGMENT_TO es, ax
     64%endif
    5565    call    RamVars_GetSegmentToDS
    56 
    57     ; Call previous handler
    58     pushf
    59     call    FAR [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
    60 
    61     ; Update Hotkeybar (process key input and draw) every fourth tick
    62     test    BYTE [es:BDA.dwTimerTicks], 11b
    63     jnz     SHORT .ReturnFromHandler
    64     call    UpdateDuringDriveDetection
    65 
    66 .ReturnFromHandler:
     66    call    HotkeyBar_UpdateDuringDriveDetection
    6767%ifdef USE_186
    68     ePOPA
     68    popa
    6969%else
    70     pop     ax
    7170    pop     cx
    7271    pop     dx
     
    7574%endif
    7675    pop     ds
     76
     77.ReturnFromHandler:
     78%ifndef USE_186
     79    pop     ax
     80%endif
    7781    pop     es
    7882    iret
     
    9195;       AX, CX, DX, SI, DI
    9296;--------------------------------------------------------------------
    93 UpdateDuringDriveDetection:
     97HotkeyBar_UpdateDuringDriveDetection:
    9498    call    ScanHotkeysFromKeyBufferAndStoreToBootvars
    9599
     
    113117;--------------------------------------------------------------------
    114118HotkeyBar_DrawToTopOfScreen:
    115     ; Store current screen coordinates to be restored
    116     ; when Hotkey Bar is rendered
    117     call    DetectPrint_GetSoftwareCoordinatesToAX
     119    ; Store current screen coordinates to stack
     120    ; (to be restored when Hotkey Bar is rendered)
     121    CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
    118122    push    ax
    119123
    120     call    MoveCursorToScreenTopLeftCorner
     124    ; Move cursor to top left corner (0, 0)
     125    xor     ax, ax
     126    call    HotkeyBar_SetCursorCoordinatesFromAX
    121127    ; Fall to .PrintFloppyDriveHotkeys
    122128
     
    230236;--------------------------------------------------------------------
    231237.EndHotkeyBarRendering:
    232     call    HotkeyBar_ClearRestOfTopRow
    233     pop     ax
    234     jmp     SHORT HotkeyBar_RestoreCursorCoordinatesFromAX
    235 
    236 
    237 ;--------------------------------------------------------------------
    238 ; HotkeyBar_ClearRestOfTopRow
    239 ;   Parameters:
    240 ;       Nothing
    241 ;   Returns:
    242 ;       Nothing
    243 ;   Corrupts registers:
    244 ;       AX, CX, DI
    245 ;--------------------------------------------------------------------
    246 HotkeyBar_ClearRestOfTopRow:
     238    ; Clear the rest of the top row
    247239    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
    248240    eMOVZX  cx, al
     
    250242    sub     cl, al
    251243    mov     al, ' '
    252     JMP_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
     244    CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
     245
     246    ; Restore the saved coordinates from stack
     247    pop     ax
     248    ; Fall to HotkeyBar_SetCursorCoordinatesFromAX
     249
     250
     251;--------------------------------------------------------------------
     252; HotkeyBar_SetCursorCoordinatesFromAX
     253;   Parameters:
     254;       Nothing
     255;   Returns:
     256;       Nothing
     257;   Corrupts registers:
     258;       AX, DI
     259;--------------------------------------------------------------------
     260HotkeyBar_SetCursorCoordinatesFromAX:
     261    JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    253262
    254263
     
    373382
    374383;--------------------------------------------------------------------
    375 ; MoveCursorToScreenTopLeftCorner
    376 ;   Parameters:
    377 ;       Nothing
    378 ;   Returns:
    379 ;       Nothing
    380 ;   Corrupts registers:
    381 ;       AX, DI
    382 ;--------------------------------------------------------------------
    383 MoveCursorToScreenTopLeftCorner:
    384     xor     ax, ax          ; Top left corner (0, 0)
    385     ; Fall to HotkeyBar_RestoreCursorCoordinatesFromAX
    386 
    387 
    388 ;--------------------------------------------------------------------
    389 ; HotkeyBar_RestoreCursorCoordinatesFromAX
    390 ;   Parameters:
    391 ;       Nothing
    392 ;   Returns:
    393 ;       Nothing
    394 ;   Corrupts registers:
    395 ;       AX, DI
    396 ;--------------------------------------------------------------------
    397 HotkeyBar_RestoreCursorCoordinatesFromAX:
    398     JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    399 
    400 
    401 ;--------------------------------------------------------------------
    402384; HotkeyBar_StoreDefaultDriveLettersToHotkeyVars
    403385;   Parameters:
     
    432414
    433415    ; Store system 1Ch Timer Tick handler and install our hotkeybar handler
    434     mov     ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4]
     416    mov     ax, [BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4]
    435417    mov     [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler], ax
    436     mov     ax, [BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4+2]
     418    mov     ax, [BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4+2]
    437419    mov     [BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2], ax
    438     mov     al, BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch
     420    mov     al, BIOS_USER_TIMER_TICK_INTERRUPT_1Ch
    439421    mov     si, HotkeyBar_TimerTickHandler
    440422    call    Interrupts_InstallHandlerToVectorInALFromCSSI
Note: See TracChangeset for help on using the changeset viewer.