Changeset 47 in xtideuniversalbios for trunk/Assembly_Library/Src/Display


Ignore:
Timestamp:
Oct 4, 2010, 7:22:40 PM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:

Assembly Library:
CGA snow prevention now works when copying strings on formatted printing.

Location:
trunk/Assembly_Library/Src/Display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Display/DisplayCharOut.asm

    r44 r47  
    22; Project name  :   Assembly Library
    33; Created date  :   26.6.2010
    4 ; Last update   :   22.9.2010
     4; Last update   :   4.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for outputting characters to video memory.
     
    169169;       DX:     CGA Status Register Address (3DAh)
    170170;   Returns:
    171 ;       Interrupts disabled
     171;       Nothing
    172172;   Corrupts registers:
    173173;       AL
    174174;--------------------------------------------------------------------
    175175%macro WAIT_UNTIL_SAFE_CGA_WRITE 0
    176     cli             ; Interrupt request would mess up timing
    177176%%WaitUntilNotInRetrace:
    178177    in      al, dx
     
    201200ALIGN JUMP_ALIGN
    202201StosbWithoutCgaSnow:
    203     call    LoadAndVerifyStatusRegisterFromBDA
     202    call    DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA
    204203    jne     SHORT .StosbWithoutWaitSinceUnknownPort
    205204
    206205    mov     ah, al
     206    cli             ; Interrupt request would mess up timing
    207207    WAIT_UNTIL_SAFE_CGA_WRITE
    208208    mov     al, ah
     209.StosbWithoutWaitSinceUnknownPort:
    209210    stosb
    210211    sti
    211212    ret
    212 ALIGN JUMP_ALIGN
    213 .StosbWithoutWaitSinceUnknownPort:
    214     stosb
    215     ret
    216213
    217214ALIGN JUMP_ALIGN
    218215StoswWithoutCgaSnow:
    219     call    LoadAndVerifyStatusRegisterFromBDA
     216    push    bx
     217    call    DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA
    220218    jne     SHORT .StoswWithoutWaitSinceUnknownPort
    221219
    222     push    bx
    223220    xchg    bx, ax
     221    cli             ; Interrupt request would mess up timing
    224222    WAIT_UNTIL_SAFE_CGA_WRITE
    225223    xchg    ax, bx
     224.StoswWithoutWaitSinceUnknownPort:
    226225    stosw
    227226    pop     bx
    228227    sti
    229228    ret
    230 ALIGN JUMP_ALIGN
    231 .StoswWithoutWaitSinceUnknownPort:
    232     stosw
    233     ret
    234 
    235 ;--------------------------------------------------------------------
    236 ; LoadAndVerifyStatusRegisterFromBDA
     229
     230
     231;--------------------------------------------------------------------
     232; DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA
    237233;   Parameters:
    238234;       DS:     BDA segment (zero)
     
    244240;--------------------------------------------------------------------
    245241ALIGN JUMP_ALIGN
    246 LoadAndVerifyStatusRegisterFromBDA:
     242DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA:
    247243    mov     dx, [BDA.wVidPort]
    248244    add     dl, OFFSET_TO_CGA_STATUS_REGISTER
  • trunk/Assembly_Library/Src/Display/DisplayFormat.asm

    r44 r47  
    22; Project name  :   Assembly Library
    33; Created date  :   29.6.2010
    4 ; Last update   :   26.9.2010
     4; Last update   :   4.10.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for displaying formatted strings.
     
    212212    jle     SHORT .NothingToAppendOrPrepend
    213213
    214     mov     bx, di
    215     add     bx, ax              ; BX = DI after prepending
    216 
     214    std
    217215    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;--------------------------------------------------------------------
     244ALIGN JUMP_ALIGN
     245.ReverseMoveCXbytesFromESSItoESDI:
     246%ifdef ELIMINATE_CGA_SNOW
     247    call    DisplayCharOut_LoadAndVerifyStatusRegisterFromBDA
     248    je      SHORT .WaitUntilReadyToMoveNextByte
     249%endif
     250
    222251    eSEG_STR rep, es, movsb
    223252
    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;--------------------------------------------------------------------
     276ALIGN 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
     294ALIGN JUMP_ALIGN
     295.ReversePrintAXspacesStartingFromESDI:
    229296    call    DisplayContext_GetCharacterOffsetToAXfromByteOffsetInAX
    230297    xchg    cx, ax              ; CX = Spaces to prepend
    231298    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
    239301
    240302
Note: See TracChangeset for help on using the changeset viewer.