Changeset 42 in xtideuniversalbios for trunk/Assembly_Library/Src/Display/DisplayPrint.asm


Ignore:
Timestamp:
Sep 18, 2010, 6:04:31 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Display Library no more produces CGA snow.

File:
1 edited

Legend:

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

    r41 r42  
    22; Project name  :   Assembly Library
    33; Created date  :   26.6.2010
    4 ; Last update   :   10.8.2010
     4; Last update   :   18.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Functions for display output.
     
    250250
    251251;--------------------------------------------------------------------
    252 ; DisplayPrint_RepeatCharacterFromALwithCountInCX
    253 ;   Parameters:
    254 ;       AL:     Character to display
    255 ;       CX:     Repeat count
    256 ;       DS:     BDA segment (zero)
    257 ;       ES:DI:  Ptr to cursor location in video RAM
    258 ;   Returns:
    259 ;       DI:     Updated offset to video RAM
    260 ;   Corrupts registers:
    261 ;       AX, DX
    262 ;--------------------------------------------------------------------
    263 ALIGN JUMP_ALIGN
    264 DisplayPrint_RepeatCharacterFromALwithCountInCX:
    265     push    ax
    266     call    DisplayPrint_CharacterFromAL
    267     pop     ax
    268     loop    DisplayPrint_RepeatCharacterFromALwithCountInCX
    269     ret
    270 
    271 
    272 ;--------------------------------------------------------------------
    273 ; DisplayPrint_CharacterFromAL
    274 ;   Parameters:
    275 ;       AL:     Character to display
    276 ;       DS:     BDA segment (zero)
    277 ;       ES:DI:  Ptr to cursor location in video RAM
    278 ;   Returns:
    279 ;       DI:     Updated offset to video RAM
    280 ;   Corrupts registers:
    281 ;       AX, DX
    282 ;--------------------------------------------------------------------
    283 ALIGN JUMP_ALIGN
    284 DisplayPrint_CharacterFromAL:
    285     mov     ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
    286     jmp     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
    287 
    288 
    289 ;--------------------------------------------------------------------
    290252; DisplayPrint_ClearScreen
    291253;   Parameters:
     
    317279;       ES:DI:  Ptr to cursor location in video RAM
    318280;   Returns:
    319 ;       Nothing
     281;       DI:     Updated offset to video RAM
    320282;   Corrupts registers:
    321283;       AX, DX
     
    323285ALIGN JUMP_ALIGN
    324286DisplayPrint_ClearAreaWithHeightInAHandWidthInAL:
     287    push    si
    325288    push    cx
    326289    push    bx
    327     push    di
    328 
    329     xchg    bx, ax                          ; Move parameters to BX
     290
     291    xchg    bx, ax                          ; Area size to BX
    330292    call    DisplayCursor_GetSoftwareCoordinatesToAX
    331     xchg    dx, ax                          ; Coordinates now in DX
    332     xor     cx, cx                          ; Zero CX
    333 
    334 ALIGN JUMP_ALIGN
    335 .ClearRowFromArea:
     293    xchg    si, ax                          ; Software (Y,X) coordinates now in SI
     294    xor     cx, cx
     295
     296ALIGN JUMP_ALIGN
     297.ClearRowLoop:
     298    mov     cl, bl                          ; Area width now in CX
    336299    mov     al, ' '                         ; Clear with space
    337     mov     ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
    338     mov     cl, bl                          ; Area width = WORDs to clear
    339     rep stosw
    340     dec     bh
    341     jz      SHORT .AreaCleared
    342 
    343     inc     dh                              ; Increment row
    344     push    dx
    345     xchg    ax, dx
     300    call    DisplayPrint_RepeatCharacterFromALwithCountInCX
     301
     302    xchg    ax, si                          ; Coordinates to AX
     303    inc     ah                              ; Increment row
     304    mov     si, ax
    346305    call    DisplayCursor_SetCoordinatesFromAX
    347     pop     dx
    348     jmp     SHORT .ClearRowFromArea
    349 
    350 ALIGN JUMP_ALIGN
    351 .AreaCleared:
    352     pop     di
    353     mov     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di
     306    dec     bh                              ; Decrement rows left
     307    jnz     SHORT .ClearRowLoop
     308
    354309    pop     bx
    355310    pop     cx
    356     ret
     311    pop     si
     312    ret
     313
     314
     315;--------------------------------------------------------------------
     316; DisplayPrint_RepeatCharacterFromALwithCountInCX
     317;   Parameters:
     318;       AL:     Character to display
     319;       CX:     Repeat count
     320;       DS:     BDA segment (zero)
     321;       ES:DI:  Ptr to cursor location in video RAM
     322;   Returns:
     323;       DI:     Updated offset to video RAM
     324;   Corrupts registers:
     325;       AX, DX
     326;--------------------------------------------------------------------
     327ALIGN JUMP_ALIGN
     328DisplayPrint_RepeatCharacterFromALwithCountInCX:
     329    push    ax
     330    call    DisplayPrint_CharacterFromAL
     331    pop     ax
     332    loop    DisplayPrint_RepeatCharacterFromALwithCountInCX
     333    ret
     334
     335
     336;--------------------------------------------------------------------
     337; DisplayPrint_CharacterFromAL
     338;   Parameters:
     339;       AL:     Character to display
     340;       DS:     BDA segment (zero)
     341;       ES:DI:  Ptr to cursor location in video RAM
     342;   Returns:
     343;       DI:     Updated offset to video RAM
     344;   Corrupts registers:
     345;       AX, DX
     346;--------------------------------------------------------------------
     347ALIGN JUMP_ALIGN
     348DisplayPrint_CharacterFromAL:
     349    mov     ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
     350    jmp     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
Note: See TracChangeset for help on using the changeset viewer.