IMPLEMENTATION MODULE GSXCHAR;

FROM GSXMAIN IMPORT CARDIN,CARDOUT,CB,simplESC,SetText;

PROCEDURE GetDimensions;		(* set Rows, Columns *)
BEGIN
  simplESC ( 1 );
  Rows    := CARDOUT[1];
  Columns := CARDOUT[2];
END GetDimensions;

PROCEDURE CursorUp;			(* text cursor 1 row up *)
BEGIN
  simplESC ( 4 );
END CursorUp;

PROCEDURE CursorDown;			(* text cursor 1 row down *)
BEGIN
  simplESC ( 5 );
END CursorDown;

PROCEDURE CursorRight;			(* text cursor 1 column right *)
BEGIN
  simplESC ( 6 );
END CursorRight;

PROCEDURE CursorLeft;			(* text cursor 1 column left *)
BEGIN
  simplESC ( 7 );
END CursorLeft;

PROCEDURE CursorHome;			(* text cursor at home position *)
BEGIN
  simplESC ( 8 );
END CursorHome;

PROCEDURE EraseLineEnd;			(* erase from text cursor to end of line *)
BEGIN
  simplESC ( 10 );
END EraseLineEnd;

PROCEDURE EraseScreenEnd;		(* erase from text cursor to end of screen *)
BEGIN
  simplESC ( 9 );
END EraseScreenEnd;

PROCEDURE CursorAt ( Row, Column : CARDINAL ); (* simple sets text cursor *)
BEGIN
  CARDIN[1] := Row;
  CARDIN[2] := Column;
  CB.CINLEN := 2;
  simplESC ( 11 );
END CursorAt;

PROCEDURE WriteText ( Text : ARRAY OF CHAR ); (* write text at cursor position *)
BEGIN
  SetText ( Text );
  simplESC ( 12 );
END WriteText;

PROCEDURE Reverse;			(* switch to inverse text *)
BEGIN
  simplESC ( 13 );
END Reverse;

PROCEDURE Normal;			(* switch to normal text ( default ) *)
BEGIN
  simplESC ( 14 );
END Normal;

PROCEDURE GetPosition ( VAR Row, Column : CARDINAL ); (* return current cursor position *)
BEGIN
  simplESC ( 15 );
  Row    := CARDOUT[1];
  Column := CARDOUT[2];
END GetPosition;

END GSXCHAR.

                                                                