Changeset 592 in xtideuniversalbios for trunk/Assembly_Library/Inc


Ignore:
Timestamp:
Jun 25, 2018, 10:29:27 PM (6 years ago)
Author:
krille_n_
Message:

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
Location:
trunk/Assembly_Library/Inc
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/BiosFunctions.inc

    r510 r592  
    66; BIOS interrupts
    77BIOS_VIDEO_INTERRUPT_10h        EQU     10h
     8BIOS_EQUIPMENT_INTERRUPT_11h    EQU     11h
    89BIOS_DISK_INTERRUPT_13h         EQU     13h
    910BIOS_SYSTEM_INTERRUPT_15h       EQU     15h
  • trunk/Assembly_Library/Inc/Debug.inc

    r590 r592  
    2424    mov     bl, %2
    2525    CALL_DISPLAY_LIBRARY PrintWordFromAXWithBaseInBL
    26 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     26%ifndef EXCLUDE_FROM_XUB
    2727    call    Keyboard_RemoveAllKeystrokesFromBuffer
    2828%endif
     
    5252    mov     al, %1
    5353    CALL_DISPLAY_LIBRARY PrintCharacterFromAL
    54 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     54%ifndef EXCLUDE_FROM_XUB
    5555    call    Keyboard_RemoveAllKeystrokesFromBuffer
    5656%endif
     
    9595%macro WAIT_ANY_KEY_TO_CONTINUE 0
    9696    push    ax
    97 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     97%ifndef EXCLUDE_FROM_XUB
    9898    call    Keyboard_RemoveAllKeystrokesFromBuffer
    9999%endif
  • trunk/Assembly_Library/Inc/Display.inc

    r590 r592  
    6161    .InitializeDisplayContext                       resb    2
    6262
    63 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     63%ifndef EXCLUDE_FROM_XUB
    6464    .SetCharacterPointerFromBXAX                    resb    2
    6565%endif
     
    7474    .SynchronizeDisplayContextToHardware            resb    2
    7575
    76 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     76%ifndef EXCLUDE_FROM_XUB
    7777    .GetCharacterPointerToBXAX                      resb    2
    7878%endif
     
    8181
    8282    .FormatNullTerminatedStringFromCSSI             resb    2
    83 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     83%ifndef EXCLUDE_FROM_XUB
    8484    .PrintSignedWordFromAXWithBaseInBL              resb    2
    8585%endif
    8686    .PrintWordFromAXWithBaseInBL                    resb    2
    87 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
     87%ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
    8888    .PrintQWordFromSSBPwithBaseInBX                 resb    2
    8989%endif
     
    9494    .PrintCharacterFromAL                           resb    2
    9595    .PrintNewlineCharacters                         resb    2
    96 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     96%ifndef EXCLUDE_FROM_XUB
    9797    .ClearAreaWithHeightInAHandWidthInAL            resb    2
    9898%endif
  • trunk/Assembly_Library/Inc/DosFunctions.inc

    r589 r592  
    66; DOS interrupts
    77DOS_INTERRUPT_21h                                   EQU     21h
     8DOS_CTRL_C_CTRL_BREAK_HANDLER_23h                   EQU     23h
    89DOS_CRITICAL_ERROR_HANDLER_24h                      EQU     24h
    910DOS_TSR_MULTIPLEX_INTERRUPT_2Fh                     EQU     2Fh
     
    3132FIND_FIRST_MATCHING_FILE                            EQU     4Eh     ; DOS 2+
    3233FIND_NEXT_MATCHING_FILE                             EQU     4Fh     ; DOS 2+
     34GET_EXTENDED_ERROR_INFORMATION                      EQU     59h     ; DOS 3.0+
    3335
    3436; DOS errors
  • trunk/Assembly_Library/Inc/Emulate.inc

    r589 r592  
    6060
    6161;--------------------------------------------------------------------
     62; Find String In String
     63;
     64; FSIS
     65;   Parameters:
     66;       %1:     String to search for (case-insensitive)
     67;       %2:     String to search in
     68;   Returns:
     69;   strpos:     Position of %1 in %2 if found, 0 if not found
     70;--------------------------------------------------------------------
     71%macro FSIS 2.nolist
     72%defstr s1 %1
     73%defstr s2 %2
     74%strlen sl1 s1
     75%strlen sl2 s2
     76%assign strpos 0
     77    %if sl1 <= sl2
     78        %assign strpos sl2 - sl1 + 1
     79        %rep strpos
     80            %substr %%ss s2 strpos, sl1
     81            %ifidni %%ss, s1
     82                %exitrep
     83            %else
     84                %assign strpos strpos - 1
     85            %endif
     86        %endrep
     87    %endif
     88%endmacro
     89
     90
     91;--------------------------------------------------------------------
    6292; The undocumented instruction SALC (Set AL According to CF).
    6393; Available on all Intel processors and truly compatible clones.
     
    108138;--------------------------------------------------------------------
    109139; The AAM instruction (ASCII Adjust after Multiplication).
    110 ; Available on all Intel processors and truly compatible clones.
    111 ; Does not work on the NEC V20/V30 or Sony CXQ70108 processors
    112 ; unless %1 is 10 (0Ah).
    113140;
    114141; eAAM
     
    152179%macro eBSF 2
    153180%ifndef USE_386
    154     push    cx
    155181    cmp     WORD %2, BYTE 0     ; Source operand is zero?
    156182    je      SHORT %%Return      ;  If so, return with ZF set
    157183
    158184    ; Set destination to zero and load mask for bit 0
     185    push    cx
    159186    xor     %1, %1
    160187    mov     cx, 1
     
    163190%%BitLoop:
    164191    test    %2, cx              ; Bit set?
    165     jnz     SHORT %%Return      ;  If so, return with ZF cleared
     192    jnz     SHORT %%PopAndReturn;  If so, return with ZF cleared
    166193    shl     cx, 1               ; Prepare to test next bit
    167194    inc     %1                  ; Increment bit index
    168195    jmp     SHORT %%BitLoop     ; Loop until bit found
    169 %%Return:
     196%%PopAndReturn:
    170197    pop     cx
     198%%Return:
    171199;-----------------------------------
    172200%else
     
    193221%macro eBSR 2
    194222%ifndef USE_386
    195     push    cx
    196223    cmp     WORD %2, BYTE 0     ; Source operand is zero?
    197224    je      SHORT %%Return      ;  If so, return with ZF set
    198225
    199226    ; Load mask for highest order bit
     227    push    cx
    200228    mov     cx, 1<<15
    201229    mov     %1, 15
     
    204232%%BitLoop:
    205233    test    %2, cx              ; Bit set?
    206     jnz     SHORT %%Return      ;  If so, return with ZF cleared
     234    jnz     SHORT %%PopAndReturn;  If so, return with ZF cleared
    207235    shr     cx, 1               ; Prepare to test next bit
    208236    dec     %1                  ; Decrement bit index
    209237    jmp     SHORT %%BitLoop     ; Loop until bit found
    210 %%Return:
     238%%PopAndReturn:
    211239    pop     cx
     240%%Return:
    212241;-----------------------------------
    213242%else
     
    260289
    261290%macro eCMOVE 2
    262     eCMOVZ %1, %2
     291    eCMOVZ  %1, %2
    263292%endmacro
    264293
    265294%macro eCMOVNE 2
    266     eCMOVNZ %1, %2
     295    eCMOVNZ %1, %2
    267296%endmacro
    268297
    269298%macro eCMOVB 2
    270     jnb     SHORT %%Return
    271     mov     %1, %2
    272 %%Return:
     299    eCMOVC  %1, %2
    273300%endmacro
    274301
     
    289316; Conditional Set.
    290317;
    291 ; eCSETcc
     318; eSETcc
    292319;   Parameters:
    293320;       %1:     Destination data
     
    297324;       Flags
    298325;--------------------------------------------------------------------
    299 %macro eCSETZ 1
     326%macro eSETZ 1
    300327    mov     %1, 0           ; Clear while preserving flags
    301328    jnz     SHORT %%Return  ; Nothing to set
     
    304331%endmacro
    305332
    306 %macro eCSETNZ 1
     333%macro eSETNZ 1
    307334    mov     %1, 0           ; Clear while preserving flags
    308335    jz      SHORT %%Return  ; Nothing to set
     
    339366        xor     dh, dh
    340367    %else   ; SI, DI, BP (all may be used in effective address)
    341         push    ax
    342         mov     al, %2
    343         xor     ah, ah
    344         xchg    ax, %1
    345         pop     ax
     368        FSIS    %1, %2
     369        %if strpos
     370            push    ax
     371            mov     al, %2
     372            xor     ah, ah
     373            xchg    %1, ax
     374            pop     ax
     375        %else
     376            xchg    %1, ax
     377            mov     al, %2
     378            xor     ah, ah
     379            xchg    %1, ax
     380        %endif
    346381    %endif
    347382;-----------------------------------
     
    484519; eSEG_STR
    485520;   Parameters:
    486 ;       %1:     REP/REPNE or REPE prefix
     521;       %1:     REP/REPE/REPZ or REPNE/REPNZ prefix
    487522;       %2:     Source segment override (destination is always ES)
    488523;       %3:     String instruction
     
    491526;       FLAGS for cmps and scas only
    492527;   Corrupts registers:
    493 ;       Nothing
     528;       FLAGS
    494529;--------------------------------------------------------------------
    495530%macro eSEG_STR 3
     
    499534        %2                      ; SEG is the prefix that won't be lost
    500535        %3                      ; String instruction
     536FSIS    cmps, %3
     537%ifn strpos
     538    FSIS    scas, %3
     539%endif
     540%if strpos                      ; Must preserve FLAGS
    501541        jcxz    %%End           ; Jump to end if no repeats left (preserves FLAGS)
    502542        jmp     SHORT %%Loop    ; Loop while repeats left
    503543    %%End:
     544%else                           ; No need to preserve FLAGS
     545        inc     cx
     546        loop    %%Loop
     547%endif
    504548%else   ; No bug on V20/V30 and later, don't know about 188/186
    505549    %2
     
    556600%ifdef USE_386
    557601    %if %2 = 1
    558         add     %1, %1  ; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
     602        FSIS    ], %1
     603        %if strpos
     604            eSHIFT_IM   %1, %2, shl
     605        %else
     606            add     %1, %1  ; Same size but faster on 386 and 486.
     607        %endif
    559608    %else
    560609        eSHIFT_IM   %1, %2, shl
     
    582631%ifdef USE_386
    583632    %if %2 = 1
    584         adc     %1, %1  ; Same size but faster on 386 and 486. Fails if %1 is a memory operand.
     633        FSIS    ], %1
     634        %if strpos
     635            eSHIFT_IM   %1, %2, rcl
     636        %else
     637            adc     %1, %1  ; Same size but faster on 386 and 486.
     638        %endif
    585639    %else
    586640        eSHIFT_IM   %1, %2, rcl
  • trunk/Assembly_Library/Inc/Macros.inc

    r566 r592  
    1818;       %1
    1919;--------------------------------------------------------------------
    20 %macro SKIP2B 1
     20%macro SKIP2B 1.nolist
    2121    %ifidni     %1, f
    2222        db  03Dh                    ; Opcode byte for CMP AX, <immed>
  • trunk/Assembly_Library/Inc/Math.inc

    r589 r592  
    2323    jb      %%Return            ;  If so, return
    2424    mov     %1, %2              ; Copy %2 to %1
    25 ALIGN JUMP_ALIGN
    2625%%Return:
    2726%endmacro
     
    3130    jl      %%Return            ;  If so, return
    3231    mov     %1, %2              ; Copy %2 to %1
    33 ALIGN JUMP_ALIGN
    3432%%Return:
    3533%endmacro
     
    5149    ja      %%Return            ;  If so, return
    5250    mov     %1, %2              ; Copy %2 to %1
    53 ALIGN JUMP_ALIGN
    5451%%Return:
    5552%endmacro
     
    5956    jg      %%Return            ;  If so, return
    6057    mov     %1, %2              ; Copy %2 to %1
    61 ALIGN JUMP_ALIGN
    6258%%Return:
    6359%endmacro
     
    6763; SHL_DXAX
    6864;   Parameters:
    69 ;       %1:     Number of bits to shift
     65;       %1:     Number of bits to shift. Can be (in preferred order) CX, CL or an immediate value.
    7066;   Returns:
    7167;       DX:AX   Shifted value
     
    7470;--------------------------------------------------------------------
    7571%macro SHL_DXAX 1
     72%ifdef USE_386
    7673    %ifnidni %1, cx
     74        ; %1 is CL or an immediate
     75        shld    dx, ax, %1
     76        shl     ax, %1
     77    %else
     78        ; %1 is CX
     79        shld    dx, ax, cl
     80        shl     ax, cl
     81    %endif
     82%else
     83    %ifidni %1, cl
     84        ; %1 is CL
     85        xor     ch, ch
     86    %elifnidni %1, cx
     87        ; %1 is an immediate
    7788        mov     cx, %1
    7889    %endif
     
    8293    eRCL_IM dx, 1
    8394    loop    .ShiftNextBit
     95%endif
    8496%endmacro
    8597
     
    88100; SHR_DXAX
    89101;   Parameters:
    90 ;       %1:     Number of bits to shift
     102;       %1:     Number of bits to shift. Can be (in preferred order) CX, CL or an immediate value.
    91103;   Returns:
    92104;       DX:AX   Shifted value
     
    95107;--------------------------------------------------------------------
    96108%macro SHR_DXAX 1
     109%ifdef USE_386
    97110    %ifnidni %1, cx
     111        ; %1 is CL or an immediate
     112        shrd    ax, dx, %1
     113        shr     dx, %1
     114    %else
     115        ; %1 is CX
     116        shrd    ax, dx, cl
     117        shr     dx, cl
     118    %endif
     119%else
     120    %ifidni %1, cl
     121        ; %1 is CL
     122        xor     ch, ch
     123    %elifnidni %1, cx
     124        ; %1 is an immediate
    98125        mov     cx, %1
    99126    %endif
     
    103130    rcr     ax, 1
    104131    loop    .ShiftNextBit
     132%endif
    105133%endmacro
    106134
  • trunk/Assembly_Library/Inc/Menu.inc

    r525 r592  
    159159SCROLL_THUMB_CHARACTER              EQU     BLOCK_FULL_FOREGROUND
    160160
    161 NO_ITEM_SELECTED                    EQU     -1
     161;NO_ITEM_SELECTED                   EQU     -1
    162162NO_ITEM_HIGHLIGHTED                 EQU     -1
    163163NO_TIMEOUT_USED                     EQU     0
Note: See TracChangeset for help on using the changeset viewer.