Changeset 44 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- Sep 27, 2010, 7:23:36 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/Display.inc
r41 r44 2 2 ; Project name : AssemblyLibrary 3 3 ; Created date : 25.6.2010 4 ; Last update : 15.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for display library. … … 37 37 .PushDisplayContext: 38 38 .PopDisplayContext: 39 .InitializeDisplayContext resb 240 41 .SetCharacterPointerFromBXAX resb 242 .SetChar acterOutputFunctionFromAXresb 243 .SetCharacterOutputParameterFromAX resb 244 .SetCharacterAttributeFromAL resb 245 .SetCursorShapeFromAX resb 246 .SetCursorCoordinatesFromAX resb 247 .SetNewPageFromAL resb 248 .SynchronizeDisplayContextToHardware resb 249 50 .GetCharacterPointerToBXAX resb 251 .GetSoftwareCoordinatesToAX resb 252 .GetColumnsToALandRowsToAH resb 253 54 .FormatNullTerminatedStringFromCSSI resb 255 .PrintSigned DecimalIntegerFromAXresb 256 .PrintWordFromAXwithBaseInBX resb 257 .PrintCharBufferFromBXSIwithLengthInCX resb 258 .PrintNullTerminatedStringFromBXSI resb 259 .PrintNullTerminatedStringFromCSSI resb 260 .PrintRepeatedCharacterFromALwithCountInCX resb 261 .PrintCharacterFromAL resb 262 .PrintNewlineCharacters resb 263 .ClearAreaWithHeightInAHandWidthInAL resb 264 .ClearScreen resb 239 .InitializeDisplayContext resb 2 40 41 .SetCharacterPointerFromBXAX resb 2 42 .SetCharOutputFunctionFromAXwithAttribFlagInDL resb 2 43 .SetCharacterOutputParameterFromAX resb 2 44 .SetCharacterAttributeFromAL resb 2 45 .SetCursorShapeFromAX resb 2 46 .SetCursorCoordinatesFromAX resb 2 47 .SetNewPageFromAL resb 2 48 .SynchronizeDisplayContextToHardware resb 2 49 50 .GetCharacterPointerToBXAX resb 2 51 .GetSoftwareCoordinatesToAX resb 2 52 .GetColumnsToALandRowsToAH resb 2 53 54 .FormatNullTerminatedStringFromCSSI resb 2 55 .PrintSignedWordFromAXWithBaseInBX resb 2 56 .PrintWordFromAXwithBaseInBX resb 2 57 .PrintCharBufferFromBXSIwithLengthInCX resb 2 58 .PrintNullTerminatedStringFromBXSI resb 2 59 .PrintNullTerminatedStringFromCSSI resb 2 60 .PrintRepeatedCharacterFromALwithCountInCX resb 2 61 .PrintCharacterFromAL resb 2 62 .PrintNewlineCharacters resb 2 63 .ClearAreaWithHeightInAHandWidthInAL resb 2 64 .ClearScreen resb 2 65 65 endstruc 66 66 67 ; Character output functions for DISPLAY_LIB.SetCharacterOutputFunctionFromAX 67 ; Attribute flags for DISPLAY_LIB.SetCharacterOutputFunctionFromAXwithAttributeFlagInDL 68 ATTRIBUTES_NOT_USED EQU 0 69 ATTRIBUTES_ARE_USED EQU FLG_CONTEXT_ATTRIBUTES 70 71 ; Character output functions for DISPLAY_LIB.SetCharacterOutputFunctionFromAXwithAttributeFlagInDL 68 72 TELETYPE_OUTPUT_WITH_ATTRIBUTE EQU DisplayCharOut_TeletypeOutputWithAttribute 69 73 TELETYPE_OUTPUT_WITHOUT_ATTRIBUTE EQU DisplayCharOut_TeletypeOutput … … 98 102 .wCursorShape resb 2 ; Current cursor shape 99 103 .bAttribute resb 1 ; Selected character attribute 100 resb 1104 .bFlags resb 1 ; Display context flags 101 105 endstruc 106 107 ; Display context flags 108 FLG_CONTEXT_ATTRIBUTES EQU (1<<0) ; Character output function uses attributes 102 109 103 110 … … 203 210 ANGLE_QUOTE_LEFT EQU 174 204 211 ANGLE_QUOTE_RIGHT EQU 175 205 212 BLOCK_MOSTLY_BACKGROUND EQU 176 213 BLOCK_EVEN_BACKGROUND_AND_FOREGROUND EQU 177 214 BLOCK_MOSTLY_FOREGROUND EQU 178 215 BLOCK_FULL_FOREGROUND EQU 219 216 217 218 ; Background character for clearing screen 219 %ifndef SCREEN_BACKGROUND_CHARACTER 220 %define SCREEN_BACKGROUND_CHARACTER BLOCK_MOSTLY_BACKGROUND 221 %endif 222 %ifndef SCREEN_BACKGROUND_ATTRIBUTE 223 %define SCREEN_BACKGROUND_ATTRIBUTE MONO_NORMAL 224 %endif 206 225 207 226 %endif ; DISPLAY_INC -
trunk/Assembly_Library/Inc/Menu.inc
r41 r44 125 125 MENU_TEXT_COLUMN_OFFSET EQU 2 126 126 127 SCROLL_TRACK_CHARACTER EQU 176128 SCROLL_THUMB_CHARACTER EQU 219127 SCROLL_TRACK_CHARACTER EQU BLOCK_EVEN_BACKGROUND_AND_FOREGROUND 128 SCROLL_THUMB_CHARACTER EQU BLOCK_FULL_FOREGROUND 129 129 130 130 NO_ITEM_SELECTED EQU -1 -
trunk/Assembly_Library/Src/Display/Display.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 2.7.2010 4 ; Last update : 13.8.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Display Library functions for CALL_DISPLAY_LIBRARY macro … … 65 65 .rgfnDisplayLibraryFunctions: 66 66 istruc DISPLAY_LIB 67 at DISPLAY_LIB.InitializeDisplayContext, dw DisplayContext_Initialize67 at DISPLAY_LIB.InitializeDisplayContext, dw DisplayContext_Initialize 68 68 69 at DISPLAY_LIB.SetCharacterPointerFromBXAX, dw DisplayContext_SetCharacterPointerFromBXAX70 at DISPLAY_LIB.SetChar acterOutputFunctionFromAX, dw DisplayContext_SetCharacterOutputFunctionFromAX71 at DISPLAY_LIB.SetCharacterOutputParameterFromAX, dw DisplayContext_SetCharacterOutputParameterFromAX72 at DISPLAY_LIB.SetCharacterAttributeFromAL, dw DisplayContext_SetCharacterAttributeFromAL73 at DISPLAY_LIB.SetCursorShapeFromAX, dw DisplayCursor_SetShapeFromAX74 at DISPLAY_LIB.SetCursorCoordinatesFromAX, dw DisplayCursor_SetCoordinatesFromAX75 at DISPLAY_LIB.SetNewPageFromAL, dw DisplayPage_SetFromAL76 at DISPLAY_LIB.SynchronizeDisplayContextToHardware, dw DisplayContext_SynchronizeToHardware69 at DISPLAY_LIB.SetCharacterPointerFromBXAX, dw DisplayContext_SetCharacterPointerFromBXAX 70 at DISPLAY_LIB.SetCharOutputFunctionFromAXwithAttribFlagInDL, dw DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL 71 at DISPLAY_LIB.SetCharacterOutputParameterFromAX, dw DisplayContext_SetCharacterOutputParameterFromAX 72 at DISPLAY_LIB.SetCharacterAttributeFromAL, dw DisplayContext_SetCharacterAttributeFromAL 73 at DISPLAY_LIB.SetCursorShapeFromAX, dw DisplayCursor_SetShapeFromAX 74 at DISPLAY_LIB.SetCursorCoordinatesFromAX, dw DisplayCursor_SetCoordinatesFromAX 75 at DISPLAY_LIB.SetNewPageFromAL, dw DisplayPage_SetFromAL 76 at DISPLAY_LIB.SynchronizeDisplayContextToHardware, dw DisplayContext_SynchronizeToHardware 77 77 78 at DISPLAY_LIB.GetCharacterPointerToBXAX, dw DisplayContext_GetCharacterPointerToBXAX79 at DISPLAY_LIB.GetSoftwareCoordinatesToAX, dw DisplayCursor_GetSoftwareCoordinatesToAX80 at DISPLAY_LIB.GetColumnsToALandRowsToAH, dw DisplayPage_GetColumnsToALandRowsToAH78 at DISPLAY_LIB.GetCharacterPointerToBXAX, dw DisplayContext_GetCharacterPointerToBXAX 79 at DISPLAY_LIB.GetSoftwareCoordinatesToAX, dw DisplayCursor_GetSoftwareCoordinatesToAX 80 at DISPLAY_LIB.GetColumnsToALandRowsToAH, dw DisplayPage_GetColumnsToALandRowsToAH 81 81 82 at DISPLAY_LIB.FormatNullTerminatedStringFromCSSI, dw .FormatNullTerminatedStringFromCSSI83 at DISPLAY_LIB.PrintSigned DecimalIntegerFromAX, dw DisplayPrint_SignedDecimalIntegerFromAX84 at DISPLAY_LIB.PrintWordFromAXwithBaseInBX, dw DisplayPrint_WordFromAXWithBaseInBX85 at DISPLAY_LIB.PrintCharBufferFromBXSIwithLengthInCX, dw DisplayPrint_CharacterBufferFromBXSIwithLengthInCX86 at DISPLAY_LIB.PrintNullTerminatedStringFromBXSI, dw DisplayPrint_NullTerminatedStringFromBXSI87 at DISPLAY_LIB.PrintNullTerminatedStringFromCSSI, dw DisplayPrint_NullTerminatedStringFromCSSI88 at DISPLAY_LIB.PrintRepeatedCharacterFromALwithCountInCX, dw DisplayPrint_RepeatCharacterFromALwithCountInCX89 at DISPLAY_LIB.PrintCharacterFromAL, dw DisplayPrint_CharacterFromAL90 at DISPLAY_LIB.PrintNewlineCharacters, dw DisplayPrint_Newline91 at DISPLAY_LIB.ClearAreaWithHeightInAHandWidthInAL, dw DisplayPrint_ClearAreaWithHeightInAHandWidthInAL92 at DISPLAY_LIB.ClearScreen, dw DisplayPrint_ClearScreen82 at DISPLAY_LIB.FormatNullTerminatedStringFromCSSI, dw .FormatNullTerminatedStringFromCSSI 83 at DISPLAY_LIB.PrintSignedWordFromAXWithBaseInBX, dw DisplayPrint_SignedWordFromAXWithBaseInBX 84 at DISPLAY_LIB.PrintWordFromAXwithBaseInBX, dw DisplayPrint_WordFromAXWithBaseInBX 85 at DISPLAY_LIB.PrintCharBufferFromBXSIwithLengthInCX, dw DisplayPrint_CharacterBufferFromBXSIwithLengthInCX 86 at DISPLAY_LIB.PrintNullTerminatedStringFromBXSI, dw DisplayPrint_NullTerminatedStringFromBXSI 87 at DISPLAY_LIB.PrintNullTerminatedStringFromCSSI, dw DisplayPrint_NullTerminatedStringFromCSSI 88 at DISPLAY_LIB.PrintRepeatedCharacterFromALwithCountInCX, dw DisplayPrint_RepeatCharacterFromALwithCountInCX 89 at DISPLAY_LIB.PrintCharacterFromAL, dw DisplayPrint_CharacterFromAL 90 at DISPLAY_LIB.PrintNewlineCharacters, dw DisplayPrint_Newline 91 at DISPLAY_LIB.ClearAreaWithHeightInAHandWidthInAL, dw DisplayPrint_ClearAreaWithHeightInAHandWidthInAL 92 at DISPLAY_LIB.ClearScreen, dw DisplayPrint_ClearScreen 93 93 iend -
trunk/Assembly_Library/Src/Display/DisplayCharOut.asm
r42 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 26.6.2010 4 ; Last update : 18.9.20104 ; Last update : 22.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for outputting characters to video memory. … … 180 180 ; made without interfering with the display. (H or V retrace) 181 181 jc SHORT %%WaitUntilNotInRetrace 182 sti183 nop ; Should have time to serve IRQ here184 cli185 182 %%WaitUntilNextRetraceStarts: 186 183 in al, dx -
trunk/Assembly_Library/Src/Display/DisplayContext.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 25.6.2010 4 ; Last update : 13.8.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for managing display context. … … 23 23 mov WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], DEFAULT_CHARACTER_OUTPUT 24 24 mov WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCursorShape], CURSOR_NORMAL 25 mov BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], MONO_NORMAL 25 mov BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], SCREEN_BACKGROUND_ATTRIBUTE 26 mov BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_ATTRIBUTES 26 27 27 28 xor ax, ax … … 152 153 153 154 ;-------------------------------------------------------------------- 154 ; DisplayContext_SetChar acterOutputFunctionFromAX155 ; DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL 155 156 ; Parameters: 156 157 ; AX: Offset to character output function 157 ; DS: BDA segment (zero) 158 ; Returns: 159 ; Nothing 160 ; Corrupts registers: 161 ; Nothing 162 ;-------------------------------------------------------------------- 163 ALIGN JUMP_ALIGN 164 DisplayContext_SetCharacterOutputFunctionFromAX: 158 ; DL: Attribute Flag 159 ; DS: BDA segment (zero) 160 ; Returns: 161 ; Nothing 162 ; Corrupts registers: 163 ; Nothing 164 ;-------------------------------------------------------------------- 165 ALIGN JUMP_ALIGN 166 DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInDL: 165 167 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], ax 168 and BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], ~FLG_CONTEXT_ATTRIBUTES 169 mov al, dl 170 and al, FLG_CONTEXT_ATTRIBUTES 171 or [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], al 166 172 ret 167 173 … … 211 217 mov dx, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam] 212 218 ret 219 220 221 ;-------------------------------------------------------------------- 222 ; DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX 223 ; Parameters: 224 ; AX: Offset in bytes from some character to another 225 ; DS: BDA segment (zero) 226 ; Returns: 227 ; AX: Offset in characters from some character to another 228 ; Corrupts registers: 229 ; Nothing 230 ;-------------------------------------------------------------------- 231 ALIGN JUMP_ALIGN 232 DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX: 233 test BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_ATTRIBUTES 234 jz SHORT ReturnOffsetInAX 235 sar ax, 1 ; BYTE count to WORD count 236 ret 237 238 ;-------------------------------------------------------------------- 239 ; DisplayContext_GetByteOffsetToAXfromCharacterOffsetInAX 240 ; Parameters: 241 ; AX: Offset in characters from some character to another 242 ; DS: BDA segment (zero) 243 ; Returns: 244 ; AX: Offset in bytes from some character to another 245 ; Corrupts registers: 246 ; Nothing 247 ;-------------------------------------------------------------------- 248 ALIGN JUMP_ALIGN 249 DisplayContext_GetByteOffsetToAXfromCharacterOffsetInAX: 250 test BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_ATTRIBUTES 251 jz SHORT ReturnOffsetInAX 252 sal ax, 1 ; WORD count to BYTE count 253 ALIGN JUMP_ALIGN, ret 254 ReturnOffsetInAX: 255 ret -
trunk/Assembly_Library/Src/Display/DisplayFormat.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 29.6.2010 4 ; Last update : 10.8.20104 ; Last update : 26.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for displaying formatted strings. … … 13 13 ; Parameters: 14 14 ; DS: BDA segment (zero) 15 ; SS:BP: Pointer to first format parameter (-=2 updates to next parameter) 16 ; CS:SI: Pointer to string to format 17 ; ES:DI: Ptr to cursor location in video RAM 18 ; Returns: 19 ; CS:SI: Ptr to end of format string (ptr to one past NULL) 20 ; DI: Updated offset to video RAM 21 ; Corrupts registers: 22 ; AX, BX, CX, DX, BP 23 ;-------------------------------------------------------------------- 24 ALIGN JUMP_ALIGN 25 DisplayFormat_ParseCharacters: 26 call ReadCharacterAndTestForNull 27 jz SHORT .QuitCharacterParsing 28 29 ePUSH_T cx, DisplayFormat_ParseCharacters ; Return address 30 xor cx, cx ; Initial placeholder size 31 cmp al, '%' ; Format specifier? 32 je SHORT ParseFormatSpecifier 33 jmp DisplayPrint_CharacterFromAL 34 35 ALIGN JUMP_ALIGN 36 .QuitCharacterParsing: 37 ret 38 39 40 ;-------------------------------------------------------------------- 41 ; ParseFormatSpecifier 42 ; Parameters: 43 ; CX: Placeholder size 44 ; DS: BDA segment (zero) 15 45 ; SS:BP: Pointer to first format parameter (-=2 for next parameter) 16 46 ; CS:SI: Pointer to string to format 17 47 ; ES:DI: Ptr to cursor location in video RAM 18 48 ; Returns: 49 ; SI: Updated to first unparsed character 19 50 ; DI: Updated offset to video RAM 20 ; Corrupts registers: 21 ; AX, BX, CX, DX, SI, BP 22 ;-------------------------------------------------------------------- 23 ALIGN JUMP_ALIGN 24 DisplayFormat_ParseCharacters: 25 call .ReadCharacterAndTestForNull 26 jz SHORT .Return 27 xor cx, cx ; Zero CX for parsing number parameter 28 cmp al, '%' 29 je SHORT .FormatParameterEncountered 30 call DisplayPrint_CharacterFromAL ; Control or printable character 31 jmp SHORT DisplayFormat_ParseCharacters 32 ALIGN JUMP_ALIGN 33 .Return: 34 ret 35 36 ;-------------------------------------------------------------------- 37 ; .ReadCharacterAndTestForNull 38 ; Parameters: 39 ; CS:SI: Pointer next character from string 40 ; Returns: 41 ; AL: Character from string 42 ; SI: Incremented to next character 43 ; ZF: Set if NULL, cleared if valid character 44 ; Corrupts registers: 45 ; Nothing 46 ;-------------------------------------------------------------------- 47 ALIGN JUMP_ALIGN 48 .ReadCharacterAndTestForNull: 49 eSEG cs 50 lodsb ; Load from CS:SI to AL 51 test al, al ; NULL to end string? 52 ret 53 54 55 ;-------------------------------------------------------------------- 56 ; .FormatParameterEncountered 57 ; Parameters: 58 ; CX: Zero or previous number parameter 59 ; DS: BDA segment (zero) 60 ; SS:BP: Pointer to next format parameter 61 ; CS:SI: Pointer to next format string character 62 ; ES:DI: Ptr to cursor location in video RAM 63 ; Returns: 64 ; SI: Incremented to next character 65 ; BP: Offset to next format parameter 66 ; Eventually jumps to DisplayFormat_ParseCharacters 51 ; BP: Updated to next format parameter 67 52 ; Corrupts registers: 68 53 ; AX, BX, CX, DX 69 54 ;-------------------------------------------------------------------- 70 55 ALIGN JUMP_ALIGN 71 .FormatParameterEncountered: 72 call .ReadCharacterAndTestForNull 73 jz SHORT .Return 56 ParseFormatSpecifier: 57 call ReadCharacterAndTestForNull 74 58 call Char_IsDecimalDigitInAL 75 jnc SHORT .FormatWithCorrectFormatFunction 76 ; Fall to .ParseNumberParameterToCX 77 78 ;-------------------------------------------------------------------- 79 ; .ParseNumberParameterToCX 80 ; Parameters: 81 ; AL: Number digit from format string 82 ; CX: Zero or previous number parameter 83 ; Returns: 84 ; CX: Updated number parameter 85 ; Jumps to .FormatParameterEncountered 59 jc SHORT .ParsePlaceholderSizeDigitFromALtoCX 60 call GetFormatSpecifierParserToAX 61 call ax ; Parser function 62 dec bp 63 dec bp ; SS:BP now points to next parameter 64 test cx, cx 65 jnz SHORT PrependOrAppendSpaces 66 ret 67 68 ;-------------------------------------------------------------------- 69 ; .ParsePlaceholderSizeDigitFromALtoCX 70 ; Parameters: 71 ; AL: Digit character from format string 72 ; CX: Current placeholder size 73 ; DS: BDA segment (zero) 74 ; Returns: 75 ; CX: Current placeholder size 76 ; Jumps back to ParseFormatSpecifier 86 77 ; Corrupts registers: 87 78 ; AX 88 79 ;-------------------------------------------------------------------- 89 .ParseNumberParameterToCX: 80 ALIGN JUMP_ALIGN 81 .ParsePlaceholderSizeDigitFromALtoCX: 82 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di 90 83 sub al, '0' ; Digit '0'...'9' to integer 0...9 91 84 mov ah, cl ; Previous number parameter to AH 92 85 aad ; AL += (AH * 10) 93 86 mov cl, al ; Updated number parameter now in CX 94 jmp SHORT .FormatParameterEncountered 95 96 ;-------------------------------------------------------------------- 97 ; .FormatWithCorrectFormatFunction 98 ; Parameters: 99 ; AL: Format placeholder character (non digit character after '%') 100 ; CX: Number parameter (zero if no number parameter present) 101 ; DS: BDA segment (zero) 102 ; SS:BP: Pointer to format parameter 103 ; CS:SI: Pointer to next format string character 104 ; ES:DI: Ptr to cursor location in video RAM 105 ; Returns: 106 ; Eventually jumps to DisplayFormat_ParseCharacters 87 jmp SHORT ParseFormatSpecifier 88 89 90 ;-------------------------------------------------------------------- 91 ; ReadCharacterAndTestForNull 92 ; Parameters: 93 ; CS:SI: Pointer next character from string 94 ; Returns: 95 ; AL: Character from string 96 ; SI: Incremented to next character 97 ; ZF: Set if NULL, cleared if valid character 98 ; Corrupts registers: 99 ; Nothing 100 ;-------------------------------------------------------------------- 101 ALIGN JUMP_ALIGN 102 ReadCharacterAndTestForNull: 103 eSEG cs 104 lodsb ; Load from CS:SI to AL 105 test al, al ; NULL to end string? 106 ret 107 108 109 ;-------------------------------------------------------------------- 110 ; GetFormatSpecifierParserToAX 111 ; Parameters: 112 ; AL: Format specifier character 113 ; Returns: 114 ; AX: Offset to parser function 115 ; Corrupts registers: 116 ; AX, BX 117 ;-------------------------------------------------------------------- 118 ALIGN JUMP_ALIGN 119 GetFormatSpecifierParserToAX: 120 mov bx, .rgcFormatCharToLookupIndex 121 ALIGN JUMP_ALIGN 122 .CheckForNextSpecifierParser: 123 cmp al, [cs:bx] 124 je SHORT .ConvertIndexToFunctionOffset 125 inc bx 126 cmp bx, .rgcFormatCharToLookupIndexEnd 127 jb SHORT .CheckForNextSpecifierParser 128 mov ax, c_FormatCharacter 129 ret 130 ALIGN JUMP_ALIGN 131 .ConvertIndexToFunctionOffset: 132 sub bx, .rgcFormatCharToLookupIndex 133 shl bx, 1 ; Shift for WORD lookup 134 mov ax, [cs:bx+.rgfnFormatSpecifierParser] 135 ret 136 137 .rgcFormatCharToLookupIndex: 138 db "aAduxsSct-+%" 139 .rgcFormatCharToLookupIndexEnd: 140 ALIGN WORD_ALIGN 141 .rgfnFormatSpecifierParser: 142 dw a_FormatAttributeForNextCharacter 143 dw A_FormatAttributeForRemainingString 144 dw d_FormatSignedDecimalWord 145 dw u_FormatUnsignedDecimalWord 146 dw x_FormatHexadecimalWord 147 dw s_FormatStringFromSegmentCS 148 dw S_FormatStringFromFarPointer 149 dw c_FormatCharacter 150 dw t_FormatRepeatCharacter 151 dw PrepareToPrependParameterWithSpaces 152 dw PrepareToAppendSpacesAfterParameter 153 dw percent_FormatPercent 154 155 156 ;-------------------------------------------------------------------- 157 ; PrependOrAppendSpaces 158 ; Parameters: 159 ; CX: Minimum length for format specifier in characters 160 ; DS: BDA segment (zero) 161 ; ES:DI: Ptr to cursor location in video RAM 162 ; Returns: 163 ; Nothing 107 164 ; Corrupts registers: 108 165 ; AX, BX, CX, DX 109 166 ;-------------------------------------------------------------------- 110 167 ALIGN JUMP_ALIGN 111 .FormatWithCorrectFormatFunction: 112 xor bx, bx ; Zero lookup index 113 ALIGN JUMP_ALIGN 114 .PlaceholderComparisonLoop: 115 cmp al, [cs:bx+.rgcFormatCharToLookupIndex] 116 je SHORT .JumpToFormatPlaceholder 117 inc bx 118 cmp bl, .EndOFrgcFormatCharToLookupIndex - .rgcFormatCharToLookupIndex 119 jb SHORT .PlaceholderComparisonLoop ; Loop 120 call DisplayPrint_CharacterFromAL ; Display unsupported format character 121 ; Fall to .UpdateSpacesToAppendAfterPrintingSingleCharacter 122 123 ;-------------------------------------------------------------------- 124 ; .UpdateSpacesToAppendAfterPrintingSingleCharacter 125 ; .UpdateSpacesToAppend 126 ; Parameters: 127 ; BX: Number of characters printed (.UpdateSpacesToAppend only) 128 ; CX: Number parameter (zero if no number parameter present) 129 ; DS: BDA segment (zero) 130 ; SS:BP: Pointer to format parameter 131 ; CS:SI: Pointer to next format string character 132 ; ES:DI: Ptr to cursor location in video RAM 133 ; Returns: 134 ; CX: Number of spaces to append 135 ; Jumps to .PrepareToFormatNextParameter 168 PrependOrAppendSpaces: 169 mov ax, di 170 sub ax, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition] 171 test cx, cx 172 js SHORT .PrependWithSpaces 173 ; Fall to .AppendSpaces 174 175 ;-------------------------------------------------------------------- 176 ; .AppendSpaces 177 ; Parameters: 178 ; AX: Number of format parameter BYTEs printed 179 ; CX: Minimum length for format specifier in characters 180 ; DS: BDA segment (zero) 181 ; ES:DI: Ptr to cursor location in video RAM 182 ; Returns: 183 ; Nothing 184 ; Corrupts registers: 185 ; AX, CX, DX 186 ;-------------------------------------------------------------------- 187 .AppendSpaces: 188 call DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX 189 sub cx, ax 190 jle SHORT .NothingToAppendOrPrepend 191 mov al, ' ' 192 jmp DisplayPrint_RepeatCharacterFromALwithCountInCX 193 194 ;-------------------------------------------------------------------- 195 ; .PrependWithSpaces 196 ; Parameters: 197 ; AX: Number of format parameter BYTEs printed 198 ; CX: Negative minimum length for format specifier in characters 199 ; DS: BDA segment (zero) 200 ; ES:DI: Ptr to cursor location in video RAM 201 ; Returns: 202 ; Nothing 136 203 ; Corrupts registers: 137 204 ; AX, BX, CX, DX 138 205 ;-------------------------------------------------------------------- 139 206 ALIGN JUMP_ALIGN 140 .UpdateSpacesToAppendAfterPrintingSingleCharacter: 141 mov bx, 1 142 ALIGN JUMP_ALIGN 143 .UpdateSpacesToAppend: 144 jcxz .PrepareToFormatNextParameter 145 sub cx, bx ; Number of spaces to append 146 jle SHORT .PrepareToFormatNextParameter 207 .PrependWithSpaces: 208 xchg ax, cx 209 neg ax 210 call DisplayContext_GetByteOffsetToAXfromCharacterOffsetInAX 211 sub ax, cx ; AX = BYTEs to prepend, CX = BYTEs to move 212 jle SHORT .NothingToAppendOrPrepend 213 214 mov bx, di 215 add bx, ax ; BX = DI after prepending 216 217 push si 218 dec di ; DI = Offset to last byte formatted 219 mov si, di 220 add di, ax ; DI = Offset to new location for last byte 221 std 222 eSEG_STR rep, es, movsb 223 224 mov dl, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags] 225 and dx, BYTE FLG_CONTEXT_ATTRIBUTES 226 not dx 227 and di, dx ; WORD alignment when using attributes 228 229 call DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX 230 xchg cx, ax ; CX = Spaces to prepend 147 231 mov al, ' ' 148 232 call DisplayPrint_RepeatCharacterFromALwithCountInCX 149 ; Fall to .PrepareToFormatNextParameter 150 151 ;-------------------------------------------------------------------- 152 ; .PrepareToFormatNextParameter 153 ; Parameters: 154 ; DS: BDA segment (zero) 155 ; SS:BP: Pointer to format parameter 156 ; CS:SI: Pointer to next format string character 157 ; ES:DI: Ptr to cursor location in video RAM 158 ; Returns: 159 ; BP: Adjusted to point next stack parameter 160 ; Jumps to DisplayFormat_ParseCharacters 161 ; Corrupts registers: 162 ; Nothing 163 ;-------------------------------------------------------------------- 164 ALIGN JUMP_ALIGN 165 .PrepareToFormatNextParameter: 166 dec bp 167 dec bp 168 jmp SHORT DisplayFormat_ParseCharacters 169 170 171 ;-------------------------------------------------------------------- 172 ; .JumpToFormatPlaceholder 173 ; Parameters: 174 ; BX: Lookup index for format function 175 ; CX: Number parameter (zero if no number parameter present) 176 ; DS: BDA segment (zero) 177 ; SS:BP: Pointer to next format parameter 178 ; CS:SI: Pointer to next format string character 179 ; ES:DI: Ptr to cursor location in video RAM 180 ; Returns: 181 ; Eventually jumps to DisplayFormat_ParseCharacters 233 cld ; Restore DF 234 235 mov di, bx 236 pop si 237 .NothingToAppendOrPrepend: 238 ret 239 240 241 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 242 ; Formatting functions 243 ; Parameters: 244 ; DS: BDA segment (zero) 245 ; SS:BP: Pointer to next format parameter (-=2 updates to next parameter) 246 ; ES:DI: Ptr to cursor location in video RAM 247 ; Returns: 248 ; SS:BP: Points to last WORD parameter used 182 249 ; Corrupts registers: 183 250 ; AX, BX, DX 184 ;-------------------------------------------------------------------- 185 ALIGN JUMP_ALIGN 186 .JumpToFormatPlaceholder: 187 shl bx, 1 ; Shift for WORD lookup 188 jmp [cs:bx+.rgfnFormatParameter] 189 190 ALIGN JUMP_ALIGN 191 .a_FormatAttributeForNextCharacter: 251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 252 ALIGN JUMP_ALIGN 253 a_FormatAttributeForNextCharacter: 192 254 mov bl, [bp] 193 255 xchg bl, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute] 194 call .ReadCharacterAndTestForNull 195 jz SHORT .Return 196 call DisplayPrint_CharacterFromAL 256 push bx 257 push cx 258 push di 259 call DisplayFormat_ParseCharacters ; Recursive call 260 pop WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition] 261 pop cx 262 pop bx 197 263 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], bl 198 jmp SHORT .UpdateSpacesToAppendAfterPrintingSingleCharacter199 200 ALIGN JUMP_ALIGN 201 .A_FormatAttributeForRemainingString:264 ret 265 266 ALIGN JUMP_ALIGN 267 A_FormatAttributeForRemainingString: 202 268 mov al, [bp] 203 269 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], al 204 jmp SHORT .PrepareToFormatNextParameter 205 206 ALIGN JUMP_ALIGN 207 .d_FormatSignedDecimalWord: 208 mov ax, [bp] 209 call DisplayPrint_SignedDecimalIntegerFromAX 210 jmp SHORT .UpdateSpacesToAppend 211 212 ALIGN JUMP_ALIGN 213 .u_FormatUnsignedDecimalWord: 270 ret 271 272 ALIGN JUMP_ALIGN 273 d_FormatSignedDecimalWord: 214 274 mov ax, [bp] 215 275 mov bx, 10 216 call DisplayPrint_WordFromAXWithBaseInBX 217 jmp SHORT .UpdateSpacesToAppend 218 219 ALIGN JUMP_ALIGN 220 .x_FormatHexadecimalWord: 276 jmp DisplayPrint_SignedWordFromAXWithBaseInBX 277 278 ALIGN JUMP_ALIGN 279 u_FormatUnsignedDecimalWord: 280 mov ax, [bp] 281 mov bx, 10 282 jmp DisplayPrint_WordFromAXWithBaseInBX 283 284 ALIGN JUMP_ALIGN 285 x_FormatHexadecimalWord: 221 286 mov ax, [bp] 222 287 mov bx, 16 223 288 call DisplayPrint_WordFromAXWithBaseInBX 224 inc bx ; Increment character count for 'h'225 289 mov al, 'h' 226 call DisplayPrint_CharacterFromAL 227 jmp SHORT .UpdateSpacesToAppend 228 229 ALIGN JUMP_ALIGN 230 .s_FormatStringFromSegmentCS: 290 jmp DisplayPrint_CharacterFromAL 291 292 ALIGN JUMP_ALIGN 293 s_FormatStringFromSegmentCS: 231 294 xchg si, [bp] 232 295 call DisplayPrint_NullTerminatedStringFromCSSI 233 mov si, [bp] ; Restore SI 234 jmp SHORT .UpdateSpacesToAppend 235 236 ALIGN JUMP_ALIGN 237 .S_FormatStringFromFarPointer: 296 mov si, [bp] 297 ret 298 299 ALIGN JUMP_ALIGN 300 S_FormatStringFromFarPointer: 301 mov bx, [bp-2] 238 302 xchg si, [bp] 239 mov bx, [bp-2]240 303 call DisplayPrint_NullTerminatedStringFromBXSI 241 mov si, [bp] ; Restore SI 242 jmp SHORT .UpdateSpacesToAppendWithDWordParameter 243 244 ALIGN JUMP_ALIGN 245 .c_FormatCharacter: 304 mov si, [bp] 305 dec bp 306 dec bp 307 ret 308 309 ALIGN JUMP_ALIGN 310 c_FormatCharacter: 246 311 mov al, [bp] 247 jmp SHORT .FormatSingleCharacterFromAL 248 249 ALIGN JUMP_ALIGN 250 .t_FormatRepeatCharacter: 312 jmp DisplayPrint_CharacterFromAL 313 314 ALIGN JUMP_ALIGN 315 t_FormatRepeatCharacter: 316 push cx 251 317 mov cx, [bp-2] 252 mov bx, cx253 318 mov al, [bp] 254 319 call DisplayPrint_RepeatCharacterFromALwithCountInCX 255 jmp SHORT .UpdateSpacesToAppendWithDWordParameter 256 257 ALIGN JUMP_ALIGN 258 .percent_FormatPercent: 320 pop cx 321 dec bp 322 dec bp 323 ret 324 325 ALIGN JUMP_ALIGN 326 percent_FormatPercent: 259 327 mov al, '%' 260 inc bp ; Adjust here since... 261 inc bp ; ...no parameter on stack 262 ; Fall to .FormatSingleCharacterFromAL 263 264 ALIGN JUMP_ALIGN 265 .FormatSingleCharacterFromAL: 266 call DisplayPrint_CharacterFromAL 267 jmp .UpdateSpacesToAppendAfterPrintingSingleCharacter 268 269 ALIGN JUMP_ALIGN 270 .UpdateSpacesToAppendWithDWordParameter: 271 dec bp 272 dec bp 273 jmp .UpdateSpacesToAppend 274 275 276 ; Table for converting format character to jump table index 277 .rgcFormatCharToLookupIndex: 278 db "aAduxsSct%" 279 .EndOFrgcFormatCharToLookupIndex: 280 281 ; Jump table 282 ALIGN WORD_ALIGN 283 .rgfnFormatParameter: 284 dw .a_FormatAttributeForNextCharacter 285 dw .A_FormatAttributeForRemainingString 286 dw .d_FormatSignedDecimalWord 287 dw .u_FormatUnsignedDecimalWord 288 dw .x_FormatHexadecimalWord 289 dw .s_FormatStringFromSegmentCS 290 dw .S_FormatStringFromFarPointer 291 dw .c_FormatCharacter 292 dw .t_FormatRepeatCharacter 293 dw .percent_FormatPercent 328 jmp DisplayPrint_CharacterFromAL 329 330 ALIGN JUMP_ALIGN 331 PrepareToPrependParameterWithSpaces: 332 neg cx 333 ; Fall to PrepareToAppendSpacesAfterParameter 334 335 ALIGN JUMP_ALIGN 336 PrepareToAppendSpacesAfterParameter: 337 add sp, BYTE 2 ; Remove return offset 338 jmp ParseFormatSpecifier -
trunk/Assembly_Library/Src/Display/DisplayPrint.asm
r42 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 26.6.2010 4 ; Last update : 18.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for display output. … … 65 65 66 66 ;-------------------------------------------------------------------- 67 ; DisplayPrint_Signed DecimalIntegerFromAX67 ; DisplayPrint_SignedWordFromAXWithBaseInBX 68 68 ; Parameters: 69 69 ; AX: Word to display 70 ; DS: BDA segment (zero) 71 ; ES:DI: Ptr to cursor location in video RAM 72 ; Returns: 73 ; BX: Number of characters printed 74 ; DI: Updated offset to video RAM 75 ; Corrupts registers: 76 ; AX, DX 77 ;-------------------------------------------------------------------- 78 ALIGN JUMP_ALIGN 79 DisplayPrint_SignedDecimalIntegerFromAX: 80 mov bx, 10 81 test ah, 1<<7 ; Sign bit set? 82 jz SHORT DisplayPrint_WordFromAXWithBaseInBX 70 ; BX: Integer base (binary=2, octal=8, decimal=10, hexadecimal=16) 71 ; DS: BDA segment (zero) 72 ; ES:DI: Ptr to cursor location in video RAM 73 ; Returns: 74 ; DI: Updated offset to video RAM 75 ; Corrupts registers: 76 ; AX, DX 77 ;-------------------------------------------------------------------- 78 ALIGN JUMP_ALIGN 79 DisplayPrint_SignedWordFromAXWithBaseInBX: 80 test ax, ax 81 jns SHORT DisplayPrint_WordFromAXWithBaseInBX 83 82 84 83 push ax … … 87 86 pop ax 88 87 neg ax 89 call DisplayPrint_WordFromAXWithBaseInBX 90 inc bx ; Increment character count for '-' 91 ret 92 88 ; Fall to DisplayPrint_WordFromAXWithBaseInBX 93 89 94 90 ;-------------------------------------------------------------------- … … 100 96 ; ES:DI: Ptr to cursor location in video RAM 101 97 ; Returns: 102 ; BX: Number of characters printed103 98 ; DI: Updated offset to video RAM 104 99 ; Corrupts registers: … … 108 103 DisplayPrint_WordFromAXWithBaseInBX: 109 104 push cx 105 push bx 110 106 111 107 xor cx, cx … … 118 114 test ax, ax ; All divided? 119 115 jnz SHORT .DivideLoop ; If not, loop 120 mov dx, cx ; Character count to DX 121 ALIGN JUMP_ALIGN 122 .PrintLoop: 123 pop bx ; Pop digit 124 mov al, [cs:bx+.rgcDigitToCharacter] 125 call DisplayPrint_CharacterFromAL 126 loop .PrintLoop 127 mov bx, dx ; Return characters printed 128 116 117 mov bx, .rgcDigitToCharacter 118 ALIGN JUMP_ALIGN 119 .PrintNextDigit: 120 pop ax ; Pop digit 121 eSEG cs 122 xlatb 123 call DisplayPrint_CharacterFromAL 124 loop .PrintNextDigit 125 126 pop bx 129 127 pop cx 130 128 ret … … 140 138 ; ES:DI: Ptr to cursor location in video RAM 141 139 ; Returns: 142 ; BX: Number of characters printed143 140 ; DI: Updated offset to video RAM 144 141 ; Corrupts registers: … … 147 144 ALIGN JUMP_ALIGN 148 145 DisplayPrint_CharacterBufferFromBXSIwithLengthInCX: 149 push cx 150 151 mov es, bx ; Buffer now in ES:SI 152 xor bx, bx ; Zero character counter 153 jcxz .BufferPrinted 154 ALIGN JUMP_ALIGN 155 .CharacterOutputLoop: 156 mov al, [es:bx+si] 157 inc bx 158 call LoadDisplaySegmentAndPrintCharacterFromAL 159 loop .CharacterOutputLoop 160 .BufferPrinted: 161 mov es, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2] 162 pop cx 146 jcxz .NothingToPrintSinceZeroLength 147 push si 148 push cx 149 150 ALIGN JUMP_ALIGN 151 .PrintNextCharacter: 152 mov ds, bx 153 lodsb 154 LOAD_BDA_SEGMENT_TO ds, dx 155 call DisplayPrint_CharacterFromAL 156 loop .PrintNextCharacter 157 158 LOAD_BDA_SEGMENT_TO ds, dx 159 pop cx 160 pop si 161 .NothingToPrintSinceZeroLength: 163 162 ret 164 163 … … 171 170 ; ES:DI: Ptr to cursor location in video RAM 172 171 ; Returns: 173 ; BX: Number of characters printed174 172 ; DI: Updated offset to video RAM 175 173 ; Corrupts registers: … … 178 176 ALIGN JUMP_ALIGN 179 177 DisplayPrint_NullTerminatedStringFromCSSI: 178 push bx 180 179 mov bx, cs 181 ; Fall to DisplayPrint_NullTerminatedStringFromBXSI 180 call DisplayPrint_NullTerminatedStringFromBXSI 181 pop bx 182 ret 183 182 184 183 185 ;-------------------------------------------------------------------- … … 188 190 ; ES:DI: Ptr to cursor location in video RAM 189 191 ; Returns: 190 ; BX: Number of characters printed191 192 ; DI: Updated offset to video RAM 192 193 ; Corrupts registers: … … 195 196 ALIGN JUMP_ALIGN 196 197 DisplayPrint_NullTerminatedStringFromBXSI: 197 mov es, bx ; String now in ES:SI 198 xor bx, bx ; Zero character counter 199 ALIGN JUMP_ALIGN 200 .CharacterOutputLoop: 201 mov al, [es:bx+si] 202 test al, al 203 jz SHORT .AllCharacterPrinted 204 inc bx 205 206 call LoadDisplaySegmentAndPrintCharacterFromAL 207 jmp SHORT .CharacterOutputLoop 208 ALIGN JUMP_ALIGN 209 .AllCharacterPrinted: 210 mov es, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2] 211 ret 212 213 ;-------------------------------------------------------------------- 214 ; LoadDisplaySegmentAndPrintCharacterFromAL 215 ; Parameters: 216 ; AL: Character to print 217 ; DI: Offset to cursor location in video RAM 218 ; DS: BDA segment (zero) 219 ; Returns: 220 ; DI: Updated offset to video RAM 221 ; Corrupts registers: 222 ; AX, DX 223 ;-------------------------------------------------------------------- 224 ALIGN JUMP_ALIGN 225 LoadDisplaySegmentAndPrintCharacterFromAL: 226 push es 227 mov es, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2] 228 call DisplayPrint_CharacterFromAL 229 pop es 230 ret 231 232 233 ;-------------------------------------------------------------------- 234 ; DisplayPrint_Newline 235 ; Parameters: 236 ; DS: BDA segment (zero) 237 ; ES:DI: Ptr to cursor location in video RAM 238 ; Returns: 239 ; DI: Updated offset to video RAM 240 ; Corrupts registers: 241 ; AX, DX 242 ;-------------------------------------------------------------------- 243 ALIGN JUMP_ALIGN 244 DisplayPrint_Newline: 245 mov al, CR 246 call DisplayPrint_CharacterFromAL 247 mov al, LF 248 jmp SHORT DisplayPrint_CharacterFromAL 198 push si 199 push cx 200 201 xor cx, cx 202 ALIGN JUMP_ALIGN 203 .PrintNextCharacter: 204 mov ds, bx ; String segment to DS 205 lodsb 206 mov ds, cx ; BDA segment to DS 207 test al, al ; NULL? 208 jz SHORT .EndOfString 209 call DisplayPrint_CharacterFromAL 210 jmp SHORT .PrintNextCharacter 211 212 ALIGN JUMP_ALIGN 213 .EndOfString: 214 pop cx 215 pop si 216 ret 249 217 250 218 … … 297 265 .ClearRowLoop: 298 266 mov cl, bl ; Area width now in CX 299 mov al, ' ' ; Clear with space267 mov al, SCREEN_BACKGROUND_CHARACTER 300 268 call DisplayPrint_RepeatCharacterFromALwithCountInCX 301 269 … … 327 295 ALIGN JUMP_ALIGN 328 296 DisplayPrint_RepeatCharacterFromALwithCountInCX: 297 jcxz .NothingToRepeat 298 push cx 299 300 ALIGN JUMP_ALIGN 301 .RepeatCharacter: 329 302 push ax 330 303 call DisplayPrint_CharacterFromAL 331 304 pop ax 332 loop DisplayPrint_RepeatCharacterFromALwithCountInCX 333 ret 305 loop .RepeatCharacter 306 307 pop cx 308 .NothingToRepeat: 309 ret 310 311 312 ;-------------------------------------------------------------------- 313 ; DisplayPrint_Newline 314 ; Parameters: 315 ; DS: BDA segment (zero) 316 ; ES:DI: Ptr to cursor location in video RAM 317 ; Returns: 318 ; DI: Updated offset to video RAM 319 ; Corrupts registers: 320 ; AX, DX 321 ;-------------------------------------------------------------------- 322 ALIGN JUMP_ALIGN 323 DisplayPrint_Newline: 324 mov al, CR 325 call DisplayPrint_CharacterFromAL 326 mov al, LF 327 ; Fall to DisplayPrint_CharacterFromAL 334 328 335 329 -
trunk/Assembly_Library/Src/LibraryTests.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 27.6.2010 4 ; Last update : 15.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Tests for Assembly Library. … … 254 254 mov ax, si 255 255 CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX 256 mov dl, ATTRIBUTES_NOT_USED 256 257 mov ax, BUFFER_OUTPUT_WITH_CHAR_ONLY 257 CALL_DISPLAY_LIBRARY SetChar acterOutputFunctionFromAX258 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL 258 259 lea ax, [si+STRING_BUFFER_SIZE] 259 260 CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX … … 408 409 call PrintHorizontalRuler 409 410 call PrintVerticalRuler 411 412 mov al, COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) 413 CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL 410 414 411 415 mov ax, CURSOR_XY(0, 1) 412 416 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 413 mov al, COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)414 CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL415 417 call PrintFormattedStrings 416 418 … … 494 496 ret 495 497 .szIntegers: 496 db "Integers -32768, -1, 0, 1, 65535: %A|%6 d|%6d|%6d|%6d|%6u|",LF,CR,NULL498 db "Integers -32768, -1, 0, 1, 65535: %A|%6-d|%6-d|%6-d|%6-d|%6-u|",LF,CR,NULL 497 499 498 500 .PrintHexadecimals: … … 508 510 ret 509 511 .szHexadecimals: 510 db "Hexadecimals CACAh, FFFFh, 0, 5A5Ah, A5A5h:%A|%6 x|%6x|%6x|%6x|%6x|",LF,CR,NULL512 db "Hexadecimals CACAh, FFFFh, 0, 5A5Ah, A5A5h:%A|%6-x|%6-x|%6-x|%6-x|%6-x|",LF,CR,NULL 511 513 512 514 .PrintCharacters: -
trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.8.2010 4 ; Last update : 16.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Common functions for many dialogs. … … 291 291 ALIGN JUMP_ALIGN 292 292 .RedrawDialogAreaAndWholeParentWindow: 293 mov al, MONO_NORMAL293 mov al, SCREEN_BACKGROUND_ATTRIBUTE 294 294 CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL 295 295 call MenuLocation_GetTitleBordersTopLeftCoordinatesToAX -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 16.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 148 148 ; Nothing 149 149 ; Corrupts registers: 150 ; AX, CX, SI, DI, DS, ES150 ; AX, CX, DX, SI, DI, DS, ES 151 151 ;-------------------------------------------------------------------- 152 152 ALIGN JUMP_ALIGN … … 171 171 ; Nothing 172 172 ; Corrupts registers: 173 ; AX, CX, D I173 ; AX, CX, DX, DI 174 174 ;-------------------------------------------------------------------- 175 175 ;ALIGN JUMP_ALIGN … … 225 225 ; DI: Updated for next file 226 226 ; Corrupts registers: 227 ; AX, BX, CX 227 ; AX, BX, CX, DX 228 228 ;-------------------------------------------------------------------- 229 229 ALIGN JUMP_ALIGN … … 241 241 ; DI: Updated for next file 242 242 ; Corrupts registers: 243 ; AX, BX, CX 243 ; AX, BX, CX, DX 244 244 ;-------------------------------------------------------------------- 245 245 ;ALIGN JUMP_ALIGN … … 253 253 xchg ax, cx 254 254 CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX 255 mov dl, ATTRIBUTES_NOT_USED 255 256 mov ax, BUFFER_OUTPUT_WITH_CHAR_ONLY 256 CALL_DISPLAY_LIBRARY SetChar acterOutputFunctionFromAX257 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL 257 258 258 259 call .FormatFileOrDirectoryToBufferFromDTAinDSSI -
trunk/Assembly_Library/Src/Menu/Dialog/StringsForDialogs.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.9.2010 4 ; Last update : 16.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Strings used by dialogs. … … 9 9 g_szTimeElapsed: db "Time elapsed :",NULL 10 10 g_szTimeLeft: db "Estimated left:",NULL 11 g_szTimeFormat: db " %2 u min %2u sec",LF,CR,NULL11 g_szTimeFormat: db " %2-u min %2-u sec",LF,CR,NULL 12 12 13 13 ; Strings for File Dialog … … 23 23 24 24 g_szFileFormat: 25 db "%14S %4 u %c%cB",LF,NULL25 db "%14S %4-u %c%cB",LF,NULL 26 26 g_szDirectoryFormat: 27 27 db "[%12S] %s-DIR",LF,NULL -
trunk/Assembly_Library/Src/Menu/MenuBorders.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.7.2010 4 ; Last update : 7.9.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing menu borders. … … 45 45 ; Nothing 46 46 ; Corrupts registers: 47 ; AX, SI, DI47 ; AX, DX, SI, DI 48 48 ;-------------------------------------------------------------------- 49 49 ALIGN JUMP_ALIGN 50 50 MenuBorders_AdjustDisplayContextForDrawingBorders: 51 mov dl, ATTRIBUTES_ARE_USED 51 52 mov ax, MenuCharOut_MenuBorderTeletypeOutputWithAttribute 52 CALL_DISPLAY_LIBRARY SetChar acterOutputFunctionFromAX53 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL 53 54 54 55 mov ax, bp … … 268 269 call MenuAttribute_SetToDisplayContextFromTypeInSI 269 270 271 push dx 272 mov dl, ATTRIBUTES_ARE_USED 270 273 mov ax, FAST_OUTPUT_WITH_ATTRIBUTE_ONLY 271 CALL_DISPLAY_LIBRARY SetCharacterOutputFunctionFromAX 274 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL 275 pop dx 272 276 273 277 call PrintMultipleBorderCharactersFromAL ; AL does not matter -
trunk/Assembly_Library/Src/Menu/MenuText.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 21.7.2010 4 ; Last update : 11.8.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for drawing menu texts by the user. … … 218 218 ; Nothing 219 219 ; Corrupts registers: 220 ; AX, SI, DI220 ; AX, DX, SI, DI 221 221 ;-------------------------------------------------------------------- 222 222 ALIGN JUMP_ALIGN 223 223 AdjustDisplayContextForDrawingTexts: 224 mov dl, ATTRIBUTES_ARE_USED 224 225 mov ax, MenuCharOut_MenuTextTeletypeOutputWithAttribute 225 CALL_DISPLAY_LIBRARY SetChar acterOutputFunctionFromAX226 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInDL 226 227 227 228 mov ax, bp -
trunk/Assembly_Library/Src/Menu/MenuTime.asm
r41 r44 2 2 ; Project name : Assembly Library 3 3 ; Created date : 25.7.2010 4 ; Last update : 13.8.20104 ; Last update : 27.9.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Menu timeouts other time related functions. … … 141 141 ; Nothing 142 142 ; Corrupts registers: 143 ; AX, DX, SI, DI143 ; AX, CX, DX, SI, DI 144 144 ;-------------------------------------------------------------------- 145 145 ALIGN JUMP_ALIGN 146 146 DrawTimeoutInAXoverMenuBorders: 147 xchg dx, ax147 xchg cx, ax 148 148 call MenuBorders_AdjustDisplayContextForDrawingBorders 149 149 call MenuLocation_GetBottomBordersTopLeftCoordinatesToAX … … 154 154 ; .PrintTimeoutStringWithSecondsInDX 155 155 ; Parameters 156 ; DX: Seconds to print156 ; CX: Seconds to print 157 157 ; SS:BP: Ptr to MENU 158 158 ; Returns: … … 166 166 167 167 mov bp, sp 168 call .GetTimeoutAttributeToAXfromSecondsIn DX168 call .GetTimeoutAttributeToAXfromSecondsInCX 169 169 mov si, .szSelectionTimeout 170 170 push ax ; Push attribute 171 push dx ; Push seconds171 push cx ; Push seconds 172 172 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI 173 173 pop bp … … 178 178 db DOUBLE_BOTTOM_LEFT_CORNER 179 179 db DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL 180 db "%AAutoselection in %2 ds",NULL181 182 ;-------------------------------------------------------------------- 183 ; .GetTimeoutAttributeToAXfromSecondsIn DX184 ; Parameters 185 ; DX: Seconds to print180 db "%AAutoselection in %2-ds",NULL 181 182 ;-------------------------------------------------------------------- 183 ; .GetTimeoutAttributeToAXfromSecondsInCX 184 ; Parameters 185 ; CX: Seconds to print 186 186 ; Returns: 187 187 ; AX: Attribute byte for seconds 188 ; DX: Seconds to print188 ; CX: Seconds to print 189 189 ; Corrupts registers: 190 190 ; SI, DI 191 191 ;-------------------------------------------------------------------- 192 192 ALIGN JUMP_ALIGN 193 .GetTimeoutAttributeToAXfromSecondsIn DX:193 .GetTimeoutAttributeToAXfromSecondsInCX: 194 194 mov si, ATTRIBUTE_CHARS.cNormalTimeout 195 cmp dx, BYTE 3195 cmp cx, BYTE 3 196 196 ja SHORT .GetAttributeToAX 197 197 add si, BYTE ATTRIBUTE_CHARS.cHurryTimeout - ATTRIBUTE_CHARS.cNormalTimeout
Note:
See TracChangeset
for help on using the changeset viewer.