Changeset 53 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Oct 13, 2010, 6:34:39 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:
File Dialog is now compatible with new line splitting.

Location:
trunk/Assembly_Library/Src
Files:
2 edited

Legend:

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

    r52 r53  
    22; Project name  :   Assembly Library
    33; Created date  :   6.9.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   13.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays file dialog.
     
    7474    loop    .InfoLineLoop
    7575    stc                     ; Event processed
     76    ret
     77
     78
     79ALIGN JUMP_ALIGN
     80.RefreshItemFromCX:
     81    call    LoadItemStringBufferToESDI
     82    mov     ax, FILE_STRING_LENGTH
     83    xchg    ax, cx
     84    mul     cx
     85    add     di, ax
     86    mov     si, di
     87    mov     bx, es
     88    dec     cx              ; Do not print LF at the end of file string
     89    CALL_DISPLAY_LIBRARY PrintCharBufferFromBXSIwithLengthInCX
     90    stc
    7691    ret
    7792
     
    93108    at  MENUEVENT.RefreshTitle,                 dw  Dialog_EventRefreshTitle
    94109    at  MENUEVENT.RefreshInformation,           dw  .RefreshInformation
    95     at  MENUEVENT.RefreshItemFromCX,            dw  Dialog_EventRefreshItemFromCX
     110    at  MENUEVENT.RefreshItemFromCX,            dw  .RefreshItemFromCX
    96111iend
    97112
     
    113128    call    LoadItemStringBufferToESDI
    114129    call    SortDirectoryContentsStringFromESDIwithCountInCX
     130    call    RemoveLastLFandTerminateESDIwithNull
    115131    call    Memory_CopySSBPtoDSSI
    116132    xor     ax, ax
     
    148164;       CX:     Number of files or directories found
    149165;   Corrupts registers:
    150 ;       AX, DX, SI, DI, DS, ES
     166;       AX, BX, DX, SI, DI, DS
    151167;--------------------------------------------------------------------
    152168ALIGN JUMP_ALIGN
    153169CreateStringFromCurrentDirectoryContentsToESDI:
     170    mov     bx, di
     171    CALL_DISPLAY_LIBRARY PushDisplayContext
     172    mov     cx, -1
     173    CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX ; ES:DI now points to buffer
     174
    154175    lds     si, [bp+DIALOG.fpDialogIO]
    155176    eMOVZX  cx, BYTE [si+FILE_DIALOG_IO.bFileAttributes]
    156177    lds     si, [si+FILE_DIALOG_IO.fpFileFilterString]
    157178    call    Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
    158     rcr     cx, 1           ; Store CF
     179
    159180    call    .ClearDLifInRootDirectory
    160181    call    Directory_GetDiskTransferAreaAddressToDSSI
    161     rcl     cx, 1           ; Restore CF
    162182    xor     cx, cx          ; Clear file/directory count
    163     ; Fall to .FindMatchingFilesAndWriteThemToESDI
    164 
    165 ;--------------------------------------------------------------------
    166 ; .FindMatchingFilesAndWriteThemToESDI
    167 ;   Parameters:
    168 ;       CX:     Initial directory count
    169 ;       DL:     Zero if root directory selected
    170 ;       DS:SI:  Ptr to DTA with first matching file
    171 ;       ES:DI:  Ptr to destination string buffer
    172 ;   Returns:
    173 ;       CX:     Incremented by number of files/directories found
    174 ;   Corrupts registers:
    175 ;       AX, DX, DI
    176 ;--------------------------------------------------------------------
    177 ;ALIGN JUMP_ALIGN
    178 .FindMatchingFilesAndWriteThemToESDI:
    179     jc      SHORT TerminateESDIwithNull
    180     call    AppendFileToBufferInESDIfromDtaInDSSI
    181     call    Directory_UpdateDTAForNextMatchUsingPreviousParameters
    182     jmp     SHORT .FindMatchingFilesAndWriteThemToESDI
     183    call    .FindMatchingFilesAndPrintThemToOffScreenBuffer
     184
     185    CALL_DISPLAY_LIBRARY PopDisplayContext
     186    ret
    183187
    184188;--------------------------------------------------------------------
     
    200204    ret
    201205
    202 
    203 ;--------------------------------------------------------------------
    204 ; TerminateESDIwithNull
    205 ;   Parameters:
    206 ;       ES:DI:  Ptr to destination string buffer
    207 ;   Returns:
    208 ;       Nothing
    209 ;   Corrupts registers:
    210 ;       AX
    211 ;--------------------------------------------------------------------
    212 ALIGN JUMP_ALIGN
    213 TerminateESDIwithNull:
    214     xor     ax, ax
    215     stosb
    216     ret
    217 
    218 
    219 ;--------------------------------------------------------------------
    220 ; AppendFileToBufferInESDIfromDtaInDSSI
     206;--------------------------------------------------------------------
     207; .FindMatchingFilesAndPrintThemToOffScreenBuffer
     208;   Parameters:
     209;       CX:     Initial directory count
     210;       DL:     Zero if root directory selected
     211;       DS:SI:  Ptr to DTA with first matching file
     212;   Returns:
     213;       CX:     Incremented by number of files/directories found
     214;   Corrupts registers:
     215;       AX, BX, DX, DI, DS
     216;--------------------------------------------------------------------
     217ALIGN JUMP_ALIGN
     218.FindMatchingFilesAndPrintThemToOffScreenBuffer:
     219    call    AppendFileFromDTAinDSSItoOffScreenBuffer
     220    call    Directory_UpdateDTAForNextMatchUsingPreviousParameters
     221    jnc     SHORT .FindMatchingFilesAndPrintThemToOffScreenBuffer
     222    ret
     223
     224
     225;--------------------------------------------------------------------
     226; AppendFileFromDTAinDSSItoOffScreenBuffer
    221227;   Parameters:
    222228;       CX:     Files/directores found
    223229;       DL:     Zero if root directory selected
    224230;       DS:SI:  Ptr to DTA containing file information
    225 ;       ES:DI:  Ptr to destination string buffer
    226231;   Returns:
    227232;       CX:     Incremented by number of files/directories found
    228 ;       DI:     Updated for next file
    229 ;   Corrupts registers:
    230 ;       AX, BX, DX
    231 ;--------------------------------------------------------------------
    232 ALIGN JUMP_ALIGN
    233 AppendFileToBufferInESDIfromDtaInDSSI:
     233;   Corrupts registers:
     234;       AX, BX
     235;--------------------------------------------------------------------
     236ALIGN JUMP_ALIGN
     237AppendFileFromDTAinDSSItoOffScreenBuffer:
    234238    call    .FilterCurrentDirectory         ; We never want "."
    235239    call    .FilterUpDirectoryWhenInRoot    ; No ".." when in root directory
    236240    inc     cx                              ; Nothing filtered so increment files/directories
    237     ; Fall to .PrepareBufferFormattingAndFormatFromDTAinDSSI
    238 
    239 ;--------------------------------------------------------------------
    240 ; .PrepareBufferFormattingAndFormatFromDTAinDSSI
    241 ;   Parameters:
    242 ;       DS:SI:  Ptr to DTA containing file information
    243 ;       ES:DI:  Ptr to destination string buffer
    244 ;   Returns:
    245 ;       DI:     Updated for next file
    246 ;   Corrupts registers:
    247 ;       AX, BX, DX
    248 ;--------------------------------------------------------------------
    249 ;ALIGN JUMP_ALIGN
    250 .PrepareBufferFormattingAndFormatFromDTAinDSSI:
     241
    251242    push    bp
    252243    push    si
     244    push    dx
    253245    push    cx
    254     mov     bx, di
    255     CALL_DISPLAY_LIBRARY PushDisplayContext
    256     mov     cx, -1
    257     CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
    258 
    259246    call    .FormatFileOrDirectoryToBufferFromDTAinDSSI
    260 
    261     CALL_DISPLAY_LIBRARY GetCharacterPointerToBXAX
    262     xchg    bx, ax
    263     CALL_DISPLAY_LIBRARY PopDisplayContext
    264     mov     di, bx
    265247    pop     cx
     248    pop     dx
    266249    pop     si
    267250    pop     bp
     251    ret
     252
     253;--------------------------------------------------------------------
     254; .FilterCurrentDirectory
     255; .FilterUpDirectoryWhenInRoot
     256;   Parameters:
     257;       DL:     Zero if root directory selected
     258;       DS:SI:  Ptr to DTA containing file information
     259;   Returns:
     260;       Nothing
     261;       Returns from AppendFileToBufferInESDIfromDtaInDSSI when filtering
     262;   Corrupts registers:
     263;       AX
     264;--------------------------------------------------------------------
     265ALIGN JUMP_ALIGN
     266.FilterCurrentDirectory:
     267    cmp     WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
     268    jne     SHORT .ReturnWithoutFiltering
     269    add     sp, BYTE 2      ; Remove return address from stack
     270    ret
     271
     272ALIGN JUMP_ALIGN
     273.FilterUpDirectoryWhenInRoot:
     274    test    dl, dl          ; Set ZF if root directory selected
     275    jnz     SHORT .ReturnWithoutFiltering
     276    cmp     WORD [si+DTA.szFile], UPDIR_CHARACTERS
     277    jne     SHORT .ReturnWithoutFiltering
     278    add     sp, BYTE 2      ; Remove return address from stack
     279ALIGN JUMP_ALIGN, ret
     280.ReturnWithoutFiltering:
    268281    ret
    269282
     
    295308;       Nothing
    296309;   Corrupts registers:
    297 ;       AX, BX, CX, DX, SI, DI, BP
     310;       AX, BX, CX, DX, SI, DI
    298311;--------------------------------------------------------------------
    299312.FormatFile:
    300     ; Convert file name to lower case
    301313    xchg    si, ax
    302     mov     dx, StringProcess_ConvertToLowerCase
    303     call    StringProcess_DSSIwithFunctionInDX
     314    call    String_ConvertDSSItoLowerCase
    304315    xchg    ax, si
    305316
    306317    ; Push parameters for file name
    307     push    ax              ; Push directory name offset
    308     push    ds              ; Push directory name segment
     318    push    ax              ; Push file name offset
     319    push    ds              ; Push file name segment
    309320
    310321    ; Push parameters for file size
     
    334345;       Nothing
    335346;   Corrupts registers:
    336 ;       AX, BX, CX, DX, SI, DI, BP
     347;       AX, SI, DI
    337348;--------------------------------------------------------------------
    338349ALIGN JUMP_ALIGN
     
    350361    ret
    351362
    352 ;--------------------------------------------------------------------
    353 ; .FilterCurrentDirectory
    354 ; .FilterUpDirectoryWhenInRoot
    355 ;   Parameters:
    356 ;       DL:     Zero if root directory selected
    357 ;       DS:SI:  Ptr to DTA containing file information
    358 ;   Returns:
    359 ;       Nothing
    360 ;       Returns from AppendFileToBufferInESDIfromDtaInDSSI when filtering
    361 ;   Corrupts registers:
    362 ;       AX
    363 ;--------------------------------------------------------------------
    364 ALIGN JUMP_ALIGN
    365 .FilterCurrentDirectory:
    366     cmp     WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
    367     jne     SHORT .ReturnWithoutFiltering
    368     add     sp, BYTE 2      ; Remove return address from stack
    369     ret
    370 
    371 ALIGN JUMP_ALIGN
    372 .FilterUpDirectoryWhenInRoot:
    373     test    dl, dl          ; Set ZF if root directory selected
    374     jnz     SHORT .ReturnWithoutFiltering
    375     cmp     WORD [si+DTA.szFile], UPDIR_CHARACTERS
    376     jne     SHORT .ReturnWithoutFiltering
    377     add     sp, BYTE 2      ; Remove return address from stack
    378 ALIGN JUMP_ALIGN, ret
    379 .ReturnWithoutFiltering:
    380     ret
    381 
    382363
    383364;--------------------------------------------------------------------
     
    388369;       SS:BP:  Ptr to DIALOG
    389370;   Returns:
    390 ;       Nothing
    391 ;   Corrupts registers:
    392 ;       AX, BX, CX, DX, SI, DI, DS, ES
     371;       ES:DI:  Ptr to end of directory contents string
     372;   Corrupts registers:
     373;       AX, BX, CX, DX, SI, DS
    393374;--------------------------------------------------------------------
    394375ALIGN JUMP_ALIGN
    395376SortDirectoryContentsStringFromESDIwithCountInCX:
    396     call    Memory_ExchangeDSSIwithESDI
     377    call    Memory_CopyESDItoDSSI
     378    call    .AddDirectoryContentsStringLengthToDI
    397379    mov     bx, .FileStringComparator
    398380    xchg    dx, cx
    399381    mov     cx, FILE_STRING_LENGTH
    400382    jmp     Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
     383
     384ALIGN JUMP_ALIGN
     385.AddDirectoryContentsStringLengthToDI:
     386    mov     ax, FILE_STRING_LENGTH
     387    mul     cx
     388    add     di, ax
     389    ret
    401390
    402391;--------------------------------------------------------------------
     
    739728    or      bx, cx
    740729    jnz     SHORT .BitShiftLoop
    741     jmp     TerminateESDIwithNull
     730    jmp     SHORT TerminateESDIwithNull
    742731
    743732;--------------------------------------------------------------------
     
    769758
    770759;--------------------------------------------------------------------
     760; RemoveLastLFandTerminateESDIwithNull
     761; TerminateESDIwithNull
     762;   Parameters:
     763;       ES:DI:  Ptr to end of buffer to terminate
     764;   Returns:
     765;       Nothing
     766;   Corrupts registers:
     767;       AX
     768;--------------------------------------------------------------------
     769ALIGN JUMP_ALIGN
     770RemoveLastLFandTerminateESDIwithNull:
     771    dec     di
     772ALIGN JUMP_ALIGN
     773TerminateESDIwithNull:
     774    xor     ax, ax
     775    stosb
     776    ret
     777
     778
     779;--------------------------------------------------------------------
    771780; InitializeNullStringsToDialogInputInDSSI
    772781;   Parameters:
  • trunk/Assembly_Library/Src/String/String.asm

    r52 r53  
    22; Project name  :   Assembly Library
    33; Created date  :   12.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   13.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for handling characters.
     
    88; Section containing code
    99SECTION .text
     10
     11;--------------------------------------------------------------------
     12; String_ConvertDSSItoLowerCase
     13;   Parameters:
     14;       DS:SI:  Ptr to string to convert
     15;   Returns:
     16;       CX:     Number of characters processed
     17;       SI:     Updated
     18;   Corrupts registers:
     19;       Nothing
     20;--------------------------------------------------------------------
     21ALIGN JUMP_ALIGN
     22String_ConvertDSSItoLowerCase:
     23    push    dx
     24    push    ax
     25
     26    mov     dx, StringProcess_ConvertToLowerCase
     27    call    StringProcess_DSSIwithFunctionInDX
     28
     29    pop     ax
     30    pop     dx
     31    ret
     32
    1033
    1134;--------------------------------------------------------------------
     
    1639;   Returns:
    1740;       AX:     Word converted from string
     41;       CX:     Number of characters processed
    1842;       SI:     Updated
    1943;       CF:     Cleared if successfull
     
    3862
    3963;--------------------------------------------------------------------
    40 ; String_CopyDSSItoESDIandGetSizeToCX
     64; String_CopyDSSItoESDIandGetLengthToCX
    4165;   Parameters:
    4266;       DS:SI:  Ptr to source NULL terminated string
     
    4973;--------------------------------------------------------------------
    5074ALIGN JUMP_ALIGN
    51 String_CopyDSSItoESDIandGetSizeToCX:
     75String_CopyDSSItoESDIandGetLengthToCX:
    5276    push    ax
    5377
Note: See TracChangeset for help on using the changeset viewer.