home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
tbridge.zip
/
DISPLAY.BR
< prev
next >
Wrap
Text File
|
1986-06-01
|
24KB
|
973 lines
{ ╔══════════════════════════════════════════════════════╗
║ DISPLAY.BR Module of BRIDGE.PAS ║ ║
║ ║
║ Last modified 10/29/85 ║ ║
║ ║
║ This module prints the game information onto the ║
║ screen and to the 'BRIDGE' script file. ║
╚══════════════════════════════════════════════════════╝
}
{ Names of hands, Suits and values }
const
HandName : array[HandType] of string[5] =
('North', 'East', 'South', 'West');
TrumpName : array[TrumpType] of string[2] =
('Cl', 'Di', 'He', 'Sp', 'NT');
ValueName : array[ValueType] of CHAR =
('2', '3', '4', '5', '6', '7', '8',
'9', 'T', 'J', 'Q', 'K', 'A');
var
TrumpStr : array[TrumpType] of string[2];
procedure InitTrumpStr;
begin
TrumpStr[Club ] := chr(5);
TrumpStr[Diamond] := chr(4);
TrumpStr[Heart ] := chr(3);
TrumpStr[Spade ] := chr(6);
TrumpStr[NT ] := 'NT';
end; { InitTrumpStr }
{ Colors }
type
TextColorType = record
Background,
Color : 0..15;
end;
ScreenPos = record
x, y : integer;
Color, background : 0..15;
end;
const { Type constants for screen colors }
NormalColor : TextColorType =
(background : Cyan; Color : Black);
LightColor : TextColorType =
(Background : Cyan; Color : White);
HandNameColor : TextColorType =
(background : LightGray; Color : Yellow);
HeadingColor : TextColorType =
(background : LightGray; Color : Blue);
BoardColor : TextColorType =
(background : Green; Color : Brown);
MessageColor : TextColorType =
(Background : Red; Color : White);
BorderColor : TextColorType =
(Background : Blue; Color : Black);
ScoreBrdColor : TextColorType =
(Background : LightGray; Color : Black);
ScoreColor : TextColorType =
(Background : Blue; Color : White);
TrumpColor : array[TrumpType] of TextColorType =
((background: LightGray; Color: Black),
(background: LightGray; Color: Red),
(background: LightGray; Color: Red),
(background: LightGray; Color: Black),
(background: LightGray; Color: Blue));
MenuPos : ScreenPos =
(x : 51; y : 18;
Color : Black; background : Cyan);
CommandPos : ScreenPos =
(x : 51; y : 21;
Color : Black; background : LightGray);
ErrorPos : ScreenPos =
(x : 51; y : 22;
Color : White; background : Red);
procedure SetColor(ScreenColor: TextColorType);
begin
TextBackground(ScreenColor.Background);
TextColor(ScreenColor.Color);
end; { SetColor }
procedure GotoPos(CurPos : ScreenPos;
Xoffset, Yoffset : integer);
{ Goes to the passed in screen position and offset and sets the color
for this field on the screen }
begin
with CurPos do
begin
TextColor(Color);
TextBackground(Background);
GotoXY(x + Xoffset, y + Yoffset);
end;
end; { GotoPos }
type
WindowString = string[25];
procedure FlushBuffer;
{ flushes the keyboard buffer }
var
Null : char;
begin
while KeyPressed do
Read(KBD, Null);
end; { FlushBuffer }
function EqBid(a, b: BidType): BOOLEAN;
begin
EqBid := (a.Level = b.Level) and (a.Trump = b.Trump);
end; { EqBid }
function DistPoints(Hand: HandType): integer;
{ Count distribution points for Player
(Void Suit 3, Singleton 2, Doubleton 1) used for bidding }
var
Pts : integer;
s : SuitType;
begin
Pts := 0;
with Sdata[Hand] do
for s := Club to Spade do
if l[s] <= 2 then
Pts := Pts + 3 - l[s];
DistPoints := Pts;
end; { DistPoints }
type
str4 = string[4];
function BidStr(Bid: BidType): str4;
{ Converts a Bid to a string }
begin
if EqBid(Bid, Pass) then
BidStr := 'Pass'
else
if EqBid(Bid, Dbl) then
BidStr := 'Dbl'
else
if EqBid(Bid, RDbl) then
BidStr := 'RDbl'
else
with Bid do
BidStr := chr(Ord('0') + Level) + ' ' + TrumpStr[Trump];
end; { BidStr }
function CardStr(Card: CardType): str4;
{ Converts a Card to a string }
begin
with Card do
CardStr := ValueName[Value] + ' ' + TrumpStr[Suit];
end; { CardStr }
function AsciiBidStr(Bid: BidType): str4;
{ BidStr with ascii characters for output file }
begin
with Bid do
if Level=0 then
AsciiBidStr := BidStr(Bid)
else
AsciiBidStr := chr(Ord('0') + Level) + ' ' + TrumpName[Trump];
end; { AsciiBidStr }
function AsciiCardStr(Card: CardType): str4;
{ CardStr with ascii characters for output file }
begin
with Card do
AsciiCardStr := ValueName[Value] + ' ' + TrumpName[Suit];
end; { AsciiCardStr }
procedure Frame(x1, y1, x2, y2: integer);
{ Print the frame of the card table }
var
x, y: integer;
type
str3 = string[3];
procedure Line(y: integer; s: str3);
begin
GotoXY(x1, y);
Write(s[1]);
for x := x1 + 1 to x2-1 do
Write(s[2]);
Write(s[3]);
end; { Line }
begin
Line(y1, '█▀█'); for y := y1 + 1 to y2-1 do
Line(y , '█ █');
Line(y2, '█▄█');
end; { Frame }
var
TopHand: HandType;
procedure GotoHand(Hand: HandType; x1, y1 : integer);
{ go to the hand position on the screen }
const
HandPos: array[0..3] of record
x, y: integer;
end =
((x: 33; y: 1),
(x: 51; y: 6),
(x: 33; y: 13),
(x: 3; y: 6));
begin
with HandPos[(Hand-TopHand) and 3] do
GotoXY(x + x1, y + y1);
end; { GotoHand }
procedure ClearHand(Hand : HandType);
begin
GotoHand(Hand, 0, 0);
SetColor(NormalColor);
Window(WhereX, WhereY, WhereX + 28, WhereY + 4);
ClrScr;
Window(1, 1, 80, 25);
end; { ClearHand }
procedure GotoCardPos(Hand: HandType);
{ goto the hands Card position on the screen }
const
CardPos: array[0..3] of record
x, y: integer;
end =
((x: 38; y: 8),
(x: 41; y: 9),
(x: 38; y: 10),
(x: 35; y: 9));
begin
with CardPos[(Hand-TopHand) and 3] do
GotoXY(x, y);
end; { GotoCardPos }
const
WindowLine = 20;
var
WindowHand : HandType;
InfoNo : integer;
procedure PrintNames(Hand: HandType);
{ Reset the information Window and print the names of the 4 hands }
var
h, StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
WindowHand := Hand;
InfoNo := 0;
SetColor(HandNameColor);
for h := 0 to 3 do
begin
GotoXY(h*8 + 3, WindowLine);
Write(HandName[(Hand + h) and 3]);
end;
GotoXY(StartX, StartY);
end; { PrintNames }
procedure OutputNames(Hand: HandType);
{ Output the names of the 4 hands on the OutputFile }
var
h: integer;
begin
Writeln(OutputFile);
for h := 0 to 3 do
Write(OutputFile, HandName[(Hand + h) and 3],
'':8-Length(HandName[(Hand + h) and 3]));
end; { OutputNames }
procedure ClearBidWindow;
begin
Window(1, WindowLine + 1, 40, 25);
SetColor(NormalColor);
ClrScr;
Window(1, 1, 80, 25);
end; { ClearBidWindow }
procedure ClearBidScreen;
begin
Window(1, WindowLine, 40, 25);
SetColor(NormalColor);
ClrScr;
Window(1, 1, 80, 25);
end; { ClearBidScreen }
type
str6 = string[6];
procedure PrintInfo(Hand: HandType; Trump: TrumpType;
CardString : str6; Bidding : boolean);
{ Print information in the information Window }
function NextHand(Hand : HandType): HandType;
{ Calculates the Hand to the 'left' of the current Hand }
begin
if Hand = West then
NextHand := North
else NextHand := Succ(Hand);
end; { NextHand }
var
LineNo: integer;
begin { PrintInfo }
LineNo := WindowLine + InfoNo div 4 + 1;
if (LineNo > 24) then
begin
LineNo := 24;
if InfoNo and 3 = 0 then
begin
SetColor(NormalColor);
GotoXY(3, WindowLine + 1);
Window(3, WindowLine + 1, 40, 25);
DelLine;
Window(1, 1, 80, 25);
end;
end;
if Bidding then
begin
SetColor(BoardColor);
GotoCardPos(NextHand(Hand));
Write(' ');
end;
GotoXY(((Hand-WindowHand) and 3) * 8 + 3, LineNo);
SetColor(TrumpColor[Trump]);
Write(CardString);
GotoCardPos(Hand);
Write(CardString);
InfoNo := InfoNo + 1;
end; { PrintInfo }
procedure OutputInfo(Str: str6);
{ Output information on the OutputFile }
begin
Write(OutputFile, Str, '':8-Length(Str));
end; { OutputInfo }
procedure PrintBid(Hand: HandType; Bid: BidType);
{ Print and output a Bid }
const
Bidding : boolean = true;
begin
PrintInfo(Hand, Bid.Trump, BidStr(Bid), Bidding);
if (InfoNo and 3 = 1) then
Writeln(OutputFile);
OutputInfo(AsciiBidStr(Bid));
end; { PrintBid }
procedure StopGames; forward;
procedure ReadOne;
var
ch : char;
begin
repeat until KeyPressed;
Read(KBD, ch);
case ch of
^C : StopGames;
^[ : if KeyPressed then
FlushBuffer;
end;
end; { ReadOne }
procedure ClearMenu; forward;
procedure ClearTblMsg;
begin
ClearMenu;
FlushBuffer;
GotoPos(MenuPos, 0, 0);
Write('Hit any key to clear table');
ReadOne;
end; { ClearTblMsg }
procedure ClearTable;
{ Clears the cards off the table }
var
Hand : HandType;
begin
SetColor(BoardColor);
for Hand := North to West do
begin
GotoCardPos(Hand);
Write(' ');
end;
end; { ClearTable }
procedure PrintCard(Hand: HandType; Card: CardType);
{ Print and output a Card }
const
Bidding : boolean = false;
var
i : integer;
r : IndexType;
Str : str6;
begin
PrintInfo(Hand, Card.Suit, CardStr(Card), Bidding);
with Sim do
if Round and 3=0 then
begin
Writeln(OutputFile);
for i := 0 to 3 do
for r := Round-4 to Round-1 do
with Game[r] do if Hand=(Dummy-1 + i) and 3 then
begin
Str := AsciiCardStr(Sdist[Hand, No]);
if Hand=BestHand then
Str := Str + '*';
OutputInfo(Str);
end;
end;
end; { PrintCard }
var
PrintAll : BOOLEAN; { Print All hands on screen }
function AutoGame : boolean;
{ Returns true if the computer is playing all the hands }
var
CurHand : HandType;
begin
AutoGame := true;
for CurHand := North to West do
if not Computer[CurHand] then
AutoGame := false;
end; { AutoGame }
function HandKnown(Hand: HandType): BOOLEAN;
{ Indicates whether the Hand should be printed on the screen }
begin
HandKnown := PrintAll or not Computer[Hand]
or (Rel.Round>0) and
((Hand = Dummy) {or not Computer[Dummy]})
or AutoGame;
end; { HandKown }
procedure PrintSuit(Hand: HandType; s: SuitType);
{ Print the cards of the Hand in the Suit }
var
i : CardNoType;
begin
if HandKnown(Hand) then
begin
GotoHand(Hand, 0, 4-Ord(s));
SetColor(TrumpColor[s]);
Write(TrumpStr[s]);
for i := 0 to 12 do
with Sdist[Hand, i] do
if not Played and (Suit=s) then
Write(ValueName[Value]:2);
SetColor(NormalColor);
Write(' ');
end;
end; { PrintSuit }
procedure PrintHand(Hand: HandType);
{ Print the Hand on the screen }
var
s : SuitType;
begin
ClearHand(Hand);
GotoHand(Hand, 0, 0);
SetColor(HandNameColor);
Write(HandName[Hand]);
for s := Club to Spade do
PrintSuit(Hand, s);
end; { PrintHand }
procedure NewScreen;
{ Clears screen and prints header information and card table }
begin
SetColor(NormalColor);
ClrScr;
GotoXY(3, 1);
SetColor(HeadingColor);
Write('TURBO - BRIDGE');
SetColor(BoardColor);
Frame(33, 6, 45, 12);
end; { NewScreen }
procedure ClearInfoArea;
begin
Window(51, 1, 79, 5);
SetColor(NormalColor);
ClrScr;
Window(1, 1, 80, 25);
end; { ClearInfoArea }
procedure ClearIt;
{ Clears table and bid screen }
begin
ClearTable;
ClearBidScreen;
end; { ClearIt }
procedure PrintScreen(FirstHand: HandType);
{ Setup the screen picture with the Known hands }
var
Hand: HandType;
begin
TopHand := FirstHand;
for Hand := North to West do
PrintHand(Hand);
end; { PrintScreen }
procedure OutputHands;
{ Output the hands on the OutputFile }
procedure OutputHandName(Hand: HandType);
begin
if Hand = North then
Write(OutputFile, 'Game', GameNo:5, '':24-9)
else
if Hand = South then
Write(OutputFile, '':24);
Write(OutputFile, HandName[Hand], '':7 - Length(HandName[Hand]),
Sdata[Hand].p - DistPoints(Hand):2, ' + ',
DistPoints(Hand):1);
if (Hand = West) then
Write(OutputFile, '':48 - 7 - 6)
else
Writeln(OutputFile);
end; { OutputHandName }
procedure OutputSuit(Hand: HandType; s: SuitType);
var i : CardNoType;
begin
if Hand in [North, South] then
Write(OutputFile, '':24);
Write(OutputFile, TrumpName[s]);
for i := 0 to 12 do with Sdist[Hand, i] do
if not Played and (Suit=s) then
Write(OutputFile, ValueName[Value]:2);
if Hand=West then
Write(OutputFile, '':48-2-Sdata[Hand].l[s] * 2)
else
Writeln(OutputFile);
end; { OutputSuit }
var
Suit: SuitType;
begin { OutputHands }
OutputHandName(North);
for Suit := Spade downto Club do OutputSuit(North, Suit);
OutputHandName(West); OutputHandName(East);
for Suit := Spade downto Club do
begin
OutputSuit(West, Suit); OutputSuit(East, Suit);
end;
OutputHandName(South);
for Suit := Spade downto Club do
OutputSuit(South, Suit);
end; { OutputHands }
function Partner(CurHand : HandType): HandType;
{ returns the team Partner of the passed in Hand }
begin
if CurHand < South then
Partner := CurHand + 2
else
Partner := CurHand - 2;
end; { Partner }
function Opponent(CurHand : HandType): HandType;
{ returns an Opponent of the passed in Hand }
begin
if CurHand < South then
Opponent := CurHand + 1
else
Opponent := CurHand - 1;
end; { Opponent }
procedure PrintTeam(Player : HandType);
{ Prints the team of the passed in player to the screen }
begin
if Player < South then
Write(HandName[Player][1], '/', HandName[Partner(Player)][1])
else
Write(HandName[Partner(Player)][1], '/', HandName[Player][1]);
end; { PrintTeam }
procedure OutputTeam(Player : HandType);
{ Prints the team of the passed in player to the output file }
begin
if Player < South then
Write(OutputFile, HandName[Player][1], '/',
HandName[Partner(Player)][1])
else
Write(OutputFile, HandName[Partner(Player)][1], '/',
HandName[Player][1]);
end; { OutputTeam }
procedure OutputContract;
{ Prints the contract to the output file }
begin
Writeln(OutputFile);
Writeln(OutputFile);
Write(OutputFile, ' ':10, 'Contract: ');
OutputTeam(Dummy);
Write(OutputFile, ' ':3, AsciiBidStr(Contract));
case Doubled of
1: Writeln(OutputFile, ' D');
2: Writeln(OutputFile, ' RD');
end;
end; { OutputContract }
procedure PrintContract;
{ Print the Contract to the screen }
begin
GotoXY(53, 1);
SetColor(NormalColor);
Write('Declarer: ');
SetColor(MessageColor);
GotoXY(63, 1);
PrintTeam(Dummy);
GotoXY(63, 2);
SetColor(TrumpColor[Contract.Trump]);
Write(BidStr(Contract));
case Doubled of
1: Write(' D');
2: Write(' RD');
end;
end; { PrintContract }
procedure Printresult;
{ Print and output the Result of the Game }
var
OverTricks, i : integer;
begin
with Rel, Contract do
begin
for i := 1 to 3 do
Writeln(OutputFile);
Write(OutputFile, ' ':10);
OutputTeam(Dummy);
SetColor(MessageColor);
if WonTricks >= Level + 6 then
begin
GotoXY(52, 4);
Write(' ');
PrintTeam(Dummy);
Write(' Made Contract ');
Write(OutputFile, ' made contract ');
OverTricks := WonTricks - (Level + 6);
if OverTricks > 0 then
begin
GotoXY(61, 5);
Write(' with ', OverTricks, ' overtrick');
Write(OutputFile, 'with ', OverTricks, ' overtrick');
if OverTricks > 1 then
begin
Write('s');
Writeln(OutputFile, 's');
end;
Write(' ');
end;
end
else
begin
GotoXY(61, 4);
Write(' ');
PrintTeam(Dummy);
Write(' down ', Level + 6-WonTricks, ' ');
Writeln(OutputFile, ' down ', Level + 6-WonTricks);
end;
end; { with }
Writeln(OutputFile);
end; { Printresult }
procedure PrintwonTricks;
{ Print Number of Tricks for each side }
begin
SetColor(MessageColor);
GotoXY(71, 1);
PrintTeam(Dummy);
GotoXY(77, 1);
PrintTeam(Opponent(Dummy));
SetColor(NormalColor);
GotoXY(72, 2);
with Rel do
Write(WonTricks:2, ' - ', TrickNo-WonTricks:2);
end; { PrintwonTricks }
procedure ClearEol;
begin
SetColor(NormalColor);
ClrEol;
end; { ClearEol }
procedure ClearTopMenu;
var
CurY : integer;
begin
for CurY := 0 to 2 do
begin
GotoPos(MenuPos, 0, CurY);
ClearEol;
end;
end; { ClearTopMenu }
procedure ClearCommand;
{ Clears the area on the screen of the user prompt }
var
CurY : integer;
begin
for CurY := 0 to 1 do
begin
GotoPos(CommandPos, 0, CurY);
ClearEol;
end;
end; { ClearCommand }
procedure ClearHelp;
{ Clears Help Window on screen }
var
CurY : integer;
begin
for CurY := 2 to 4 do
begin
GotoPos(CommandPos, 0, CurY);
ClearEol;
end;
end; { ClearHelp }
procedure ClearBottomMenu;
begin
ClearCommand;
ClearHelp;
end; { ClearBottomMenu }
procedure ClearMenu;
begin
ClearTopMenu;
ClearBottomMenu;
end; { ClearMenu }
procedure ReClear;
{ Clears Menu but not the command linc }
begin
ClearTopMenu;
ClearHelp;
end;
type
PrintString = string[30];
procedure LightFirst(Message : PrintString; CurPos : ScreenPos);
{ Prints pased in string highlighting the first character }
var
i : integer;
begin
SetColor(LightColor);
Write(Message[1]);
if Length(Message) > 1 then
begin
TextColor(CurPos.Color);
TextBackground(CurPos.background);
for i := 2 to Length(Message) do
Write(Message[i]);
end;
end; { LightFirst }
procedure BidHelp;
{ Help lines show the user how to make legal bid }
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ClearHelp;
GotoPos(CommandPos, 0, 2);
Write(' Bid Number of Tricks 1..7 ');
GotoPos(CommandPos, 0, 3);
Write(' ');
LightFirst('Double ', CommandPos);
LightFirst('Redouble ', CommandPos);
LightFirst('Pass ', CommandPos);
GotoPos(CommandPos, 0, 4);
Write(' ':27);
GotoXY(StartX, StartY); { Restore cursor }
end; { BidHelp }
procedure SuitHelp;
{ Shows user how to legally specify the card suits }
begin
ClearTopMenu;
ClearHelp;
GotoPos(MenuPos, 6, 0);
LightFirst('Clubs ', MenuPos);
LightFirst('Diamonds', MenuPos);
GotoPos(MenuPos, 6, 1);
LightFirst('Hearts ', MenuPos);
LightFirst('Spades', MenuPos);
end; { SuitHelp }
procedure BidSuitHelp;
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
SuitHelp;
GotoPos(MenuPos, 11, 2);
LightFirst('NoTrump', MenuPos);
GotoXY(StartX, StartY); { Restore cursor }
end; { BidSuitHelp }
procedure BidMenu;
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ReClear;
GotoPos(MenuPos, 3, 0);
LightFirst('ClearBids ', MenuPos);
LightFirst('NewDeal', MenuPos);
GotoPos(MenuPos, 3, 1);
LightFirst('Score ', MenuPos);
Write('e');
LightFirst('Xit ', MenuPos);
BidHelp;
GotoXY(StartX, StartY); { Restore cursor position }
end; { BidMenu }
function Lead : boolean;
{ True if the current hand is to lead }
begin
Lead := Rel.Round and 3 = 0;
end;
procedure PlaySuitHelp;
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
SuitHelp;
if not Lead then
begin
GotoPos(CommandPos, 0, 3);
Write('or hit <RETURN> for lead Suit');
end;
GotoXY(StartX, StartY); { Restore cursor }
end; { PlaySuitHelp }
procedure RankHelp;
{ Help mesage on how to enter Card ranks }
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ClearHelp;
GotoPos(CommandPos, 0, 2);
Write(' Card ranks: 2..9,T,J,Q,K,A ');
if not Lead then
begin
GotoPos(CommandPos, 0, 3);
Write(' or hit <RETURN> to discard ');
end;
GotoXY(StartX, StartY);
end; { RankHelp }
procedure PlayMenu;
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ReClear;
GotoPos(MenuPos, 2, 0);
Write('Aut');
LightFirst('Oplay', MenuPos);
GotoPos(MenuPos, 16, 0);
LightFirst('NewGame', MenuPos);
GotoPos(MenuPos, 5, 1);
LightFirst('Score', MenuPos);
GotoPos(MenuPos, 16, 1);
LightFirst('Hint',MenuPos);
GotoPos(MenuPos, 10, 2);
Write(' e');
LightFirst('Xit ', MenuPos);
RankHelp;
GotoXY(StartX, StartY);
end; { PlayMenu }
procedure PlayMessage(Hand : HandType; Hint : boolean );
{ Lets user know that the Computer is playing the Hand }
begin
ClearMenu;
GotoPos(CommandPos, 4, -3);
case Hand of
North : Write(' North');
East : Write(' East');
South : Write(' South');
West : Write(' West');
end;
Write(' to ');
if Hint then Write('find hint ')
else
begin
if Lead then Write('Lead ')
else Write('Play ');
end;
end; { PlayMessage }
procedure HintHelp;
{ Tells user options on hint }
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ClearHelp;
GotoPos(CommandPos, 0, 2);
Write(' Hit <RETURN> to play hint ');
GotoPos(CommandPos, 0, 3);
Write(' <BACKSPACE> clears hint ');
GotoXY(StartX, StartY); { Restore cursor }
end; { HintHelp }
procedure CleanUpBids;
begin
Delay(800); { Gives user time to look at the last Bid }
ClearTable;
ClearBidScreen;
end; { CleanUpBids }
procedure Beep;
{ Sounded when an error is detected }
begin
Sound(220);
Delay(250);
NoSound;
end;
type
MessageString = string[80];
procedure ClearError;
{ Clears out the error message area }
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
GotoPos(ErrorPos, 0, 0);
ClearEol;
GotoXY(StartX, StartY); { Restore cursor position }
end; { ClearError }
procedure Message(CurMessage : MessageString);
var
StartX, StartY : integer;
begin
StartX := WhereX;
StartY := WhereY;
ClearError;
GotoPos(ErrorPos, 6, 0);
Write(CurMessage);
GotoXY(StartX, StartY);
end; { Message }
procedure Error(CurError : MessageString);
{ Prints passed in Error message }
begin
Beep;
Message(CurError);
end; { Error }
{ end DISPLAY.BR }