Board index » delphi » ansi graphics in turbo pascal

ansi graphics in turbo pascal

        Could someone explain to me how to make simple ansi graphics (like you
would find on a BBS) appear in a DOS turbo pascal program?  How do I make
different colored text?  Please reply via e-mail

Thanks,
Joe
capa...@{*word*104}enet.net

 

Re:ansi graphics in turbo pascal


Quote
Joe Capasso wrote:
>         Could someone explain to me how to make simple ansi graphics (like you
> would find on a BBS) appear in a DOS turbo pascal program?  How do I make
> different colored text?  Please reply via e-mail

You might want to download and check out:

http://pw1.netcom.com/~setech/download/fans203b.zip

You can load and display ANSI images in your TP 6/7 programs without having to
rely on ANSI.SYS being loaded.  It's a fast, complete ANSI engine (ANSI music
not supported).

Quote
> Thanks,
> Joe
> capa...@{*word*104}enet.net

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:ansi graphics in turbo pascal


 ca>         Could someone explain to me how to make simple ansi graphics (like yo
 ca> would find on a BBS) appear in a DOS turbo pascal program?  How do I m
 ca> different colored text?  Please reply via e-mail

i have routines that easiler enable me to change colors by using pipe codes
or telegard color codes:

unit tgcolor;

interface

procedure pwrite(inp:string);
procedure pwriteln(a:string);

implementation

uses crt,mav;

procedure pwrite(inp:string);
var a,
    b,
    a1,
    a2,
    blink  : byte;
    err    : integer;

begin
  a := 1;
  b := 0;
  while a <= length(inp) do
    begin
      blink := 0;
      a1 := 0;
      a2 := 0;
      case inp[a] of
        '`': if ((inp[a+1] in ['0'..'9','A'..'F']) and
                (inp[a+2] in ['0'..'9','A'..'F'])) and
                (a <= length(inp)-2) then
               begin
                 if inp[a+1] in ['0'..'9'] then
                   val(inp[a+1],a1,err)
                 else
                   a1 := ord(inp[a+1]) - 55;

                 if inp[a+2] in ['0'..'9'] then
                   val(inp[a+2],a2,err)
                 else
                   a2 := ord(inp[a+2]) - 55;

                 if a1 >= 8 then
                   begin
                     blink := 128;
                     a1 := a1 - 8;
                   end;

                 textbackground(a1);
                 textcolor(a2 + blink);
                 b := 3;
               end
             else
               begin
                 b := 1;
                 write(inp[a]);
               end;

      '|': if (inp[a+1] in ['0'..'3']) and
              (inp[a+2] in ['0'..'9']) and
              (str2int(inp[a+1] + inp[a+2]) <= 39) and
              (a <= length(inp)-2) then
             begin
               val(inp[a+1] + inp[a+2],a1,err);
               if a1 >= 24 then
                 begin
                   blink := 128;
                   a1 := a1 - 24;
                 end;

               if a1 >= 16 then
                 textbackground(a1-16);

               if a1 <= 15 then
                 textcolor(a1 + blink);
                 b := 3;
             end
           else
             begin
               b := 1;
               write(inp[a]);
             end;
      else
        begin
          b := 1;
          write(inp[a]);
        end;
      end;

      a := a + b;
    end;
end;

procedure pwriteln(a:string);
begin
  pwrite(a);
  writeln;
end;

begin
end.

the maverick - m...@microserve.net - http://xf.home.ml.org

... Classical music is the kind we keep thinking will turn into a tune.

~~~ Telegard/2 v3.09.b17/mL

Re:ansi graphics in turbo pascal


Quote
Joe Capasso (capa...@{*word*104}enet.net) wrote:

:       Could someone explain to me how to make simple ansi graphics (like you
: would find on a BBS) appear in a DOS turbo pascal program?  How do I make
: different colored text?  Please reply via e-mail

       The ANSI editor called THEDRAW came with a
machine language (inline) Turbo Pascal "Uncrunch"
routine that will fill the whole screen with color
using a special compressed THEDRAW file format file
in a procedure.   You use THEDRAW program to create
ANSI files.
       I also wrote a comparable ANSI editor to
create ANSI files with, but it needs the DOS ANSI.SYS
loaded.

       Older versions of Turbo Pascal require a
compiler directive to use ANSI ESCAPE sequences
in a program.
       Without an ANSI editor, you need to learn
the ANSI ESCAPE sequences like Write(Chr(27),'[1;34;43m');

Ken Fischer

---

Re:ansi graphics in turbo pascal


Quote
Ken Fischer wrote:
> [...]
>        The ANSI editor called THEDRAW came with a
> machine language (inline) Turbo Pascal "Uncrunch"
> routine that will fill the whole screen with color
> using a special compressed THEDRAW file format file
> in a procedure.   You use THEDRAW program to create
> ANSI files.

Side note here.  the UNCRUNCH program doesn't acutally display ANSI files.
TheDraw lets you save in a data code format, and UNCRUNCH decodes the data.
Since it stores data as typed constants, it's a bit limited in its
functionality.

Quote
> Ken Fischer

> ---

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:ansi graphics in turbo pascal


Quote
Scott Earnest (setech@_ix.netcom.com) wrote:
: Ken Fischer wrote:

: > [...]
: >        The ANSI editor called THEDRAW came with a
: > machine language (inline) Turbo Pascal "Uncrunch"
: > routine that will fill the whole screen with color
: > using a special compressed THEDRAW file format file
: > in a procedure.   You use THEDRAW program to create
: > ANSI files.
:
: Side note here.  the UNCRUNCH program doesn't acutally display ANSI files.

      Right, the ANSI screen must be saved in THEDRAW
as a special THEDRAW file format, which can be used as
a Turbo Pascal data cunstruct.
      But an existing ANSI screen file must already
exist and be loaded into THEDRAW, or an ANSI screen
must be created within THEDRAW.

: TheDraw lets you save in a data code format, and UNCRUNCH decodes the data.
: Since it stores data as typed constants, it's a bit limited in its
: functionality.

      Right, it's use is in programming fast display
of full color text plane screens.
      Some people like to keep programs as stand alone
without support files, that is what UNCRUNCH is for.
      To display ANSI files, intall ANSI.SYS and type
the file up in DOS, or use the SMILE or SMILEQ program
or one like them.
      In Turbo Pascal, with ANSI.SYS installed, using
the DOS write interrupt will display ANSI files, but
be aware that using ANSI.SYS exposes the keyboard keys
to possible reassignment.

Ken Fischer

---

Re:ansi graphics in turbo pascal


Quote
>      Right, it's use is in programming fast display
>of full color text plane screens.
>      Some people like to keep programs as stand alone
>without support files, that is what UNCRUNCH is for.
>      To display ANSI files, intall ANSI.SYS and type
>the file up in DOS, or use the SMILE or SMILEQ program
>or one like them.
>      In Turbo Pascal, with ANSI.SYS installed, using
>the DOS write interrupt will display ANSI files, but
>be aware that using ANSI.SYS exposes the keyboard keys
>to possible reassignment.

>Ken Fischer

If you want to use Crt and still be able to display ANSI sequences use this
at the beginning of your program:

Assign(Output, ''); { Two single quotes with nothing between }
ReWrite(Output);

Note that the file Output is NOT defined in your program. It's a built-it
text file.

Bean, th...@igateway.com

Other Threads