Changeset 491 in xtideuniversalbios for trunk/Assembly_Library


Ignore:
Timestamp:
Dec 15, 2012, 2:46:29 PM (12 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • Added a new define (USE_UNDOC_INTEL) that enables optimizations possible by using undocumented instructions available on all Intel processors and truly compatible clones. AFAIK the only exceptions are the NEC V-series and the Sony CXQ70108 processors so this option should be safe for use on the AT builds.
  • Building BIOSDRVS or the BIOS without MODULE_STRINGS_COMPRESSED would fail due to the recent code exclusions so I changed them a bit. Also fixed the mistaken change to Main.asm
  • Changed the Tandy specific info in Configuration_FullMode.txt so it matches the info in the Wiki.
  • Optimizations and fixes in general.
Location:
trunk/Assembly_Library
Files:
14 edited

Legend:

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

    r489 r491  
    5757
    5858;==========================================================================
     59
     60;--------------------------------------------------------------------
     61; The undocumented instruction SALC (Set AL According to CF).
     62; Available on all Intel processors and truly compatible clones.
     63; Does not work on the NEC V20/V30 or Sony CXQ70108 processors.
     64;
     65; eSALC
     66;   Parameters:
     67;       Nothing
     68;   Returns:
     69;       AL:     FFh if CF=1
     70;               00h if CF=0
     71;   Corrupts registers:
     72;       Nothing
     73;--------------------------------------------------------------------
     74%macro eSALC 0
     75    db      0D6h
     76%endmacro
     77
     78
     79;--------------------------------------------------------------------
     80; The AAD instruction (ASCII Adjust before Division).
     81; Available on all Intel processors and truly compatible clones.
     82; Does not work on the NEC V20/V30 or Sony CXQ70108 processors
     83; unless %1 is 10 (0Ah).
     84;
     85; eAAD
     86;   Parameters:
     87;       %1:     Any 8 bit number (0...255)
     88;   Returns:
     89;       AL:     AH * %1 + AL
     90;       AH:     0
     91;       Flags:  Set according to result
     92;   Corrupts registers:
     93;       Nothing
     94;--------------------------------------------------------------------
     95%macro eAAD 1
     96%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     97    %if %1 > 255
     98        %error Invalid parameter passed to eAAD (%1 > 255)
     99    %else
     100        db      0D5h, %1
     101    %endif
     102%endif
     103%endmacro
     104
     105
     106;--------------------------------------------------------------------
     107; The AAM instruction (ASCII Adjust after Multiplication).
     108; Available on all Intel processors and truly compatible clones.
     109; Does not work on the NEC V20/V30 or Sony CXQ70108 processors
     110; unless %1 is 10 (0Ah).
     111;
     112; eAAM
     113;   Parameters:
     114;       %1:     Any 8 bit number except 0 (1...255)
     115;   Returns:
     116;       AL:     AL MOD %1
     117;       AH:     AL / %1
     118;       Flags:  Set according to result
     119;   Corrupts registers:
     120;       Nothing
     121;--------------------------------------------------------------------
     122%macro eAAM 1
     123%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
     124    %if %1 > 255
     125        %error Invalid parameter passed to eAAM (%1 > 255)
     126    %elif %1 = 0
     127        %error Invalid parameter passed to eAAM (%1 = 0). This would cause a divide-by-zero exception!
     128    %else
     129        db      0D4h, %1
     130    %endif
     131%endif
     132%endmacro
     133
    59134
    60135;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Display/CgaSnow.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Section containing code
     
    9494    ret
    9595
    96 %ifdef INCLUDE_MENU_LIBRARY
     96
    9797;--------------------------------------------------------------------
    9898; CgaSnow_RepMovsb
     
    107107;       AX, CX, DX
    108108;--------------------------------------------------------------------
     109%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     110    %ifdef MODULE_STRINGS_COMPRESSED
     111        %define EXCLUDE
     112    %endif
     113    %ifdef MODULE_BOOT_MENU
     114        %undef EXCLUDE
     115    %endif
     116%endif
     117
     118%ifndef EXCLUDE
    109119ALIGN DISPLAY_JUMP_ALIGN
    110120CgaSnow_RepMovsb:
     
    123133    ret
    124134%endif
     135%undef EXCLUDE
     136
    125137
    126138;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Display/DisplayContext.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Section containing code
     
    102102
    103103
    104 %ifdef INCLUDE_MENU_LIBRARY
    105 
    106104;--------------------------------------------------------------------
    107105; DisplayContext_Push
     106; DisplayContext_Pop
    108107;   Parameters:
    109108;       Nothing
     
    113112;       AX, DI
    114113;--------------------------------------------------------------------
     114%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     115    %ifndef MODULE_BOOT_MENU
     116        %define EXCLUDE
     117    %endif
     118%endif
     119
     120%ifndef EXCLUDE
    115121ALIGN DISPLAY_JUMP_ALIGN
    116122DisplayContext_Push:
     
    126132    %endrep
    127133%endif
    128        
     134
    129135    mov     ds, di                  ; Restore DS
    130136    jmp     ax
    131137
    132 ;--------------------------------------------------------------------
    133 ; DisplayContext_Pop
    134 ;   Parameters:
    135 ;       Nothing
    136 ;   Returns:
    137 ;       Nothing
    138 ;   Corrupts registers:
    139 ;       AX, DI
    140 ;--------------------------------------------------------------------
     138
    141139ALIGN DISPLAY_JUMP_ALIGN
    142140DisplayContext_Pop:
     
    145143    pop     ax                      ; Pop return address
    146144
    147 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS       
     145%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    148146    %assign i DISPLAY_CONTEXT_size-2
    149147    %rep DISPLAY_CONTEXT_size / 2
     
    152150    %endrep
    153151%endif
    154        
     152
    155153    push    ax                      ; Push return address
    156154    push    dx
     
    159157    mov     ds, di                  ; Restore DS
    160158    ret
    161 %endif
     159%endif ; EXCLUDE
     160%undef EXCLUDE
     161
    162162
    163163;--------------------------------------------------------------------
     
    189189    pop     ds
    190190    ret
    191 
    192 %endif  ; INCLUDE_MENU_LIBRARY
     191%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    193192
    194193
     
    231230%endif
    232231
    233 %ifdef INCLUDE_MENU_LIBRARY
    234 
     232
     233%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     234    %ifndef MODULE_BOOT_MENU
     235        %define EXCLUDE
     236    %endif
     237%endif
    235238;--------------------------------------------------------------------
    236239; DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
     
    244247;       BL
    245248;--------------------------------------------------------------------
     249%ifndef EXCLUDE ; 1 of 3
    246250ALIGN DISPLAY_JUMP_ALIGN
    247251DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL:
     
    251255    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], ax
    252256    ret
     257%endif
    253258
    254259
     
    263268;       Nothing
    264269;--------------------------------------------------------------------
     270%ifndef EXCLUDE ; 2 of 3
    265271ALIGN DISPLAY_JUMP_ALIGN
    266272DisplayContext_SetCharacterAttributeFromAL:
    267273    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], al
    268274    ret
     275%endif
    269276
    270277
     
    279286;       Nothing
    280287;--------------------------------------------------------------------
     288%ifndef EXCLUDE ; 3 of 3
    281289ALIGN DISPLAY_JUMP_ALIGN
    282290DisplayContext_SetCharacterOutputParameterFromAX:
    283291    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], ax
    284292    ret
    285        
    286 %endif   ; INCLUDE_MENU_LIBRARY
    287        
     293%endif
     294
     295%undef EXCLUDE
     296
     297
    288298;--------------------------------------------------------------------
    289299; DisplayContext_GetCharacterOutputParameterToDX
     
    295305;       Nothing
    296306;--------------------------------------------------------------------
    297 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG  ; This is currently unused (dead code)
     307%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
    298308ALIGN DISPLAY_JUMP_ALIGN
    299309DisplayContext_GetCharacterOutputParameterToDX:
     
    322332%endif
    323333
    324        
     334
    325335;--------------------------------------------------------------------
    326336; DisplayContext_GetByteOffsetToAXfromCharacterOffsetInAX
  • trunk/Assembly_Library/Src/Display/DisplayCursor.asm

    r489 r491  
    3737    ret
    3838
    39 %ifdef INCLUDE_MENU_LIBRARY
     39
    4040;--------------------------------------------------------------------
    4141; DisplayCursor_SetShapeFromAX
     
    4848;       Nothing
    4949;--------------------------------------------------------------------
     50%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     51    %ifndef MODULE_BOOT_MENU
     52        %define EXCLUDE
     53    %endif
     54%endif
     55
     56%ifndef EXCLUDE
    5057ALIGN DISPLAY_JUMP_ALIGN
    5158DisplayCursor_SetShapeFromAX:
     
    5360    ret
    5461%endif
    55        
     62%undef EXCLUDE
     63
     64
    5665;--------------------------------------------------------------------
    5766; DisplayCursor_SetCoordinatesFromAX
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Section containing code
     
    109109
    110110
    111 %ifndef MODULE_STRINGS_COMPRESSED
    112111;--------------------------------------------------------------------
    113112; DisplayPrint_WordFromAXWithBaseInBX
     
    122121;       AX, DX
    123122;--------------------------------------------------------------------
     123%ifndef MODULE_STRINGS_COMPRESSED
    124124ALIGN DISPLAY_JUMP_ALIGN
    125125DisplayPrint_WordFromAXWithBaseInBX:
     
    152152g_rgcDigitToCharacter:  db  "0123456789ABCDEF"
    153153
     154%endif ; MODULE_STRINGS_COMPRESSED
     155
    154156;--------------------------------------------------------------------
    155157; DisplayPrint_QWordFromSSBPwithBaseInBX
     
    164166;       AX, DX, [SS:BP]
    165167;--------------------------------------------------------------------
    166 %ifndef EXCLUDE_FROM_XTIDECFG   ; Not used in XTIDECFG
     168%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
    167169ALIGN DISPLAY_JUMP_ALIGN
    168170DisplayPrint_QWordFromSSBPwithBaseInBX:
     
    181183    mov     cx, bx              ; Character count to CX
    182184    jmp     SHORT PrintAllPushedDigits
    183 %endif  ; EXCLUDE_FROM_XTIDECFG
    184 
    185 %endif  ; MODULE_STRINGS_COMPRESSED
     185%endif
    186186
    187187
     
    220220
    221221
    222 %ifdef INCLUDE_MENU_LIBRARY
    223222;--------------------------------------------------------------------
    224223; DisplayPrint_ClearScreenWithCharInALandAttributeInAH
     
    233232;       AX, DX
    234233;--------------------------------------------------------------------
     234%ifdef INCLUDE_MENU_LIBRARY
    235235ALIGN DISPLAY_JUMP_ALIGN
    236236DisplayPrint_ClearScreenWithCharInALandAttributeInAH:
     
    251251    ret
    252252%endif
    253        
     253
     254
    254255;--------------------------------------------------------------------
    255256; DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
  • trunk/Assembly_Library/Src/File/FileIO.asm

    r446 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020
    2121; Section containing code
     
    3737ALIGN JUMP_ALIGN
    3838FileIO_CreateWithPathInDSSIandAttributesInCX:
    39     xchg    dx, si      ; Path now in DS:DX
    4039    mov     ah, CREATE_OR_TRUNCATE_FILE
    41     jmp     SHORT CreateOrOpenFile
    42 
     40    SKIP2B  bx
     41    ; Fall to FileIO_OpenWithPathInDSSIandFileAccessInAL
    4342
    4443;--------------------------------------------------------------------
     
    5554;       AX, BX
    5655;--------------------------------------------------------------------
    57 ALIGN JUMP_ALIGN
    5856FileIO_OpenWithPathInDSSIandFileAccessInAL:
     57    mov     ah, OPEN_EXISTING_FILE
    5958    xchg    dx, si      ; Path now in DS:DX
    60     mov     ah, OPEN_EXISTING_FILE
    61 CreateOrOpenFile:
    6259    int     DOS_INTERRUPT_21h
    6360    xchg    si, dx
     
    8784    ret
    8885
    89 ;--------------------------------------------------------------------
    90 ; File position is updated so next read will start where
    91 ; previous read stopped.
    92 ;
    93 ; FileIO_ReadCXbytesToDSSIusingHandleFromBX
    94 ;   Parameters:
    95 ;       BX:     File handle
    96 ;       CX:     Number of bytes to read
    97 ;       DS:SI:  Ptr to destination buffer
    98 ;   Returns:
    99 ;       AX:     Number of bytes actually read if successful (0 if at EOF before call)
    100 ;               DOS error code if CF set
    101 ;       CF:     Clear if successful
    102 ;               Set if error
    103 ;   Corrupts registers:
    104 ;       Nothing
    105 ;--------------------------------------------------------------------
    106 ALIGN JUMP_ALIGN
    107 FileIO_ReadCXbytesToDSSIusingHandleFromBX:
    108     xchg    dx, si              ; DS:DX now points to destination buffer
    109     mov     ah, READ_FROM_FILE_OR_DEVICE
    110     int     DOS_INTERRUPT_21h
    111     xchg    si, dx
    112     ret
    113 
    11486
    11587;--------------------------------------------------------------------
     
    134106    ret
    135107
     108
     109;--------------------------------------------------------------------
     110; File position is updated so next read will start where
     111; previous read stopped.
     112;
     113; FileIO_ReadCXbytesToDSSIusingHandleFromBX
     114;   Parameters:
     115;       BX:     File handle
     116;       CX:     Number of bytes to read
     117;       DS:SI:  Ptr to destination buffer
     118;   Returns:
     119;       AX:     Number of bytes actually read if successful (0 if at EOF before call)
     120;               DOS error code if CF set
     121;       CF:     Clear if successful
     122;               Set if error
     123;   Corrupts registers:
     124;       Nothing
     125;--------------------------------------------------------------------
     126ALIGN JUMP_ALIGN
     127FileIO_ReadCXbytesToDSSIusingHandleFromBX:
     128    mov     ah, READ_FROM_FILE_OR_DEVICE
     129    SKIP2B  f
     130    ; Fall to FileIO_WriteCXbytesFromDSSIusingHandleFromBX
     131
    136132;--------------------------------------------------------------------
    137133; File position is updated so next write will start where
    138134; previous write stopped.
    139135;
    140 ; FileIO_WriteCXbytesFromDSSIusingHandleFromBX:
     136; FileIO_WriteCXbytesFromDSSIusingHandleFromBX
    141137;   Parameters:
    142138;       BX:     File handle
     
    151147;       Nothing
    152148;--------------------------------------------------------------------
    153 ALIGN JUMP_ALIGN
    154149FileIO_WriteCXbytesFromDSSIusingHandleFromBX:
    155     xchg    dx, si              ; DS:DX now points to source buffer
    156150    mov     ah, WRITE_TO_FILE_OR_DEVICE
     151    xchg    dx, si              ; DS:DX now points to buffer
    157152    int     DOS_INTERRUPT_21h
    158153    xchg    si, dx
     
    232227
    233228;--------------------------------------------------------------------
    234 ; FileIO_GetFileSizeToDXAXusingHandleFromBXandResetFilePosition:
     229; FileIO_GetFileSizeToDXAXusingHandleFromBXandResetFilePosition
    235230;   Parameters:
    236231;       BX:     File handle
     
    287282
    288283;--------------------------------------------------------------------
    289 ; FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX:
     284; FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX
    290285;   Parameters:
    291286;       AL:     SEEK_FROM.(origin)
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm

    r376 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020
    2121; Section containing code
     
    9999    mov     [si+PROGRESS_DIALOG_IO.wStartTimeTicks], ax
    100100
    101     ; 0 = 65536 but it needs to be adjusted to 65535 prevent division by zero
     101    ; 0 = 65536 but it needs to be adjusted to 65535 to prevent division by zero
    102102    cmp     WORD [si+PROGRESS_DIALOG_IO.wMaxProgressValue], BYTE 0
    103103    jne     SHORT CalculateProgressNeededBeforeUpdatingCharacter
     
    288288    div     cx          ; AX = Estimated ticks left
    289289    xchg    dx, ax
    290     SKIP2B  f   ; cmp ax, <next instruction>
     290    SKIP2B  ax
    291291.PreventDivisionByZero:
    292292    xor     dx, dx
     
    309309    mov     bp, sp
    310310    mov     si, g_szTimeFormat
    311     call    TimerTicks_GetMinutesToAXfromTicksInDX
     311    call    TimerTicks_GetMinutesToAXandRemainderTicksToDXfromTicksInDX
    312312    push    ax
    313313    call    TimerTicks_GetSecondsToAXfromTicksInDX
  • trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm

    r376 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020
    2121; Section containing code
     
    7979;       AX:     Item line for last thumb character
    8080;   Corrupts registers:
    81 ;       CX, DX
     81;       DX
    8282;--------------------------------------------------------------------
    8383ALIGN MENU_JUMP_ALIGN
     
    9595;       AX:     Item line for first thumb character
    9696;   Corrupts registers:
    97 ;       CX, DX
     97;       DX
    9898;--------------------------------------------------------------------
    9999ALIGN MENU_JUMP_ALIGN
  • trunk/Assembly_Library/Src/Menu/MenuTime.asm

    r376 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020
    2121; Section containing code
     
    101101;       AX:     Seconds until timeout
    102102;   Corrupts registers:
    103 ;       AX
     103;       Nothing
    104104;--------------------------------------------------------------------
    105105ALIGN MENU_JUMP_ALIGN
     
    116116    xchg    dx, ax
    117117    call    TimerTicks_GetSecondsToAXfromTicksInDX
    118     SKIP2B  f   ; cmp ax, <next instruction>
     118    SKIP2B  dx
    119119.TimeoutHasOccurredSoMakeSureTicksAreNotBelowZero:
    120120    xor     ax, ax
  • trunk/Assembly_Library/Src/Serial/SerialServer.asm

    r376 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020
    2121%include "SerialServer.inc"
     
    7575
    7676        mov     al,83h
    77         add     dl,Serial_UART_lineControl
     77        add     dl, Serial_UART_lineControl ; Clears CF
    7878        out     dx,al
    7979
     
    8282        out     dx,al
    8383
     84%ifdef USE_UNDOC_INTEL
     85        eSALC   ; Clear AL using CF
     86%else
    8487        xor     ax,ax
     88%endif
    8589        inc     dx              ; divisor high
    8690        push    dx
     
    103107
    104108        pop     dx              ; base, interrupts disabled
     109%ifdef USE_UNDOC_INTEL
     110        eSALC   ; Clear AL using CF
     111%else
    105112        xor     ax,ax
     113%endif
    106114        out     dx,al
    107115
  • trunk/Assembly_Library/Src/String/Char.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Section containing code
     
    2929;       %3:     Last accepted value in range
    3030;   Returns:
    31 ;       CF:     Set if character is range
     31;       CF:     Set if character in range
    3232;               (Jumps to Char_CharIsNotValid if before range)
    3333;   Corrupts registers:
     
    5151;       Nothing
    5252;--------------------------------------------------------------------
     53%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     54    %ifndef MODULE_HOTKEYS
     55        %define EXCLUDE
     56    %endif
     57%endif
     58
     59%ifndef EXCLUDE
    5360ALIGN STRING_JUMP_ALIGN
    5461Char_IsLowerCaseLetterInAL:
    5562    IS_BETWEEN_IMMEDIATES al, 'a', 'z'
    5663    ret
     64%endif
     65%undef EXCLUDE
     66
    5767
    5868;--------------------------------------------------------------------
     
    7282    ret
    7383%endif
     84
    7485
    7586;--------------------------------------------------------------------
     
    94105%endif
    95106
     107
    96108;--------------------------------------------------------------------
    97109; Char_IsDecimalDigitInAL
     
    110122    ret
    111123%endif
     124
    112125
    113126;--------------------------------------------------------------------
     
    141154%endif
    142155
     156
    143157;--------------------------------------------------------------------
    144158; Char_CharIsValid
     
    159173%endif
    160174
     175
     176%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     177    %ifndef MODULE_HOTKEYS
     178        %define EXCLUDE
     179    %endif
     180    %ifndef MODULE_STRINGS_COMPRESSED
     181        %undef EXCLUDE
     182    %endif
     183%endif
     184
     185%ifndef EXCLUDE
    161186ALIGN STRING_JUMP_ALIGN
    162187Char_CharIsNotValid:
    163188    clc
    164189    ret
     190%endif
     191%undef EXCLUDE
    165192
    166193
     
    181208%endif
    182209
    183                
     210
    184211;--------------------------------------------------------------------
    185212; Char_ALtoUpperCaseLetter
     
    191218;       Nothing
    192219;--------------------------------------------------------------------
    193 %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS       
     220%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    194221ALIGN STRING_JUMP_ALIGN
    195222Char_ALtoUpperCaseLetter:
     
    200227%endif
    201228
    202        
     229
    203230;--------------------------------------------------------------------
    204231; Char_ChangeCaseInAL
     
    210237;       Nothing
    211238;--------------------------------------------------------------------
     239%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    212240Char_ChangeCaseInAL:
    213241    xor     al, 32
    214242.Return:
    215243    ret
     244%endif
     245
    216246
    217247;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Time/TimerTicks.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
    19 
    20 ; System timer ticks 18.2 times per second = 54.9 ms / tick
    21 TICKS_PER_HOUR          EQU     65520
     18;
     19
     20; With a PIT input clock of 1193181.6666... Hz and a maximum
     21; 16 bit divisor of 65536 (if PIT programmed with 0) we get:
     22;
     23; Clock / Divisor = ~18.2065 ticks per second
     24; Clock * SecondsPerMinute / Divisor = ~1092 ticks per minute
     25; Clock * SecondsPerHour / Divisor = ~65543 ticks per hour
     26;
     27; Since 65543 can't fit in a 16 bit register we use the
     28; maximum possible instead and disregard the last ~8 ticks.
     29
     30TICKS_PER_HOUR          EQU     65535
    2231TICKS_PER_MINUTE        EQU     1092
    2332TICKS_PER_SECOND        EQU     18
     
    2837
    2938;--------------------------------------------------------------------
    30 ; TimerTicks_GetHoursToAXfromTicksInDXAX
    31 ; TimerTicks_GetMinutesToAXfromTicksInDX
    32 ; TimerTicks_GetSecondsToAXfromTicksInDX
     39; TimerTicks_GetHoursToAXandRemainderTicksToDXfromTicksInDXAX
     40; TimerTicks_GetMinutesToAXandRemainderTicksToDXfromTicksInDX
     41; TimerTicks_GetSecondsToAXandRemainderTicksToDXfromTicksInDX
    3342;   Parameters
    3443;       DX(:AX):    Timer ticks to convert
     
    4251%ifndef EXCLUDE_FROM_XTIDECFG
    4352ALIGN JUMP_ALIGN
    44 TimerTicks_GetHoursToAXfromTicksInDXAX:
     53TimerTicks_GetHoursToAXandRemainderTicksToDXfromTicksInDXAX:
    4554    mov     cx, TICKS_PER_HOUR
    4655    div     cx      ; Divide DX:AX by CX, Hours to AX, remainder ticks to DX
     
    4958
    5059ALIGN JUMP_ALIGN
    51 TimerTicks_GetMinutesToAXfromTicksInDX:
     60TimerTicks_GetMinutesToAXandRemainderTicksToDXfromTicksInDX:
    5261    xor     ax, ax
    5362    xchg    ax, dx  ; Ticks now in DX:AX
     
    5766%endif ; EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
    5867
    59 %ifdef INCLUDE_MENU_LIBRARY
    60 ALIGN JUMP_ALIGN
    61 TimerTicks_GetSecondsToAXfromTicksInDX:
     68%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
     69ALIGN JUMP_ALIGN
     70TimerTicks_GetSecondsToAXandRemainderTicksToDXfromTicksInDX:
     71    ; This procedure can handle at most 4607 ticks in DX (almost 256 seconds)
     72    ; More than 4607 ticks will generate a divide overflow exception!
    6273    xchg    ax, dx  ; Ticks now in AX
    6374    mov     cl, TICKS_PER_SECOND
     
    6879%endif
    6980
     81
     82%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     83    %ifndef MODULE_BOOT_MENU
     84        %define EXCLUDE
     85    %endif
     86%endif
     87;--------------------------------------------------------------------
     88; TimerTicks_GetSecondsToAXfromTicksInDX
     89;   Parameters
     90;       DX:         Timer ticks to convert
     91;   Returns:
     92;       AX:         Seconds
     93;   Corrupts registers:
     94;       DX
     95;--------------------------------------------------------------------
     96%ifndef EXCLUDE ; 1 of 3
     97ALIGN JUMP_ALIGN
     98TimerTicks_GetSecondsToAXfromTicksInDX:
     99    mov     ax, 3600    ; Approximately 65536 / (Clock / Divisor)
     100    mul     dx
     101    xchg    dx, ax
     102    ret
     103%endif
     104
     105
    70106;--------------------------------------------------------------------
    71107; First tick might take 0...54.9 ms and remaining ticks
     
    82118;       AX
    83119;--------------------------------------------------------------------
    84 %ifdef INCLUDE_MENU_LIBRARY     
     120%ifndef EXCLUDE ; 2 of 3
    85121ALIGN JUMP_ALIGN
    86122TimerTicks_InitializeTimeoutFromAX:
     
    90126    ret
    91127%endif
     128
    92129
    93130;--------------------------------------------------------------------
     
    102139;       Nothing
    103140;--------------------------------------------------------------------
    104 %ifdef INCLUDE_MENU_LIBRARY     
     141%ifndef EXCLUDE ; 3 of 3
    105142ALIGN JUMP_ALIGN
    106143TimerTicks_GetTimeoutTicksLeftToAXfromDSBX:
     
    114151%endif
    115152
     153%undef EXCLUDE
     154
     155
    116156;--------------------------------------------------------------------
    117157; TimerTicks_GetElapsedToAXandResetDSBX
     
    134174%endif
    135175
     176
    136177;--------------------------------------------------------------------
    137178; TimerTicks_GetElapsedToAXfromDSBX
     
    161202;       Nothing
    162203;--------------------------------------------------------------------
     204%ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
     205    %ifndef MODULE_BOOT_MENU OR MODULE_HOTKEYS
     206        %define EXCLUDE
     207    %endif
     208%endif
     209
     210%ifndef EXCLUDE
    163211ALIGN JUMP_ALIGN
    164212TimerTicks_ReadFromBdaToAX:
     
    170218    pop     ds
    171219    ret
     220%endif
     221%undef EXCLUDE
  • trunk/Assembly_Library/Src/Util/Registers.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1818;
    19        
     19
    2020; Section containing code
    2121SECTION .text
     
    5252;       Nothing
    5353;--------------------------------------------------------------------
     54%ifdef INCLUDE_MENU_LIBRARY
    5455ALIGN JUMP_ALIGN
    55 %ifdef INCLUDE_MENU_LIBRARY     
    5656Registers_CopySSBPtoESDI:
    5757    COPY_SSBP_TO_ESDI
  • trunk/Assembly_Library/Src/Util/Size.asm

    r489 r491  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020%ifdef INCLUDE_MENU_LIBRARY
     
    6868    ; Convert remainder to tenths
    6969    xchg    bx, ax                      ; Store AX
    70     mov     ax, 10
    71     mul     cx                          ; DX:AX = remainder * 10
    72     eSHR_IM ax, 10                      ; Divide AX by 1024
     70    mov     ax, 5
     71    mul     cx                          ; DX:AX = remainder * (10 / 2)
     72%ifdef USE_186
     73    shr     ax, 9                       ; Divide AX by (1024 / 2)
     74%else
     75    shr     ax, 1
     76    mov     al, ah
     77    cbw
     78%endif
    7379    xchg    cx, ax                      ; CX = tenths
    7480    xchg    ax, bx
     
    124130;--------------------------------------------------------------------
    125131ALIGN UTIL_SIZE_JUMP_ALIGN
    126 Size_ConvertSectorCountInBXDXAXtoKiB:               ; unused entrypoint ok
     132Size_ConvertSectorCountInBXDXAXtoKiB:   ; unused entrypoint ok
    127133Size_DivideBXDXAXbyTwo:
    128134    shr     bx, 1                   ; Divide sector count by 2...
Note: See TracChangeset for help on using the changeset viewer.