Changeset 52 in xtideuniversalbios


Ignore:
Timestamp:
Oct 12, 2010, 6:51:07 PM (13 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
Files:
3 added
1 deleted
26 edited

Legend:

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

    r49 r52  
    22; Project name  :   AssemblyLibrary
    33; Created date  :   8.10.2010
    4 ; Last update   :   8.10.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Macros for preventing CGA snow.
     
    2828    %elifidn %1, stosw
    2929        call    CgaSnow_Stosw
    30     %elifidn %1, scasb
    31         call    CgaSnow_Scasb
    3230    %elifidn %1, rep movsb
    3331        call    CgaSnow_RepMovsb
  • trunk/Assembly_Library/Inc/Display.inc

    r50 r52  
    22; Project name  :   AssemblyLibrary
    33; Created date  :   25.6.2010
    4 ; Last update   :   9.10.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for display library.
     
    2626    %elifidn %1, PopDisplayContext
    2727        call    DisplayContext_Pop
    28     %elifidn %1, PrepareOffScreenBufferInESBXtoESDI
    29         call    DisplayContext_PrepareOffScreenBufferInESBXtoESDI
     28    %elifidn %1, PrepareOffScreenBufferInESBXwithLengthInCX
     29        call    DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX
    3030    %else
    3131        mov     di, DISPLAY_LIB.%1
     
    3939    .PushDisplayContext:
    4040    .PopDisplayContext:
    41     .PrepareOffScreenBufferInESBXtoESDI:
    4241    .InitializeDisplayContext                       resb    2
    4342
  • trunk/Assembly_Library/Inc/Menu.inc

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   5.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for Menu library.
     
    9595    .wTimeoutTicks                  resb    2   ; Selection timeout in system timer ticks
    9696    .wItems                         resb    2   ; Number of items in menu
     97    .wHighlightedItem               resb    2   ; Index for highlighted item
    9798
    9899    .wTitleAndInfoLines:
     
    115116                                    resb    1
    116117    .wTimeoutCounter                resb    2
    117 
    118     .wHighlightedItem               resb    2   ; Index for highlighted item
    119118    .wFirstVisibleItem              resb    2   ; Index for first visible item on the menu
    120119endstruc
  • trunk/Assembly_Library/Src/AssemblyLibrary.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   15.9.2010
    4 ; Last update   :   8.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Assembly Library main file. This is the only file that
     
    3333
    3434%ifdef INCLUDE_MENU_LIBRARY
     35    %include "CharOutLineSplitter.asm"
    3536    %include "Menu.asm"
    3637    %include "MenuAttributes.asm"
     
    5354        %include "DialogString.asm"
    5455        %include "DialogWord.asm"
    55         %include "LineSplitter.asm"
     56        %include "ItemLineSplitter.asm"
    5657        %include "StringsForDialogs.asm"
    5758    %endif
     
    6162    %include "Char.asm"
    6263    %include "String.asm"
     64    %include "StringProcess.asm"
    6365%endif
    6466
  • trunk/Assembly_Library/Src/Display/CgaSnow.asm

    r50 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   8.10.2010
    4 ; Last update   :   9.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for preventing CGA snow.
     
    2323    cmp     WORD [BDA.wVidPort], CGA_STATUS_REGISTER - OFFSET_TO_CGA_STATUS_REGISTER
    2424    jne     SHORT .CgaNotFound
    25     call    DisplayPage_GetColumnsToALandRowsToAH
    26     cmp     ah, [BDA.bVidRows]      ; Video rows stored only by EGA and later
    27     je      SHORT .CgaNotFound      ; Must be EGA or later
     25
     26    ; All standard CGA modes use 25 rows but only EGA and later store it to BDA.
     27    cmp     BYTE [BDA.bVidRows], 25
     28    jge     SHORT .CgaNotFound
    2829    stc
    2930    ret
     
    8384
    8485;--------------------------------------------------------------------
    85 ; CgaSnow_Scasb
    86 ;   Parameters:
    87 ;       AL:     Byte for comparison
    88 ;       DS:     BDA segment (zero)
    89 ;       ES:DI:  Ptr to video memory where to output
    90 ;   Returns:
    91 ;       DI:     Incremented for next character
    92 ;   Corrupts registers:
    93 ;       AX, DX
    94 ;--------------------------------------------------------------------
    95 ALIGN JUMP_ALIGN
    96 CgaSnow_Scasb:
    97     call    LoadCgaStatusRegisterAddressToDXifCgaPresent
    98     jz      SHORT .ScasbWithoutWaitSinceUnknownPort
    99 
    100     mov     ah, al
    101     cli             ; Interrupt request would mess up timing
    102     WAIT_UNTIL_SAFE_CGA_WRITE
    103     mov     al, ah
    104 .ScasbWithoutWaitSinceUnknownPort:
    105     scasb
    106     sti
    107     ret
    108 
    109 
    110 ;--------------------------------------------------------------------
    11186; CgaSnow_RepMovsb
    11287;   Parameters:
  • trunk/Assembly_Library/Src/Display/DisplayContext.asm

    r50 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   25.6.2010
    4 ; Last update   :   9.10.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for managing display context.
     
    119119
    120120;--------------------------------------------------------------------
    121 ; DisplayContext_PrepareOffScreenBufferInESBXtoESDI
    122 ;   Parameters:
    123 ;       BX:AX:  Ptr to off screen buffer
    124 ;   Returns:
    125 ;       Nothing
    126 ;   Corrupts registers:
    127 ;       AX
    128 ;--------------------------------------------------------------------
    129 ALIGN JUMP_ALIGN
    130 DisplayContext_PrepareOffScreenBufferInESBXtoESDI:
     121; DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX
     122;   Parameters:
     123;       CX:     Off screen buffer length in characters
     124;       ES:BX:  Ptr to off screen buffer
     125;   Returns:
     126;       Nothing
     127;   Corrupts registers:
     128;       AX, DI
     129;--------------------------------------------------------------------
     130ALIGN JUMP_ALIGN
     131DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX:
    131132    push    ds
    132133
     
    139140    mov     ax, BUFFER_OUTPUT_WITH_CHAR_ONLY
    140141    call    DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL
     142    mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], cx
    141143
    142144    mov     bx, di
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   26.6.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for display output.
     
    326326ALIGN JUMP_ALIGN
    327327DisplayPrint_Newline:
     328    mov     al, LF
     329    call    DisplayPrint_CharacterFromAL
    328330    mov     al, CR
    329     call    DisplayPrint_CharacterFromAL
    330     mov     al, LF
    331331    ; Fall to DisplayPrint_CharacterFromAL
    332 
    333332
    334333;--------------------------------------------------------------------
  • trunk/Assembly_Library/Src/Keyboard/Keyboard.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   5.7.2010
    4 ; Last update   :   7.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for managing keyboard.
     
    2626ALIGN JUMP_ALIGN
    2727Keyboard_ReadUserInputtedWordWhilePrinting:
    28     push    es
    29     push    di
     28    push    ds
     29    push    si
    3030    push    cx
    3131
    32     eENTER_STRUCT BUFFER_SIZE_FOR_WORD_INPUT
    33     call    Memory_CopySSBPtoESDI
    34 
    3532    mov     cx, BUFFER_SIZE_FOR_WORD_INPUT
     33    call    Memory_ReserveCXbytesFromStackToDSSI
     34
    3635    call    Char_GetFilterFunctionToDXforNumericBaseInBX
     36    call    Memory_ExchangeDSSIwithESDI
    3737    call    Keyboard_ReadUserInputtedStringToESDIWhilePrinting
    38     jz      SHORT .Return
    39 
    40     call    Memory_ExchangeDSSIwithESDI
     38    call    Memory_ExchangeDSSIwithESDI ; Does not modify FLAGS
     39    jz      SHORT .CancelledByUser
     40
    4141    call    String_ConvertWordToAXfromStringInDSSIwithBaseInBX
    42     call    Memory_ExchangeDSSIwithESDI
    43 .Return:
    44     eLEAVE_STRUCT BUFFER_SIZE_FOR_WORD_INPUT
     42.CancelledByUser:
     43    add     sp, BYTE BUFFER_SIZE_FOR_WORD_INPUT
    4544    test    cx, cx                  ; Set ZF if string length is zero
    4645    pop     cx
    47     pop     di
    48     pop     es
     46    pop     si
     47    pop     ds
    4948    ret
    5049
  • trunk/Assembly_Library/Src/LibraryTests.asm

    r50 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   27.6.2010
    4 ; Last update   :   27.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Tests for Assembly Library.
     
    7171    mov     BYTE [si+MENUINIT.bTitleLines], TEST_MENU_TITLE_LINES
    7272    mov     BYTE [si+MENUINIT.bInfoLines], TEST_MENU_INFO_LINES
    73     mov     ax, 1
    74     CALL_MENU_LIBRARY HighlightItemFromAX
     73    mov     WORD [si+MENUINIT.wHighlightedItem], 1
    7574    stc
    7675    ret
     
    9594    ret
    9695.szInfoTitle:
    97     db      "Information line 1,",CR,LF,
     96    db      "Information line 1,",LF,CR,
    9897    db      "Information line 2. ",
    9998    db      "This comes (12) right after Information line 2.",NULL
     
    615614    db      "so scroll bars and message dialog can be tested. This string does not use "
    616615    db      "formatting so it should be simple to display this correctly. This string "
    617     db      "does, however, use newline characters. Lets change line right now!",CR,LF,
     616    db      "does, however, use newline characters. Lets change line right now!",LF,CR,
    618617    db      "Well did it work? Let's try line feed alone",LF,"Well? "
     618    db      "Now two LFs:",LF,LF,"What happened? "
    619619    db      "We could also see what two spaces does _  _. There was two spaces between "
    620620    db      "underscores. Lets try three this time _   _. Well, did they work correctly? "
    621     db      "What next, I guess that was all, no wait. Let's see what TAB does! Here it "
    622     db      "goes:",TAB,"Well did it work? Just one more time:",TAB,"Well are we good? "
    623     db      "No since LF is the only supported control character, unfortunately. "
     621    db      "Too bad that LF, CR and BS (backspace) are the only supported control "
     622    db      "characters. Others don't either work or they break line splitting. "
    624623    db      "This is the last sentence of this long string!",NULL
    625624
  • 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
  • trunk/Assembly_Library/Src/Menu/MenuAttributes.asm

    r47 r52  
    2424
    2525;--------------------------------------------------------------------
    26 ; MenuAttribute_GetToALfromTypeInSI
     26; MenuAttribute_SetToDisplayContextFromTypeInSI
    2727;   Parameters
    2828;       SI:     Attribute type (from ATTRIBUTE_CHARS)
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r45 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   28.9.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu borders.
     
    5050MenuBorders_AdjustDisplayContextForDrawingBorders:
    5151    mov     bl, ATTRIBUTES_ARE_USED
    52     mov     ax, MenuCharOut_MenuBorderTeletypeOutputWithAttribute
     52    mov     ax, MenuCharOut_MenuTeletypeOutput
    5353    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    5454
    55     mov     ax, bp
     55    call    CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX
    5656    CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
    5757
  • trunk/Assembly_Library/Src/Menu/MenuCharOut.asm

    r51 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   15.7.2010
    4 ; Last update   :   10.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Character out function for printing withing menu window.
     
    1010
    1111;--------------------------------------------------------------------
    12 ; MenuCharOut_MenuBorderTeletypeOutputWithAttribute
     12; MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange
     13; MenuCharOut_MenuTeletypeOutput
    1314;   Parameters:
    1415;       AL:     Character to output
     
    1617;       DS:     BDA segment (zero)
    1718;       ES:DI:  Ptr to video memory where to output
     19;       [DISPLAY_CONTEXT.wCharOutParam]:
     20;               Low byte  = First column offset (after CR)
     21;               High byte = Last column offset (when using automatic line change)
    1822;   Returns:
    1923;       DI:     Incremented for next character
     
    2226;--------------------------------------------------------------------
    2327ALIGN JUMP_ALIGN
    24 MenuCharOut_MenuBorderTeletypeOutputWithAttribute:
    25     cmp     al, CR                  ; Carriage return?
    26     je      SHORT .PrintCRandAdjustColumnToMenuBorders
    27     jmp     DisplayCharOut_TeletypeOutputWithAttribute
    28 
    29 ALIGN JUMP_ALIGN
    30 .PrintCRandAdjustColumnToMenuBorders:
    31     call    DisplayCharOut_BiosTeletypeOutput
    32     xor     ax, ax                  ; No offset, cursor to start of border
    33     jmp     SHORT SetCursorToNextMenuLine
    34 
    35 
    36 ;--------------------------------------------------------------------
    37 ; MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange
    38 ; MenuCharOut_MenuTextTeletypeOutputWithAttribute
    39 ;   Parameters:
    40 ;       AL:     Character to output
    41 ;       AH:     Attribute to output
    42 ;       DS:     BDA segment (zero)
    43 ;       ES:DI:  Ptr to video memory where to output
    44 ;   Returns:
    45 ;       DI:     Incremented for next character
    46 ;   Corrupts registers:
    47 ;       AX, DX
    48 ;--------------------------------------------------------------------
    49 ALIGN JUMP_ALIGN
    50 MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange:
    51     push    di
    52     push    ax
    53     mov     al, DOUBLE_VERTICAL
    54     add     di, BYTE MENU_TEXT_COLUMN_OFFSET    ; Border char comes after space
    55     WAIT_RETRACE_IF_NECESSARY_THEN scasb
    56     pop     ax
    57     pop     di
    58     je      SHORT MovePartialWordToNewTextLineAndPrintCharacterFromAX
     28MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange:
     29    call    CharOutLineSplitter_IsCursorAtTheEndOfTextLine
     30    jnc     SHORT MenuCharOut_MenuTeletypeOutput
     31    cmp     al, ' '
     32    jb      SHORT ReturnSinceNoNeedToStartLineWithControlCharacter
     33    call    CharOutLineSplitter_MovePartialWordToNewTextLine
    5934    ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute
    6035
    6136ALIGN JUMP_ALIGN
    62 MenuCharOut_MenuTextTeletypeOutputWithAttribute:
    63     cmp     al, CR                      ; Carriage return?
    64     je      SHORT PrintCRfromALandAdjustColumnToMenuText
     37MenuCharOut_MenuTeletypeOutput:
     38    cmp     al, CR
     39    je      SHORT PrintCRandAdjustOffsetForStartOfLine
    6540    jmp     DisplayCharOut_TeletypeOutputWithAttribute
    6641
    6742
    6843;--------------------------------------------------------------------
    69 ; MovePartialWordToNewTextLineAndPrintCharacterFromAX
    70 ;   Parameters:
    71 ;       AL:     Character to output
    72 ;       AH:     Attribute to output
    73 ;       DS:     BDA segment (zero)
    74 ;       ES:DI:  Ptr to end of text line in video memory
    75 ;   Returns:
    76 ;       DI:     Incremented for next character
    77 ;   Corrupts registers:
    78 ;       AX, DX
    79 ;--------------------------------------------------------------------
    80 ALIGN JUMP_ALIGN
    81 MovePartialWordToNewTextLineAndPrintCharacterFromAX:
    82     cmp     al, ' '     ; Space or any control character
    83     jb      SHORT .MoveCursorInDItoBeginningOfNextLine
    84     push    si
    85     push    cx
    86     push    ax
    87 
    88     call    .GetOffsetToPartialWordToSIandSizeToCX
    89     call    .MoveCursorInDItoBeginningOfNextLine
    90     jcxz    .NothingToMove
    91     call    .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
    92 .NothingToMove:
    93     pop     ax
    94     pop     cx
    95     pop     si
    96     jmp     DisplayCharOut_TeletypeOutputWithAttribute
    97 
    98 ;--------------------------------------------------------------------
    99 ; .GetOffsetToPartialWordToSIandSizeToCX
    100 ;   Parameters:
    101 ;       ES:DI:  Ptr to space before border character
    102 ;   Returns:
    103 ;       CX:     Number of bytes that needs to be moved
    104 ;       ES:SI:  Ptr to beginning of partial word that needs to be moved to new line
    105 ;   Corrupts registers:
    106 ;       Nothing
    107 ;--------------------------------------------------------------------
    108 ALIGN JUMP_ALIGN
    109 .GetOffsetToPartialWordToSIandSizeToCX:
    110     xor     cx, cx
    111     mov     si, di
    112 ALIGN JUMP_ALIGN
    113 .ScanNextCharacter:     ; Space will always be found since one comes after border
    114     dec     si
    115     dec     si
    116     cmp     BYTE [es:si], ' '
    117     je      SHORT .PartialWordFound
    118     inc     cx
    119     jmp     SHORT .ScanNextCharacter
    120 ALIGN JUMP_ALIGN
    121 .PartialWordFound:
    122     inc     si
    123     inc     si          ; SI now points one past space
    124     shl     cx, 1       ; Characters to bytes
    125     ret
    126 
    127 ;--------------------------------------------------------------------
    128 ; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX
    129 ;   Parameters:
    130 ;       CX:     Number of bytes in partial word
    131 ;       DS:     BDA segment (zero)
    132 ;       ES:SI:  Ptr to partial word on previous line
    133 ;       ES:DI:  Ptr to new empty line
    134 ;   Returns:
    135 ;       ES:DI:  Ptr where to store next character
    136 ;   Corrupts registers:
    137 ;       AX, CX, DX, SI
    138 ;--------------------------------------------------------------------
    139 ALIGN JUMP_ALIGN
    140 .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX:
    141     push    si
    142     push    cx
    143     WAIT_RETRACE_IF_NECESSARY_THEN rep movsb
    144     pop     cx
    145     pop     si
    146     xchg    di, si
    147     shr     cx, 1       ; Bytes to characters
    148     mov     al, ' '
    149     call    DisplayPrint_RepeatCharacterFromALwithCountInCX
    150     mov     di, si
    151     ret
    152 
    153 ;--------------------------------------------------------------------
    154 ; .MoveCursorInDItoBeginningOfNextLine
     44; MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine
     45; PrintCRandAdjustOffsetForStartOfLine
    15546;   Parameters:
    15647;       DS:     BDA segment (zero)
    15748;       ES:DI:  Ptr to cursor location
     49;       [DISPLAY_CONTEXT.wCharOutParam]:
     50;               Low byte  = First column offset (after CR)
     51;               High byte = Last column offset (when using automatic line change)
    15852;   Returns:
    15953;       ES:DI:  Ptr to beginning of new line
     
    16256;--------------------------------------------------------------------
    16357ALIGN JUMP_ALIGN
    164 .MoveCursorInDItoBeginningOfNextLine:
     58MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine:
    16559    mov     al, LF
    16660    call    DisplayCharOut_BiosTeletypeOutput
     61    ; Fall to PrintCRandAdjustOffsetForStartOfLine
     62
     63ALIGN JUMP_ALIGN
     64PrintCRandAdjustOffsetForStartOfLine:
    16765    mov     al, CR
    168     ; Fall to PrintCRfromALandAdjustColumnToMenuText
    169 
    170 
    171 ;--------------------------------------------------------------------
    172 ; PrintCRfromALandAdjustColumnToMenuText
    173 ;   Parameters:
    174 ;       AL:     Character to output (CR)
    175 ;       DS:     BDA segment (zero)
    176 ;       ES:DI:  Ptr to video memory where to output
    177 ;   Returns:
    178 ;       DI:     Incremented for next text line
    179 ;   Corrupts registers:
    180 ;       AX, DX
    181 ;--------------------------------------------------------------------
    182 ALIGN JUMP_ALIGN
    183 PrintCRfromALandAdjustColumnToMenuText:
    18466    call    DisplayCharOut_BiosTeletypeOutput
    185     mov     al, MENU_TEXT_COLUMN_OFFSET ; Offset to start of text
    186     ; Fall to SetCursorToNextMenuLine
    187 
    188 ;--------------------------------------------------------------------
    189 ; SetCursorToNextMenuLine
    190 ;   Parameters:
    191 ;       AL:     Column offset from start of borders
    192 ;       DS:     BDA segment (zero)
    193 ;       ES:DI:  Ptr to video memory where to output
    194 ;   Returns:
    195 ;       DI:     Adjusted for next line
    196 ;   Corrupts registers:
    197 ;       AX, DX
    198 ;--------------------------------------------------------------------
    199 ALIGN JUMP_ALIGN
    200 SetCursorToNextMenuLine:
    201     push    bp
    202 
    203     mov     bp, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
    204     call    .AddCoordinatesForNewBorderLineToAX
    205     call    DisplayCursor_SetCoordinatesFromAX  ; Updates DI
    206 
    207     pop     bp
     67    eMOVZX  ax, BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
     68    add     di, ax
     69ReturnSinceNoNeedToStartLineWithControlCharacter:
    20870    ret
    209 
    210 ;--------------------------------------------------------------------
    211 ; .AddCoordinatesForNewBorderLineToAX
    212 ;   Parameters:
    213 ;       AL:     Column offset from start of borders
    214 ;       DS:     BDA segment (zero)
    215 ;       SS:BP:  Ptr to MENU
    216 ;   Returns:
    217 ;       AX:     Coordinates for new line
    218 ;   Corrupts registers:
    219 ;       DX
    220 ;--------------------------------------------------------------------
    221 ALIGN JUMP_ALIGN
    222 .AddCoordinatesForNewBorderLineToAX:
    223     call    MenuLocation_AddTitleBordersTopLeftCoordinatesToAX
    224     push    ax
    225     call    DisplayCursor_GetSoftwareCoordinatesToAX
    226     pop     dx
    227     mov     al, dl                  ; Adjust column to borders
    228     ret
  • trunk/Assembly_Library/Src/Menu/MenuEvent.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   5.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for initializing menu system.
     
    8282    mov     bx, MENUEVENT.RefreshInformation
    8383LoadHighlightedItemToCXandSendMessageFromBX:
    84     mov     cx, [bp+MENU.wHighlightedItem]
     84    mov     cx, [bp+MENUINIT.wHighlightedItem]
    8585    jmp     SHORT MenuEvent_SendFromBX
    8686
     
    117117MenuEvent_HighlightItemFromCX:
    118118    mov     dx, cx
    119     xchg    dx, [bp+MENU.wHighlightedItem]
     119    xchg    dx, [bp+MENUINIT.wHighlightedItem]
    120120    push    dx
    121121
     
    125125    pop     ax
    126126    call    MenuText_RefreshItemFromAX
    127     mov     ax, [bp+MENU.wHighlightedItem]
     127    mov     ax, [bp+MENUINIT.wHighlightedItem]
    128128    jmp     MenuText_RefreshItemFromAX
    129129
  • trunk/Assembly_Library/Src/Menu/MenuInit.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   5.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for initializing menu system.
     
    3030    call    Memory_ZeroSSBPwithSizeInCX
    3131    call    MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
    32     mov     ax, [bp+MENU.wHighlightedItem]
     32    mov     ax, [bp+MENUINIT.wHighlightedItem]
    3333
    3434    eLEAVE_STRUCT MENU_size
     
    5656    mov     [bp+MENU.dwUserData], ax
    5757    mov     [bp+MENU.dwUserData+2], dx
    58     mov     WORD [bp+MENU.wHighlightedItem], NO_ITEM_HIGHLIGHTED
    5958
    6059    mov     ax, CURSOR_HIDDEN
     
    110109ALIGN JUMP_ALIGN
    111110MenuInit_HighlightItemFromAX:
    112     sub     ax, [bp+MENU.wHighlightedItem]
     111    sub     ax, [bp+MENUINIT.wHighlightedItem]
    113112    jmp     MenuScrollbars_MoveHighlightedItemByAX
    114113
     
    124123ALIGN JUMP_ALIGN
    125124MenuInit_GetHighlightedItemToAX:
    126     mov     ax, [bp+MENU.wHighlightedItem]
     125    mov     ax, [bp+MENUINIT.wHighlightedItem]
    127126    ret
    128127
  • trunk/Assembly_Library/Src/Menu/MenuLoop.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   22.7.2010
    4 ; Last update   :   16.9.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu loop for waiting keystrokes.
     
    102102.LeaveMenuWithoutSelectingItem:
    103103    call    MenuInit_CloseMenuWindow
    104     mov     WORD [bp+MENU.wHighlightedItem], NO_ITEM_HIGHLIGHTED
     104    mov     WORD [bp+MENUINIT.wHighlightedItem], NO_ITEM_HIGHLIGHTED
    105105    stc
    106106    ret
     
    108108ALIGN JUMP_ALIGN
    109109.SelectItem:
    110     mov     cx, [bp+MENU.wHighlightedItem]
     110    mov     cx, [bp+MENUINIT.wHighlightedItem]
    111111    call    MenuEvent_ItemSelectedFromCX
    112112    stc
     
    151151    xchg    ax, cx
    152152    neg     ax
    153     mov     cx, [bp+MENU.wHighlightedItem]
     153    mov     cx, [bp+MENUINIT.wHighlightedItem]
    154154    add     cx, ax
    155155    jge     SHORT .MoveHighlightedItemByAX  ; No rotation for PgUp
     
    157157ALIGN JUMP_ALIGN
    158158.SelectFirstItem:
    159     mov     ax, [bp+MENU.wHighlightedItem]
     159    mov     ax, [bp+MENUINIT.wHighlightedItem]
    160160    neg     ax
    161161    jmp     SHORT .MoveHighlightedItemByAX
     
    165165    call    MenuScrollbars_GetMaxVisibleItemsOnPageToCX
    166166    xchg    ax, cx
    167     mov     cx, [bp+MENU.wHighlightedItem]
     167    mov     cx, [bp+MENUINIT.wHighlightedItem]
    168168    add     cx, ax
    169169    cmp     cx, [bp+MENUINIT.wItems]
     
    173173.SelectLastItem:
    174174    mov     ax, [bp+MENUINIT.wItems]
    175     sub     ax, [bp+MENU.wHighlightedItem]
     175    sub     ax, [bp+MENUINIT.wHighlightedItem]
    176176    dec     ax
    177177    jmp     SHORT .MoveHighlightedItemByAX
  • trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm

    r41 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   20.7.2010
    4 ; Last update   :   9.8.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing scroll bars over menu borders.
     
    9898ALIGN JUMP_ALIGN
    9999MenuScrollbars_MoveHighlightedItemByAX:
    100     mov     cx, [bp+MENU.wHighlightedItem]
     100    mov     cx, [bp+MENUINIT.wHighlightedItem]
    101101    add     cx, ax
    102102    call    .RotateItemInCX
     
    118118
    119119    mov     dx, [bp+MENU.wFirstVisibleItem]
    120     sub     dx, [bp+MENU.wHighlightedItem]
     120    sub     dx, [bp+MENUINIT.wHighlightedItem]
    121121    add     dx, cx
    122122    MAX_S   dx, 0
  • trunk/Assembly_Library/Src/Menu/MenuText.asm

    r48 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   21.7.2010
    4 ; Last update   :   7.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu texts by the user.
     
    7676PrepareToDrawTitleArea:
    7777    mov     si, ATTRIBUTE_CHARS.cTitle
    78     mov     ax, MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange
    79     call    AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX
    8078    call    MenuLocation_GetTitleTextTopLeftCoordinatesToAX
    81     CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    82     ret
     79    jmp     SHORT FinishPreparationsToDrawTitleOrInformationArea
    8380
    8481ALIGN JUMP_ALIGN
    8582PrepareToDrawInformationArea:
    8683    mov     si, ATTRIBUTE_CHARS.cInformation
    87     mov     ax, MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange
    88     call    AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX
    8984    call    MenuLocation_GetInformationTextTopLeftCoordinatesToAX
    90     CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    91     ret
     85FinishPreparationsToDrawTitleOrInformationArea:
     86    mov     dx, MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange
     87    jmp     SHORT AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX
    9288
    9389
     
    134130    call    MenuScrollbars_IsItemInCXonVisiblePage
    135131    jnc     SHORT .InvalidItem
    136     mov     ax, cx
    137     call    MenuText_AdjustDisplayContextForDrawingItemFromAX
     132    call    MenuText_AdjustDisplayContextForDrawingItemFromCX
    138133    call    MenuEvent_RefreshItemFromCX
    139134    call    DrawScrollbarIfNecessary
     
    144139
    145140;--------------------------------------------------------------------
    146 ; MenuText_AdjustDisplayContextForDrawingItemFromAX
    147 ;   Parameters
    148 ;       AX:     Item to refresh
    149 ;       SS:BP:  Ptr to MENU
    150 ;   Returns:
    151 ;       CX:     Item to refresh
    152 ;   Corrupts registers:
    153 ;       AX, SI, DI
    154 ;--------------------------------------------------------------------
    155 ALIGN JUMP_ALIGN
    156 MenuText_AdjustDisplayContextForDrawingItemFromAX:
    157     mov     cx, ax
     141; MenuText_AdjustDisplayContextForDrawingItemFromCX
     142;   Parameters
     143;       CX:     Item to refresh
     144;       SS:BP:  Ptr to MENU
     145;   Returns:
     146;       Nothing
     147;   Corrupts registers:
     148;       AX, BX, DX, SI, DI
     149;--------------------------------------------------------------------
     150ALIGN JUMP_ALIGN
     151MenuText_AdjustDisplayContextForDrawingItemFromCX:
     152    mov     ax, cx
     153    call    GetItemTextAttributeTypeToSIforItemInCX
    158154    call    MenuLocation_GetTextCoordinatesToAXforItemInAX
     155    mov     dx, MenuCharOut_MenuTeletypeOutput
     156    ; Fall to AdjustDisplayContextForDrawingTextsAtCoordinatesInAXwithAttributeTypeInSI
     157
     158;--------------------------------------------------------------------
     159; AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX
     160;   Parameters
     161;       AX:     Cursor coordinates to set
     162;       DX:     Character output function
     163;       SI:     Attribute type (from ATTRIBUTE_CHARS)
     164;       SS:BP:  Ptr to MENU
     165;   Returns:
     166;       Nothing
     167;   Corrupts registers:
     168;       AX, BX, DX, SI, DI
     169;--------------------------------------------------------------------
     170ALIGN JUMP_ALIGN
     171AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX:
    159172    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
    160     call    .GetItemTextAttributeTypeToSIforItemInCX
    161     mov     ax, MenuCharOut_MenuTextTeletypeOutputWithAttribute
    162     jmp     SHORT AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX
    163 
    164 ;--------------------------------------------------------------------
    165 ; .GetItemTextAttributeTypeToSIforItemInCX
     173
     174    xchg    ax, dx
     175    mov     bl, ATTRIBUTES_ARE_USED
     176    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
     177
     178    call    CharOutLineSplitter_PrepareForPrintingTextLines
     179    jmp     MenuAttribute_SetToDisplayContextFromTypeInSI
     180
     181
     182;--------------------------------------------------------------------
     183; GetItemTextAttributeTypeToSIforItemInCX
    166184;   Parameters
    167185;       CX:     Item to refresh
     
    173191;--------------------------------------------------------------------
    174192ALIGN JUMP_ALIGN
    175 .GetItemTextAttributeTypeToSIforItemInCX:
     193GetItemTextAttributeTypeToSIforItemInCX:
    176194    mov     si, ATTRIBUTE_CHARS.cItem
    177195    test    BYTE [bp+MENU.bFlags], FLG_MENU_NOHIGHLIGHT
    178196    jnz     SHORT .ReturnAttributeTypeInSI
    179     cmp     cx, [bp+MENU.wHighlightedItem]
     197
     198    cmp     cx, [bp+MENUINIT.wHighlightedItem]
    180199    jne     SHORT .ReturnAttributeTypeInSI
    181200    sub     si, BYTE ATTRIBUTE_CHARS.cItem - ATTRIBUTE_CHARS.cHighlightedItem
     
    258277    pop     cx
    259278    ret
    260 
    261 
    262 ;--------------------------------------------------------------------
    263 ; AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX
    264 ;   Parameters
    265 ;       AX:     Character output function
    266 ;       SI:     Attribute type (from ATTRIBUTE_CHARS)
    267 ;       SS:BP:  Ptr to MENU
    268 ;   Returns:
    269 ;       Nothing
    270 ;   Corrupts registers:
    271 ;       AX, BX, SI, DI
    272 ;--------------------------------------------------------------------
    273 ALIGN JUMP_ALIGN
    274 AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX:
    275     mov     bl, ATTRIBUTES_ARE_USED
    276     CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
    277 
    278     mov     ax, bp
    279     CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
    280 
    281     jmp     MenuAttribute_SetToDisplayContextFromTypeInSI
  • trunk/Assembly_Library/Src/String/String.asm

    r46 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   12.7.2010
    4 ; Last update   :   1.10.2010
     4; Last update   :   12.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for handling characters.
     
    1616;   Returns:
    1717;       AX:     Word converted from string
    18 ;       DI:     Offset to NULL or first invalid character
    19 ;       CF:     Set if conversion successfull
    20 ;               Cleared if invalid string
     18;       SI:     Updated
     19;       CF:     Cleared if successfull
     20;               Set if error during conversion
    2121;   Corrupts registers:
    22 ;       DX
     22;       Nothing
    2323;--------------------------------------------------------------------
    2424ALIGN JUMP_ALIGN
    2525String_ConvertWordToAXfromStringInDSSIwithBaseInBX:
    26     xor     dx, dx
    27     cld
     26    push    di
     27    push    dx
    2828
    29 ALIGN JUMP_ALIGN
    30 .ConvertWordToAXfromStringInDSSIwithBaseInBX:
    31     lodsb                       ; Load character from DS:SI to AL
    32     call    Char_ConvertIntegerToALfromDigitInALwithBaseInBX
    33     jnc     SHORT .InvalidCharacter
    34     xor     ah, ah
    35     push    ax                  ; Push integer
    36     xchg    ax, dx              ; Copy WORD to AX
    37     mul     bx                  ; DX:AX = word in AX * base in BX
    38     pop     dx                  ; Pop integer
    39     add     dx, ax              ; WORD back to DX
    40     jmp     SHORT .ConvertWordToAXfromStringInDSSIwithBaseInBX
     29    xor     di, di
     30    mov     dx, StringProcess_ConvertToWordInDIWithBaseInBX
     31    call    StringProcess_DSSIwithFunctionInDX
     32    xchg    ax, di
    4133
    42 ALIGN JUMP_ALIGN
    43 .InvalidCharacter:
    44     sub     al, 1               ; Set CF if NULL character, clear CF otherwise
    45     xchg    ax, dx              ; Return WORD in AX
     34    pop     dx
     35    pop     di
    4636    ret
    4737
    4838
    4939;--------------------------------------------------------------------
    50 ; String_CopyToESDIfromDSSIwithoutTerminatingESDI
     40; String_CopyDSSItoESDIandGetSizeToCX
    5141;   Parameters:
    5242;       DS:SI:  Ptr to source NULL terminated string
     
    5949;--------------------------------------------------------------------
    6050ALIGN JUMP_ALIGN
    61 String_CopyToESDIfromDSSIwithoutTerminatingESDI:
     51String_CopyDSSItoESDIandGetSizeToCX:
    6252    push    ax
     53
    6354    xor     cx, cx
    64 
    6555ALIGN JUMP_ALIGN
    66 .GetAndStoreNewCharacter:
     56.CopyNextCharacter:
    6757    lodsb                       ; Load from DS:SI to AL
    6858    test    al, al              ; NULL to end string?
     
    7060    stosb                       ; Store from AL to ES:DI
    7161    inc     cx                  ; Increment number of characters written
    72     jmp     SHORT .GetAndStoreNewCharacter
     62    jmp     SHORT .CopyNextCharacter
    7363
    7464ALIGN JUMP_ALIGN
     
    7969
    8070;--------------------------------------------------------------------
    81 ; String_ConvertDSSItoLowerCase
     71; String_GetLengthFromDSSItoCX
    8272;   Parameters:
    83 ;       DS:SI:  Ptr to NULL terminated string to convert
     73;       DS:SI:  Ptr to NULL terminated string
    8474;   Returns:
    85 ;       Nothing
     75;       CX:     String length in characters
    8676;   Corrupts registers:
    8777;       Nothing
    8878;--------------------------------------------------------------------
    8979ALIGN JUMP_ALIGN
    90 String_ConvertDSSItoLowerCase:
     80String_GetLengthFromDSSItoCX:
     81    push    ax
    9182    push    si
    92     push    ax
    9383
    94 ALIGN JUMP_ALIGN
    95 .ConvertNextCharacter:
    96     lodsb
    97     test    al, al              ; NULL to end string?
    98     jz      SHORT .EndOfString
    99     call    Char_ALtoLowerCaseLetter
    100     mov     [si-1], al
    101     jmp     SHORT .ConvertNextCharacter
     84    call    Memory_ExchangeDSSIwithESDI
     85    xor     ax, ax      ; Find NULL
     86    mov     cx, -1      ; Full segment if necessary
     87    repne scasb
     88    mov     cx, di
     89    call    Memory_ExchangeDSSIwithESDI
    10290
    103 ALIGN JUMP_ALIGN
    104 .EndOfString:
     91    pop     si
     92    stc
     93    sbb     cx, si      ; Subtract NULL
    10594    pop     ax
    106     pop     si
    10795    ret
  • trunk/Assembly_Library/Src/Util/Memory.asm

    r50 r52  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   9.10.2010
     4; Last update   :   11.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for memory access.
     
    131131; Memory_CopySSBPtoESDI
    132132; Memory_CopySSBPtoDSSI
     133; Memory_CopyDSSItoESDI
    133134; Memory_CopyESDItoDSSI
    134135;   Parameters
     
    151152    pop     ds
    152153    mov     si, bp
     154    ret
     155
     156ALIGN JUMP_ALIGN
     157Memory_CopyDSSItoESDI:
     158    push    ds
     159    pop     es
     160    mov     di, si
    153161    ret
    154162
Note: See TracChangeset for help on using the changeset viewer.