Changeset 67 in xtideuniversalbios for trunk/Assembly_Library


Ignore:
Timestamp:
Dec 9, 2010, 5:14:25 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:

  • Forgot to update SI on new File Read and Write functions.
  • Screen clearing function now accepts any character and attribute.
  • Menu library now accepts CR,LF combination as line feed. Previously only LF,CR worked properly.
Location:
trunk/Assembly_Library
Files:
9 edited

Legend:

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

    r52 r67  
    22; Project name  :   AssemblyLibrary
    33; Created date  :   25.6.2010
    4 ; Last update   :   11.10.2010
     4; Last update   :   7.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for display library.
     
    6464    .PrintNewlineCharacters                         resb    2
    6565    .ClearAreaWithHeightInAHandWidthInAL            resb    2
    66     .ClearScreen                                    resb    2
     66    .ClearScreenWithCharInALandAttrInAH             resb    2
    6767endstruc
    6868
     
    229229    %define SCREEN_BACKGROUND_ATTRIBUTE     MONO_NORMAL
    230230%endif
     231%define SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE   (SCREEN_BACKGROUND_CHARACTER | (SCREEN_BACKGROUND_ATTRIBUTE<<8))
     232%define DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE      (' ' | (MONO_NORMAL<<8))
    231233
    232234%endif ; DISPLAY_INC
  • trunk/Assembly_Library/Src/Display/Display.asm

    r45 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   2.7.2010
    4 ; Last update   :   28.9.2010
     4; Last update   :   7.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Display Library functions for CALL_DISPLAY_LIBRARY macro
     
    9090    at  DISPLAY_LIB.PrintNewlineCharacters,                         dw  DisplayPrint_Newline
    9191    at  DISPLAY_LIB.ClearAreaWithHeightInAHandWidthInAL,            dw  DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
    92     at  DISPLAY_LIB.ClearScreen,                                    dw  DisplayPrint_ClearScreen
     92    at  DISPLAY_LIB.ClearScreenWithCharInALandAttrInAH,             dw  DisplayPrint_ClearScreenWithCharInALandAttributeInAH
    9393iend
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r52 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   26.6.2010
    4 ; Last update   :   11.10.2010
     4; Last update   :   7.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for display output.
     
    222222
    223223;--------------------------------------------------------------------
    224 ; DisplayPrint_ClearScreen
    225 ;   Parameters:
     224; DisplayPrint_ClearScreenWithCharInALandAttributeInAH
     225;   Parameters:
     226;       AL:     Character to clear with
     227;       AH:     Attribute to clear with
    226228;       DS:     BDA segment (zero)
    227229;       ES:DI:  Ptr to cursor location in video RAM
     
    232234;--------------------------------------------------------------------
    233235ALIGN JUMP_ALIGN
    234 DisplayPrint_ClearScreen:
     236DisplayPrint_ClearScreenWithCharInALandAttributeInAH:
    235237    push    di
     238    push    cx
     239
     240    xchg    cx, ax
    236241    xor     ax, ax
    237     call    DisplayCursor_SetCoordinatesFromAX
     242    call    DisplayCursor_SetCoordinatesFromAX      ; Updates DI
    238243    call    DisplayPage_GetColumnsToALandRowsToAH
    239     call    DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
     244    mul     ah      ; AX = AL*AH = Characters on screen
     245    xchg    cx, ax  ; AX = Char+Attr, CX = WORDs to store
     246    rep stosw
     247
     248    pop     cx
    240249    pop     di
    241250    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di
  • trunk/Assembly_Library/Src/File/FileIO.asm

    r66 r67  
    178178    call    bp                      ; Transfer function
    179179    jc      SHORT .ErrorOccurredDuringTransfer
     180    add     si, SPLIT_SIZE_FOR_LARGE_TRANSFERS
    180181    dec     dx
    181182    jnz     SHORT .TransferNextBytes
  • trunk/Assembly_Library/Src/LibraryTests.asm

    r60 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   27.6.2010
    4 ; Last update   :   22.11.2010
     4; Last update   :   7.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Tests for Assembly Library.
     
    3131LibraryTests_Start:
    3232    CALL_DISPLAY_LIBRARY InitializeDisplayContext
    33     CALL_DISPLAY_LIBRARY ClearScreen
     33    mov     ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
     34    CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
    3435
    3536    ;call   LibraryTests_Sort
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r62 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   30.11.2010
     4; Last update   :   9.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu borders.
     
    2929MenuBorders_RefreshAll:
    3030    call    MenuBorders_AdjustDisplayContextForDrawingBorders
    31     call    GetNumberOfMiddleCharactersToDX
     31    call    MenuBorders_GetNumberOfMiddleCharactersToDX
    3232    call    RefreshTitleBorders
    3333    call    RefreshItemBorders
     
    5151    call    MenuLocation_GetBottomBordersTopLeftCoordinatesToAX
    5252    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    53     call    GetNumberOfMiddleCharactersToDX
     53    call    MenuBorders_GetNumberOfMiddleCharactersToDX
    5454    jmp     SHORT DrawBottomBorderLine
    5555
     
    9595    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    9696
    97     call    GetNumberOfMiddleCharactersToDX
     97    call    MenuBorders_GetNumberOfMiddleCharactersToDX
    9898    jmp     SHORT RefreshItemBorders
    9999
    100100
    101101;--------------------------------------------------------------------
    102 ; GetNumberOfMiddleCharactersToDX
     102; MenuBorders_GetNumberOfMiddleCharactersToDX
    103103;   Parameters
    104104;       SS:BP:  Ptr to MENU
     
    109109;--------------------------------------------------------------------
    110110ALIGN JUMP_ALIGN
    111 GetNumberOfMiddleCharactersToDX:
     111MenuBorders_GetNumberOfMiddleCharactersToDX:
    112112    eMOVZX  dx, BYTE [bp+MENUINIT.bWidth]
    113113    sub     dx, BYTE MENU_HORIZONTAL_BORDER_LINES
     
    300300    pop     bx
    301301
    302     call    PrintMultipleBorderCharactersFromAL ; AL does not matter
     302    call    MenuBorders_PrintMultipleBorderCharactersFromAL ; AL does not matter
    303303
    304304    CALL_DISPLAY_LIBRARY PopDisplayContext
     
    326326    eSEG    cs
    327327    lodsb           ; Load from [si+BORDER_CHARS.cMiddle] to AL
    328     call    PrintMultipleBorderCharactersFromAL
     328    call    MenuBorders_PrintMultipleBorderCharactersFromAL
    329329
    330330    eSEG    cs
     
    334334;--------------------------------------------------------------------
    335335; MenuBorders_PrintSingleBorderCharacterFromAL
    336 ; PrintMultipleBorderCharactersFromAL
     336; MenuBorders_PrintMultipleBorderCharactersFromAL
    337337;   Parameters
    338338;       AL:     Character to print
    339 ;       DX:     Repeat count (PrintMultipleBorderCharactersFromAL)
     339;       DX:     Repeat count (MenuBorders_PrintMultipleBorderCharactersFromAL)
    340340;       SS:BP:  Ptr to MENU
    341341;   Returns:
     
    350350
    351351ALIGN JUMP_ALIGN
    352 PrintMultipleBorderCharactersFromAL:
     352MenuBorders_PrintMultipleBorderCharactersFromAL:
    353353    push    cx
    354354    mov     cx, dx
  • trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm

    r52 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   20.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   9.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing scroll bars over menu borders.
     
    1717;               Cleared if no scroll bars needed
    1818;   Corrupts registers:
    19 ;       CX
     19;       AX
    2020;--------------------------------------------------------------------
    2121ALIGN JUMP_ALIGN
    2222MenuScrollbars_AreScrollbarsNeeded:
     23    xchg    ax, cx
    2324    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    2425    cmp     cx, [bp+MENUINIT.wItems]        ; Set CF if max visible < total items
     26    xchg    cx, ax
    2527    ret
    2628
  • trunk/Assembly_Library/Src/Menu/MenuText.asm

    r54 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   21.7.2010
    4 ; Last update   :   24.10.2010
     4; Last update   :   9.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu texts by the user.
     
    126126MenuText_RefreshItemFromAX:
    127127    push    cx
    128     mov     cx, ax                  ; Backup item to CX
    129 
     128    push    ax
     129
     130    xchg    cx, ax
    130131    call    MenuScrollbars_IsItemInCXonVisiblePage
    131132    jnc     SHORT .InvalidItem
    132133    call    MenuText_AdjustDisplayContextForDrawingItemFromCX
     134    call    ClearPreviousItem
    133135    call    MenuEvent_RefreshItemFromCX
    134     call    DrawScrollbarIfNecessary
     136    call    DrawScrollbarCharacterForItemInCXifNecessary
    135137.InvalidItem:
    136     xchg    ax, cx                  ; Restore AX
     138    pop     ax
    137139    pop     cx
    138140    ret
     
    181183
    182184;--------------------------------------------------------------------
     185; ClearPreviousItem
     186;   Parameters
     187;       SS:BP:  Ptr to MENU
     188;   Returns:
     189;       Nothing
     190;   Corrupts registers:
     191;       AX, BX, DX, DI
     192;--------------------------------------------------------------------
     193ALIGN JUMP_ALIGN
     194ClearPreviousItem:
     195    CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
     196    xchg    bx, ax
     197
     198    call    MenuBorders_GetNumberOfMiddleCharactersToDX
     199    sub     dx, BYTE MENU_TEXT_COLUMN_OFFSET
     200    mov     al, [cs:g_rgbTextBorderCharacters+BORDER_CHARS.cMiddle]
     201    call    MenuBorders_PrintMultipleBorderCharactersFromAL
     202
     203    xchg    ax, bx
     204    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
     205    ret
     206
     207
     208;--------------------------------------------------------------------
    183209; GetItemTextAttributeTypeToSIforItemInCX
    184210;   Parameters
     
    205231
    206232;--------------------------------------------------------------------
    207 ; DrawScrollbarIfNecessary
     233; DrawScrollbarCharacterForItemInCXifNecessary
    208234;   Parameters
    209235;       CX:     Item to refresh
     
    212238;       Nothing
    213239;   Corrupts registers:
    214 ;       AX, BX, DX, SI, DI
    215 ;--------------------------------------------------------------------
    216 ALIGN JUMP_ALIGN
    217 DrawScrollbarIfNecessary:
    218     push    cx
    219     call    .DrawSpacesBeforeScrollbarCharacter
     240;       AX, CX, BX, DX, SI, DI
     241;--------------------------------------------------------------------
     242ALIGN JUMP_ALIGN
     243DrawScrollbarCharacterForItemInCXifNecessary:
    220244    call    MenuScrollbars_AreScrollbarsNeeded
    221     pop     cx
    222245    jc      SHORT .DrawScrollbarCharacter
    223246    ret
    224247
    225 ;--------------------------------------------------------------------
    226 ; .DrawSpacesBeforeScrollbarCharacter
    227 ;   Parameters
    228 ;       CX:     Item to refresh
    229 ;       SS:BP:  Ptr to MENU
    230 ;   Returns:
    231 ;       Nothing
    232 ;   Corrupts registers:
    233 ;       AX, CX, DX, DI
    234 ;--------------------------------------------------------------------
    235 ALIGN JUMP_ALIGN
    236 .DrawSpacesBeforeScrollbarCharacter:
    237     CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
    238     xchg    dx, ax                  ; Current coordinates to DX
    239     mov     ax, cx
    240     call    MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
    241     sub     al, dl
    242     sub     al, MENU_TEXT_COLUMN_OFFSET/2
    243 
    244     eMOVZX  cx, al
    245     jcxz    .NoSpacesNeeded
    246     mov     al, ' '
    247     CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
    248 ALIGN JUMP_ALIGN, ret
    249 .NoSpacesNeeded:
    250     ret
    251 
    252 ;--------------------------------------------------------------------
    253 ; .DrawScrollbarCharacter
    254 ;   Parameters
    255 ;       CX:     Item to refresh
    256 ;       SS:BP:  Ptr to MENU
    257 ;   Returns:
    258 ;       Nothing
    259 ;   Corrupts registers:
    260 ;       AX, BX, DX, SI, DI
    261 ;--------------------------------------------------------------------
    262248ALIGN JUMP_ALIGN
    263249.DrawScrollbarCharacter:
    264     push    cx
    265 
    266250    call    MenuBorders_AdjustDisplayContextForDrawingBorders
    267 
    268251    mov     ax, cx
    269252    call    MenuLocation_GetScrollbarCoordinatesToAXforItemInAX
     
    273256    sub     di, [bp+MENU.wFirstVisibleItem]     ; Item to line
    274257    call    MenuScrollbars_GetScrollCharacterToALForLineInDI
    275     CALL_DISPLAY_LIBRARY PrintCharacterFromAL
    276 
    277     pop     cx
    278     ret
     258    jmp     MenuBorders_PrintSingleBorderCharacterFromAL
  • trunk/Assembly_Library/Src/String/StringProcess.asm

    r52 r67  
    22; Project name  :   Assembly Library
    33; Created date  :   12.10.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   7.12.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for processing characters in a string.
     
    1010
    1111;--------------------------------------------------------------------
    12 ; Character processing callback function prototype for StringProcess_DSSIwithFunctionInBX.
     12; Character processing callback function prototype for StringProcess_DSSIwithFunctionInDX.
    1313;   Parameters:
    1414;       AL:         Character to process
    15 ;       CX:         Number of characters processed
     15;       CX:         Character number (index for next character)
    1616;       DS:SI:      Ptr to next character
    1717;       BX,DI,ES:   Free to use by processing function
Note: See TracChangeset for help on using the changeset viewer.