Changeset 52 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/Dialog


Ignore:
Timestamp:
Oct 12, 2010, 6:51:07 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:
Completely rewritten line splitting (slower but no need to modify string).
Some changes to string processing functions.
Saved few bytes from CGA detection.

Location:
trunk/Assembly_Library/Src/Menu/Dialog
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm

    r50 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   6.8.2010
    4 ; Last update   :   9.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Common functions for many dialogs.
     
    3838    call    Keyboard_RemoveAllKeystrokesFromBuffer
    3939
    40     mov     ax, [bp+MENU.wHighlightedItem]
     40    mov     ax, [bp+MENUINIT.wHighlightedItem]
    4141    eLEAVE_STRUCT DIALOG_size
    4242    pop     ds
     
    7878
    7979;--------------------------------------------------------------------
    80 ; Dialog_EventInitializeMenuinitFromDSSIforSingleItem
    81 ;   Parameters:
     80; Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
     81;   Parameters:
     82;       AX:         Index of highlighted item
    8283;       DS:SI:      Ptr to MENUINIT struct to initialize
    8384;       SS:BP:      Ptr to DIALOG
     
    8788;--------------------------------------------------------------------
    8889ALIGN JUMP_ALIGN
    89 Dialog_EventInitializeMenuinitFromDSSIforSingleItem:
     90Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX:
    9091    les     di, [bp+DIALOG.fpDialogIO]
    9192    mov     WORD [es:di+DIALOG_INPUT.fszItems], g_szSingleItem
    9293    mov     [es:di+DIALOG_INPUT.fszItems+2], cs
    93     ; Fall to Dialog_EventInitializeMenuinitFromDSSI
    94 
    95 ;--------------------------------------------------------------------
    96 ; Dialog_EventInitializeMenuinitFromDSSI
    97 ;   Parameters:
     94    ; Fall to Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
     95
     96;--------------------------------------------------------------------
     97; Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
     98;   Parameters:
     99;       AX:         Index of highlighted item
    98100;       DS:SI:      Ptr to MENUINIT struct to initialize
    99101;       SS:BP:      Ptr to DIALOG
     
    103105;--------------------------------------------------------------------
    104106ALIGN JUMP_ALIGN
    105 Dialog_EventInitializeMenuinitFromDSSI:
     107Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX:
     108    mov     [bp+MENUINIT.wHighlightedItem], ax
    106109    les     di, [bp+DIALOG.fpDialogIO]
    107110    call    .GetWidthBasedOnParentMenuToAL
    108111    mov     [bp+MENUINIT.bWidth], al
    109112
    110     call    MenuLocation_GetMaxTextLineLengthToAX
    111     mov     bx, ax
    112113    lds     si, [es:di+DIALOG_INPUT.fszTitle]
    113     call    LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX
     114    call    ItemLineSplitter_GetLinesToAXforStringInDSSI
    114115    mov     [bp+MENUINIT.bTitleLines], al
    115116
    116     mov     ax, bx
    117117    lds     si, [es:di+DIALOG_INPUT.fszItems]
    118     call    LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX
     118    call    ItemLineSplitter_GetLinesToAXforStringInDSSI
    119119    mov     [bp+MENUINIT.wItems], ax
    120120
    121     xchg    ax, bx
    122121    lds     si, [es:di+DIALOG_INPUT.fszInfo]
    123     call    LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX
     122    call    ItemLineSplitter_GetLinesToAXforStringInDSSI
    124123    mov     [bp+MENUINIT.bInfoLines], al
    125124
     
    178177ALIGN JUMP_ALIGN
    179178Dialog_EventRefreshTitle:
    180     mov     dl, [bp+MENUINIT.bTitleLines]
    181179    lds     si, [bp+DIALOG.fpDialogIO]
    182     les     di, [si+DIALOG_INPUT.fszTitle]
    183     jmp     SHORT PrintDLlinesFromESDI
     180    lds     si, [si+DIALOG_INPUT.fszTitle]
     181    jmp     SHORT PrintTitleOrInfoLine
    184182
    185183ALIGN JUMP_ALIGN
    186184Dialog_EventRefreshInformation:
    187     mov     dl, [bp+MENUINIT.bInfoLines]
    188185    lds     si, [bp+DIALOG.fpDialogIO]
    189     les     di, [si+DIALOG_INPUT.fszInfo]
    190     ; Fall to PrintDLlinesFromESDI
    191 
    192 ALIGN JUMP_ALIGN
    193 PrintDLlinesFromESDI:
    194     xor     cx, cx              ; Start from line zero
    195     mov     dh, cl              ; Line count now in DX
    196 ALIGN JUMP_ALIGN
    197 .PrintNextLine:
    198     call    LineSplitter_PrintLineInCXfromStringInESDI
    199     push    di
    200     CALL_DISPLAY_LIBRARY PrintNewlineCharacters
    201     pop     di
    202     inc     cx
    203     dec     dx
    204     jnz     SHORT .PrintNextLine
     186    lds     si, [si+DIALOG_INPUT.fszInfo]
     187    ; Fall to PrintTitleOrInfoLine
     188
     189ALIGN JUMP_ALIGN
     190PrintTitleOrInfoLine:
     191    mov     bx, ds
     192    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
    205193    stc
    206194    ret
     
    218206Dialog_EventRefreshItemFromCX:
    219207    lds     si, [bp+DIALOG.fpDialogIO]
    220     les     di, [si+DIALOG_INPUT.fszItems]
    221     call    LineSplitter_PrintLineInCXfromStringInESDI
     208    lds     si, [si+DIALOG_INPUT.fszItems]
     209    call    ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
     210    jnc     SHORT .LineNotFound
     211
     212    mov     bx, ds
     213    CALL_DISPLAY_LIBRARY PrintCharBufferFromBXSIwithLengthInCX
     214.LineNotFound:
    222215    stc
    223216    ret
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm

    r51 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   6.9.2010
    4 ; Last update   :   10.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays file dialog.
     
    4949.ItemSelectedFromCX:
    5050    call    LoadItemStringBufferToESDI
    51     call    LineSplitter_GetOffsetToSIforLineCXfromStringInESDI
    52     push    es
    53     pop     ds
     51    call    Memory_CopyESDItoDSSI
     52    call    ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
    5453    jmp     ParseSelectionFromItemLineInDSSI
    5554
     
    115114    call    SortDirectoryContentsStringFromESDIwithCountInCX
    116115    call    Memory_CopySSBPtoDSSI
    117     call    Dialog_EventInitializeMenuinitFromDSSI
     116    xor     ax, ax
     117    call    Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
    118118    call    GetInfoLinesToCXandDialogFlagsToAX
    119119    mov     [bp+MENUINIT.bInfoLines], cl
    120120    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
    121121    mov     [bp+MENUINIT.bHeight], ah               ; Always max height
    122     xor     ax, ax
    123     mov     [bp+MENU.wHighlightedItem], ax
    124     mov     [bp+MENU.wFirstVisibleItem], ax
     122    mov     WORD [bp+MENU.wFirstVisibleItem], 0
    125123    ret
    126124
     
    256254    mov     bx, di
    257255    CALL_DISPLAY_LIBRARY PushDisplayContext
    258     CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXtoESDI
     256    mov     cx, -1
     257    CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
    259258
    260259    call    .FormatFileOrDirectoryToBufferFromDTAinDSSI
     
    299298;--------------------------------------------------------------------
    300299.FormatFile:
     300    ; Convert file name to lower case
     301    xchg    si, ax
     302    mov     dx, StringProcess_ConvertToLowerCase
     303    call    StringProcess_DSSIwithFunctionInDX
     304    xchg    ax, si
     305
    301306    ; Push parameters for file name
    302     xchg    si, ax
    303     call    String_ConvertDSSItoLowerCase
    304     xchg    ax, si
    305307    push    ax              ; Push directory name offset
    306308    push    ds              ; Push directory name segment
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   6.8.2010
    4 ; Last update   :   6.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays message dialog.
     
    4444.InitializeMenuinitFromDSSI:
    4545    or      BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT
    46     mov     WORD [bp+MENU.wHighlightedItem], 0
    47     jmp     Dialog_EventInitializeMenuinitFromDSSI
     46    xor     ax, ax      ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling
     47    jmp     Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
    4848
    4949
     
    9191ALIGN JUMP_ALIGN
    9292.DecrementLines:
    93     cmp     WORD [bp+MENU.wHighlightedItem], BYTE 0
     93    cmp     WORD [bp+MENUINIT.wHighlightedItem], BYTE 0
    9494    je      SHORT .AlreadyAtTheTopOrBottom
    9595
    9696    mov     ax, [bp+MENU.wFirstVisibleItem]
    97     mov     [bp+MENU.wHighlightedItem], ax
     97    mov     [bp+MENUINIT.wHighlightedItem], ax
    9898    mov     ah, MENU_KEY_UP
    9999    jmp     MenuLoop_ProcessScrollingKeysFromAX
     
    103103    mov     ax, [bp+MENUINIT.wItems]
    104104    dec     ax                      ; Last possible item to highlight
    105     cmp     [bp+MENU.wHighlightedItem], ax
     105    cmp     [bp+MENUINIT.wHighlightedItem], ax
    106106    jae     SHORT .AlreadyAtTheTopOrBottom
    107107
    108108    call    MenuScrollbars_GetLastVisibleItemOnPageToAX
    109     mov     [bp+MENU.wHighlightedItem], ax
     109    mov     [bp+MENUINIT.wHighlightedItem], ax
    110110    mov     ah, MENU_KEY_DOWN
    111111    jmp     MenuLoop_ProcessScrollingKeysFromAX
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   15.8.2010
    4 ; Last update   :   28.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays progress bar dialog and starts progress task.
     
    7878ALIGN JUMP_ALIGN
    7979.InitializeMenuinitFromDSSI:
    80     call    Dialog_EventInitializeMenuinitFromDSSIforSingleItem
     80    mov     ax, NO_ITEM_HIGHLIGHTED
     81    call    Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
    8182    lds     si, [bp+DIALOG.fpDialogIO]
    8283    call    TimerTicks_ReadFromBdaToAX
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogSelection.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   13.8.2010
    4 ; Last update   :   13.8.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays selection dialog.
     
    4343ALIGN JUMP_ALIGN
    4444.InitializeMenuinitFromDSSI:
    45     mov     WORD [bp+MENU.wHighlightedItem], 0
    46     jmp     Dialog_EventInitializeMenuinitFromDSSI
     45    xor     ax, ax
     46    jmp     Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
    4747
    4848
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   12.8.2010
    4 ; Last update   :   7.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays word input dialog.
     
    4343
    4444ALIGN JUMP_ALIGN
     45.InitializeMenuinitFromDSSI:
     46    xor     ax, ax
     47    jmp     Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
     48
     49
     50ALIGN JUMP_ALIGN
    4551.IdleProcessing:
    46     xor     ax, ax                      ; Item 0 is used as input line
    47     call    MenuText_AdjustDisplayContextForDrawingItemFromAX
     52    xor     cx, cx                      ; Item 0 is used as input line
     53    call    MenuText_AdjustDisplayContextForDrawingItemFromCX
    4854    call    GetStringFromUser
    4955    call    MenuInit_CloseMenuWindow
     
    5561.rgfnEventHandlers:
    5662istruc MENUEVENT
    57     at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  Dialog_EventInitializeMenuinitFromDSSIforSingleItem
     63    at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  .InitializeMenuinitFromDSSI
    5864    at  MENUEVENT.ExitMenu,                     dw  Dialog_EventNotHandled
    5965    at  MENUEVENT.IdleProcessing,               dw  .IdleProcessing
  • trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   10.8.2010
    4 ; Last update   :   7.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays word input dialog.
     
    4343
    4444ALIGN JUMP_ALIGN
     45.InitializeMenuinitFromDSSI:
     46    xor     ax, ax
     47    jmp     Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
     48
     49
     50ALIGN JUMP_ALIGN
    4551.IdleProcessing:
    46     xor     ax, ax                      ; Item 0 is used as input line
    47     call    MenuText_AdjustDisplayContextForDrawingItemFromAX
     52    xor     cx, cx                      ; Item 0 is used as input line
     53    call    MenuText_AdjustDisplayContextForDrawingItemFromCX
    4854    call    GetWordFromUser
    4955    call    MenuInit_CloseMenuWindow
     
    5561.rgfnEventHandlers:
    5662istruc MENUEVENT
    57     at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  Dialog_EventInitializeMenuinitFromDSSIforSingleItem
     63    at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  .InitializeMenuinitFromDSSI
    5864    at  MENUEVENT.ExitMenu,                     dw  Dialog_EventNotHandled
    5965    at  MENUEVENT.IdleProcessing,               dw  .IdleProcessing
Note: See TracChangeset for help on using the changeset viewer.