Changeset 54 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- Oct 24, 2010, 11:01:17 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/Dialog.inc
r45 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.9.2010 4 ; Last update : 2 8.9.20104 ; Last update : 22.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for Menu library dialogs. … … 59 59 endstruc 60 60 61 struc DRIVE_DIALOG_IO 62 .dialogInput resb DIALOG_INPUT_size 63 .bUserCancellation resb 1 64 resb 1 65 .cReturnDriveLetter resb 1 66 .bReturnDriveNumber resb 1 67 endstruc 68 61 69 struc FILE_DIALOG_IO 62 70 ; DIALOG_INPUT adjusted for File Dialog -
trunk/Assembly_Library/Inc/Menu.inc
r52 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.7.2010 4 ; Last update : 12.10.20104 ; Last update : 23.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for Menu library. … … 87 87 .GetStringWithIoInDSSI resb 2 88 88 .GetFileNameWithIoInDSSI resb 2 89 .GetDriveWithIoInDSSI resb 2 89 90 %endif 90 91 endstruc -
trunk/Assembly_Library/Src/AssemblyLibrary.asm
r52 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.9.2010 4 ; Last update : 12.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Assembly Library main file. This is the only file that … … 48 48 %ifdef INCLUDE_MENU_DIALOGS 49 49 %include "Dialog.asm" 50 %include "DialogDrive.asm" 50 51 %include "DialogFile.asm" 51 52 %include "DialogMessage.asm" … … 73 74 %include "Bit.asm" 74 75 %include "Memory.asm" 76 %include "Registers.asm" 75 77 %include "Size.asm" 76 78 %include "Sort.asm" -
trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
r52 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 5.7.2010 4 ; Last update : 12.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for managing keyboard. … … 34 34 35 35 call Char_GetFilterFunctionToDXforNumericBaseInBX 36 call Memory_ExchangeDSSIwithESDI36 call Registers_ExchangeDSSIwithESDI 37 37 call Keyboard_ReadUserInputtedStringToESDIWhilePrinting 38 call Memory_ExchangeDSSIwithESDI ; Does not modify FLAGS38 call Registers_ExchangeDSSIwithESDI ; Does not modify FLAGS 39 39 jz SHORT .CancelledByUser 40 40 … … 42 42 .CancelledByUser: 43 43 add sp, BYTE BUFFER_SIZE_FOR_WORD_INPUT 44 test cx, cx ; Set ZF if string length is zero44 test cx, cx ; Set ZF if string length is zero 45 45 pop cx 46 46 pop si -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r53 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 13.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 49 49 .ItemSelectedFromCX: 50 50 call LoadItemStringBufferToESDI 51 call Memory_CopyESDItoDSSI51 call Registers_CopyESDItoDSSI 52 52 call ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX 53 53 jmp ParseSelectionFromItemLineInDSSI … … 113 113 114 114 ;-------------------------------------------------------------------- 115 ; ReInitializeMenuinitFromSSBP 115 116 ; InitializeMenuinitFromSSBP 116 117 ; Parameters: 117 ; DS:SI: Ptr to MENUINIT to initialize (also points to DIALOG)118 118 ; SS:BP: Ptr to DIALOG 119 119 ; Returns: … … 123 123 ;-------------------------------------------------------------------- 124 124 ALIGN JUMP_ALIGN 125 ReInitializeMenuinitFromSSBP: 126 call DisplayLoadingMessageInInformationArea 125 127 InitializeMenuinitFromSSBP: 126 128 call LoadItemStringBufferToESDI … … 129 131 call SortDirectoryContentsStringFromESDIwithCountInCX 130 132 call RemoveLastLFandTerminateESDIwithNull 131 call Memory_CopySSBPtoDSSI 133 134 call Registers_CopySSBPtoDSSI 132 135 xor ax, ax 133 136 call Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX … … 199 202 ALIGN JUMP_ALIGN 200 203 .ClearDLifInRootDirectory: 201 call Memory_CopyESDItoDSSI204 call Registers_CopyESDItoDSSI 202 205 call Directory_WriteCurrentPathToDSSI 203 206 mov dl, [si] … … 375 378 ALIGN JUMP_ALIGN 376 379 SortDirectoryContentsStringFromESDIwithCountInCX: 377 call Memory_CopyESDItoDSSI380 call Registers_CopyESDItoDSSI 378 381 call .AddDirectoryContentsStringLengthToDI 379 382 mov bx, .FileStringComparator … … 431 434 cmp bh, bl 432 435 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 ;-------------------------------------------------------------------- 447 ALIGN JUMP_ALIGN 448 RemoveLastLFandTerminateESDIwithNull: 449 dec di 450 xor ax, ax 451 stosb 452 ret 433 453 434 454 … … 547 567 ALIGN JUMP_ALIGN 548 568 RefreshFilesToDisplay: 549 call InitializeMenuinitFromSSBP569 call ReInitializeMenuinitFromSSBP 550 570 jmp MenuInit_RefreshMenuWindow 551 571 … … 661 681 jz SHORT ReturnWithoutHandlingKeystroke 662 682 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 ;-------------------------------------------------------------------- 701 ALIGN 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 ;-------------------------------------------------------------------- 718 ALIGN 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] 665 724 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 ;-------------------------------------------------------------------- 739 ALIGN JUMP_ALIGN 740 DisplayLoadingMessageInInformationArea: 741 call MenuText_ClearInformationArea 742 call MenuText_PrepareToDrawInformationArea 743 mov si, g_szLoadingPleaseWait 744 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI 776 745 ret 777 746 -
trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm
r46 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.9.2010 4 ; Last update : 1.10.20104 ; Last update : 23.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Strings used by dialogs. … … 11 11 g_szTimeFormat: db " %2-u min %2-u sec",LF,CR,NULL 12 12 13 ; Strings for Drive Dialog 14 g_szDriveFormat: db "%c:",NULL 15 13 16 ; Strings for File Dialog 14 17 g_szChangeDrive: db "F2 Change Drive",LF,CR,NULL … … 18 21 g_szSelectNewDrive: 19 22 db "Select new drive.",NULL 23 g_szLoadingPleaseWait: 24 db "Loading. Please wait...",NULL 20 25 21 26 g_szEnterNewFileOrDirectory: -
trunk/Assembly_Library/Src/Menu/Menu.asm
r48 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 3.8.2010 4 ; Last update : 7.10.20104 ; Last update : 23.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Menu Library functions for CALL_MENU_LIBRARY macro … … 69 69 at MENU_LIB.GetStringWithIoInDSSI, dw DialogString_GetStringWithIoInDSSI 70 70 at MENU_LIB.GetFileNameWithIoInDSSI, dw DialogFile_GetFileNameWithIoInDSSI 71 at MENU_LIB.GetDriveWithIoInDSSI, dw DialogDrive_GetDriveWithIoInDSSI 71 72 %endif 72 73 iend -
trunk/Assembly_Library/Src/Menu/MenuText.asm
r52 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 21.7.2010 4 ; Last update : 12.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing menu texts by the user. … … 27 27 ALIGN JUMP_ALIGN 28 28 MenuText_ClearInformationArea: 29 call PrepareToDrawInformationArea29 call MenuText_PrepareToDrawInformationArea 30 30 mov cl, [bp+MENUINIT.bInfoLines] 31 31 ClearCLlinesOfText: 32 32 mov al, [bp+MENUINIT.bWidth] 33 sub al, MENU_HORIZONTAL_BORDER_LINES+ MENU_TEXT_COLUMN_OFFSET33 sub al, MENU_HORIZONTAL_BORDER_LINES+(MENU_TEXT_COLUMN_OFFSET/2) 34 34 mul cl 35 35 xchg cx, ax … … 60 60 cmp BYTE [bp+MENUINIT.bInfoLines], 0 61 61 jz SHORT NothingToRefresh 62 call PrepareToDrawInformationArea62 call MenuText_PrepareToDrawInformationArea 63 63 jmp MenuEvent_RefreshInformation 64 64 … … 80 80 81 81 ALIGN JUMP_ALIGN 82 PrepareToDrawInformationArea:82 MenuText_PrepareToDrawInformationArea: 83 83 mov si, ATTRIBUTE_CHARS.cInformation 84 84 call MenuLocation_GetInformationTextTopLeftCoordinatesToAX -
trunk/Assembly_Library/Src/String/String.asm
r53 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 12.7.2010 4 ; Last update : 13.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for handling characters. … … 106 106 push si 107 107 108 call Memory_ExchangeDSSIwithESDI108 call Registers_ExchangeDSSIwithESDI 109 109 xor ax, ax ; Find NULL 110 110 mov cx, -1 ; Full segment if necessary 111 111 repne scasb 112 112 mov cx, di 113 call Memory_ExchangeDSSIwithESDI113 call Registers_ExchangeDSSIwithESDI 114 114 115 115 pop si -
trunk/Assembly_Library/Src/Util/Memory.asm
r52 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.7.2010 4 ; Last update : 11.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for memory access. … … 70 70 push di 71 71 push ax 72 call Memory_CopySSBPtoESDI72 call Registers_CopySSBPtoESDI 73 73 call Memory_ZeroESDIwithSizeInCX 74 74 pop ax … … 110 110 111 111 ;-------------------------------------------------------------------- 112 ; Memory_ExchangeDSSIwithESDI113 ; Parameters114 ; Nothing115 ; Returns:116 ; DS:SI and ES:DI are exchanged.117 ; Corrupts registers:118 ; Nothing119 ;--------------------------------------------------------------------120 ALIGN JUMP_ALIGN121 Memory_ExchangeDSSIwithESDI:122 push ds123 push es124 pop ds125 pop es126 xchg si, di127 ret128 129 130 ;--------------------------------------------------------------------131 ; Memory_CopySSBPtoESDI132 ; Memory_CopySSBPtoDSSI133 ; Memory_CopyDSSItoESDI134 ; Memory_CopyESDItoDSSI135 ; Parameters136 ; Nothing137 ; Returns:138 ; Copies farm pointer to different segment/pointer register pair139 ; Corrupts registers:140 ; Nothing141 ;--------------------------------------------------------------------142 ALIGN JUMP_ALIGN143 Memory_CopySSBPtoESDI:144 push ss145 pop es146 mov di, bp147 ret148 149 ALIGN JUMP_ALIGN150 Memory_CopySSBPtoDSSI:151 push ss152 pop ds153 mov si, bp154 ret155 156 ALIGN JUMP_ALIGN157 Memory_CopyDSSItoESDI:158 push ds159 pop es160 mov di, si161 ret162 163 ALIGN JUMP_ALIGN164 Memory_CopyESDItoDSSI:165 push es166 pop ds167 mov si, di168 ret169 170 171 ;--------------------------------------------------------------------172 ; Memory_SetZFifNullPointerInDSSI173 ; Parameters174 ; DS:SI: Far pointer175 ; Returns:176 ; ZF: Set if NULL pointer in DS:SI177 ; Corrupts registers:178 ; Nothing179 ;--------------------------------------------------------------------180 ALIGN JUMP_ALIGN181 Memory_SetZFifNullPointerInDSSI:182 push ax183 mov ax, ds184 or ax, si185 pop ax186 ret187 188 189 ;--------------------------------------------------------------------190 112 ; Memory_ReserveCXbytesFromStackToDSSI 191 113 ; Parameters -
trunk/Assembly_Library/Src/Util/Sort.asm
r46 r54 2 2 ; Project name : Assembly Library 3 3 ; Created date : 28.9.2010 4 ; Last update : 1.10.20104 ; Last update : 24.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Sorting algorithms … … 230 230 231 231 ; Item DX to Item AX 232 call Memory_ExchangeDSSIwithESDI232 call Registers_ExchangeDSSIwithESDI 233 233 call GetItemPointerToDSSIfromIndexInDX 234 234 call CopyItemFromDSSItoESDI … … 236 236 ; Stack to Item DX 237 237 call GetPointerToTemporaryItemToESDI 238 call Memory_ExchangeDSSIwithESDI238 call Registers_ExchangeDSSIwithESDI 239 239 call CopyItemFromDSSItoESDI 240 240
Note:
See TracChangeset
for help on using the changeset viewer.