Changeset 46 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu
- Timestamp:
- Oct 4, 2010, 7:38:36 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library/Src/Menu
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm
r44 r46 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.8.2010 4 ; Last update : 27.9.20104 ; Last update : 1.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Common functions for many dialogs. … … 28 28 eENTER_STRUCT DIALOG_size 29 29 30 mov cx, DIALOG_size / 231 call Memory_ZeroSSBP byWordsInCX30 mov cx, DIALOG_size 31 call Memory_ZeroSSBPwithSizeInCX 32 32 mov [bp+DIALOG.fpDialogIO], si 33 33 mov [bp+DIALOG.fpDialogIO+2], ds -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r45 r46 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 28.9.20104 ; Last update : 4.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 112 112 call LoadItemStringBufferToESDI 113 113 call CreateStringFromCurrentDirectoryContentsToESDI 114 call LoadItemStringBufferToESDI 115 call SortDirectoryContentsStringFromESDIwithCountInCX 114 116 push ss 115 117 pop ds … … 120 122 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 121 123 mov [bp+MENUINIT.bHeight], ah ; Always max height 122 mov WORD [bp+MENU.wHighlightedItem], 0 124 xor ax, ax 125 mov [bp+MENU.wHighlightedItem], ax 126 mov [bp+MENU.wFirstVisibleItem], ax 123 127 ret 124 128 … … 146 150 ; SS:BP: Ptr to DIALOG 147 151 ; Returns: 148 ; Nothing149 ; Corrupts registers: 150 ; AX, CX,DX, SI, DI, DS, ES152 ; CX: Number of files or directories found 153 ; Corrupts registers: 154 ; AX, DX, SI, DI, DS, ES 151 155 ;-------------------------------------------------------------------- 152 156 ALIGN JUMP_ALIGN … … 160 164 call Directory_GetDiskTransferAreaAddressToDSSI 161 165 rcl cx, 1 ; Restore CF 166 xor cx, cx ; Clear file/directory count 162 167 ; Fall to .FindMatchingFilesAndWriteThemToESDI 163 168 … … 165 170 ; .FindMatchingFilesAndWriteThemToESDI 166 171 ; Parameters: 172 ; CX: Initial directory count 167 173 ; DL: Zero if root directory selected 168 174 ; DS:SI: Ptr to DTA with first matching file 169 175 ; ES:DI: Ptr to destination string buffer 170 176 ; Returns: 171 ; Nothing172 ; Corrupts registers: 173 ; AX, CX,DX, DI177 ; CX: Incremented by number of files/directories found 178 ; Corrupts registers: 179 ; AX, DX, DI 174 180 ;-------------------------------------------------------------------- 175 181 ;ALIGN JUMP_ALIGN 176 182 .FindMatchingFilesAndWriteThemToESDI: 177 jc SHORT RemoveLastLFandTerminateESDIwithNull183 jc SHORT TerminateESDIwithNull 178 184 call AppendFileToBufferInESDIfromDtaInDSSI 179 185 call Directory_UpdateDTAForNextMatchUsingPreviousParameters … … 200 206 ret 201 207 202 ;-------------------------------------------------------------------- 203 ; RemoveLastLFandTerminateESDIwithNull 208 209 ;-------------------------------------------------------------------- 210 ; TerminateESDIwithNull 204 211 ; Parameters: 205 212 ; ES:DI: Ptr to destination string buffer … … 210 217 ;-------------------------------------------------------------------- 211 218 ALIGN JUMP_ALIGN 212 RemoveLastLFandTerminateESDIwithNull:219 TerminateESDIwithNull: 213 220 xor ax, ax 214 dec di ; Remove last LF215 221 stosb 216 222 ret 217 223 224 218 225 ;-------------------------------------------------------------------- 219 226 ; AppendFileToBufferInESDIfromDtaInDSSI 220 227 ; Parameters: 228 ; CX: Files/directores found 221 229 ; DL: Zero if root directory selected 222 230 ; DS:SI: Ptr to DTA containing file information 223 231 ; ES:DI: Ptr to destination string buffer 224 232 ; Returns: 233 ; CX: Incremented by number of files/directories found 225 234 ; DI: Updated for next file 226 235 ; Corrupts registers: 227 ; AX, BX, CX,DX236 ; AX, BX, DX 228 237 ;-------------------------------------------------------------------- 229 238 ALIGN JUMP_ALIGN … … 231 240 call .FilterCurrentDirectory ; We never want "." 232 241 call .FilterUpDirectoryWhenInRoot ; No ".." when in root directory 242 inc cx ; Nothing filtered so increment files/directories 233 243 ; Fall to .PrepareBufferFormattingAndFormatFromDTAinDSSI 234 244 … … 241 251 ; DI: Updated for next file 242 252 ; Corrupts registers: 243 ; AX, BX, CX,DX253 ; AX, BX, DX 244 254 ;-------------------------------------------------------------------- 245 255 ;ALIGN JUMP_ALIGN … … 247 257 push bp 248 258 push si 249 mov cx, di 259 push cx 260 mov bx, di 250 261 CALL_DISPLAY_LIBRARY PushDisplayContext 251 262 263 xchg ax, bx 252 264 mov bx, es 253 xchg ax, cx254 265 CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX 255 266 mov bl, ATTRIBUTES_NOT_USED … … 261 272 CALL_DISPLAY_LIBRARY GetCharacterPointerToBXAX 262 273 mov es, bx 263 xchg cx, ax274 xchg bx, ax 264 275 CALL_DISPLAY_LIBRARY PopDisplayContext 265 mov di, cx 276 mov di, bx 277 pop cx 266 278 pop si 267 279 pop bp … … 281 293 mov bp, sp 282 294 lea ax, [si+DTA.szFile] 283 push ax284 push ds285 295 286 296 test BYTE [si+DTA.bFileAttributes], FLG_FILEATTR_DIRECTORY 287 297 jnz SHORT .FormatDirectory 288 298 ; Fall to .FormatFile 299 300 ;-------------------------------------------------------------------- 301 ; .FormatFile 302 ; Parameters: 303 ; BP: SP before pushing formatting parameters 304 ; DS:AX: Far pointer to file name 305 ; DS:SI: Ptr to DTA containing file information 306 ; Returns: 307 ; Nothing 308 ; Corrupts registers: 309 ; AX, BX, CX, DX, SI, DI, BP 310 ;-------------------------------------------------------------------- 311 .FormatFile: 312 ; Push parameters for file name 313 xchg si, ax 314 call String_ConvertDSSItoLowerCase 315 xchg ax, si 316 push ax ; Push directory name offset 317 push ds ; Push directory name segment 318 319 ; Push parameters for file size 289 320 mov ax, [si+DTA.dwFileSize] 290 321 mov dx, [si+DTA.dwFileSize+2] … … 298 329 push dx 299 330 push cx 331 332 ; Format to buffer 300 333 mov si, g_szFileFormat 301 334 jmp SHORT .FormatStringInCSSIandReturn 302 335 336 ;-------------------------------------------------------------------- 337 ; .FormatDirectory 338 ; Parameters: 339 ; BP: SP before pushing formatting parameters 340 ; DS:AX: Far pointer to directory name 341 ; DS:SI: Ptr to DTA containing file information 342 ; Returns: 343 ; Nothing 344 ; Corrupts registers: 345 ; AX, BX, CX, DX, SI, DI, BP 346 ;-------------------------------------------------------------------- 303 347 ALIGN JUMP_ALIGN 304 348 .FormatDirectory: 349 push ax ; Push directory name offset 350 push ds ; Push directory name segment 305 351 mov ax, g_szSub 306 352 cmp WORD [si+DTA.szFile], UPDIR_CHARACTERS … … 345 391 346 392 ;-------------------------------------------------------------------- 393 ; SortDirectoryContentsStringFromESDIwithCountInCX 394 ; Parameters: 395 ; CX: Number of files and directories 396 ; ES:DI: Buffer containing directory contents string 397 ; SS:BP: Ptr to DIALOG 398 ; Returns: 399 ; Nothing 400 ; Corrupts registers: 401 ; AX, BX, CX, DX, SI, DI, DS, ES 402 ;-------------------------------------------------------------------- 403 ALIGN JUMP_ALIGN 404 SortDirectoryContentsStringFromESDIwithCountInCX: 405 call Memory_ExchangeDSSIwithESDI 406 mov bx, .FileStringComparator 407 xchg dx, cx 408 mov cx, FILE_STRING_LENGTH 409 jmp Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX 410 411 ;-------------------------------------------------------------------- 412 ; .FileStringComparator 413 ; Parameters: 414 ; CX: Item size in bytes 415 ; DS:SI: Ptr to first item to compare 416 ; ES:DI: Ptr to second item to compare 417 ; Returns: 418 ; FLAGS: Signed comparition between first and second item 419 ; Corrupts registers: 420 ; Nothing 421 ;-------------------------------------------------------------------- 422 ALIGN JUMP_ALIGN 423 .FileStringComparator: 424 push di 425 push si 426 push cx 427 push bx 428 429 mov bx, FILE_STRING_LENGTH-2 ; Zero BH 430 cmp WORD [si], UPDIR_CHARACTERS 431 je SHORT .ForceValueFromDSSItoBeLess 432 mov bl, [si+bx] 433 cmp bl, [es:di+FILE_STRING_LENGTH-2] ; 'B' for files, 'R' for directories 434 jne SHORT .ForceValueFromDSSItoBeMoreOrLess 435 repe cmpsb ; Two directories or two files 436 437 ALIGN JUMP_ALIGN 438 .ReturnFromComparison: 439 pop bx 440 pop cx 441 pop si 442 pop di 443 ret 444 ALIGN JUMP_ALIGN 445 .ForceValueFromDSSItoBeMoreOrLess: 446 ja SHORT .ForceValueFromDSSItoBeLess ; Directory in SI, file in DI 447 xchg bl, bh 448 ; Fall to ForceValueFromDSSItoBeLess 449 ALIGN JUMP_ALIGN 450 .ForceValueFromDSSItoBeLess: 451 cmp bh, bl 452 jmp SHORT .ReturnFromComparison 453 454 455 ;-------------------------------------------------------------------- 347 456 ; GetInfoLinesToCXandDialogFlagsToAX 348 457 ; Parameters: … … 388 497 ALIGN JUMP_ALIGN 389 498 ParseSelectionFromItemLineInDSSI: 390 cmp BYTE [si], '[' 391 je SHORT .ChangeToSubdirInDSSI 392 ; Fall to .SelectFileFromDSSI 393 394 ;-------------------------------------------------------------------- 395 ; .SelectFileFromDSSI 396 ; Parameters: 397 ; DS:SI: Ptr to char buffer containing file name to be selected 499 mov ax, [si] 500 cmp ax, UPDIR_CHARACTERS 501 je SHORT .ChangeToUpdir 502 call Char_IsUpperCaseLetterInAL 503 jc SHORT .ParseAndChangeToSubdirInDSSI 504 ; Fall to .ParseAndSelectFileFromDSSI 505 506 ;-------------------------------------------------------------------- 507 ; .ParseAndSelectFileFromDSSI 508 ; Parameters: 509 ; DS:SI: NULL terminated string selected from dialog 398 510 ; SS:BP: Ptr to DIALOG 399 511 ; Returns: … … 402 514 ; All, except BP 403 515 ;-------------------------------------------------------------------- 404 ;ALIGN JUMP_ALIGN 405 .SelectFileFromDSSI: 516 .ParseAndSelectFileFromDSSI: 406 517 les di, [bp+DIALOG.fpDialogIO] 407 518 add di, BYTE FILE_DIALOG_IO.szFile … … 414 525 415 526 ;-------------------------------------------------------------------- 416 ; ChangeToSubdirInDSSI 417 ; Parameters: 418 ; DS:SI: NULL terminated string containing new subdir in [] 419 ; SS:BP: Ptr to DIALOG 420 ; Returns: 421 ; Nothing 422 ; Corrupts registers: 423 ; All, except BP 424 ;-------------------------------------------------------------------- 425 ALIGN JUMP_ALIGN 426 .ChangeToSubdirInDSSI: 427 inc si ; Skip '[' 428 mov BYTE [si+12], NULL ; Replace ']' with NULL 429 cmp WORD [si], UPDIR_CHARACTERS 430 eCMOVE si, g_szUpdir ; Real DOS do not accept spaces after ".." 527 ; .ChangeToUpdir 528 ; Parameters: 529 ; SS:BP: Ptr to DIALOG 530 ; Returns: 531 ; Nothing 532 ; Corrupts registers: 533 ; All, except BP 534 ;-------------------------------------------------------------------- 535 ALIGN JUMP_ALIGN 536 .ChangeToUpdir: 537 mov si, g_szUpdir 538 jmp SHORT .ChangeDirectoryToDSSI 539 540 ;-------------------------------------------------------------------- 541 ; .ParseAndChangeToSubdirInDSSI 542 ; Parameters: 543 ; DS:SI: NULL terminated string selected from dialog 544 ; SS:BP: Ptr to DIALOG 545 ; Returns: 546 ; Nothing 547 ; Corrupts registers: 548 ; All, except BP 549 ;-------------------------------------------------------------------- 550 ALIGN JUMP_ALIGN 551 .ParseAndChangeToSubdirInDSSI: 552 mov BYTE [si+12], NULL ; Terminate with NULL (unnecessary spaces do not matter) 553 .ChangeDirectoryToDSSI: 431 554 call Directory_ChangeToPathFromDSSI 432 555 ; Fall to RefreshFilesToDisplay … … 624 747 or bx, cx 625 748 jnz SHORT .BitShiftLoop 626 jmp RemoveLastLFandTerminateESDIwithNull749 jmp TerminateESDIwithNull 627 750 628 751 ;-------------------------------------------------------------------- -
trunk/Assembly_Library/Src/Menu/Dialog/LineSplitter.asm
r41 r46 2 2 ; Project name : Assembly Library 3 3 ; Created date : 8.8.2010 4 ; Last update : 1 5.9.20104 ; Last update : 1.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Splits long strings to multiple lines. … … 131 131 .ProcessControlCharacter: 132 132 cmp al, NULL ; End of string? 133 je SHORT . EndOfString133 je SHORT .RemoveEmptyLinesAtTheEndIfAnyExists 134 134 cmp al, LF ; Line feed? 135 135 je SHORT .NewlineCharacter … … 142 142 ALIGN JUMP_ALIGN 143 143 .NewlineCharacter: 144 mov BYTE [si-1], SOH 144 mov BYTE [si-1], SOH ; SOH marks previous newline character 145 145 mov [bp+LINE_SPLITTER.pLastWord], si 146 146 jmp SHORT .StartNewLine 147 147 148 148 ALIGN JUMP_ALIGN 149 .EndOfString: 150 ret 149 .RemoveEmptyLinesAtTheEndIfAnyExists: 150 mov al, [si-2] ; Load character before NULL 151 cmp al, SOH 152 je SHORT .RemoveEmptyLineAtTheEndOfString 153 cmp al, LF 154 je SHORT .RemoveEmptyLineAtTheEndOfString 155 ret 156 ALIGN JUMP_ALIGN 157 .RemoveEmptyLineAtTheEndOfString: 158 dec si 159 dec WORD [bp+LINE_SPLITTER.wLines] 160 mov BYTE [si-1], NULL 161 jmp SHORT .RemoveEmptyLinesAtTheEndIfAnyExists 151 162 152 163 -
trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm
r44 r46 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.9.2010 4 ; Last update : 27.9.20104 ; Last update : 1.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Strings used by dialogs. … … 22 22 db "Enter name for new file or directory.",NULL 23 23 24 FILE_STRING_LENGTH EQU (24+1) ; +1 = LF in directory contents string 24 25 g_szFileFormat: 25 db "%1 4S%4-u %c%cB",LF,NULL26 db "%16S%4-u %c%cB",LF,NULL 26 27 g_szDirectoryFormat: 27 db " [%12S]%s-DIR",LF,NULL28 db "%16S%s-DIR",LF,NULL 28 29 g_szSub: 29 30 db ANGLE_QUOTE_RIGHT,"SUB",NULL 30 31 g_szUp: 31 db ANGLE_QUOTE_LEFT," UP",NULL32 db ANGLE_QUOTE_LEFT," UP",NULL 32 33 33 34 g_szSingleItem: ; Used by Dialog.asm for single item line -
trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
r41 r46 94 94 istruc ATTRIBUTE_CHARS 95 95 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) 96 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_ WHITE)96 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) 97 97 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) 98 98 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) -
trunk/Assembly_Library/Src/Menu/MenuInit.asm
r41 r46 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.7.2010 4 ; Last update : 1 6.9.20104 ; Last update : 1.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for initializing menu system. … … 27 27 eENTER_STRUCT MENU_size 28 28 29 mov cx, MENU_size / 230 call Memory_ZeroSSBP byWordsInCX29 mov cx, MENU_size 30 call Memory_ZeroSSBPwithSizeInCX 31 31 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX 32 32 mov ax, [bp+MENU.wHighlightedItem]
Note:
See TracChangeset
for help on using the changeset viewer.