home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / PASUTIL1.ZIP / SCREEN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-12-28  |  1.1 KB  |  44 lines

  1. Program Screen (Input,Output);
  2.  
  3. { This is an intermediate level Pascal program which illustrates how one
  4.   can get directly at the screen memory area through Pascal's ADS types.
  5.   The program prompts the user for a character and then flashes this 
  6.   character all over the screen.  A normal attribute is given; this is the
  7.   chr(7) reference... Program illustrates speed of direct Pascal/screen
  8.   output. }
  9.  
  10. VAR
  11.    Choice: char;
  12.  
  13. Procedure ScreenWrite (What: char);
  14.  
  15. TYPE
  16.    ScreenImage = array[1..160] of char;
  17.    ScreenLoc = ADS of ScreenImage;
  18. VAR
  19.    i: integer;
  20.    ScreenLine,TextLine: ScreenImage;
  21.    ScreenPtr, TextPtr: ScreenLoc;
  22. BEGIN
  23.    for i:=1 to 80 do
  24.       BEGIN
  25.          TextLine[2*i-1]:= what;
  26.          TextLine[2*i]:= chr(7);
  27.       END;
  28.    ScreenPtr.S := 16#b000;
  29.    ScreenPtr.R := 0;
  30.    TextPtr := ADS TextLine;
  31.    for i := 0 to 24 do
  32.       BEGIN
  33.          ScreenPtr^ := TextPtr^;
  34.          ScreenPtr.R := ScreenPtr.R + 160
  35.       END
  36. END;
  37.  
  38. begin
  39.   repeat
  40.     write ('Character? ');
  41.     readln (choice);
  42.     screenwrite (choice);
  43.   until (choice='q');
  44. end.