'===========================================================================
' Subject: PRINT CHARACTER                    Date: 10-25-99 (18:05)       
'  Author: Randall L. Glass                   Code: PB                     
'  Origin: rlglass@yahoo.com                Packet: PB.ABC
'===========================================================================
'----------------------------------------------------------------------------
'
'                                  PrintChar
'                               BY Randall Glass
'                                Copyright 1999
'
'----------------------------------------------------------------------------
' FREEWARE
'
' You may use this as long as you give me credit somewhere in the documentation
'
' Email rlglass@yahoo.com
'
'--------------------------------------------------------------------------

IF(PBVScreenCARD AND 1) = 0 THEN
      ScreenSegment?? = 47104       '&HB800          'color monitor
ELSE
      ScreenSegment?? = 45056       '&HB000          'mono monitor
END IF

SUB PrintAtr(byval Row%, byval Col%,ByVal LineWidth%, byval Attr%)
ScreenSeg??  = ScreenSegment??
!           push    ds              ;save the good stuff
!           mov     ax,Row%         ; get the row
!           dec     al              ; convert row to zero base
!           mov     bl,80           ; get the number of cols
!           mul     bl              ; multiply # of cols * rows
!           add     ax,Col%         ; add the column
!           dec     al              ; convert column to zero base
!           mov     di,ax           ; offset within video page
!           shl     di,1            ; account for color/attribute
!           mov     es,ScreenSeg??  ;put video segment into ax
!           mov     ah,Attr%        ;the color attribute will be needed
!           mov     cx,LineWidth%
forloop:
!           inc     di              ;increment to the next vidram position
!           mov     es:[di],ah      ;poke the attribute into vidram
!           inc     di
!           loop    forloop         ;loop until cx = 0
!           pop     ds
END SUB

SUB PrintVertChars(byval Row%, byval Col%,BYVAL Rows%,BYVAL CharVal?, byval Attr?)
ScreenSeg??  = ScreenSegment??
!       push        ds              ;save the good stuff
!       push        di              ;because we're gonna destroy it
!       push        si
!       mov         ax,Row%         ; get the row
!       dec         al              ; convert row to zero base
!       mov         bl,80           ; get the number of cols
!       mul         bl              ; multiply # of cols * rows
!       add         ax,Col%         ; add the column
!       dec         al              ; convert column to zero base
!       mov         di,ax           ; offset within video page
!       shl         di,1            ; account for color/attribute
!       mov         es,ScreenSeg??  ;put video segment into es
!       mov         ah,Attr?        ;the color attribute will be needed
!       mov         al,CharVal?
!       mov         cx,Rows%
forloop2:
!       mov         es:[di],al	;poke the attribute into vidram
!       inc         di              ;increment to the next vidram position
!       mov         es:[di],ah	;poke the attribute into vidram
!       add         DI,159
!       inc         si              ;increment to the next string position
!       loop        forloop2		;loop until cx = 0

END SUB

SUB PrintvertAtrs(byval Row%, byval Col%,BYVAL SWidth%, byval Attr?)
ScreenSeg??  = ScreenSegment??

!       push        ds              ;save the good stuff
!       push        di              ;because we're gonna destroy it
!       push        si
!       mov         ax,Row%         ; get the row
!       dec         al              ; convert row to zero base
!       mov         bl,80           ; get the number of cols
!       mul         bl              ; multiply # of cols * rows
!       add         ax,Col%         ; add the column
!       dec         al              ; convert column to zero base
!       mov         di,ax           ; offset within video page
!       shl         di,1            ; account for color/attribute
!       mov         es,ScreenSeg??    ;put video segment into es
!       mov         ah,Attr?            ;the color attribute will be needed
!       mov         cx,SWidth%
!       inc         di                  ;increment to the next vidram position
forloop3:
!       mov         es:[di],ah          ;poke the attribute into vidram
!       ADD         di,160
!       loop        forloop3             ;loop until cx = 0
!       pop         si                  ;restore the good stuff
!       pop         di
!       pop         ds

END SUB
