Changeset 54 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm


Ignore:
Timestamp:
Oct 24, 2010, 11:01:17 AM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to Assembly Library:
Drive selection moved to own dialog from File Dialog.
File Dialog now displays loading text for better usability in slow systems.
Moved some functions from Memory.asm to new Registers.asm.

File:
1 edited

Legend:

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

    r53 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   6.9.2010
    4 ; Last update   :   13.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Displays file dialog.
     
    4949.ItemSelectedFromCX:
    5050    call    LoadItemStringBufferToESDI
    51     call    Memory_CopyESDItoDSSI
     51    call    Registers_CopyESDItoDSSI
    5252    call    ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
    5353    jmp     ParseSelectionFromItemLineInDSSI
     
    113113
    114114;--------------------------------------------------------------------
     115; ReInitializeMenuinitFromSSBP
    115116; InitializeMenuinitFromSSBP
    116117;   Parameters:
    117 ;       DS:SI:      Ptr to MENUINIT to initialize (also points to DIALOG)
    118118;       SS:BP:      Ptr to DIALOG
    119119;   Returns:
     
    123123;--------------------------------------------------------------------
    124124ALIGN JUMP_ALIGN
     125ReInitializeMenuinitFromSSBP:
     126    call    DisplayLoadingMessageInInformationArea
    125127InitializeMenuinitFromSSBP:
    126128    call    LoadItemStringBufferToESDI
     
    129131    call    SortDirectoryContentsStringFromESDIwithCountInCX
    130132    call    RemoveLastLFandTerminateESDIwithNull
    131     call    Memory_CopySSBPtoDSSI
     133
     134    call    Registers_CopySSBPtoDSSI
    132135    xor     ax, ax
    133136    call    Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
     
    199202ALIGN JUMP_ALIGN
    200203.ClearDLifInRootDirectory:
    201     call    Memory_CopyESDItoDSSI
     204    call    Registers_CopyESDItoDSSI
    202205    call    Directory_WriteCurrentPathToDSSI
    203206    mov     dl, [si]
     
    375378ALIGN JUMP_ALIGN
    376379SortDirectoryContentsStringFromESDIwithCountInCX:
    377     call    Memory_CopyESDItoDSSI
     380    call    Registers_CopyESDItoDSSI
    378381    call    .AddDirectoryContentsStringLengthToDI
    379382    mov     bx, .FileStringComparator
     
    431434    cmp     bh, bl
    432435    jmp     SHORT .ReturnFromComparison
     436
     437
     438;--------------------------------------------------------------------
     439; RemoveLastLFandTerminateESDIwithNull
     440;   Parameters:
     441;       ES:DI:  Ptr to end of buffer to terminate
     442;   Returns:
     443;       Nothing
     444;   Corrupts registers:
     445;       AX
     446;--------------------------------------------------------------------
     447ALIGN JUMP_ALIGN
     448RemoveLastLFandTerminateESDIwithNull:
     449    dec     di
     450    xor     ax, ax
     451    stosb
     452    ret
    433453
    434454
     
    547567ALIGN JUMP_ALIGN
    548568RefreshFilesToDisplay:
    549     call    InitializeMenuinitFromSSBP
     569    call    ReInitializeMenuinitFromSSBP
    550570    jmp     MenuInit_RefreshMenuWindow
    551571
     
    661681    jz      SHORT ReturnWithoutHandlingKeystroke
    662682
    663     call    .ShowDriveSelectionDialogAndGetDriveNumberToDL
    664     jnc     SHORT RefreshFilesToDisplay
     683    call    DisplayLoadingMessageInInformationArea
     684    mov     cx, DRIVE_DIALOG_IO_size
     685    call    Memory_ReserveCXbytesFromStackToDSSI
     686    call    .DisplayDriveSelectionDialogWithIoInDSSI
     687    call    .ChangeDriveToUserSelectionFromIoInDSSI
     688    add     sp, BYTE DRIVE_DIALOG_IO_size
     689    ret
     690
     691;--------------------------------------------------------------------
     692; .DisplayDriveSelectionDialogWithIoInDSSI
     693;   Parameters:
     694;       DS:SI:  Ptr to uninitialized DRIVE_DIALOG_IO
     695;       SS:BP:  Ptr to DIALOG
     696;   Returns:
     697;       DS:SI:  Ptr to DRIVE_DIALOG_IO
     698;   Corrupts registers:
     699;       AX, DI
     700;--------------------------------------------------------------------
     701ALIGN JUMP_ALIGN
     702.DisplayDriveSelectionDialogWithIoInDSSI:
     703    call    InitializeNullStringsToDialogInputInDSSI
     704    mov     WORD [si+DIALOG_INPUT.fszTitle], g_szSelectNewDrive
     705    CALL_MENU_LIBRARY GetDriveWithIoInDSSI
     706    ret
     707
     708;--------------------------------------------------------------------
     709; .ChangeDriveToUserSelectionFromIoInDSSI
     710;   Parameters:
     711;       DS:SI:  Ptr to DRIVE_DIALOG_IO
     712;       SS:BP:  Ptr to DIALOG
     713;   Returns:
     714;       Nothing
     715;   Corrupts registers:
     716;       All, except BP
     717;--------------------------------------------------------------------
     718ALIGN JUMP_ALIGN
     719.ChangeDriveToUserSelectionFromIoInDSSI:
     720    cmp     BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE
     721    jne     SHORT .UserCancelledDriveChange
     722
     723    mov     dl, [si+DRIVE_DIALOG_IO.bReturnDriveNumber]
    665724    call    Drive_SetDefaultFromDL
    666     jmp     SHORT RefreshFilesToDisplay
    667 
    668 ;--------------------------------------------------------------------
    669 ; .ShowDriveSelectionDialogAndGetDriveNumberToDL
    670 ;   Parameters:
    671 ;       SS:BP:  Ptr to DIALOG
    672 ;   Returns:
    673 ;       DL:     Drive selected by user
    674 ;       CF:     Set if new drive selected
    675 ;               Cleared if selection cancelled by user
    676 ;   Corrupts registers:
    677 ;       All, except BP
    678 ;--------------------------------------------------------------------
    679 ALIGN JUMP_ALIGN
    680 .ShowDriveSelectionDialogAndGetDriveNumberToDL:
    681     mov     cx, DIALOG_INPUT_size
    682     call    Memory_ReserveCXbytesFromStackToDSSI
    683     call    .InitializeDialogInputInDSSIforDriveSelection
    684     call    DialogSelection_GetSelectionToAXwithInputInDSSI
    685     add     sp, BYTE DIALOG_INPUT_size
    686     cmp     ax, BYTE NO_ITEM_SELECTED   ; Clear CF if equal
    687     jne     SHORT .ConvertDriveNumberToDLfromItemIndexInAX
    688     ret
    689 
    690 ALIGN JUMP_ALIGN
    691 .InitializeDialogInputInDSSIforDriveSelection:
    692     call    InitializeNullStringsToDialogInputInDSSI
    693     call    LoadItemStringBufferToESDI
    694     mov     WORD [si+DIALOG_INPUT.fszTitle], g_szSelectNewDrive
    695     mov     [si+DIALOG_INPUT.fszItems], di
    696     mov     [si+DIALOG_INPUT.fszItems+2], es
    697     call    Drive_GetFlagsForAvailableDrivesToDXAX
    698     ; Fall to .GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX
    699 
    700 ;--------------------------------------------------------------------
    701 ; .GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX
    702 ;   Parameters:
    703 ;       DX:AX:  Drive letter flags
    704 ;       ES:DI:  Ptr to item string buffer
    705 ;       SS:BP:  Ptr to DIALOG
    706 ;   Returns:
    707 ;       Nothing
    708 ;   Corrupts registers:
    709 ;       AX, BX, CX, DX, DI, ES
    710 ;--------------------------------------------------------------------
    711 ;ALIGN JUMP_ALIGN
    712 .GenerateDriveSelectionStringToESDIfromDriveFlagsInDXAX:
    713     cld
    714     xchg    cx, ax
    715     mov     ax, 3A41h       ; A:
    716 ALIGN JUMP_ALIGN
    717 .BitShiftLoop:
    718     shr     dx, 1
    719     rcr     cx, 1
    720     jnc     SHORT .CheckIfMoreDrivesLeft
    721     stosw
    722     mov     BYTE [es:di], LF
    723     inc     di
    724 ALIGN JUMP_ALIGN
    725 .CheckIfMoreDrivesLeft:
    726     inc     ax              ; Next drive letter
    727     mov     bx, dx
    728     or      bx, cx
    729     jnz     SHORT .BitShiftLoop
    730     jmp     SHORT TerminateESDIwithNull
    731 
    732 ;--------------------------------------------------------------------
    733 ; .ConvertDriveNumberToDLfromItemIndexInAX
    734 ;   Parameters:
    735 ;       AX:     Selected drive item
    736 ;   Returns:
    737 ;       DL:     Drive number
    738 ;       CF:     Set since drive selected
    739 ;   Corrupts registers:
    740 ;       AX, CX, DH
    741 ;--------------------------------------------------------------------
    742 ALIGN JUMP_ALIGN
    743 .ConvertDriveNumberToDLfromItemIndexInAX:
    744     mov     ah, -1
    745     xchg    cx, ax
    746     call    Drive_GetFlagsForAvailableDrivesToDXAX
    747 ALIGN JUMP_ALIGN
    748 .BitScanLoop:
    749     shr     dx, 1
    750     rcr     ax, 1
    751     inc     ch              ; Increment drive number
    752     sbb     cl, 0           ; Decrement selection index
    753     jnc     SHORT .BitScanLoop
    754     mov     dl, ch
    755     stc                     ; Drive selected by user
    756     ret
    757 
    758 
    759 ;--------------------------------------------------------------------
    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 ;--------------------------------------------------------------------
    769 ALIGN JUMP_ALIGN
    770 RemoveLastLFandTerminateESDIwithNull:
    771     dec     di
    772 ALIGN JUMP_ALIGN
    773 TerminateESDIwithNull:
    774     xor     ax, ax
    775     stosb
     725    jmp     RefreshFilesToDisplay
     726.UserCancelledDriveChange:
     727    ret
     728
     729
     730;--------------------------------------------------------------------
     731; DisplayLoadingMessageInInformationArea
     732;   Parameters:
     733;       SS:BP:      Ptr to DIALOG
     734;   Returns:
     735;       Nothing
     736;   Corrupts registers:
     737;       AX, BX, CX, DX, SI, DI
     738;--------------------------------------------------------------------
     739ALIGN JUMP_ALIGN
     740DisplayLoadingMessageInInformationArea:
     741    call    MenuText_ClearInformationArea
     742    call    MenuText_PrepareToDrawInformationArea
     743    mov     si, g_szLoadingPleaseWait
     744    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
    776745    ret
    777746
Note: See TracChangeset for help on using the changeset viewer.