Category : Pascal Source Code
Archive   : ANSITP4.ZIP
Filename : ANSI.PAS

 
Output of file : ANSI.PAS contained in archive : ANSITP4.ZIP
Unit Ansi;

Interface

Uses
Crt,Dos;

Type
Str3=String[3];
Str6=String[6];
Str10=String[10];
Str15=String[15];
Str255=String[255];

Procedure Print(Strng:Str255);
Procedure Println(Strng:Str255);
Procedure NLn;
Function Colr(Back,Fore:Byte; Blinkit:Boolean):Str15;
Procedure PrtColr(Back,Fore:Byte; Blinkit:Boolean);
Function GoXY(X,Y:Byte):Str10;
Procedure PrtGoXY(X,Y:Byte);
Function GoRight(Amt:Byte):Str10;
Function GoLeft(Amt:Byte):Str10;
Function GoDown(Amt:Byte):Str10;
Function GoUp(Amt:Byte):Str10;
Procedure PrtGoRight(Amt:Byte);
Procedure PrtGoLeft(Amt:Byte);
Procedure PrtGoDown(Amt:Byte);
Procedure PrtGoUp(Amt:Byte);
Function Cls:Str6;
Procedure PrtCls;

Implementation

Procedure Print(Strng:Str255);
Var
Regs:Registers;
Cnt:Byte;
Begin
For Cnt:=1 to Length(Strng) do
With Regs do begin
DX:=Ord(Strng[Cnt]);
AX:=$200;
MsDos(Regs);
End;
End;

Procedure Println(Strng:Str255);
Begin
Print(Strng+#13+#10);
End;

Procedure NLn;
Begin
Println('');
End;

Function Colr(Back,Fore:Byte; Blinkit:Boolean):Str15;
Var
Tlin:Str15;
Stat:Byte;
P1,P2,P3:Str3;
Const
Colrs:Array[0..7] Of Byte = (0,4,2,6,1,5,3,7);
Begin
Stat:=0;
If Fore>7 then begin
Fore:=Fore-8;
Stat:=1;
End;
Str(Stat,P1);
Str(Colrs[Fore],P2);
Str(Colrs[Back],P3);
Tlin:=#27+'[';
If Blinkit then Tlin:=Tlin+P1+';5'
else Tlin:=Tlin+'0;'+P1;
Tlin:=Tlin+';3'+P2+';4'+P3+'m';
Colr:=Tlin;
End;

Procedure PrtColr(Back,Fore:Byte; Blinkit:Boolean);
Begin
Print(Colr(Back,Fore,Blinkit));
End;

Function GoXY(X,Y:Byte):Str10;
Var
P1,P2:Str3;
Begin
Str(Y,P1);
Str(X,P2);
GoXY:=#27+'['+P1+';'+P2+'f';
End;

Procedure PrtGoXY(X,Y:Byte);
Begin
Print(GoXY(X,Y));
End;


Function GoRight(Amt:Byte):Str10;
Var
P1:Str3;
Begin
Str(Amt,P1);
GoRight:=#27+'['+P1+'C';
End;

Function GoLeft(Amt:Byte):Str10;
Var
P1:Str3;
Begin
Str(Amt,P1);
GoLeft:=#27+'['+P1+'D';
End;

Function GoDown(Amt:Byte):Str10;
Var
P1:Str3;
Begin
Str(Amt,P1);
GoDown:=#27+'['+P1+'B';
End;

Function GoUp(Amt:Byte):Str10;
Var
P1:Str3;
Begin
Str(Amt,P1);
GoUp:=#27+'['+P1+'A';
End;

Procedure PrtGoRight(Amt:Byte);
Var
P1:Str3;
Begin
Str(Amt,P1);
Print(#27+'['+P1+'C');
End;

Procedure PrtGoLeft(Amt:Byte);
Var
P1:Str3;
Begin
Str(Amt,P1);
Print(#27+'['+P1+'D');
End;

Procedure PrtGoDown(Amt:Byte);
Var
P1:Str3;
Begin
Str(Amt,P1);
Print(#27+'['+P1+'B');
End;

Procedure PrtGoUp(Amt:Byte);
Var
P1:Str3;
Begin
Str(Amt,P1);
Print(#27+'['+P1+'A');
End;

Function Cls:Str6;
Begin
Cls:=#27+'[2J';
End;

Procedure PrtCls;
Begin
Print(Cls);
End;

Begin
End.

  3 Responses to “Category : Pascal Source Code
Archive   : ANSITP4.ZIP
Filename : ANSI.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/