Changeset 52 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- Oct 12, 2010, 6:51:07 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 3 added
- 1 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/CgaSnow.inc
r49 r52 2 2 ; Project name : AssemblyLibrary 3 3 ; Created date : 8.10.2010 4 ; Last update : 8.10.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Macros for preventing CGA snow. … … 28 28 %elifidn %1, stosw 29 29 call CgaSnow_Stosw 30 %elifidn %1, scasb31 call CgaSnow_Scasb32 30 %elifidn %1, rep movsb 33 31 call CgaSnow_RepMovsb -
trunk/Assembly_Library/Inc/Display.inc
r50 r52 2 2 ; Project name : AssemblyLibrary 3 3 ; Created date : 25.6.2010 4 ; Last update : 9.10.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for display library. … … 26 26 %elifidn %1, PopDisplayContext 27 27 call DisplayContext_Pop 28 %elifidn %1, PrepareOffScreenBufferInESBX toESDI29 call DisplayContext_PrepareOffScreenBufferInESBX toESDI28 %elifidn %1, PrepareOffScreenBufferInESBXwithLengthInCX 29 call DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX 30 30 %else 31 31 mov di, DISPLAY_LIB.%1 … … 39 39 .PushDisplayContext: 40 40 .PopDisplayContext: 41 .PrepareOffScreenBufferInESBXtoESDI:42 41 .InitializeDisplayContext resb 2 43 42 -
trunk/Assembly_Library/Inc/Menu.inc
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.7.2010 4 ; Last update : 5.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for Menu library. … … 95 95 .wTimeoutTicks resb 2 ; Selection timeout in system timer ticks 96 96 .wItems resb 2 ; Number of items in menu 97 .wHighlightedItem resb 2 ; Index for highlighted item 97 98 98 99 .wTitleAndInfoLines: … … 115 116 resb 1 116 117 .wTimeoutCounter resb 2 117 118 .wHighlightedItem resb 2 ; Index for highlighted item119 118 .wFirstVisibleItem resb 2 ; Index for first visible item on the menu 120 119 endstruc -
trunk/Assembly_Library/Src/AssemblyLibrary.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.9.2010 4 ; Last update : 8.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Assembly Library main file. This is the only file that … … 33 33 34 34 %ifdef INCLUDE_MENU_LIBRARY 35 %include "CharOutLineSplitter.asm" 35 36 %include "Menu.asm" 36 37 %include "MenuAttributes.asm" … … 53 54 %include "DialogString.asm" 54 55 %include "DialogWord.asm" 55 %include " LineSplitter.asm"56 %include "ItemLineSplitter.asm" 56 57 %include "StringsForDialogs.asm" 57 58 %endif … … 61 62 %include "Char.asm" 62 63 %include "String.asm" 64 %include "StringProcess.asm" 63 65 %endif 64 66 -
trunk/Assembly_Library/Src/Display/CgaSnow.asm
r50 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 8.10.2010 4 ; Last update : 9.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for preventing CGA snow. … … 23 23 cmp WORD [BDA.wVidPort], CGA_STATUS_REGISTER - OFFSET_TO_CGA_STATUS_REGISTER 24 24 jne SHORT .CgaNotFound 25 call DisplayPage_GetColumnsToALandRowsToAH 26 cmp ah, [BDA.bVidRows] ; Video rows stored only by EGA and later 27 je SHORT .CgaNotFound ; Must be EGA or later 25 26 ; All standard CGA modes use 25 rows but only EGA and later store it to BDA. 27 cmp BYTE [BDA.bVidRows], 25 28 jge SHORT .CgaNotFound 28 29 stc 29 30 ret … … 83 84 84 85 ;-------------------------------------------------------------------- 85 ; CgaSnow_Scasb86 ; Parameters:87 ; AL: Byte for comparison88 ; DS: BDA segment (zero)89 ; ES:DI: Ptr to video memory where to output90 ; Returns:91 ; DI: Incremented for next character92 ; Corrupts registers:93 ; AX, DX94 ;--------------------------------------------------------------------95 ALIGN JUMP_ALIGN96 CgaSnow_Scasb:97 call LoadCgaStatusRegisterAddressToDXifCgaPresent98 jz SHORT .ScasbWithoutWaitSinceUnknownPort99 100 mov ah, al101 cli ; Interrupt request would mess up timing102 WAIT_UNTIL_SAFE_CGA_WRITE103 mov al, ah104 .ScasbWithoutWaitSinceUnknownPort:105 scasb106 sti107 ret108 109 110 ;--------------------------------------------------------------------111 86 ; CgaSnow_RepMovsb 112 87 ; Parameters: -
trunk/Assembly_Library/Src/Display/DisplayContext.asm
r50 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 25.6.2010 4 ; Last update : 9.10.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for managing display context. … … 119 119 120 120 ;-------------------------------------------------------------------- 121 ; DisplayContext_PrepareOffScreenBufferInESBXtoESDI 122 ; Parameters: 123 ; BX:AX: Ptr to off screen buffer 124 ; Returns: 125 ; Nothing 126 ; Corrupts registers: 127 ; AX 128 ;-------------------------------------------------------------------- 129 ALIGN JUMP_ALIGN 130 DisplayContext_PrepareOffScreenBufferInESBXtoESDI: 121 ; DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX 122 ; Parameters: 123 ; CX: Off screen buffer length in characters 124 ; ES:BX: Ptr to off screen buffer 125 ; Returns: 126 ; Nothing 127 ; Corrupts registers: 128 ; AX, DI 129 ;-------------------------------------------------------------------- 130 ALIGN JUMP_ALIGN 131 DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX: 131 132 push ds 132 133 … … 139 140 mov ax, BUFFER_OUTPUT_WITH_CHAR_ONLY 140 141 call DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL 142 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], cx 141 143 142 144 mov bx, di -
trunk/Assembly_Library/Src/Display/DisplayPrint.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 26.6.2010 4 ; Last update : 27.9.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for display output. … … 326 326 ALIGN JUMP_ALIGN 327 327 DisplayPrint_Newline: 328 mov al, LF 329 call DisplayPrint_CharacterFromAL 328 330 mov al, CR 329 call DisplayPrint_CharacterFromAL330 mov al, LF331 331 ; Fall to DisplayPrint_CharacterFromAL 332 333 332 334 333 ;-------------------------------------------------------------------- -
trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 5.7.2010 4 ; Last update : 7.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for managing keyboard. … … 26 26 ALIGN JUMP_ALIGN 27 27 Keyboard_ReadUserInputtedWordWhilePrinting: 28 push es29 push di28 push ds 29 push si 30 30 push cx 31 31 32 eENTER_STRUCT BUFFER_SIZE_FOR_WORD_INPUT33 call Memory_CopySSBPtoESDI34 35 32 mov cx, BUFFER_SIZE_FOR_WORD_INPUT 33 call Memory_ReserveCXbytesFromStackToDSSI 34 36 35 call Char_GetFilterFunctionToDXforNumericBaseInBX 36 call Memory_ExchangeDSSIwithESDI 37 37 call Keyboard_ReadUserInputtedStringToESDIWhilePrinting 38 jz SHORT .Return39 40 call Memory_ExchangeDSSIwithESDI 38 call Memory_ExchangeDSSIwithESDI ; Does not modify FLAGS 39 jz SHORT .CancelledByUser 40 41 41 call String_ConvertWordToAXfromStringInDSSIwithBaseInBX 42 call Memory_ExchangeDSSIwithESDI 43 .Return: 44 eLEAVE_STRUCT BUFFER_SIZE_FOR_WORD_INPUT 42 .CancelledByUser: 43 add sp, BYTE BUFFER_SIZE_FOR_WORD_INPUT 45 44 test cx, cx ; Set ZF if string length is zero 46 45 pop cx 47 pop di48 pop es46 pop si 47 pop ds 49 48 ret 50 49 -
trunk/Assembly_Library/Src/LibraryTests.asm
r50 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 27.6.2010 4 ; Last update : 27.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Tests for Assembly Library. … … 71 71 mov BYTE [si+MENUINIT.bTitleLines], TEST_MENU_TITLE_LINES 72 72 mov BYTE [si+MENUINIT.bInfoLines], TEST_MENU_INFO_LINES 73 mov ax, 1 74 CALL_MENU_LIBRARY HighlightItemFromAX 73 mov WORD [si+MENUINIT.wHighlightedItem], 1 75 74 stc 76 75 ret … … 95 94 ret 96 95 .szInfoTitle: 97 db "Information line 1,", CR,LF,96 db "Information line 1,",LF,CR, 98 97 db "Information line 2. ", 99 98 db "This comes (12) right after Information line 2.",NULL … … 615 614 db "so scroll bars and message dialog can be tested. This string does not use " 616 615 db "formatting so it should be simple to display this correctly. This string " 617 db "does, however, use newline characters. Lets change line right now!", CR,LF,616 db "does, however, use newline characters. Lets change line right now!",LF,CR, 618 617 db "Well did it work? Let's try line feed alone",LF,"Well? " 618 db "Now two LFs:",LF,LF,"What happened? " 619 619 db "We could also see what two spaces does _ _. There was two spaces between " 620 620 db "underscores. Lets try three this time _ _. Well, did they work correctly? " 621 db "What next, I guess that was all, no wait. Let's see what TAB does! Here it " 622 db "goes:",TAB,"Well did it work? Just one more time:",TAB,"Well are we good? " 623 db "No since LF is the only supported control character, unfortunately. " 621 db "Too bad that LF, CR and BS (backspace) are the only supported control " 622 db "characters. Others don't either work or they break line splitting. " 624 623 db "This is the last sentence of this long string!",NULL 625 624 -
trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm
r50 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.8.2010 4 ; Last update : 9.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Common functions for many dialogs. … … 38 38 call Keyboard_RemoveAllKeystrokesFromBuffer 39 39 40 mov ax, [bp+MENU .wHighlightedItem]40 mov ax, [bp+MENUINIT.wHighlightedItem] 41 41 eLEAVE_STRUCT DIALOG_size 42 42 pop ds … … 78 78 79 79 ;-------------------------------------------------------------------- 80 ; Dialog_EventInitializeMenuinitFromDSSIforSingleItem 81 ; Parameters: 80 ; Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX 81 ; Parameters: 82 ; AX: Index of highlighted item 82 83 ; DS:SI: Ptr to MENUINIT struct to initialize 83 84 ; SS:BP: Ptr to DIALOG … … 87 88 ;-------------------------------------------------------------------- 88 89 ALIGN JUMP_ALIGN 89 Dialog_EventInitializeMenuinitFromDSSIforSingleItem :90 Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX: 90 91 les di, [bp+DIALOG.fpDialogIO] 91 92 mov WORD [es:di+DIALOG_INPUT.fszItems], g_szSingleItem 92 93 mov [es:di+DIALOG_INPUT.fszItems+2], cs 93 ; Fall to Dialog_EventInitializeMenuinitFromDSSI 94 95 ;-------------------------------------------------------------------- 96 ; Dialog_EventInitializeMenuinitFromDSSI 97 ; Parameters: 94 ; Fall to Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX 95 96 ;-------------------------------------------------------------------- 97 ; Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX 98 ; Parameters: 99 ; AX: Index of highlighted item 98 100 ; DS:SI: Ptr to MENUINIT struct to initialize 99 101 ; SS:BP: Ptr to DIALOG … … 103 105 ;-------------------------------------------------------------------- 104 106 ALIGN JUMP_ALIGN 105 Dialog_EventInitializeMenuinitFromDSSI: 107 Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX: 108 mov [bp+MENUINIT.wHighlightedItem], ax 106 109 les di, [bp+DIALOG.fpDialogIO] 107 110 call .GetWidthBasedOnParentMenuToAL 108 111 mov [bp+MENUINIT.bWidth], al 109 112 110 call MenuLocation_GetMaxTextLineLengthToAX111 mov bx, ax112 113 lds si, [es:di+DIALOG_INPUT.fszTitle] 113 call LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX114 call ItemLineSplitter_GetLinesToAXforStringInDSSI 114 115 mov [bp+MENUINIT.bTitleLines], al 115 116 116 mov ax, bx117 117 lds si, [es:di+DIALOG_INPUT.fszItems] 118 call LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX118 call ItemLineSplitter_GetLinesToAXforStringInDSSI 119 119 mov [bp+MENUINIT.wItems], ax 120 120 121 xchg ax, bx122 121 lds si, [es:di+DIALOG_INPUT.fszInfo] 123 call LineSplitter_SplitStringFromDSSIwithMaxLineLengthInAXandGetLineCountToAX122 call ItemLineSplitter_GetLinesToAXforStringInDSSI 124 123 mov [bp+MENUINIT.bInfoLines], al 125 124 … … 178 177 ALIGN JUMP_ALIGN 179 178 Dialog_EventRefreshTitle: 180 mov dl, [bp+MENUINIT.bTitleLines]181 179 lds si, [bp+DIALOG.fpDialogIO] 182 l es di, [si+DIALOG_INPUT.fszTitle]183 jmp SHORT Print DLlinesFromESDI180 lds si, [si+DIALOG_INPUT.fszTitle] 181 jmp SHORT PrintTitleOrInfoLine 184 182 185 183 ALIGN JUMP_ALIGN 186 184 Dialog_EventRefreshInformation: 187 mov dl, [bp+MENUINIT.bInfoLines]188 185 lds si, [bp+DIALOG.fpDialogIO] 189 les di, [si+DIALOG_INPUT.fszInfo] 190 ; Fall to PrintDLlinesFromESDI 191 192 ALIGN JUMP_ALIGN 193 PrintDLlinesFromESDI: 194 xor cx, cx ; Start from line zero 195 mov dh, cl ; Line count now in DX 196 ALIGN JUMP_ALIGN 197 .PrintNextLine: 198 call LineSplitter_PrintLineInCXfromStringInESDI 199 push di 200 CALL_DISPLAY_LIBRARY PrintNewlineCharacters 201 pop di 202 inc cx 203 dec dx 204 jnz SHORT .PrintNextLine 186 lds si, [si+DIALOG_INPUT.fszInfo] 187 ; Fall to PrintTitleOrInfoLine 188 189 ALIGN JUMP_ALIGN 190 PrintTitleOrInfoLine: 191 mov bx, ds 192 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI 205 193 stc 206 194 ret … … 218 206 Dialog_EventRefreshItemFromCX: 219 207 lds si, [bp+DIALOG.fpDialogIO] 220 les di, [si+DIALOG_INPUT.fszItems] 221 call LineSplitter_PrintLineInCXfromStringInESDI 208 lds si, [si+DIALOG_INPUT.fszItems] 209 call ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX 210 jnc SHORT .LineNotFound 211 212 mov bx, ds 213 CALL_DISPLAY_LIBRARY PrintCharBufferFromBXSIwithLengthInCX 214 .LineNotFound: 222 215 stc 223 216 ret -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r51 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 1 0.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 49 49 .ItemSelectedFromCX: 50 50 call LoadItemStringBufferToESDI 51 call LineSplitter_GetOffsetToSIforLineCXfromStringInESDI 52 push es 53 pop ds 51 call Memory_CopyESDItoDSSI 52 call ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX 54 53 jmp ParseSelectionFromItemLineInDSSI 55 54 … … 115 114 call SortDirectoryContentsStringFromESDIwithCountInCX 116 115 call Memory_CopySSBPtoDSSI 117 call Dialog_EventInitializeMenuinitFromDSSI 116 xor ax, ax 117 call Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX 118 118 call GetInfoLinesToCXandDialogFlagsToAX 119 119 mov [bp+MENUINIT.bInfoLines], cl 120 120 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 121 121 mov [bp+MENUINIT.bHeight], ah ; Always max height 122 xor ax, ax 123 mov [bp+MENU.wHighlightedItem], ax 124 mov [bp+MENU.wFirstVisibleItem], ax 122 mov WORD [bp+MENU.wFirstVisibleItem], 0 125 123 ret 126 124 … … 256 254 mov bx, di 257 255 CALL_DISPLAY_LIBRARY PushDisplayContext 258 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXtoESDI 256 mov cx, -1 257 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX 259 258 260 259 call .FormatFileOrDirectoryToBufferFromDTAinDSSI … … 299 298 ;-------------------------------------------------------------------- 300 299 .FormatFile: 300 ; Convert file name to lower case 301 xchg si, ax 302 mov dx, StringProcess_ConvertToLowerCase 303 call StringProcess_DSSIwithFunctionInDX 304 xchg ax, si 305 301 306 ; Push parameters for file name 302 xchg si, ax303 call String_ConvertDSSItoLowerCase304 xchg ax, si305 307 push ax ; Push directory name offset 306 308 push ds ; Push directory name segment -
trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.8.2010 4 ; Last update : 6.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays message dialog. … … 44 44 .InitializeMenuinitFromDSSI: 45 45 or BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT 46 mov WORD [bp+MENU.wHighlightedItem], 047 jmp Dialog_EventInitializeMenuinitFromDSSI 46 xor ax, ax ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling 47 jmp Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX 48 48 49 49 … … 91 91 ALIGN JUMP_ALIGN 92 92 .DecrementLines: 93 cmp WORD [bp+MENU .wHighlightedItem], BYTE 093 cmp WORD [bp+MENUINIT.wHighlightedItem], BYTE 0 94 94 je SHORT .AlreadyAtTheTopOrBottom 95 95 96 96 mov ax, [bp+MENU.wFirstVisibleItem] 97 mov [bp+MENU .wHighlightedItem], ax97 mov [bp+MENUINIT.wHighlightedItem], ax 98 98 mov ah, MENU_KEY_UP 99 99 jmp MenuLoop_ProcessScrollingKeysFromAX … … 103 103 mov ax, [bp+MENUINIT.wItems] 104 104 dec ax ; Last possible item to highlight 105 cmp [bp+MENU .wHighlightedItem], ax105 cmp [bp+MENUINIT.wHighlightedItem], ax 106 106 jae SHORT .AlreadyAtTheTopOrBottom 107 107 108 108 call MenuScrollbars_GetLastVisibleItemOnPageToAX 109 mov [bp+MENU .wHighlightedItem], ax109 mov [bp+MENUINIT.wHighlightedItem], ax 110 110 mov ah, MENU_KEY_DOWN 111 111 jmp MenuLoop_ProcessScrollingKeysFromAX -
trunk/Assembly_Library/Src/Menu/Dialog/DialogProgress.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.8.2010 4 ; Last update : 28.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays progress bar dialog and starts progress task. … … 78 78 ALIGN JUMP_ALIGN 79 79 .InitializeMenuinitFromDSSI: 80 call Dialog_EventInitializeMenuinitFromDSSIforSingleItem 80 mov ax, NO_ITEM_HIGHLIGHTED 81 call Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX 81 82 lds si, [bp+DIALOG.fpDialogIO] 82 83 call TimerTicks_ReadFromBdaToAX -
trunk/Assembly_Library/Src/Menu/Dialog/DialogSelection.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.8.2010 4 ; Last update : 1 3.8.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays selection dialog. … … 43 43 ALIGN JUMP_ALIGN 44 44 .InitializeMenuinitFromDSSI: 45 mov WORD [bp+MENU.wHighlightedItem], 046 jmp Dialog_EventInitializeMenuinitFromDSSI 45 xor ax, ax 46 jmp Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX 47 47 48 48 -
trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 12.8.2010 4 ; Last update : 7.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays word input dialog. … … 43 43 44 44 ALIGN JUMP_ALIGN 45 .InitializeMenuinitFromDSSI: 46 xor ax, ax 47 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX 48 49 50 ALIGN JUMP_ALIGN 45 51 .IdleProcessing: 46 xor ax, ax ; Item 0 is used as input line47 call MenuText_AdjustDisplayContextForDrawingItemFrom AX52 xor cx, cx ; Item 0 is used as input line 53 call MenuText_AdjustDisplayContextForDrawingItemFromCX 48 54 call GetStringFromUser 49 55 call MenuInit_CloseMenuWindow … … 55 61 .rgfnEventHandlers: 56 62 istruc MENUEVENT 57 at MENUEVENT.InitializeMenuinitFromDSSI, dw Dialog_EventInitializeMenuinitFromDSSIforSingleItem63 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI 58 64 at MENUEVENT.ExitMenu, dw Dialog_EventNotHandled 59 65 at MENUEVENT.IdleProcessing, dw .IdleProcessing -
trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 10.8.2010 4 ; Last update : 7.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays word input dialog. … … 43 43 44 44 ALIGN JUMP_ALIGN 45 .InitializeMenuinitFromDSSI: 46 xor ax, ax 47 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX 48 49 50 ALIGN JUMP_ALIGN 45 51 .IdleProcessing: 46 xor ax, ax ; Item 0 is used as input line47 call MenuText_AdjustDisplayContextForDrawingItemFrom AX52 xor cx, cx ; Item 0 is used as input line 53 call MenuText_AdjustDisplayContextForDrawingItemFromCX 48 54 call GetWordFromUser 49 55 call MenuInit_CloseMenuWindow … … 55 61 .rgfnEventHandlers: 56 62 istruc MENUEVENT 57 at MENUEVENT.InitializeMenuinitFromDSSI, dw Dialog_EventInitializeMenuinitFromDSSIforSingleItem63 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI 58 64 at MENUEVENT.ExitMenu, dw Dialog_EventNotHandled 59 65 at MENUEVENT.IdleProcessing, dw .IdleProcessing -
trunk/Assembly_Library/Src/Menu/MenuAttributes.asm
r47 r52 24 24 25 25 ;-------------------------------------------------------------------- 26 ; MenuAttribute_ GetToALfromTypeInSI26 ; MenuAttribute_SetToDisplayContextFromTypeInSI 27 27 ; Parameters 28 28 ; SI: Attribute type (from ATTRIBUTE_CHARS) -
trunk/Assembly_Library/Src/Menu/MenuBorders.asm
r45 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.7.2010 4 ; Last update : 28.9.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing menu borders. … … 50 50 MenuBorders_AdjustDisplayContextForDrawingBorders: 51 51 mov bl, ATTRIBUTES_ARE_USED 52 mov ax, MenuCharOut_Menu BorderTeletypeOutputWithAttribute52 mov ax, MenuCharOut_MenuTeletypeOutput 53 53 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL 54 54 55 mov ax, bp55 call CharOutLineSplitter_GetFirstBorderLineColumnOffsetToAX 56 56 CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX 57 57 -
trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
r51 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.7.2010 4 ; Last update : 1 0.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Character out function for printing withing menu window. … … 10 10 11 11 ;-------------------------------------------------------------------- 12 ; MenuCharOut_MenuBorderTeletypeOutputWithAttribute 12 ; MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange 13 ; MenuCharOut_MenuTeletypeOutput 13 14 ; Parameters: 14 15 ; AL: Character to output … … 16 17 ; DS: BDA segment (zero) 17 18 ; ES:DI: Ptr to video memory where to output 19 ; [DISPLAY_CONTEXT.wCharOutParam]: 20 ; Low byte = First column offset (after CR) 21 ; High byte = Last column offset (when using automatic line change) 18 22 ; Returns: 19 23 ; DI: Incremented for next character … … 22 26 ;-------------------------------------------------------------------- 23 27 ALIGN JUMP_ALIGN 24 MenuCharOut_MenuBorderTeletypeOutputWithAttribute: 25 cmp al, CR ; Carriage return? 26 je SHORT .PrintCRandAdjustColumnToMenuBorders 27 jmp DisplayCharOut_TeletypeOutputWithAttribute 28 29 ALIGN JUMP_ALIGN 30 .PrintCRandAdjustColumnToMenuBorders: 31 call DisplayCharOut_BiosTeletypeOutput 32 xor ax, ax ; No offset, cursor to start of border 33 jmp SHORT SetCursorToNextMenuLine 34 35 36 ;-------------------------------------------------------------------- 37 ; MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange 38 ; MenuCharOut_MenuTextTeletypeOutputWithAttribute 39 ; Parameters: 40 ; AL: Character to output 41 ; AH: Attribute to output 42 ; DS: BDA segment (zero) 43 ; ES:DI: Ptr to video memory where to output 44 ; Returns: 45 ; DI: Incremented for next character 46 ; Corrupts registers: 47 ; AX, DX 48 ;-------------------------------------------------------------------- 49 ALIGN JUMP_ALIGN 50 MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange: 51 push di 52 push ax 53 mov al, DOUBLE_VERTICAL 54 add di, BYTE MENU_TEXT_COLUMN_OFFSET ; Border char comes after space 55 WAIT_RETRACE_IF_NECESSARY_THEN scasb 56 pop ax 57 pop di 58 je SHORT MovePartialWordToNewTextLineAndPrintCharacterFromAX 28 MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange: 29 call CharOutLineSplitter_IsCursorAtTheEndOfTextLine 30 jnc SHORT MenuCharOut_MenuTeletypeOutput 31 cmp al, ' ' 32 jb SHORT ReturnSinceNoNeedToStartLineWithControlCharacter 33 call CharOutLineSplitter_MovePartialWordToNewTextLine 59 34 ; Fall to MenuCharOut_MenuTextTeletypeOutputWithAttribute 60 35 61 36 ALIGN JUMP_ALIGN 62 MenuCharOut_MenuTe xtTeletypeOutputWithAttribute:63 cmp al, CR ; Carriage return?64 je SHORT PrintCR fromALandAdjustColumnToMenuText37 MenuCharOut_MenuTeletypeOutput: 38 cmp al, CR 39 je SHORT PrintCRandAdjustOffsetForStartOfLine 65 40 jmp DisplayCharOut_TeletypeOutputWithAttribute 66 41 67 42 68 43 ;-------------------------------------------------------------------- 69 ; MovePartialWordToNewTextLineAndPrintCharacterFromAX 70 ; Parameters: 71 ; AL: Character to output 72 ; AH: Attribute to output 73 ; DS: BDA segment (zero) 74 ; ES:DI: Ptr to end of text line in video memory 75 ; Returns: 76 ; DI: Incremented for next character 77 ; Corrupts registers: 78 ; AX, DX 79 ;-------------------------------------------------------------------- 80 ALIGN JUMP_ALIGN 81 MovePartialWordToNewTextLineAndPrintCharacterFromAX: 82 cmp al, ' ' ; Space or any control character 83 jb SHORT .MoveCursorInDItoBeginningOfNextLine 84 push si 85 push cx 86 push ax 87 88 call .GetOffsetToPartialWordToSIandSizeToCX 89 call .MoveCursorInDItoBeginningOfNextLine 90 jcxz .NothingToMove 91 call .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 92 .NothingToMove: 93 pop ax 94 pop cx 95 pop si 96 jmp DisplayCharOut_TeletypeOutputWithAttribute 97 98 ;-------------------------------------------------------------------- 99 ; .GetOffsetToPartialWordToSIandSizeToCX 100 ; Parameters: 101 ; ES:DI: Ptr to space before border character 102 ; Returns: 103 ; CX: Number of bytes that needs to be moved 104 ; ES:SI: Ptr to beginning of partial word that needs to be moved to new line 105 ; Corrupts registers: 106 ; Nothing 107 ;-------------------------------------------------------------------- 108 ALIGN JUMP_ALIGN 109 .GetOffsetToPartialWordToSIandSizeToCX: 110 xor cx, cx 111 mov si, di 112 ALIGN JUMP_ALIGN 113 .ScanNextCharacter: ; Space will always be found since one comes after border 114 dec si 115 dec si 116 cmp BYTE [es:si], ' ' 117 je SHORT .PartialWordFound 118 inc cx 119 jmp SHORT .ScanNextCharacter 120 ALIGN JUMP_ALIGN 121 .PartialWordFound: 122 inc si 123 inc si ; SI now points one past space 124 shl cx, 1 ; Characters to bytes 125 ret 126 127 ;-------------------------------------------------------------------- 128 ; .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX 129 ; Parameters: 130 ; CX: Number of bytes in partial word 131 ; DS: BDA segment (zero) 132 ; ES:SI: Ptr to partial word on previous line 133 ; ES:DI: Ptr to new empty line 134 ; Returns: 135 ; ES:DI: Ptr where to store next character 136 ; Corrupts registers: 137 ; AX, CX, DX, SI 138 ;-------------------------------------------------------------------- 139 ALIGN JUMP_ALIGN 140 .MovePartialWordFromPreviousLineInESSItoNewLineInESDIwithSizeInCX: 141 push si 142 push cx 143 WAIT_RETRACE_IF_NECESSARY_THEN rep movsb 144 pop cx 145 pop si 146 xchg di, si 147 shr cx, 1 ; Bytes to characters 148 mov al, ' ' 149 call DisplayPrint_RepeatCharacterFromALwithCountInCX 150 mov di, si 151 ret 152 153 ;-------------------------------------------------------------------- 154 ; .MoveCursorInDItoBeginningOfNextLine 44 ; MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine 45 ; PrintCRandAdjustOffsetForStartOfLine 155 46 ; Parameters: 156 47 ; DS: BDA segment (zero) 157 48 ; ES:DI: Ptr to cursor location 49 ; [DISPLAY_CONTEXT.wCharOutParam]: 50 ; Low byte = First column offset (after CR) 51 ; High byte = Last column offset (when using automatic line change) 158 52 ; Returns: 159 53 ; ES:DI: Ptr to beginning of new line … … 162 56 ;-------------------------------------------------------------------- 163 57 ALIGN JUMP_ALIGN 164 .MoveCursorInDItoBeginningOfNextLine:58 MenuCharOut_PrintLFCRandAdjustOffsetForStartOfLine: 165 59 mov al, LF 166 60 call DisplayCharOut_BiosTeletypeOutput 61 ; Fall to PrintCRandAdjustOffsetForStartOfLine 62 63 ALIGN JUMP_ALIGN 64 PrintCRandAdjustOffsetForStartOfLine: 167 65 mov al, CR 168 ; Fall to PrintCRfromALandAdjustColumnToMenuText169 170 171 ;--------------------------------------------------------------------172 ; PrintCRfromALandAdjustColumnToMenuText173 ; Parameters:174 ; AL: Character to output (CR)175 ; DS: BDA segment (zero)176 ; ES:DI: Ptr to video memory where to output177 ; Returns:178 ; DI: Incremented for next text line179 ; Corrupts registers:180 ; AX, DX181 ;--------------------------------------------------------------------182 ALIGN JUMP_ALIGN183 PrintCRfromALandAdjustColumnToMenuText:184 66 call DisplayCharOut_BiosTeletypeOutput 185 mov al, MENU_TEXT_COLUMN_OFFSET ; Offset to start of text 186 ; Fall to SetCursorToNextMenuLine 187 188 ;-------------------------------------------------------------------- 189 ; SetCursorToNextMenuLine 190 ; Parameters: 191 ; AL: Column offset from start of borders 192 ; DS: BDA segment (zero) 193 ; ES:DI: Ptr to video memory where to output 194 ; Returns: 195 ; DI: Adjusted for next line 196 ; Corrupts registers: 197 ; AX, DX 198 ;-------------------------------------------------------------------- 199 ALIGN JUMP_ALIGN 200 SetCursorToNextMenuLine: 201 push bp 202 203 mov bp, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam] 204 call .AddCoordinatesForNewBorderLineToAX 205 call DisplayCursor_SetCoordinatesFromAX ; Updates DI 206 207 pop bp 67 eMOVZX ax, BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam] 68 add di, ax 69 ReturnSinceNoNeedToStartLineWithControlCharacter: 208 70 ret 209 210 ;--------------------------------------------------------------------211 ; .AddCoordinatesForNewBorderLineToAX212 ; Parameters:213 ; AL: Column offset from start of borders214 ; DS: BDA segment (zero)215 ; SS:BP: Ptr to MENU216 ; Returns:217 ; AX: Coordinates for new line218 ; Corrupts registers:219 ; DX220 ;--------------------------------------------------------------------221 ALIGN JUMP_ALIGN222 .AddCoordinatesForNewBorderLineToAX:223 call MenuLocation_AddTitleBordersTopLeftCoordinatesToAX224 push ax225 call DisplayCursor_GetSoftwareCoordinatesToAX226 pop dx227 mov al, dl ; Adjust column to borders228 ret -
trunk/Assembly_Library/Src/Menu/MenuEvent.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.7.2010 4 ; Last update : 5.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for initializing menu system. … … 82 82 mov bx, MENUEVENT.RefreshInformation 83 83 LoadHighlightedItemToCXandSendMessageFromBX: 84 mov cx, [bp+MENU .wHighlightedItem]84 mov cx, [bp+MENUINIT.wHighlightedItem] 85 85 jmp SHORT MenuEvent_SendFromBX 86 86 … … 117 117 MenuEvent_HighlightItemFromCX: 118 118 mov dx, cx 119 xchg dx, [bp+MENU .wHighlightedItem]119 xchg dx, [bp+MENUINIT.wHighlightedItem] 120 120 push dx 121 121 … … 125 125 pop ax 126 126 call MenuText_RefreshItemFromAX 127 mov ax, [bp+MENU .wHighlightedItem]127 mov ax, [bp+MENUINIT.wHighlightedItem] 128 128 jmp MenuText_RefreshItemFromAX 129 129 -
trunk/Assembly_Library/Src/Menu/MenuInit.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 13.7.2010 4 ; Last update : 5.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for initializing menu system. … … 30 30 call Memory_ZeroSSBPwithSizeInCX 31 31 call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX 32 mov ax, [bp+MENU .wHighlightedItem]32 mov ax, [bp+MENUINIT.wHighlightedItem] 33 33 34 34 eLEAVE_STRUCT MENU_size … … 56 56 mov [bp+MENU.dwUserData], ax 57 57 mov [bp+MENU.dwUserData+2], dx 58 mov WORD [bp+MENU.wHighlightedItem], NO_ITEM_HIGHLIGHTED59 58 60 59 mov ax, CURSOR_HIDDEN … … 110 109 ALIGN JUMP_ALIGN 111 110 MenuInit_HighlightItemFromAX: 112 sub ax, [bp+MENU .wHighlightedItem]111 sub ax, [bp+MENUINIT.wHighlightedItem] 113 112 jmp MenuScrollbars_MoveHighlightedItemByAX 114 113 … … 124 123 ALIGN JUMP_ALIGN 125 124 MenuInit_GetHighlightedItemToAX: 126 mov ax, [bp+MENU .wHighlightedItem]125 mov ax, [bp+MENUINIT.wHighlightedItem] 127 126 ret 128 127 -
trunk/Assembly_Library/Src/Menu/MenuLoop.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 22.7.2010 4 ; Last update : 1 6.9.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Menu loop for waiting keystrokes. … … 102 102 .LeaveMenuWithoutSelectingItem: 103 103 call MenuInit_CloseMenuWindow 104 mov WORD [bp+MENU .wHighlightedItem], NO_ITEM_HIGHLIGHTED104 mov WORD [bp+MENUINIT.wHighlightedItem], NO_ITEM_HIGHLIGHTED 105 105 stc 106 106 ret … … 108 108 ALIGN JUMP_ALIGN 109 109 .SelectItem: 110 mov cx, [bp+MENU .wHighlightedItem]110 mov cx, [bp+MENUINIT.wHighlightedItem] 111 111 call MenuEvent_ItemSelectedFromCX 112 112 stc … … 151 151 xchg ax, cx 152 152 neg ax 153 mov cx, [bp+MENU .wHighlightedItem]153 mov cx, [bp+MENUINIT.wHighlightedItem] 154 154 add cx, ax 155 155 jge SHORT .MoveHighlightedItemByAX ; No rotation for PgUp … … 157 157 ALIGN JUMP_ALIGN 158 158 .SelectFirstItem: 159 mov ax, [bp+MENU .wHighlightedItem]159 mov ax, [bp+MENUINIT.wHighlightedItem] 160 160 neg ax 161 161 jmp SHORT .MoveHighlightedItemByAX … … 165 165 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX 166 166 xchg ax, cx 167 mov cx, [bp+MENU .wHighlightedItem]167 mov cx, [bp+MENUINIT.wHighlightedItem] 168 168 add cx, ax 169 169 cmp cx, [bp+MENUINIT.wItems] … … 173 173 .SelectLastItem: 174 174 mov ax, [bp+MENUINIT.wItems] 175 sub ax, [bp+MENU .wHighlightedItem]175 sub ax, [bp+MENUINIT.wHighlightedItem] 176 176 dec ax 177 177 jmp SHORT .MoveHighlightedItemByAX -
trunk/Assembly_Library/Src/Menu/MenuScrollbars.asm
r41 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 20.7.2010 4 ; Last update : 9.8.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing scroll bars over menu borders. … … 98 98 ALIGN JUMP_ALIGN 99 99 MenuScrollbars_MoveHighlightedItemByAX: 100 mov cx, [bp+MENU .wHighlightedItem]100 mov cx, [bp+MENUINIT.wHighlightedItem] 101 101 add cx, ax 102 102 call .RotateItemInCX … … 118 118 119 119 mov dx, [bp+MENU.wFirstVisibleItem] 120 sub dx, [bp+MENU .wHighlightedItem]120 sub dx, [bp+MENUINIT.wHighlightedItem] 121 121 add dx, cx 122 122 MAX_S dx, 0 -
trunk/Assembly_Library/Src/Menu/MenuText.asm
r48 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 21.7.2010 4 ; Last update : 7.10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing menu texts by the user. … … 76 76 PrepareToDrawTitleArea: 77 77 mov si, ATTRIBUTE_CHARS.cTitle 78 mov ax, MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange79 call AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX80 78 call MenuLocation_GetTitleTextTopLeftCoordinatesToAX 81 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 82 ret 79 jmp SHORT FinishPreparationsToDrawTitleOrInformationArea 83 80 84 81 ALIGN JUMP_ALIGN 85 82 PrepareToDrawInformationArea: 86 83 mov si, ATTRIBUTE_CHARS.cInformation 87 mov ax, MenuCharOut_MenuTextTeletypeOutputWithAttributeAndAutomaticLineChange88 call AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX89 84 call MenuLocation_GetInformationTextTopLeftCoordinatesToAX 90 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 91 ret 85 FinishPreparationsToDrawTitleOrInformationArea: 86 mov dx, MenuCharOut_MenuTeletypeOutputWithAutomaticLineChange 87 jmp SHORT AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX 92 88 93 89 … … 134 130 call MenuScrollbars_IsItemInCXonVisiblePage 135 131 jnc SHORT .InvalidItem 136 mov ax, cx 137 call MenuText_AdjustDisplayContextForDrawingItemFromAX 132 call MenuText_AdjustDisplayContextForDrawingItemFromCX 138 133 call MenuEvent_RefreshItemFromCX 139 134 call DrawScrollbarIfNecessary … … 144 139 145 140 ;-------------------------------------------------------------------- 146 ; MenuText_AdjustDisplayContextForDrawingItemFromAX 147 ; Parameters 148 ; AX: Item to refresh 149 ; SS:BP: Ptr to MENU 150 ; Returns: 151 ; CX: Item to refresh 152 ; Corrupts registers: 153 ; AX, SI, DI 154 ;-------------------------------------------------------------------- 155 ALIGN JUMP_ALIGN 156 MenuText_AdjustDisplayContextForDrawingItemFromAX: 157 mov cx, ax 141 ; MenuText_AdjustDisplayContextForDrawingItemFromCX 142 ; Parameters 143 ; CX: Item to refresh 144 ; SS:BP: Ptr to MENU 145 ; Returns: 146 ; Nothing 147 ; Corrupts registers: 148 ; AX, BX, DX, SI, DI 149 ;-------------------------------------------------------------------- 150 ALIGN JUMP_ALIGN 151 MenuText_AdjustDisplayContextForDrawingItemFromCX: 152 mov ax, cx 153 call GetItemTextAttributeTypeToSIforItemInCX 158 154 call MenuLocation_GetTextCoordinatesToAXforItemInAX 155 mov dx, MenuCharOut_MenuTeletypeOutput 156 ; Fall to AdjustDisplayContextForDrawingTextsAtCoordinatesInAXwithAttributeTypeInSI 157 158 ;-------------------------------------------------------------------- 159 ; AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX 160 ; Parameters 161 ; AX: Cursor coordinates to set 162 ; DX: Character output function 163 ; SI: Attribute type (from ATTRIBUTE_CHARS) 164 ; SS:BP: Ptr to MENU 165 ; Returns: 166 ; Nothing 167 ; Corrupts registers: 168 ; AX, BX, DX, SI, DI 169 ;-------------------------------------------------------------------- 170 ALIGN JUMP_ALIGN 171 AdjustDisplayContextForDrawingTextsAtCoordsInAXwithAttrTypeInSIandCharOutFunctionInDX: 159 172 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 160 call .GetItemTextAttributeTypeToSIforItemInCX 161 mov ax, MenuCharOut_MenuTextTeletypeOutputWithAttribute 162 jmp SHORT AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX 163 164 ;-------------------------------------------------------------------- 165 ; .GetItemTextAttributeTypeToSIforItemInCX 173 174 xchg ax, dx 175 mov bl, ATTRIBUTES_ARE_USED 176 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL 177 178 call CharOutLineSplitter_PrepareForPrintingTextLines 179 jmp MenuAttribute_SetToDisplayContextFromTypeInSI 180 181 182 ;-------------------------------------------------------------------- 183 ; GetItemTextAttributeTypeToSIforItemInCX 166 184 ; Parameters 167 185 ; CX: Item to refresh … … 173 191 ;-------------------------------------------------------------------- 174 192 ALIGN JUMP_ALIGN 175 .GetItemTextAttributeTypeToSIforItemInCX:193 GetItemTextAttributeTypeToSIforItemInCX: 176 194 mov si, ATTRIBUTE_CHARS.cItem 177 195 test BYTE [bp+MENU.bFlags], FLG_MENU_NOHIGHLIGHT 178 196 jnz SHORT .ReturnAttributeTypeInSI 179 cmp cx, [bp+MENU.wHighlightedItem] 197 198 cmp cx, [bp+MENUINIT.wHighlightedItem] 180 199 jne SHORT .ReturnAttributeTypeInSI 181 200 sub si, BYTE ATTRIBUTE_CHARS.cItem - ATTRIBUTE_CHARS.cHighlightedItem … … 258 277 pop cx 259 278 ret 260 261 262 ;--------------------------------------------------------------------263 ; AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX264 ; Parameters265 ; AX: Character output function266 ; SI: Attribute type (from ATTRIBUTE_CHARS)267 ; SS:BP: Ptr to MENU268 ; Returns:269 ; Nothing270 ; Corrupts registers:271 ; AX, BX, SI, DI272 ;--------------------------------------------------------------------273 ALIGN JUMP_ALIGN274 AdjustDisplayContextForDrawingTextsWithCharOutFunctionFromAX:275 mov bl, ATTRIBUTES_ARE_USED276 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL277 278 mov ax, bp279 CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX280 281 jmp MenuAttribute_SetToDisplayContextFromTypeInSI -
trunk/Assembly_Library/Src/String/String.asm
r46 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 12.7.2010 4 ; Last update : 1 .10.20104 ; Last update : 12.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for handling characters. … … 16 16 ; Returns: 17 17 ; AX: Word converted from string 18 ; DI: Offset to NULL or first invalid character19 ; CF: Set if conversionsuccessfull20 ; Cleared if invalid string18 ; SI: Updated 19 ; CF: Cleared if successfull 20 ; Set if error during conversion 21 21 ; Corrupts registers: 22 ; DX22 ; Nothing 23 23 ;-------------------------------------------------------------------- 24 24 ALIGN JUMP_ALIGN 25 25 String_ConvertWordToAXfromStringInDSSIwithBaseInBX: 26 xor dx, dx27 cld26 push di 27 push dx 28 28 29 ALIGN JUMP_ALIGN 30 .ConvertWordToAXfromStringInDSSIwithBaseInBX: 31 lodsb ; Load character from DS:SI to AL 32 call Char_ConvertIntegerToALfromDigitInALwithBaseInBX 33 jnc SHORT .InvalidCharacter 34 xor ah, ah 35 push ax ; Push integer 36 xchg ax, dx ; Copy WORD to AX 37 mul bx ; DX:AX = word in AX * base in BX 38 pop dx ; Pop integer 39 add dx, ax ; WORD back to DX 40 jmp SHORT .ConvertWordToAXfromStringInDSSIwithBaseInBX 29 xor di, di 30 mov dx, StringProcess_ConvertToWordInDIWithBaseInBX 31 call StringProcess_DSSIwithFunctionInDX 32 xchg ax, di 41 33 42 ALIGN JUMP_ALIGN 43 .InvalidCharacter: 44 sub al, 1 ; Set CF if NULL character, clear CF otherwise 45 xchg ax, dx ; Return WORD in AX 34 pop dx 35 pop di 46 36 ret 47 37 48 38 49 39 ;-------------------------------------------------------------------- 50 ; String_Copy ToESDIfromDSSIwithoutTerminatingESDI40 ; String_CopyDSSItoESDIandGetSizeToCX 51 41 ; Parameters: 52 42 ; DS:SI: Ptr to source NULL terminated string … … 59 49 ;-------------------------------------------------------------------- 60 50 ALIGN JUMP_ALIGN 61 String_Copy ToESDIfromDSSIwithoutTerminatingESDI:51 String_CopyDSSItoESDIandGetSizeToCX: 62 52 push ax 53 63 54 xor cx, cx 64 65 55 ALIGN JUMP_ALIGN 66 . GetAndStoreNewCharacter:56 .CopyNextCharacter: 67 57 lodsb ; Load from DS:SI to AL 68 58 test al, al ; NULL to end string? … … 70 60 stosb ; Store from AL to ES:DI 71 61 inc cx ; Increment number of characters written 72 jmp SHORT . GetAndStoreNewCharacter62 jmp SHORT .CopyNextCharacter 73 63 74 64 ALIGN JUMP_ALIGN … … 79 69 80 70 ;-------------------------------------------------------------------- 81 ; String_ ConvertDSSItoLowerCase71 ; String_GetLengthFromDSSItoCX 82 72 ; Parameters: 83 ; DS:SI: Ptr to NULL terminated string to convert73 ; DS:SI: Ptr to NULL terminated string 84 74 ; Returns: 85 ; Nothing75 ; CX: String length in characters 86 76 ; Corrupts registers: 87 77 ; Nothing 88 78 ;-------------------------------------------------------------------- 89 79 ALIGN JUMP_ALIGN 90 String_ConvertDSSItoLowerCase: 80 String_GetLengthFromDSSItoCX: 81 push ax 91 82 push si 92 push ax93 83 94 ALIGN JUMP_ALIGN 95 .ConvertNextCharacter: 96 lodsb 97 test al, al ; NULL to end string? 98 jz SHORT .EndOfString 99 call Char_ALtoLowerCaseLetter 100 mov [si-1], al 101 jmp SHORT .ConvertNextCharacter 84 call Memory_ExchangeDSSIwithESDI 85 xor ax, ax ; Find NULL 86 mov cx, -1 ; Full segment if necessary 87 repne scasb 88 mov cx, di 89 call Memory_ExchangeDSSIwithESDI 102 90 103 ALIGN JUMP_ALIGN 104 .EndOfString: 91 pop si 92 stc 93 sbb cx, si ; Subtract NULL 105 94 pop ax 106 pop si107 95 ret -
trunk/Assembly_Library/Src/Util/Memory.asm
r50 r52 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.7.2010 4 ; Last update : 9.10.20104 ; Last update : 11.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for memory access. … … 131 131 ; Memory_CopySSBPtoESDI 132 132 ; Memory_CopySSBPtoDSSI 133 ; Memory_CopyDSSItoESDI 133 134 ; Memory_CopyESDItoDSSI 134 135 ; Parameters … … 151 152 pop ds 152 153 mov si, bp 154 ret 155 156 ALIGN JUMP_ALIGN 157 Memory_CopyDSSItoESDI: 158 push ds 159 pop es 160 mov di, si 153 161 ret 154 162
Note:
See TracChangeset
for help on using the changeset viewer.