mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 06:22:25 +00:00
vt100 improved
This commit is contained in:
parent
ec730b6da2
commit
c0b83a8ee9
1 changed files with 178 additions and 75 deletions
|
|
@ -30,20 +30,142 @@ VAR
|
||||||
CSI* : ARRAY 5 OF CHAR;
|
CSI* : ARRAY 5 OF CHAR;
|
||||||
tmpstr : ARRAY 32 OF CHAR;
|
tmpstr : ARRAY 32 OF CHAR;
|
||||||
|
|
||||||
(* if n = 0 then clears from cursor to end of the screen
|
|
||||||
if n = 1 then clears from cursor to beginning of the screen
|
PROCEDURE EscSeq (n : INTEGER; letter : ARRAY OF CHAR);
|
||||||
if n = 2 then clears entire screen *)
|
|
||||||
PROCEDURE ED* (n : INTEGER);
|
|
||||||
VAR nstr : ARRAY 2 OF CHAR;
|
VAR nstr : ARRAY 2 OF CHAR;
|
||||||
mstr : ARRAY 5 OF CHAR;
|
cmd : ARRAY 5 OF CHAR;
|
||||||
BEGIN
|
BEGIN
|
||||||
IntStr.IntToStr (n, nstr);
|
IntStr.IntToStr (n, nstr);
|
||||||
COPY(CSI, mstr);
|
COPY(CSI, cmd);
|
||||||
Strings.Append(nstr, mstr);
|
Strings.Append (nstr, cmd);
|
||||||
Strings.Append("J", mstr);
|
Strings.Append (letter, cmd);
|
||||||
Console.String(mstr);
|
Console.String (cmd);
|
||||||
|
END EscSeq;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE EscSeq2(n, m : INTEGER; letter : ARRAY OF CHAR);
|
||||||
|
VAR nstr, mstr : ARRAY 5 OF CHAR;
|
||||||
|
cmd : ARRAY 12 OF CHAR;
|
||||||
|
BEGIN
|
||||||
|
IF n < 1 THEN n := 1 END;
|
||||||
|
IF m < 1 THEN m := 1 END;
|
||||||
|
IntStr.IntToStr(n, nstr);
|
||||||
|
IntStr.IntToStr(m, mstr);
|
||||||
|
|
||||||
|
COPY (CSI, cmd);
|
||||||
|
Strings.Append (nstr, cmd);
|
||||||
|
Strings.Append (';', cmd);
|
||||||
|
Strings.Append (mstr, cmd);
|
||||||
|
Strings.Append (letter, cmd);
|
||||||
|
Console.String (cmd);
|
||||||
|
|
||||||
|
END EscSeq2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(* Cursor up
|
||||||
|
moves cursor n cells in the given direction. if the cursor is already at the edge of the screen, this has no effect *)
|
||||||
|
|
||||||
|
PROCEDURE CUU*(n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'A');
|
||||||
|
END CUU;
|
||||||
|
|
||||||
|
(* Cursor down
|
||||||
|
moves cursor n cells in the given direction. if the cursor is already at the edge of the screen, this has no effect *)
|
||||||
|
|
||||||
|
PROCEDURE CUD*(n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'B');
|
||||||
|
END CUD;
|
||||||
|
|
||||||
|
|
||||||
|
(* Cursor forward
|
||||||
|
moves cursor n cells in the given direction. if the cursor is already at the edge of the screen, this has no effect *)
|
||||||
|
|
||||||
|
PROCEDURE CUF*(n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'C');
|
||||||
|
END CUF;
|
||||||
|
|
||||||
|
(* Cursor back
|
||||||
|
moves cursor n cells in the given direction. if the cursor is already at the edge of the screen, this has no effect *)
|
||||||
|
|
||||||
|
PROCEDURE CUB*(n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'D');
|
||||||
|
END CUB;
|
||||||
|
|
||||||
|
(* Curnser Next Line
|
||||||
|
moves cursor to beginning of the line n lines down *)
|
||||||
|
|
||||||
|
PROCEDURE CNL*( n: INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'E');
|
||||||
|
END CNL;
|
||||||
|
|
||||||
|
|
||||||
|
(* Cursor Previous Line
|
||||||
|
Moves cursor to beginning of the line n lines down *)
|
||||||
|
|
||||||
|
PROCEDURE CPL*( n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'F');
|
||||||
|
END CPL;
|
||||||
|
|
||||||
|
(* Cursor Horizontal Absolute
|
||||||
|
Moves the cursor to column n *)
|
||||||
|
|
||||||
|
PROCEDURE CHA*( n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq (n, 'G');
|
||||||
|
END CHA;
|
||||||
|
|
||||||
|
(* Cursor position, moves cursor to row n, column m *)
|
||||||
|
PROCEDURE CUP*(n, m : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq2 (n, m, 'H');
|
||||||
|
END CUP;
|
||||||
|
|
||||||
|
(* Erase Display
|
||||||
|
if n = 0 then clears from cursor to end of the screen
|
||||||
|
if n = 1 then clears from cursor to beginning of the screen
|
||||||
|
if n = 2 then clears entire screen *)
|
||||||
|
|
||||||
|
PROCEDURE ED* (n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq(n, 'J');
|
||||||
END ED;
|
END ED;
|
||||||
|
|
||||||
|
(* Erase in Line
|
||||||
|
Erases part of the line. If n is zero, clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change *)
|
||||||
|
PROCEDURE EL*( n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq(n, 'K');
|
||||||
|
END EL;
|
||||||
|
|
||||||
|
(* Scroll Up
|
||||||
|
Scroll whole page up by n lines. New lines are added at the bottom *)
|
||||||
|
PROCEDURE SU*( n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq(n, 'S')
|
||||||
|
END SU;
|
||||||
|
|
||||||
|
(* Scroll Down
|
||||||
|
Scroll whole page down by n (default 1) lines. New lines are added at the top *)
|
||||||
|
PROCEDURE SD*( n : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq(n, 'T');
|
||||||
|
END SD;
|
||||||
|
|
||||||
|
(* Horizontal and Vertical Position,
|
||||||
|
Moves the cursor to row n, column m. Both default to 1 if omitted. Same as CUP *)
|
||||||
|
PROCEDURE HVP*(n, m : INTEGER);
|
||||||
|
BEGIN
|
||||||
|
EscSeq2 (n, m, 'f');
|
||||||
|
END HVP;
|
||||||
|
|
||||||
|
(* wrappers *)
|
||||||
PROCEDURE EraseDisplay*;
|
PROCEDURE EraseDisplay*;
|
||||||
BEGIN
|
BEGIN
|
||||||
ED(2);
|
ED(2);
|
||||||
|
|
@ -55,25 +177,6 @@ BEGIN
|
||||||
ED(2);
|
ED(2);
|
||||||
END ClrScr;
|
END ClrScr;
|
||||||
|
|
||||||
(* Cursor position, moves cursor to row n, column m *)
|
|
||||||
PROCEDURE CUP*(n, m : INTEGER);
|
|
||||||
VAR nstr, mstr : ARRAY 5 OF CHAR;
|
|
||||||
str : ARRAY 12 OF CHAR;
|
|
||||||
BEGIN
|
|
||||||
IF n < 1 THEN n := 1 END;
|
|
||||||
IF m < 1 THEN m := 1 END;
|
|
||||||
IntStr.IntToStr(n, nstr);
|
|
||||||
IntStr.IntToStr(m, mstr);
|
|
||||||
|
|
||||||
COPY (CSI, str);
|
|
||||||
Strings.Append (nstr, str);
|
|
||||||
Strings.Append (';', str);
|
|
||||||
Strings.Append (mstr, str);
|
|
||||||
Strings.Append ("H", str);
|
|
||||||
Console.String (str);
|
|
||||||
|
|
||||||
END CUP;
|
|
||||||
|
|
||||||
(* pascal crt like wrapper *)
|
(* pascal crt like wrapper *)
|
||||||
PROCEDURE GotoXY* (x, y: INTEGER);
|
PROCEDURE GotoXY* (x, y: INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue