Changeset 54 in xtideuniversalbios


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.

Location:
trunk/Assembly_Library
Files:
2 added
11 edited

Legend:

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

    r45 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   15.9.2010
    4 ; Last update   :   28.9.2010
     4; Last update   :   22.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for Menu library dialogs.
     
    5959endstruc
    6060
     61struc DRIVE_DIALOG_IO
     62    .dialogInput        resb    DIALOG_INPUT_size
     63    .bUserCancellation  resb    1
     64                        resb    1
     65    .cReturnDriveLetter resb    1
     66    .bReturnDriveNumber resb    1
     67endstruc
     68
    6169struc FILE_DIALOG_IO
    6270    ; DIALOG_INPUT adjusted for File Dialog
  • trunk/Assembly_Library/Inc/Menu.inc

    r52 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   13.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   23.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Defines for Menu library.
     
    8787    .GetStringWithIoInDSSI                          resb    2
    8888    .GetFileNameWithIoInDSSI                        resb    2
     89    .GetDriveWithIoInDSSI                           resb    2
    8990%endif
    9091endstruc
  • trunk/Assembly_Library/Src/AssemblyLibrary.asm

    r52 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   15.9.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Assembly Library main file. This is the only file that
     
    4848    %ifdef INCLUDE_MENU_DIALOGS
    4949        %include "Dialog.asm"
     50        %include "DialogDrive.asm"
    5051        %include "DialogFile.asm"
    5152        %include "DialogMessage.asm"
     
    7374    %include "Bit.asm"
    7475    %include "Memory.asm"
     76    %include "Registers.asm"
    7577    %include "Size.asm"
    7678    %include "Sort.asm"
  • trunk/Assembly_Library/Src/Keyboard/Keyboard.asm

    r52 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   5.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for managing keyboard.
     
    3434
    3535    call    Char_GetFilterFunctionToDXforNumericBaseInBX
    36     call    Memory_ExchangeDSSIwithESDI
     36    call    Registers_ExchangeDSSIwithESDI
    3737    call    Keyboard_ReadUserInputtedStringToESDIWhilePrinting
    38     call    Memory_ExchangeDSSIwithESDI ; Does not modify FLAGS
     38    call    Registers_ExchangeDSSIwithESDI  ; Does not modify FLAGS
    3939    jz      SHORT .CancelledByUser
    4040
     
    4242.CancelledByUser:
    4343    add     sp, BYTE BUFFER_SIZE_FOR_WORD_INPUT
    44     test    cx, cx                  ; Set ZF if string length is zero
     44    test    cx, cx                          ; Set ZF if string length is zero
    4545    pop     cx
    4646    pop     si
  • 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
  • trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm

    r46 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   14.9.2010
    4 ; Last update   :   1.10.2010
     4; Last update   :   23.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Strings used by dialogs.
     
    1111g_szTimeFormat:         db  " %2-u min %2-u sec",LF,CR,NULL
    1212
     13; Strings for Drive Dialog
     14g_szDriveFormat:        db  "%c:",NULL
     15
    1316; Strings for File Dialog
    1417g_szChangeDrive:        db  "F2 Change Drive",LF,CR,NULL
     
    1821g_szSelectNewDrive:
    1922    db      "Select new drive.",NULL
     23g_szLoadingPleaseWait:
     24    db      "Loading. Please wait...",NULL
    2025
    2126g_szEnterNewFileOrDirectory:
  • trunk/Assembly_Library/Src/Menu/Menu.asm

    r48 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   3.8.2010
    4 ; Last update   :   7.10.2010
     4; Last update   :   23.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Menu Library functions for CALL_MENU_LIBRARY macro
     
    6969    at  MENU_LIB.GetStringWithIoInDSSI,                         dw  DialogString_GetStringWithIoInDSSI
    7070    at  MENU_LIB.GetFileNameWithIoInDSSI,                       dw  DialogFile_GetFileNameWithIoInDSSI
     71    at  MENU_LIB.GetDriveWithIoInDSSI,                          dw  DialogDrive_GetDriveWithIoInDSSI
    7172%endif
    7273iend
  • trunk/Assembly_Library/Src/Menu/MenuText.asm

    r52 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   21.7.2010
    4 ; Last update   :   12.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for drawing menu texts by the user.
     
    2727ALIGN JUMP_ALIGN
    2828MenuText_ClearInformationArea:
    29     call    PrepareToDrawInformationArea
     29    call    MenuText_PrepareToDrawInformationArea
    3030    mov     cl, [bp+MENUINIT.bInfoLines]
    3131ClearCLlinesOfText:
    3232    mov     al, [bp+MENUINIT.bWidth]
    33     sub     al, MENU_HORIZONTAL_BORDER_LINES+MENU_TEXT_COLUMN_OFFSET
     33    sub     al, MENU_HORIZONTAL_BORDER_LINES+(MENU_TEXT_COLUMN_OFFSET/2)
    3434    mul     cl
    3535    xchg    cx, ax
     
    6060    cmp     BYTE [bp+MENUINIT.bInfoLines], 0
    6161    jz      SHORT NothingToRefresh
    62     call    PrepareToDrawInformationArea
     62    call    MenuText_PrepareToDrawInformationArea
    6363    jmp     MenuEvent_RefreshInformation
    6464
     
    8080
    8181ALIGN JUMP_ALIGN
    82 PrepareToDrawInformationArea:
     82MenuText_PrepareToDrawInformationArea:
    8383    mov     si, ATTRIBUTE_CHARS.cInformation
    8484    call    MenuLocation_GetInformationTextTopLeftCoordinatesToAX
  • trunk/Assembly_Library/Src/String/String.asm

    r53 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   12.7.2010
    4 ; Last update   :   13.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for handling characters.
     
    106106    push    si
    107107
    108     call    Memory_ExchangeDSSIwithESDI
     108    call    Registers_ExchangeDSSIwithESDI
    109109    xor     ax, ax      ; Find NULL
    110110    mov     cx, -1      ; Full segment if necessary
    111111    repne scasb
    112112    mov     cx, di
    113     call    Memory_ExchangeDSSIwithESDI
     113    call    Registers_ExchangeDSSIwithESDI
    114114
    115115    pop     si
  • trunk/Assembly_Library/Src/Util/Memory.asm

    r52 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   14.7.2010
    4 ; Last update   :   11.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for memory access.
     
    7070    push    di
    7171    push    ax
    72     call    Memory_CopySSBPtoESDI
     72    call    Registers_CopySSBPtoESDI
    7373    call    Memory_ZeroESDIwithSizeInCX
    7474    pop     ax
     
    110110
    111111;--------------------------------------------------------------------
    112 ; Memory_ExchangeDSSIwithESDI
    113 ;   Parameters
    114 ;       Nothing
    115 ;   Returns:
    116 ;       DS:SI and ES:DI are exchanged.
    117 ;   Corrupts registers:
    118 ;       Nothing
    119 ;--------------------------------------------------------------------
    120 ALIGN JUMP_ALIGN
    121 Memory_ExchangeDSSIwithESDI:
    122     push    ds
    123     push    es
    124     pop     ds
    125     pop     es
    126     xchg    si, di
    127     ret
    128 
    129 
    130 ;--------------------------------------------------------------------
    131 ; Memory_CopySSBPtoESDI
    132 ; Memory_CopySSBPtoDSSI
    133 ; Memory_CopyDSSItoESDI
    134 ; Memory_CopyESDItoDSSI
    135 ;   Parameters
    136 ;       Nothing
    137 ;   Returns:
    138 ;       Copies farm pointer to different segment/pointer register pair
    139 ;   Corrupts registers:
    140 ;       Nothing
    141 ;--------------------------------------------------------------------
    142 ALIGN JUMP_ALIGN
    143 Memory_CopySSBPtoESDI:
    144     push    ss
    145     pop     es
    146     mov     di, bp
    147     ret
    148 
    149 ALIGN JUMP_ALIGN
    150 Memory_CopySSBPtoDSSI:
    151     push    ss
    152     pop     ds
    153     mov     si, bp
    154     ret
    155 
    156 ALIGN JUMP_ALIGN
    157 Memory_CopyDSSItoESDI:
    158     push    ds
    159     pop     es
    160     mov     di, si
    161     ret
    162 
    163 ALIGN JUMP_ALIGN
    164 Memory_CopyESDItoDSSI:
    165     push    es
    166     pop     ds
    167     mov     si, di
    168     ret
    169 
    170 
    171 ;--------------------------------------------------------------------
    172 ; Memory_SetZFifNullPointerInDSSI
    173 ;   Parameters
    174 ;       DS:SI:  Far pointer
    175 ;   Returns:
    176 ;       ZF:     Set if NULL pointer in DS:SI
    177 ;   Corrupts registers:
    178 ;       Nothing
    179 ;--------------------------------------------------------------------
    180 ALIGN JUMP_ALIGN
    181 Memory_SetZFifNullPointerInDSSI:
    182     push    ax
    183     mov     ax, ds
    184     or      ax, si
    185     pop     ax
    186     ret
    187 
    188 
    189 ;--------------------------------------------------------------------
    190112; Memory_ReserveCXbytesFromStackToDSSI
    191113;   Parameters
  • trunk/Assembly_Library/Src/Util/Sort.asm

    r46 r54  
    22; Project name  :   Assembly Library
    33; Created date  :   28.9.2010
    4 ; Last update   :   1.10.2010
     4; Last update   :   24.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Sorting algorithms
     
    230230
    231231    ; Item DX to Item AX
    232     call    Memory_ExchangeDSSIwithESDI
     232    call    Registers_ExchangeDSSIwithESDI
    233233    call    GetItemPointerToDSSIfromIndexInDX
    234234    call    CopyItemFromDSSItoESDI
     
    236236    ; Stack to Item DX
    237237    call    GetPointerToTemporaryItemToESDI
    238     call    Memory_ExchangeDSSIwithESDI
     238    call    Registers_ExchangeDSSIwithESDI
    239239    call    CopyItemFromDSSItoESDI
    240240
Note: See TracChangeset for help on using the changeset viewer.