{********************************************************************}
{   Turbo Pascal V.7.0 by Borland International Copyright (c) 1992   }
{                                                                    }
{       * * * Speiser`s Techno-Tool-Unit for everybody * * *         }
{                                                                    }
{            by Dipl.-Ing. Thomas Speiser Copyright 1998             }
{********************************************************************}

{$O+,F+}
Unit Techno;

Interface

Uses Graph ,Crt, Bgidriv, BGIfont;

Type
  cursfeld=Array[0..1,0..15] Of Word;

Const
  Copyright = 'Techno-Tool-Unit by Dipl.-Ing. Thomas Speiser Software-Programmer Copyright 1998';
  Bgidir    = 'C:\THOMAS\PROGRAM\TP\BGI';
  Info      = 'by Dipl.-Ing. Thomas Speiser Software-Programmer Copyright MXMVIII';

  c0:cursfeld=(($9FFF,$8FFF,$87FF,$83FF,$81FF,$80FF,$807F,$803F,
            $801F,$800F,$80FF,$887F,$987F,$FC3F,$FC3F,$FE3F),
            ($0000,$2000,$3000,$3800,$3C00,$3E00,$3F00,$3F80,
            $3FC0,$3E00,$3600,$2300,$0300,$0180,$0180,$0000)); {Maus}

  c1:cursfeld=(($F3FF,$E1FF,$E1FF,$E1FF,$E1FF,$E049,$E000,$E000,
            $8000,$0000,$0000,$0000,$0000,$0000,$0000,$8001),
            ($0000,$0C00,$0C00,$0C00,$0C00,$0C00,$0DB6,$0DB6,
            $0DB6,$6DB6,$6FFE,$6FFE,$7FFE,$7FFE,$7FFE,$0000)); {Handy}

  c2:cursfeld=(($0000,$0000,$0000,$C003,$E007,$F00F,$F81F,$FC3F,
            $FC3F,$F81F,$F00F,$E007,$C003,$0000,$0000,$0000),
            ($0000,$7FFE,$0000,$1FF8,$0FF0,$0000,$0000,$0000,
            $0180,$03C0,$07E0,$0E70,$1818,$0000,$7FFE,$0000)); {Clock}

  c3:cursfeld=(($81C0,$83E0,$83E0,$81C0,$8080,$B006,$F80F,$F80F,
            $F80F,$B006,$8080,$81C0,$83E0,$83E0,$81C0,$FFFF),
            ($0000,$380E,$380E,$3C1E,$0E38,$0770,$03E0,$03E0,
            $03E0,$0770,$0E38,$3C1E,$380E,$380E,$0000,$0000)); {Cross}

  c4:cursfeld=(($FE1F,$F01F,$0000,$0000,$0000,$F01F,$FE1F,$FFFF,
            $FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF),
            ($0000,$00C0,$07C0,$7FFE,$07C0,$00C0,$0000,$0000,
            $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000)); {Arrow}

  Center: Boolean = False;
  CenterX: Boolean = False;
  Done: Boolean = False;
  Back  = 1;
  First = 2;

 alt_y = #21; alt_x = #45; alt_c = #46; alt_v = #47; alt_b = #48; alt_n = #49; alt_m = #50;
 alt_a = #30; alt_s = #31; alt_d = #32; alt_f = #33; alt_g = #34; alt_h = #35; alt_j = #36; alt_k = #37; alt_l = #38;
 alt_q = #16; alt_w = #17; alt_e = #18; alt_r = #19; alt_t = #20; alt_z = #44; alt_u = #22; alt_i = #23; alt_o = #24;
 alt_p = #24;

{ »Tastenkombination [Ctrl] + [Break] gedrckt« }

  SaveInt09:  Pointer = nil;
  SysErrorFunc: Boolean = False;
  CtrlBreakHit: Boolean = False;
  SaveCtrlBreak: Boolean = False;
  SysErrActive: Boolean = False;

Var Out: String;
    p: array[1..10] of pointer;
    m1,m2,m3,m4 : Word;
    Rest,i,l,n: integer;
    Left,Right,Rise,BKGraph: boolean;
    Ch: Char;
    count: word;

PROCEDURE Button(x1,y1,x2: Integer;Info:string;i:integer);
PROCEDURE WinGraph(x1,y1,x2,y2: Integer;Info:string);
PROCEDURE RecGraph(x1,y1,x2,y2: Integer);
PROCEDURE WriteText(x1,y1: Integer;Info: string);
PROCEDURE WaitGraph;
PROCEDURE LineGraph(x1,y1,x2: Integer;text: string);
PROCEDURE Link(GraphDriver: integer);
PROCEDURE MouseGraph;
PROCEDURE MouseReset;
PROCEDURE BKcolor(s,col:integer);
PROCEDURE Box(x1,y1: Integer);
PROCEDURE MouseWindow(x1,y1,x2,y2:Word);
PROCEDURE MouseOFF;
PROCEDURE Mouse;
PROCEDURE Handy;
PROCEDURE Clock;
PROCEDURE Cross;
PROCEDURE Arrow;
PROCEDURE MouseON;
PROCEDURE Keys;
PROCEDURE MouseData;
PROCEDURE Screen(x1,y1,x2,y2: Integer);
PROCEDURE InitSysError;
PROCEDURE DoneSysError;
FUNCTION Board(Info: string;var taste:char): boolean;
PROCEDURE Put(x1,y1,x2,y2: Integer);
FUNCTION Splitline(Info: string;var st:string):boolean;

{Delphi 3 Konvertierungs - Proceduren}
FUNCTION IntToStr(Int: Integer):STRING;
FUNCTION StrToInt(Str: STRING): Integer;

Implementation

VAR size: array[1..10] of word;

{$L SYSINT.OBJ}

PROCEDURE InitSysError; external;
PROCEDURE DoneSysError; external;

PROCEDURE Maus; ASSEMBLER;
ASM
  MOV AX,m1
  MOV BX,m2
  MOV CX,m3
  MOV DX,m4
  INT $33
  MOV m1,AX
  MOV m2,BX
  MOV m3,CX
  MOV m4,DX
END;

PROCEDURE LESc1; ASSEMBLER;
ASM
  MOV AX,SEG(c1)
  MOV ES,AX
END;

PROCEDURE MausDa(nr:Word);
Inline($58/$cd/$33);

PROCEDURE CLEAR;
BEGIN
  MEM[$0040:$001A]:=MEM[$0040:$001C];
END;

PROCEDURE Put(x1,y1,x2,y2: Integer);
BEGIN
IF Center = true then begin
x1:=(GetmaxX-x2) div 2; y1:=(GetmaxY-y2) div 2; end;
IF CenterX = true then begin
x1:=(GetmaxX-x2) div 2; end;

MausDa(2);
PutImage(x1, y1, P[count]^, NormalPut);
FreeMem(P[count], Size[count]);
MausDa(1);
Dec(count);
Center:=false;
CenterX:=false;
END;

PROCEDURE Screen(x1,y1,x2,y2: Integer);
BEGIN
IF Center = true then begin
x1:=(GetmaxX-x2) div 2; y1:=(GetmaxY-y2) div 2;
x2:=x1+x2; y2:=y1+y2; end;
IF CenterX = true then begin
x1:=(GetmaxX-x2) div 2; x2:=x1+x2; end;

inc(count);
if count = 10 then count:=1;
MausDa(2);
Size[count]:=ImageSize(x1,y1,x2,y2);
GetMem(P[count], Size[count]);
GetImage(x1,y1,x2,y2,P[count]^);
MausDa(1);
END;

PROCEDURE Mouse;
BEGIN
  MausDa(2);
  m1:=9; m2:=5; m3:=0; m4:=Ofs(c0);
  LESc1; Maus;
  MausDa(1);
  MouseWindow(4,0,GetMaxX-6,GetMaxY-15);
END;

PROCEDURE Handy;
BEGIN
  MausDa(2);
  m1:=9; m2:=5; m3:=0; m4:=Ofs(c1);
  LESc1; Maus;
  MausDa(1);
  MouseWindow(5,0,GetMaxX-10,GetMaxY-15);
END;

PROCEDURE Clock;
BEGIN
  MausDa(2);
  m1:=9; m2:=5; m3:=0; m4:=Ofs(c2);
  LESc1; Maus;
  MausDa(1);
  MouseWindow(5,0,GetMaxX-10,GetMaxY-15);
END;

PROCEDURE Cross;
BEGIN
  MausDa(2);
  m1:=9; m2:=5; m3:=0; m4:=Ofs(c3);
  LESc1; Maus;
  MausDa(1);
  MouseWindow(4,0,GetMaxX-10,GetMaxY-14);
END;

PROCEDURE Arrow;
BEGIN
  MausDa(2);
  m1:=9; m2:=5; m3:=0; m4:=Ofs(c4);
  LESc1; Maus;
  MausDa(1);
  MouseWindow(5,0,GetMaxX-10,GetMaxY-6);
END;

PROCEDURE Keys;
BEGIN
CH:=#1;
END;

PROCEDURE Button(x1,y1,x2: Integer;Info:string;i:integer);
VAR
V,width: integer;
t: string;
BEGIN
Left:=false;
Right:=false;

IF (m3>x1) AND (m3<x2) AND (m4>y1) AND (m4<y1+30) then begin
MausDa(2);
if info <> '' then begin
setcolor(white);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);

if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(white);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t);
end;
MausDa(1); end
else begin
MausDa(2);
setcolor(0);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);

if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(0);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t);
MausDa(1);
end;

IF (i = Back) then begin
MausDa(2);
setcolor(0);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
setcolor(darkgray);
line(x2+1, y1, x2+1,y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(white);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(lightgray);
line(x1, y1, x2+1, y1);
line(x1, y1, x1, y1+31);
if info <> '' then begin
setcolor(black);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);
if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(black);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t); end;
MausDa(1);
end;

IF (i = First) then begin
MausDa(2);
setfillstyle(1,LIGHTGRAY);
bar(x1,y1,x2,y1+30);
if info <> '' then begin
setcolor(black);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);
if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(black);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t);
end;

setcolor(white);
line(x1, y1, x2, y1);
line(x1, y1, x1, y1+30);
setcolor(darkgray);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(0);
line(x2+1, y1, x2+1, y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(lightgray);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
MausDa(1);
end;

IF (m2 = 1) AND (m3>x1) AND (m3<x2) AND (m4>y1) AND (m4<y1+30) then begin
MausDa(2);
setcolor(0);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
setcolor(darkgray);
line(x2+1, y1, x2+1,y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(white);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(lightgray);
line(x1, y1, x2+1, y1);
line(x1, y1, x1, y1+31);
MausDa(1);
Delay(320);
MausDa(2);
if info <> '' then begin
setcolor(black);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);

if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(black);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t);
end;

setcolor(white);
line(x1, y1, x2, y1);
line(x1, y1, x1, y1+30);
setcolor(darkgray);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(0);
line(x2+1, y1, x2+1, y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(lightgray);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
Mausda(1);
m2:=0;Left:=true;
end;

IF (m2 = 2) AND (m3>x1) AND (m3<x2) AND (m4>y1) AND (m4<y1+30) then begin
MausDa(2);
setcolor(0);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
setcolor(darkgray);
line(x2+1, y1, x2+1,y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(white);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(lightgray);
line(x1, y1, x2+1, y1);
line(x1, y1, x1, y1+31);
Mausda(1);
Delay(320);
MausDa(2);
if info <> '' then begin
setcolor(black);
settextstyle(2,horizdir,5);
t:=info;
v:=pos('°',t);
delete(t,v,1);
Width:=Textwidth(t);
Moveto((x2-Width) div 2 + x1 div 2,Y1+6);

if v <> 0 then begin
t:=copy(info,1,v-1);
outtext(t);
t:=copy(info,v+1,1);
setcolor(lightgreen);
outtext(t);
setcolor(black);
t:=copy(info,V+2,length(Info));
outtext(t);
end else outtext(t);end;

setcolor(white);
line(x1, y1, x2, y1);
line(x1, y1, x1, y1+30);
setcolor(darkgray);
line(x2, y1, x2, y1+30);
line(x1, y1+30, x2, y1+30);
setcolor(0);
line(x2+1, y1, x2+1, y1+30);
line(x1, y1+30+1, x2+1, y1+30+1);
setcolor(lightgray);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y1+30-1);
Mausda(1);
m2:=0;Right:=true;
end;

end;

PROCEDURE WinGraph(x1,y1,x2,y2: Integer;Info: string);
var s: string;
BEGIN
IF Center = true then begin
x1:=(GetmaxX-x2) div 2; y1:=(GetmaxY-y2) div 2;
x2:=x1+x2; y2:=y1+y2; end;

IF CenterX = true then begin
x1:=(GetmaxX-x2) div 2; x2:=x1+x2; end;

MausDa(2);
setfillstyle(1,LIGHTGRAY);
bar(x1,y1,x2,y2);

setcolor(white);
line(x1, y1, x2, y1);
line(x1, y1, x1, y2);
setcolor(0);
line(x2, y1, x2, y2);
line(x1, y2, x2, y2);
setcolor(darkgray);
line(x2-1, y1, x2-1, y2-1);
line(x1, y2-1, x2-1, y2-1);

setfillstyle(9,blue);
bar(x1+4,y1+4,x2-5,y1+21);

if Info <> '' then begin
setcolor(white);
settextstyle(2,horizdir,5);
outtextxy(x1+9,y1+4,Info);
settextstyle(2,horizdir,2);
str(count,s);
outtextxy(x2-10,y1+4,s);
end;
Setcolor(white);
outtextxy(x2-39,y2-10,'T. Speiser');
MausDa(1);
Center:=false;
CenterX:=false;
end;

PROCEDURE RecGraph(x1,y1,x2,y2: Integer);
BEGIN
IF Center = true then begin
x1:=(GetmaxX-x2) div 2; y1:=(GetmaxY-y2) div 2;
x2:=x1+x2; y2:=y1+y2; end;
IF CenterX = true then begin
x1:=(GetmaxX-x2) div 2; x2:=x1+x2; end;

MausDa(2);
setcolor(darkgray);
line(x1, y1, x2, y1);
line(x1, y1, x1, y2);
setcolor(white);
line(x2, y1, x2, y2);
line(x1, y2, x2, y2);
setcolor(0);
line(x1+1, y1+1, x2-1, y1+1);
line(x1+1, y1+1, x1+1, y2-1);
MausDa(1);
Center:=false;
CenterX:=false;
end;

PROCEDURE WriteText(x1,y1: Integer;Info: string);
BEGIN
IF Center = true then begin
x1:=(GetmaxX-Textwidth(info)) div 2; y1:=GetmaxY div 2; end;
IF CenterX = true then begin
x1:=(GetmaxX-Textwidth(info)) div 2; end;

MausDa(2);
outtextxy(x1,y1,Info);
MausDa(1);
end;

PROCEDURE WaitGraph;
BEGIN
Repeat
Until Keypressed;
ReadKey;
end;

PROCEDURE LineGraph(x1,y1,x2: Integer;text: string);
var taste:char;
    zeichen : string;
    I,x3,x: integer;
    laenge,l2,posi: byte;
    Done: Boolean;
BEGIN
CLEAR;
MausDa(2);
setfillstyle(1,white);
bar(x1,y1,x2,y1+20);
settextstyle(0,horizdir,1);
Setcolor(lightgray);
rectangle(x1+1,y1+1,x2-1,y1+19);
Setcolor(0);
rectangle(x1-1,y1-1,x2+1,y1+21);
Inc(y1,6);
Inc(x1,8);
x:=x1;
x3:=x2-x1;
moveto(x1,y1);
Done:=False;

laenge:=0;

if (text = 'code') OR (text = '') then begin end else
begin l2:=length(text);
FOR i:=1 TO l2 DO begin
Inc(laenge);
zeichen[laenge]:=text[i]; end;

for i:=1 to l2 do begin
moveto(x1,y1);
Outtext(zeichen[i]);inc(x1,8); end; end;
MausDa(1);

if BKGraph = false then begin
MausDa(2);
OutText('_');
MausDa(1);
posi:=laenge;
repeat
taste:=readkey;
case taste of

#0:
begin
taste:=readkey;
case taste of
#77: begin {RIGHT}
If x1 < x+8*(laenge) THEN BEGIN
inc(posi);
SetColor(white);
MoveTo(X1,Y1); OutText('_');
inc(x1,8);
SetColor(0);
MoveTo(X1,Y1); OutText('_');
MoveTo(X1-8,Y1); OutText(zeichen[posi]);
end;
end;

#75: begin {LEFT}
If x1 <> x THEN BEGIN
Dec(posi);
SetColor(white);
MoveTo(X1,Y1); OutText('_');
Dec(x1,8);
SetColor(0);
MoveTo(X1,Y1); OutText('_');
If x1 < x+8*(laenge)-8 THEN BEGIN MoveTo(X1+8,Y1); OutText(zeichen[posi+2]); end;
end;
end;

#71: begin {POS 1}
SetColor(white);  MoveTo(X1,Y1); OutText('_');
                  MoveTo(X1,Y1); OutText(zeichen[posi]); x1:=x; posi:=0;
SetColor(0);      MoveTo(X1,Y1); OutText('_'); end;

#79: begin {ENDE}
SetColor(white);  MoveTo(X1,Y1); OutText('_');
                  x1:=x+8*(laenge); posi:=laenge;
SetColor(0);      MoveTo(X1,Y1); OutText('_'); end;

end;
end;

'a'..'z','A'..'Z','0'..'9','!'..'?','\','_','„','”','','Ž','š','™','ß':

BEGIN
MausDa(2);
If x1 < x2-16 THEN BEGIN
Inc(posi);
if text = 'code' then begin
SetColor(white);  MoveTo(X1,Y1); OutText('_');
SetColor(0);      MoveTo(X1,Y1); OutText('*');
OutText('_');
end
else begin
SetColor(white);  MoveTo(X1,Y1); OutText('_');
                  MoveTo(X1,Y1); OutText(zeichen[posi]);
SetColor(0);      MoveTo(X1,Y1); OutText(taste);
OutText('_'); end;
if x1 >= x+(8*laenge) then Inc(laenge);
zeichen[posi]:=taste;
Inc(x1,8);
end;
MausDa(1);
end;

#8: {BACK}
Begin
MausDa(2);
if x1 <> x THEN BEGIN
Dec(x1,8);
if text = 'code' then begin
SetColor(white); if x1 < x2-16 then begin
                  MoveTo(X1+8,Y1); OutText('_'); end;
                  MoveTo(X1,Y1); OutText('*');
Setcolor(0);MoveTo(X1,Y1);OutText('_');
end
else begin
SetColor(white); if x1 < x2-16 then begin
                  MoveTo(X1+8,Y1); OutText('_'); end;
                  MoveTo(X1,Y1); OutText(zeichen[posi]);
SetColor(0);MoveTo(X1,Y1);OutText('_');end;
zeichen[posi]:=' ';
Dec(posi);
if x1 >= x+8*(laenge)-8 then dec(laenge);
end;
MausDa(1);
END;

#32: {SPACE}
begin MausDa(2);
If x1 < x2-16 THEN BEGIN
inc(posi);
if text = 'code' then begin
SetColor(white);  MoveTo(X1,Y1); OutText('_');
                  MoveTo(X1,Y1); OutText('*');
Setcolor(0);OutText('_');
end
else begin
SetColor(white);  MoveTo(X1,Y1); OutText('_');
                  MoveTo(X1,Y1); OutText(zeichen[posi]);
SetColor(0); OutText('_'); end;
if x1 >= x+8*(laenge) then Inc(laenge);
zeichen[posi]:=' ';
Inc(x1,8);
end;
MausDa(1);
end;

#13: begin done:=true end;
end;
until Done;
MausDa(2);
SetColor(white);  MoveTo(X1,Y1); OutText('_');

Text:='';

FOR i:=1 TO laenge DO
text:=text+zeichen[i];
Out:=text;
MausDa(1);
end;
end;

PROCEDURE MouseReset;
BEGIN
  IF Mem[MemW[0:$cc+2]:MemW[0:$cc]]<>$cf THEN BEGIN
    MausDa(0);
    MausDa(1);
    Mouse;
  END
  ELSE BEGIN
    settextstyle(0,horizdir,1);
    Setcolor(white);
    WriteText(1,1,'Keine Maus gefunden!!! MOUSE.COM aufrufen!!!');
    Delay(2000);
  END;
END;

PROCEDURE Link(GraphDriver: integer);
VAR GraphMode: integer;

procedure Abort(Msg : string);
begin
  Writeln(Msg, ': ', GraphErrorMsg(GraphResult));
  Halt(1);
end;

begin
  { Register all the drivers }
  if RegisterBGIdriver(@CGADriverProc) < 0 then
    Abort('CGA');
  if RegisterBGIdriver(@EGAVGADriverProc) < 0 then
    Abort('EGA/VGA');
  if RegisterBGIdriver(@HercDriverProc) < 0 then
    Abort('Herc');
  if RegisterBGIdriver(@ATTDriverProc) < 0 then
    Abort('AT&T');
  if RegisterBGIdriver(@PC3270DriverProc) < 0 then
    Abort('PC 3270');

  { Register all the fonts }
  if RegisterBGIfont(@GothicFontProc) < 0 then
    Abort('Gothic');
  if RegisterBGIfont(@SansSerifFontProc) < 0 then
    Abort('SansSerif');
  if RegisterBGIfont(@SmallFontProc) < 0 then
    Abort('Small');
  if RegisterBGIfont(@TriplexFontProc) < 0 then
    Abort('Triplex');

  IF GraphDriver = 256 THEN BEGIN GraphDriver:=InstallUserDriver('SVGA256M',nil);
  GraphMode := 2; RegisterBGIdriver(@SVGA256mDriverProc); END ELSE GraphDriver := Detect;

  InitGraph(GraphDriver, GraphMode,'');
  if GraphResult <> grOk then
  begin
    Writeln('Graphics init error: ', GraphErrorMsg(GraphDriver));
    Halt(1);
  end;
end;

PROCEDURE MouseGraph;
VAR a,b:integer;
BEGIN
  a:=m3;b:=m4;
  REPEAT
  m1:=3; Maus;
  IF keypressed THEN BEGIN ch:=readkey; Break; END;
  UNTIL (a<>m3) OR (b<>m4) OR (m2<>0);
  Delay(50);
END;

PROCEDURE MouseData;
BEGIN
  m1:=3; Maus;
END;

PROCEDURE BKcolor(s,col:integer);
begin
MausDa(2);
setfillstyle(s,col);
bar(0,0,640,480);
MausDa(1);
end;

PROCEDURE Box(x1,y1: Integer);
BEGIN
Left:=false;
IF (m2 <> 1) AND (m2 <> 2) AND (m2 <> 3) then begin
MausDa(2);
setcolor(0);
rectangle(x1,y1,x1+14,y1+14);
rectangle(x1,y1,x1+15,y1+15);
MausDa(1); end;

IF (m2 = 1) AND (m3>x1) AND (m3<x1+15) AND (m4>y1) AND (m4<y1+15) then begin

IF Rise = true then begin
MausDa(2);
setfillstyle(1,lightgreen);
bar(x1+1,y1+1,x1+13,y1+13);
Mausda(1);
Left:=true; Rise:= false; Delay(200); end else begin

MausDa(2);
setfillstyle(1,lightgray);
bar(x1+1,y1+1,x1+13,y1+13);
Mausda(1);
Left:=true; Rise:= true; Delay(200); end;
m2:=0;
end;
end;

PROCEDURE MouseWindow(x1,y1,x2,y2:Word);
BEGIN
  MausDa(2);
  m1:=7; m3:=x1; m4:=x2;
  Maus;
  m1:=8; m3:=y1; m4:=y2;
  Maus; MausDa(1);
END;

PROCEDURE MouseOFF;
BEGIN
  MausDa(2);
END;

PROCEDURE MouseON;
BEGIN
  MausDa(1);
END;

FUNCTION Board(Info: string;var taste:char): boolean;
var i: integer;
begin
Board:=false;
if taste <> info[1] then exit;
for i:=2 to length(info) do begin
taste:=readkey;
if (taste <> info[i]) then exit end;
Board:=true;
Keys;
end;

FUNCTION Splitline(Info: string;var st:string):boolean;
var i:integer;
    st2: string;
begin
Splitline:=false;
i:=pos('=',st);
st2:=copy(st,1,i-1);
if st2 = info then begin st:=copy(st,i+1,length(st)); Splitline:=true; end;
end;

FUNCTION IntToStr(Int: Integer):STRING;
VAR S: STRING;
BEGIN
str(Int,S);
IntToStr:=S;
END;

FUNCTION StrToInt(Str: STRING): Integer;
VAR Int: Integer;
BEGIN
Val(Str,Int,Int);
StrToInt:=Int;
END;

END.