Changeset 47 in xtideuniversalbios for trunk/Assembly_Library/Src/Display/DisplayFormat.asm
- Timestamp:
- Oct 4, 2010, 7:22:40 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Display/DisplayFormat.asm
r44 r47 2 2 ; Project name : Assembly Library 3 3 ; Created date : 29.6.2010 4 ; Last update : 26.9.20104 ; Last update : 4.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for displaying formatted strings. … … 212 212 jle SHORT .NothingToAppendOrPrepend 213 213 214 mov bx, di 215 add bx, ax ; BX = DI after prepending 216 214 std 217 215 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 216 217 lea si, [di-1] ; SI = Offset to last byte formatted 218 add di, ax ; DI = Cursor location after preceeding completed 219 push di 220 dec di ; DI = Offset where to move last byte formatted 221 xchg bx, ax ; BX = BYTEs to prepend 222 call .ReverseMoveCXbytesFromESSItoESDI 223 xchg ax, bx 224 call .ReversePrintAXspacesStartingFromESDI 225 226 pop di 227 pop si 228 cld ; Restore DF 229 .NothingToAppendOrPrepend: 230 ret 231 232 ;-------------------------------------------------------------------- 233 ; .ReverseMoveCXbytesFromESSItoESDI 234 ; Parameters: 235 ; CX: Number of bytes to move 236 ; DS: BDA segment (zero) 237 ; ES:SI: Ptr to source in video RAM 238 ; ES:DI: Ptr to destination in video RAM 239 ; Returns: 240 ; DI: Offset to character preceeding string just moved 241 ; Corrupts registers: 242 ; AX, CX, DX, SI 243 ;-------------------------------------------------------------------- 244 ALIGN JUMP_ALIGN 245 .ReverseMoveCXbytesFromESSItoESDI: 246 %ifdef ELIMINATE_CGA_SNOW 247 call DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA 248 je SHORT .WaitUntilReadyToMoveNextByte 249 %endif 250 222 251 eSEG_STR rep, es, movsb 223 252 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 253 %ifdef ELIMINATE_CGA_SNOW 254 jmp SHORT .AlignDIforFirstPreceedingSpace 255 .WaitUntilReadyToMoveNextByte: 256 cli ; Interrupt request would mess up timing 257 WAIT_UNTIL_SAFE_CGA_WRITE 258 .MovsbWithoutWaitSinceUnknownPort: 259 eSEG es 260 movsb 261 sti 262 loop .WaitUntilReadyToMoveNextByte 263 %endif 264 ; Fall to .AlignDIforFirstPreceedingSpace 265 266 ;-------------------------------------------------------------------- 267 ; .AlignDIforFirstPreceedingSpace 268 ; Parameters: 269 ; DS: BDA segment (zero) 270 ; ES:DI: Byte offset before last byte moved 271 ; Returns: 272 ; DI: Offset to space preceeding moved string 273 ; Corrupts registers: 274 ; AX 275 ;-------------------------------------------------------------------- 276 ALIGN JUMP_ALIGN 277 .AlignDIforFirstPreceedingSpace: 278 mov al, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags] 279 and ax, BYTE FLG_CONTEXT_ATTRIBUTES 280 not ax 281 and di, ax 282 ret 283 284 ;-------------------------------------------------------------------- 285 ; .ReversePrintAXspacesStartingFromESDI 286 ; Parameters: 287 ; AX: Number of spaces to print 288 ; DS: BDA segment (zero) 289 ; ES:DI: Ptr to destination in video RAM 290 ; Returns: 291 ; DI: Updated 292 ; Corrupts registers: 293 ; AX, CX, DX 294 ALIGN JUMP_ALIGN 295 .ReversePrintAXspacesStartingFromESDI: 229 296 call DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX 230 297 xchg cx, ax ; CX = Spaces to prepend 231 298 mov al, ' ' 232 call DisplayPrint_RepeatCharacterFromALwithCountInCX 233 cld ; Restore DF 234 235 mov di, bx 236 pop si 237 .NothingToAppendOrPrepend: 238 ret 299 jmp DisplayPrint_RepeatCharacterFromALwithCountInCX 300 239 301 240 302
Note:
See TracChangeset
for help on using the changeset viewer.