'===========================================================================
' Subject: DISPLAY W/INT21H & ANSI.SYS        Date: 08-28-92 (12:55)       
'  Author: Mark Olson                         Code: QB, PDS                
'  Origin: FidoNet QUIK_BAS Echo            Packet: ANSI.ABC
'===========================================================================
'>> there any way to "redirect" them to ANSI.SYS instead of writing the
'>> decoding routines myself?


'All Right I've read a couple of replies and most are correct as far as
'displaying ANSI graphics, but just to throw in my two cents...

'        ANSI graphis is the use of Escape codes to change Text Display
'        Atributes and Display Related functions.  There are several ways
'        of doing this.  The one I have seen here is the use of CON: or
'        the Standard Output Device (Console). There is nothing wrong
'        with that aprroach BUT there is another avenue which access
'        ANSI.SYS Directly Via Interrupt 21h sub-function 40h.

' ----------------------------- Ansi Routine ---------------------------
'       QuickBasic 4.5 & PDS 7.X Modifications
'       Use of Ansi.sys to display Ansi graphics at the current cursor
'       location. Using Int 21H Sub-Function 40H.

DECLARE SUB AnsiWrite (Text$)

'Use   QB.exe  /L    To load the quickbasic library QB.qbl
'Use   QBX.exe /L    To load the PDS 7.X Library   QBX.qbl

'$INCLUDE: 'QB.BI'
' Use $include: QBX.bi for PDS 7.X

DIM SHARED RegsX AS RegTypeX

Esc$ = CHR$(27)        ' Escape Character

Temp$ = ""

White$ = Esc$ + "[0m" + Esc$ + "[37m"
BrYellow$ = Esc$ + "[1m" + Esc$ + "[33m"

Temp$ = White$ + "This is a " + BrYellow$ + "Example " + White$ + "of ANSI!"

CLS

AnsiWrite (Temp$)

' ---------------------------------------------------------------
SUB AnsiWrite (Text$)

        RegsX.ax = &H4000          'AH = 40H
        RegsX.bx = 1               'FILE HANDLE
        RegsX.cx = LEN(Text$)      'Number of Bytes to Write
        RegsX.ds = VARSEG(Text$)   'Segment for the string

        'Use SSEG(Text$) Vice VARSEG(Text$) for PDS 7.1

        RegsX.dx = SADD(Text$)     'Segment offset(address) of string

        CALL InterruptX(&H21, RegsX, RegsX)

END SUB
'------------------------------------------------------------------
