Changeset 603 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


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.
Location:
trunk/XTIDE_Universal_BIOS
Files:
6 edited

Legend:

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

    r601 r603  
    106106    cli
    107107    mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler]
    108     mov     [es:BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4], ax
     108    mov     [es:BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4], ax
    109109    mov     ax, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.fpPrevTimerHandler+2]
    110     mov     [es:BIOS_SYSTEM_TIMER_TICK_INTERRUPT_1Ch*4+2], ax
     110    mov     [es:BIOS_USER_TIMER_TICK_INTERRUPT_1Ch*4+2], ax
    111111    sti
    112112%endif
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r592 r603  
    3232DetectPrint_InitializeDisplayContext:
    3333    JMP_DISPLAY_LIBRARY InitializeDisplayContext
    34 
    35 
    36 %ifdef MODULE_HOTKEYS
    37 ;--------------------------------------------------------------------
    38 ; DetectPrint_GetSoftwareCoordinatesToAX
    39 ;   Parameters:
    40 ;       Nothing
    41 ;   Returns:
    42 ;       Nothing
    43 ;   Corrupts registers:
    44 ;       AX, DI
    45 ;--------------------------------------------------------------------
    46 DetectPrint_GetSoftwareCoordinatesToAX:
    47     JMP_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
    48 %endif
    4934
    5035
  • 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
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r601 r603  
    5454                    db  "%s @ %x",LF,CR                     ; -=XTIDE ... =- @ Segment
    5555                    db  "%s",LF,CR                          ; version string
     56%ifdef MODULE_STRINGS_COMPRESSED
    5657                    db  "Released under GNU GPL v2",LF,CR
     58%else
     59                    db  "Released under GNU GPL v2",LF
     60%endif
    5761                    db  LF,CR,NULL
    5862%ifdef MODULE_BOOT_MENU
     
    157161%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    158162
    159 g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
    160 ;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     163%ifdef MODULE_STRINGS_COMPRESSED
     164    g_szDeviceTypeValues_Displacement equ 3
     165%else
     166    g_szDeviceTypeValues_Displacement equ 4
     167%endif
    161168;
    162169; Ensure that device type strings are correctly spaced in memory
  • trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm

    r601 r603  
    100100      db     3dh,  39h                ; compressed
    101101
     102%ifdef MODULE_STRINGS_COMPRESSED
    102103    ; db    "Released under GNU GPL v2",LF,CR
    103104    ; db     52h,  65h,  6ch,  65h,  61h,  73h,  65h,  64h,  20h,  75h,  6eh,  64h,  65h,  72h,  20h,  47h,  4eh,  55h,  20h,  47h,  50h,  4ch,  20h,  76h,  32h,  0ah,  0dh    ; uncompressed
    104105      db     58h,  6bh,  72h,  6bh,  67h,  79h,  6bh, 0eah,  7bh,  74h,  6ah,  6bh, 0f8h,  4dh,  54h, 0dbh,  4dh,  56h, 0d2h,  7ch,  2ch,  39h                                  ; compressed
    105106
     107%else
     108db  "Released under GNU GPL v2",LF
     109%endif
    106110    ; db    LF,CR,NULL
    107111    ; db     0ah,  0dh,  00h    ; uncompressed
     
    314318%endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL
    315319
    316 g_szDeviceTypeValues_Displacement equ 3     ; 3 compressed, 4 uncompressed
    317 ;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues)
     320%ifdef MODULE_STRINGS_COMPRESSED
     321g_szDeviceTypeValues_Displacement equ 3
     322%else
     323g_szDeviceTypeValues_Displacement equ 4
     324%endif
    318325;
    319326; Ensure that device type strings are correctly spaced in memory
     
    601608
    602609;; translated usage stats
     610;; 181:1
     611;; 48:2
     612;; 172:2
     613;; 50:2
     614;; 171:2
     615;; 45:2
     616;; 51:3
     617;; 200:1
     618;; 34:3
     619;; 179:8
     620;; 33:1
     621;; 53:2
     622;; 47:2
    603623;; 54:2
    604 ;; 172:2
    605 ;; 171:2
    606 ;; 47:2
    607 ;; 53:2
     624;; 46:3
     625;; 32:34
     626;; 56:9
    608627;; 175:1
    609 ;; 56:9
    610 ;; 45:2
    611 ;; 50:2
    612 ;; 200:1
    613 ;; 33:1
    614 ;; 51:3
    615 ;; 179:8
    616 ;; 46:3
    617 ;; 48:2
    618 ;; 34:3
    619628;; 49:2
    620 ;; 181:1
    621629;; 44:1
    622 ;; 32:34
    623630;; total translated: 20
    624631
    625632;; format usage stats
     633;; 5-x:1
     634;; s:14
     635;; z:2
     636;; u:6
     637;; 2-u:1
     638;; nl:12
     639;; 2-I:1
     640;; c:13
    626641;; 5-u:2
    627 ;; z:2
    628 ;; nl:12
    629642;; x:5
    630643;; A:4
    631 ;; 2-u:1
    632 ;; s:14
    633 ;; 2-I:1
    634 ;; 5-x:1
    635 ;; u:6
    636 ;; c:13
    637644;; total format: 11
    638645
  • trunk/XTIDE_Universal_BIOS/makefile

    r598 r603  
    127127###################
    128128
    129 # Target size of the BIOS, used in main.asm for number of 512B blocks (CNT_ROM_BLOCKS) and by checksum Perl script below ('make checksum').
     129# Target size of the BIOS, used in Main.asm for number of 512B blocks (CNT_ROM_BLOCKS) and by checksum Perl script below ('make checksum').
    130130# Note! The size must be a multiple of 2 KB for compatibility reasons.
    131131BIOS_SIZE_TINY = 4096
Note: See TracChangeset for help on using the changeset viewer.