ANSI Display... 
Author Message
 ANSI Display...

Has anyone got an ANSI display routine that doesn't poke the characters
onto the screen?  I'm in need of a routine that uses LOCATE, COLOR, and
PRINT.

Thanx,
Trevor Osborne



Sat, 21 Oct 2000 03:00:00 GMT  
 ANSI Display...

TCO>Has anyone got an ANSI display routine that doesn't poke the characters
TCO>onto the screen?  I'm in need of a routine that uses LOCATE, COLOR, and
TCO>PRINT.

    I'm not sure what you want but here's some code for positioning the
    ANSI cursor and setting ANSI screen colors. It assumes you have the
    CONSole device driver ANSI.SYS loaded. You can use both SUBs remotely
    provided you also print to the active com port inside the SUBs.

' ------------- CUT HERE ------------------------ CUT HERE ---------------
REM Position ANSI cursor and set ANSI screen colors.

DEFINT A-Z  ' all untyped variables will now default to type integer
DECLARE SUB MoveCursor (X%, Y%)
DECLARE SUB SetColors (FG%, BG%, Attr%)

ESC$ = CHR$(27)                        ' ESC code
CRLF$ = CHR$(13) + CHR$(10)            ' Carriage return-line feed pair
Cleer$ = CHR$(27) + "[2J"              ' Clear ANSI screen code
Blink$ = CHR$(27) + "[5;1m"            ' Blink ANSI color
Reset$ = CHR$(27) + "[0m"              ' Reset ANSI color to white on black

OPEN "CONS:" FOR OUTPUT AS #1          ' Open CONSole device for output

PRINT #1, Cleer$                       ' Clear the screen
FG% = 33     ' bright yellow
BG% = 40     ' black background
Attr% = 1    ' bright
CALL SetColors(FG%, BG%, Attr%)

X% = 12      ' screen line 12
Y% = 32      ' screen column 32
CALL MoveCursor(X%, Y%)   ' and position screen cursor
PRINT #1, "Hello World!"  ' Display a message
PRINT #1, Reset$          ' Reset ANSI screen colors to drab white on black
CLOSE #1                  ' Close CONSole device
END                       ' End of main program

REM Position cursor on local screen
SUB MoveCursor (X%, Y%)
 Move$ = CHR$(27) + "[" + LTRIM$(STR$(X%)) + ";" + LTRIM$(STR$(Y%)) + "H"
 PRINT #1, Move$;
END SUB

REM Set ANSI screen colors
REM FG% = foreground color, BG% = background color, Attr% = attribute
REM
' Possible values for attribute (Attr%):
'
'   0      All attributes off (resets everything)
'   1      High intensity (bright\bold) on
'   4      Underline on (mono screens only; blue otherwise)
'   5      Blink on
'   7      Reverse video on (black on white)
'   8      "Cancelled" (invisible)
'
' Possible ANSI color values:
'
' Color      Background (BG%)    Foreground (FG%)
' Black          40                  30
' Red            41                  31
' Green          42                  32
' Yellow         43                  33
' Blue           44                  34
' Magenta        45                  35
' Cyan           46                  36
' White          47                  37
'
SUB SetColors (FG%, BG%, Attr%)
 Text$ = CHR$(27) + "[" + LTRIM$(STR$(Attr%)) + ";" + LTRIM$(STR$(BG%))
 Text$ = Text$ + ";" + LTRIM$(STR$(FG%)) + "m"
 PRINT #1, Text$;                  ' display ANSI on the screen
END SUB
' ------------- CUT HERE ------------------------ CUT HERE ---------------

Hope that helps. Good luck!

-Robert Fortune

 * OLX 2.1 TD * ..."Bummer!" said Pooh realizing his scanner was fried.



Sat, 21 Oct 2000 03:00:00 GMT  
 ANSI Display...


Quote:

>Has anyone got an ANSI display routine that doesn't poke the characters
>onto the screen?  I'm in need of a routine that uses LOCATE, COLOR, and
>PRINT.

>Thanx,
>Trevor Osborne

  I wrote a ANSI routine a long time ago in C.   Don't remember how I did it.
I t was for a ANSI.SYS replacement driver I wrote.  It does many graphical
things and sound and even has some commands for GUIs in dos.   If you want to
check it out for whatever reason it's PD now.  Just go to www.hotfiles.com
then type in   CONDOR  in the search box.  It's the latest version but it
may be the one with a minor bug in the included paint program.  There was
a 7B release.  Oh it supports several different screen modes text and graphics
not just the 640x480 16 as stated in the description.  Take a look at it I worked
{*filter*} that thing.

...Larry



Mon, 23 Oct 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ansi display

2. displaying ANSI scree

3. displaying ANSI screens

4. How Display ANSI Text in textbox

5. Display ANSI-Codes in VB

6. Displaying ANSI

7. How do I display ANSI text?

8. How do I display ANSI text?

9. ANSI Characters without loading ANSI.SYS

10. Ansi Art without Ansi.SYS

11. Linking ANSI-Text-File to ACC97

12. Translation ANSI to ASCII

 

 
Powered by phpBB® Forum Software