Changeset 45 in xtideuniversalbios for trunk/Assembly_Library/Src


Ignore:
Timestamp:
Sep 29, 2010, 5:59:07 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to assembly library:
Changed SetCharOutputFunctionFromAXwithAttribFlagInDL to SetCharOutputFunctionFromAXwithAttribFlagInBL since DX register gets corrupted by Display_FunctionFromDI.
Implemented quicksort.

Location:
trunk/Assembly_Library/Src
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/AssemblyLibrary.asm

    r41 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   15.9.2010
    4 ; Last update   :   15.9.2010
     4; Last update   :   29.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Assembly Library main file. This is the only file that
     
    7171    %include "Memory.asm"
    7272    %include "Size.asm"
     73    %include "Sort.asm"
    7374%endif
  • trunk/Assembly_Library/Src/Display/Display.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   2.7.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Display Library functions for CALL_DISPLAY_LIBRARY macro
     
    6868
    6969    at  DISPLAY_LIB.SetCharacterPointerFromBXAX,                    dw  DisplayContext_SetCharacterPointerFromBXAX
    70     at  DISPLAY_LIB.SetCharOutputFunctionFromAXwithAttribFlagInDL,  dw  DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL
     70    at  DISPLAY_LIB.SetCharOutputFunctionFromAXwithAttribFlagInBL,  dw  DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
    7171    at  DISPLAY_LIB.SetCharacterOutputParameterFromAX,              dw  DisplayContext_SetCharacterOutputParameterFromAX
    7272    at  DISPLAY_LIB.SetCharacterAttributeFromAL,                    dw  DisplayContext_SetCharacterAttributeFromAL
  • trunk/Assembly_Library/Src/Display/DisplayContext.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   25.6.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for managing display context.
     
    153153
    154154;--------------------------------------------------------------------
    155 ; DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL
     155; DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
    156156;   Parameters:
    157157;       AX:     Offset to character output function
    158 ;       DL:     Attribute Flag
    159 ;       DS:     BDA segment (zero)
    160 ;   Returns:
    161 ;       Nothing
    162 ;   Corrupts registers:
    163 ;       Nothing
    164 ;--------------------------------------------------------------------
    165 ALIGN JUMP_ALIGN
    166 DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL:
     158;       BL:     Attribute Flag
     159;       DS:     BDA segment (zero)
     160;   Returns:
     161;       Nothing
     162;   Corrupts registers:
     163;       Nothing
     164;--------------------------------------------------------------------
     165ALIGN JUMP_ALIGN
     166DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL:
    167167    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], ax
    168     and     BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], ~FLG_CONTEXT_ATTRIBUTES
    169     mov     al, dl
    170     and     al, FLG_CONTEXT_ATTRIBUTES
    171     or      [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], al
     168    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], bl
    172169    ret
    173170
  • trunk/Assembly_Library/Src/LibraryTests.asm

    r44 r45  
    3333    CALL_DISPLAY_LIBRARY ClearScreen
    3434
    35     call    LibraryTests_ForDisplayLibrary
     35    call    LibraryTests_Sort
     36    ;call   LibraryTests_ForDisplayLibrary
    3637    ;call   LibraryTests_ForKeyboardLibrary
    37     call    LibraryTests_ForMenuLibrary
     38    ;call   LibraryTests_ForMenuLibrary
    3839
    3940    ; Exit to DOS
     
    254255    mov     ax, si
    255256    CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX
    256     mov     dl, ATTRIBUTES_NOT_USED
     257    mov     bl, ATTRIBUTES_NOT_USED
    257258    mov     ax, BUFFER_OUTPUT_WITH_CHAR_ONLY
    258     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL
     259    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    259260    lea     ax, [si+STRING_BUFFER_SIZE]
    260261    CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
     
    551552.szRepeat:
    552553    db  "Repeating character '-':                   %A%t",LF,CR,NULL
    553        
     554
     555
     556;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     557LibraryTests_Sort:
     558    call    .PrintWords
     559    push    cs
     560    pop     ds
     561    mov     si, .rgwItems
     562    mov     dx, 7
     563    mov     cx, 2
     564    mov     bx, .Comparator
     565    call    Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
     566    call    .PrintWords
     567    ret
     568
     569
     570.Comparator:
     571    push    ax
     572    mov     ax, [si]
     573    ;DISPLAY_DEBUG_CHARACTER 'I'
     574    ;DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY ax, 10
     575    ;DISPLAY_DEBUG_CHARACTER ','
     576    ;DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY [es:di], 10
     577    ;DISPLAY_DEBUG_CHARACTER ' '
     578    cmp     ax, [es:di]
     579    pop     ax
     580    ret
     581
     582.PrintWords:
     583    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
     584    mov     cx, 7
     585    push    cs
     586    pop     ds
     587    mov     si, .rgwItems
     588    mov     bx, 10
     589.Loop:
     590    lodsw
     591    CALL_DISPLAY_LIBRARY PrintSignedWordFromAXWithBaseInBX
     592    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
     593    loop    .Loop
     594    ret
     595
     596
     597.rgwItems:
     598    dw      435
     599    dw      -31551
     600    dw      345
     601    dw      0
     602    dw      -18
     603    dw      23
     604    dw      435
     605
    554606
    555607
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   6.9.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays file dialog.
     
    253253    xchg    ax, cx
    254254    CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX
    255     mov     dl, ATTRIBUTES_NOT_USED
     255    mov     bl, ATTRIBUTES_NOT_USED
    256256    mov     ax, BUFFER_OUTPUT_WITH_CHAR_ONLY
    257     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL
     257    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    258258
    259259    call    .FormatFileOrDirectoryToBufferFromDTAinDSSI
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm

    r41 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   15.8.2010
    4 ; Last update   :   16.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays progress bar dialog and starts progress task.
     
    167167    jcxz    .DrawEmptyCharsOnly
    168168
    169     mov     al, SCROLL_THUMB_CHARACTER
     169    mov     al, PROGRESS_COMPLETE_CHARACTER
    170170    CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
    171171
     
    173173    mov     cx, dx
    174174    jcxz    .NothingLeftToDraw
    175     mov     al, SCROLL_TRACK_CHARACTER
     175    mov     al, PROGRESS_INCOMPLETE_CHARACTER
    176176    CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
    177177
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu borders.
     
    4545;       Nothing
    4646;   Corrupts registers:
    47 ;       AX, DX, SI, DI
     47;       AX, BX, SI, DI
    4848;--------------------------------------------------------------------
    4949ALIGN JUMP_ALIGN
    5050MenuBorders_AdjustDisplayContextForDrawingBorders:
    51     mov     dl, ATTRIBUTES_ARE_USED
     51    mov     bl, ATTRIBUTES_ARE_USED
    5252    mov     ax, MenuCharOut_MenuBorderTeletypeOutputWithAttribute
    53     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL
     53    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    5454
    5555    mov     ax, bp
     
    269269    call    MenuAttribute_SetToDisplayContextFromTypeInSI
    270270
    271     push    dx
    272     mov     dl, ATTRIBUTES_ARE_USED
     271    push    bx
     272    mov     bl, ATTRIBUTES_ARE_USED
    273273    mov     ax, FAST_OUTPUT_WITH_ATTRIBUTE_ONLY
    274     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL
    275     pop     dx
     274    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
     275    pop     bx
    276276
    277277    call    PrintMultipleBorderCharactersFromAL ; AL does not matter
  • trunk/Assembly_Library/Src/Menu/MenuText.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   21.7.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu texts by the user.
     
    218218;       Nothing
    219219;   Corrupts registers:
    220 ;       AX, DX, SI, DI
     220;       AX, BX, SI, DI
    221221;--------------------------------------------------------------------
    222222ALIGN JUMP_ALIGN
    223223AdjustDisplayContextForDrawingTexts:
    224     mov     dl, ATTRIBUTES_ARE_USED
     224    mov     bl, ATTRIBUTES_ARE_USED
    225225    mov     ax, MenuCharOut_MenuTextTeletypeOutputWithAttribute
    226     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL
     226    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    227227
    228228    mov     ax, bp
  • trunk/Assembly_Library/Src/Menu/MenuTime.asm

    r44 r45  
    22; Project name  :   Assembly Library
    33; Created date  :   25.7.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   28.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu timeouts other time related functions.
     
    5656ALIGN JUMP_ALIGN
    5757MenuTime_UpdateSelectionTimeout:
    58     cmp     WORD [bp+MENUINIT.wTimeoutTicks], BYTE 0
    59     je      SHORT .ReturnSinceTimeoutDisabled   ; CF cleared
    6058    push    ds
    6159
    62     call    GetSecondsUntilTimeoutToAXandPtrToTimeoutCounterToDSBX
    63     cmp     al, [bp+MENU.bLastSecondPrinted]
    64     je      SHORT .SetCFifTimeoutAndReturn
    65     mov     [bp+MENU.bLastSecondPrinted], al
    66     call    DrawTimeoutInAXoverMenuBorders
     60    call    MenuTime_DrawWithoutUpdating
     61    jnc     SHORT .TimeoutDisabled
     62    call    PointDSBXtoTimeoutCounter
     63    call    TimerTicks_SetCarryIfTimeoutFromDSBX
    6764
    6865ALIGN JUMP_ALIGN
    69 .SetCFifTimeoutAndReturn:
    70     call    TimerTicks_SetCarryIfTimeoutFromDSBX
     66.TimeoutDisabled:
    7167    pop     ds
    72 .ReturnSinceTimeoutDisabled:
    7368    ret
    74 
    7569
    7670;--------------------------------------------------------------------
     
    7973;       SS:BP:  Ptr to MENU
    8074;   Returns:
    81 ;       Nothing
     75;       CF:     Set if timeout enabled
     76;               Cleared if timeout disabled
    8277;   Corrupts registers:
    8378;       AX, BX, CX, DX, SI, DI
     
    8681MenuTime_DrawWithoutUpdating:
    8782    cmp     WORD [bp+MENUINIT.wTimeoutTicks], BYTE 0
    88     je      SHORT .ReturnSinceTimeoutDisabled
     83    je      SHORT .ReturnSinceTimeoutDisabled   ; Clear CF
    8984
    9085    push    ds
    91     call    GetSecondsUntilTimeoutToAXandPtrToTimeoutCounterToDSBX
     86    call    GetSecondsLeftUntilTimeoutToAXandCounterToDSBX
    9287    call    DrawTimeoutInAXoverMenuBorders
    9388    pop     ds
     89    stc
     90ALIGN JUMP_ALIGN, ret
    9491.ReturnSinceTimeoutDisabled:
    9592    ret
     93
     94
     95;--------------------------------------------------------------------
     96; GetSecondsLeftUntilTimeoutToAXandCounterToDSBX
     97;   Parameters
     98;       SS:BP:  Ptr to MENU
     99;   Returns:
     100;       AX:     Seconds until timeout
     101;       DS:BX:  Ptr to timeout counter
     102;   Corrupts registers:
     103;       AX, CX, DX
     104;--------------------------------------------------------------------
     105ALIGN JUMP_ALIGN
     106GetSecondsLeftUntilTimeoutToAXandCounterToDSBX:
     107    call    PointDSBXtoTimeoutCounter
     108    call    TimerTicks_GetElapsedToAXfromDSBX
     109    neg     ax          ; Negate since DS:BX points to end time
     110    MAX_S   ax, 0       ; Set to zero if overflow
     111    xchg    dx, ax
     112    jmp     TimerTicks_GetSecondsToAXfromTicksInDX
    96113
    97114
     
    111128    lea     bx, [bp+MENU.wTimeoutCounter]
    112129    ret
    113 
    114 
    115 ;--------------------------------------------------------------------
    116 ; GetSecondsUntilTimeoutToAXandPtrToTimeoutCounterToDSBX
    117 ;   Parameters
    118 ;       SS:BP:  Ptr to MENU
    119 ;   Returns:
    120 ;       AX:     Seconds until timeout
    121 ;       DS:BX:  Ptr to timeout counter
    122 ;   Corrupts registers:
    123 ;       AX, CX, DX
    124 ;--------------------------------------------------------------------
    125 ALIGN JUMP_ALIGN
    126 GetSecondsUntilTimeoutToAXandPtrToTimeoutCounterToDSBX:
    127     call    PointDSBXtoTimeoutCounter
    128     call    TimerTicks_GetElapsedToAXfromDSBX
    129     neg     ax          ; Negate since DS:BX points to end time
    130     MAX_S   ax, 0       ; Set to zero if overflow
    131     xchg    dx, ax
    132     jmp     TimerTicks_GetSecondsToAXfromTicksInDX
    133130
    134131
     
    173170    pop     bp
    174171
     172    ; Draw right border with normal border color
    175173    mov     al, DOUBLE_RIGHT_HORIZONTAL_TO_SINGLE_VERTICAL
    176174    jmp     MenuBorders_PrintSingleBorderCharacterFromAL
     
    178176    db      DOUBLE_BOTTOM_LEFT_CORNER
    179177    db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
    180     db      "%AAutoselection in %2-ds",NULL
     178    db      "%AAutoselection in %2-us",NULL
    181179
    182180;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.