tcrt.pp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. { %INTERACTIVE }
  2. {
  3. Program to test CRT unit by Mark May.
  4. Only standard TP functions are tested (except WhereX, WhereY).
  5. }
  6. program tesicrt;
  7. uses crt;
  8. var
  9. i,j : longint;
  10. fil : text;
  11. c : char;
  12. begin
  13. {Window/AssignCrt/GotoXY}
  14. clrscr;
  15. writeln ('This should be on a clear screen...');
  16. gotoxy (10,10);
  17. writeln ('(10,10) is the coordinate of this sentence');
  18. window (10,11,70,22);
  19. writeln ('Window (10,11,70,22) executed.');
  20. writeln ('Sending some output to a file, assigned to crt.');
  21. assigncrt ( fil);
  22. rewrite (fil);
  23. writeln (fil,'This was written to the file, assigned to the crt.');
  24. writeln (fil,'01234567890123456789012345678901234567890123456789012345678901234567890');
  25. close (fil);
  26. writeln ('The above too, but this not any more');
  27. write ('Press any key to continue');
  28. c:=readkey;
  29. clrscr;
  30. writeln ('the small window should have been cleared.');
  31. write ('Press any key to continue');
  32. c:=readkey;
  33. {Colors/KeyPressed}
  34. window (1,1,80,25);
  35. clrscr;
  36. writeln ('Color testing :');
  37. writeln;
  38. highvideo;
  39. write ('highlighted text');
  40. normvideo;
  41. write (' normal text ');
  42. lowvideo;
  43. writeln ('And low text.');
  44. writeln;
  45. writeln ('Color chart :');
  46. for i:=black to lightgray do
  47. begin
  48. textbackground (i);
  49. textcolor (0);
  50. write ('backgr. : ',i:2,' ');
  51. for j:= black to white do
  52. begin
  53. textcolor (j);
  54. write (' ',j:2,' ');
  55. end;
  56. writeln;
  57. end;
  58. normvideo;
  59. writeln ('The same, with blinking foreground.');
  60. for i:=black to lightgray do
  61. begin
  62. textbackground (i);
  63. textcolor (0);
  64. write ('backgr. : ',i:2,' ');
  65. for j:= black to white do
  66. begin
  67. textcolor (j+128);
  68. write (' ',j:2,' ');
  69. end;
  70. writeln;
  71. end;
  72. textcolor (white);
  73. textbackground (black);
  74. writeln;
  75. writeln ('press any key to continue');
  76. repeat until keypressed;
  77. c:=readkey;
  78. {ClrEol/DelLine/InsLine}
  79. clrscr;
  80. writeln ('Testing some line functions :');
  81. writeln ;
  82. writeln ('This line should become blank after you press enter');
  83. writeln;
  84. writeln ('The following line should then become blank from column 10');
  85. writeln ('12345678901234567890');
  86. writeln;
  87. writeln ('This line should disappear.');
  88. writeln;
  89. writeln ('Between this line and the next, an empty line should appear.');
  90. writeln ('This is the next line, above which the empty one should appear');
  91. writeln;
  92. write ('Press any key to observe the predicted effects.');
  93. readkey;
  94. gotoxy(1,3);clreol;
  95. gotoxy (10,6);clreol;
  96. gotoxy (1,8);delline;
  97. gotoxy (1,10); insline;
  98. gotoxy (18,13); clreol;
  99. writeln ('end.');
  100. readkey;
  101. end.