Changeset 53 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- Oct 13, 2010, 6:34:39 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library/Src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r52 r53 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 1 2.10.20104 ; Last update : 13.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 74 74 loop .InfoLineLoop 75 75 stc ; Event processed 76 ret 77 78 79 ALIGN 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 76 91 ret 77 92 … … 93 108 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle 94 109 at MENUEVENT.RefreshInformation, dw .RefreshInformation 95 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventRefreshItemFromCX110 at MENUEVENT.RefreshItemFromCX, dw .RefreshItemFromCX 96 111 iend 97 112 … … 113 128 call LoadItemStringBufferToESDI 114 129 call SortDirectoryContentsStringFromESDIwithCountInCX 130 call RemoveLastLFandTerminateESDIwithNull 115 131 call Memory_CopySSBPtoDSSI 116 132 xor ax, ax … … 148 164 ; CX: Number of files or directories found 149 165 ; Corrupts registers: 150 ; AX, DX, SI, DI, DS, ES166 ; AX, BX, DX, SI, DI, DS 151 167 ;-------------------------------------------------------------------- 152 168 ALIGN JUMP_ALIGN 153 169 CreateStringFromCurrentDirectoryContentsToESDI: 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 154 175 lds si, [bp+DIALOG.fpDialogIO] 155 176 eMOVZX cx, BYTE [si+FILE_DIALOG_IO.bFileAttributes] 156 177 lds si, [si+FILE_DIALOG_IO.fpFileFilterString] 157 178 call Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX 158 rcr cx, 1 ; Store CF 179 159 180 call .ClearDLifInRootDirectory 160 181 call Directory_GetDiskTransferAreaAddressToDSSI 161 rcl cx, 1 ; Restore CF162 182 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 183 187 184 188 ;-------------------------------------------------------------------- … … 200 204 ret 201 205 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 ;-------------------------------------------------------------------- 217 ALIGN JUMP_ALIGN 218 .FindMatchingFilesAndPrintThemToOffScreenBuffer: 219 call AppendFileFromDTAinDSSItoOffScreenBuffer 220 call Directory_UpdateDTAForNextMatchUsingPreviousParameters 221 jnc SHORT .FindMatchingFilesAndPrintThemToOffScreenBuffer 222 ret 223 224 225 ;-------------------------------------------------------------------- 226 ; AppendFileFromDTAinDSSItoOffScreenBuffer 221 227 ; Parameters: 222 228 ; CX: Files/directores found 223 229 ; DL: Zero if root directory selected 224 230 ; DS:SI: Ptr to DTA containing file information 225 ; ES:DI: Ptr to destination string buffer226 231 ; Returns: 227 232 ; 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 ;-------------------------------------------------------------------- 236 ALIGN JUMP_ALIGN 237 AppendFileFromDTAinDSSItoOffScreenBuffer: 234 238 call .FilterCurrentDirectory ; We never want "." 235 239 call .FilterUpDirectoryWhenInRoot ; No ".." when in root directory 236 240 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 251 242 push bp 252 243 push si 244 push dx 253 245 push cx 254 mov bx, di255 CALL_DISPLAY_LIBRARY PushDisplayContext256 mov cx, -1257 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX258 259 246 call .FormatFileOrDirectoryToBufferFromDTAinDSSI 260 261 CALL_DISPLAY_LIBRARY GetCharacterPointerToBXAX262 xchg bx, ax263 CALL_DISPLAY_LIBRARY PopDisplayContext264 mov di, bx265 247 pop cx 248 pop dx 266 249 pop si 267 250 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 ;-------------------------------------------------------------------- 265 ALIGN 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 272 ALIGN 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 279 ALIGN JUMP_ALIGN, ret 280 .ReturnWithoutFiltering: 268 281 ret 269 282 … … 295 308 ; Nothing 296 309 ; Corrupts registers: 297 ; AX, BX, CX, DX, SI, DI , BP310 ; AX, BX, CX, DX, SI, DI 298 311 ;-------------------------------------------------------------------- 299 312 .FormatFile: 300 ; Convert file name to lower case301 313 xchg si, ax 302 mov dx, StringProcess_ConvertToLowerCase 303 call StringProcess_DSSIwithFunctionInDX 314 call String_ConvertDSSItoLowerCase 304 315 xchg ax, si 305 316 306 317 ; Push parameters for file name 307 push ax ; Push directoryname offset308 push ds ; Push directoryname segment318 push ax ; Push file name offset 319 push ds ; Push file name segment 309 320 310 321 ; Push parameters for file size … … 334 345 ; Nothing 335 346 ; Corrupts registers: 336 ; AX, BX, CX, DX, SI, DI, BP347 ; AX, SI, DI 337 348 ;-------------------------------------------------------------------- 338 349 ALIGN JUMP_ALIGN … … 350 361 ret 351 362 352 ;--------------------------------------------------------------------353 ; .FilterCurrentDirectory354 ; .FilterUpDirectoryWhenInRoot355 ; Parameters:356 ; DL: Zero if root directory selected357 ; DS:SI: Ptr to DTA containing file information358 ; Returns:359 ; Nothing360 ; Returns from AppendFileToBufferInESDIfromDtaInDSSI when filtering361 ; Corrupts registers:362 ; AX363 ;--------------------------------------------------------------------364 ALIGN JUMP_ALIGN365 .FilterCurrentDirectory:366 cmp WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS367 jne SHORT .ReturnWithoutFiltering368 add sp, BYTE 2 ; Remove return address from stack369 ret370 371 ALIGN JUMP_ALIGN372 .FilterUpDirectoryWhenInRoot:373 test dl, dl ; Set ZF if root directory selected374 jnz SHORT .ReturnWithoutFiltering375 cmp WORD [si+DTA.szFile], UPDIR_CHARACTERS376 jne SHORT .ReturnWithoutFiltering377 add sp, BYTE 2 ; Remove return address from stack378 ALIGN JUMP_ALIGN, ret379 .ReturnWithoutFiltering:380 ret381 382 363 383 364 ;-------------------------------------------------------------------- … … 388 369 ; SS:BP: Ptr to DIALOG 389 370 ; Returns: 390 ; Nothing391 ; Corrupts registers: 392 ; AX, BX, CX, DX, SI, D I, DS, ES371 ; ES:DI: Ptr to end of directory contents string 372 ; Corrupts registers: 373 ; AX, BX, CX, DX, SI, DS 393 374 ;-------------------------------------------------------------------- 394 375 ALIGN JUMP_ALIGN 395 376 SortDirectoryContentsStringFromESDIwithCountInCX: 396 call Memory_ExchangeDSSIwithESDI 377 call Memory_CopyESDItoDSSI 378 call .AddDirectoryContentsStringLengthToDI 397 379 mov bx, .FileStringComparator 398 380 xchg dx, cx 399 381 mov cx, FILE_STRING_LENGTH 400 382 jmp Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX 383 384 ALIGN JUMP_ALIGN 385 .AddDirectoryContentsStringLengthToDI: 386 mov ax, FILE_STRING_LENGTH 387 mul cx 388 add di, ax 389 ret 401 390 402 391 ;-------------------------------------------------------------------- … … 739 728 or bx, cx 740 729 jnz SHORT .BitShiftLoop 741 jmp TerminateESDIwithNull730 jmp SHORT TerminateESDIwithNull 742 731 743 732 ;-------------------------------------------------------------------- … … 769 758 770 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 776 ret 777 778 779 ;-------------------------------------------------------------------- 771 780 ; InitializeNullStringsToDialogInputInDSSI 772 781 ; Parameters: -
trunk/Assembly_Library/Src/String/String.asm
r52 r53 2 2 ; Project name : Assembly Library 3 3 ; Created date : 12.7.2010 4 ; Last update : 1 2.10.20104 ; Last update : 13.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for handling characters. … … 8 8 ; Section containing code 9 9 SECTION .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 ;-------------------------------------------------------------------- 21 ALIGN JUMP_ALIGN 22 String_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 10 33 11 34 ;-------------------------------------------------------------------- … … 16 39 ; Returns: 17 40 ; AX: Word converted from string 41 ; CX: Number of characters processed 18 42 ; SI: Updated 19 43 ; CF: Cleared if successfull … … 38 62 39 63 ;-------------------------------------------------------------------- 40 ; String_CopyDSSItoESDIandGet SizeToCX64 ; String_CopyDSSItoESDIandGetLengthToCX 41 65 ; Parameters: 42 66 ; DS:SI: Ptr to source NULL terminated string … … 49 73 ;-------------------------------------------------------------------- 50 74 ALIGN JUMP_ALIGN 51 String_CopyDSSItoESDIandGet SizeToCX:75 String_CopyDSSItoESDIandGetLengthToCX: 52 76 push ax 53 77
Note:
See TracChangeset
for help on using the changeset viewer.