Changeset 44 in xtideuniversalbios for trunk/Assembly_Library/Src/Display/DisplayPrint.asm
- Timestamp:
- Sep 27, 2010, 7:23:36 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.