Changeset 52 in xtideuniversalbios for trunk/Assembly_Library/Src/Menu
- Timestamp:
- Oct 12, 2010, 6:51:07 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library/Src/Menu
- Files:
-
- 2 added
- 1 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.