home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / PAGWRITE.ZIP / PAGEDISP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-10-07  |  4.9 KB  |  104 lines

  1. {     Demonstration program to show use of User provided I/O device driver
  2.   routines from Turbo Pascal. The output routine shown here enables writing
  3.   to either of the 4 display pages available on the Color Graphics adapter
  4.   While keeping one of the pages on display, and switching between display
  5.   pages to change display screens very rapidly.}
  6.  
  7. const
  8. Attribute:byte =7;          {Attribute of characters to be written}
  9. Out_Page: byte =0;          {Page to which Write and Writeln procedures
  10.                              would output characters to}
  11.  
  12. Procedure  Textcolor(a:byte);
  13. {****************************************************************************
  14. Replaces Standard Turbo Procedure TextColor
  15. *****************************************************************************}
  16. begin
  17. Attribute:=(Attribute and $70)+(a and 15)+((a and 16) shl 3)
  18. end;
  19.  
  20.  
  21. Procedure Textbackground(a:byte);
  22. {****************************************************************************
  23. Replaces Standard Turbo Procedure TextBackground.
  24. *****************************************************************************}
  25. begin
  26. Attribute:=(Attribute and $8F) + ((a and 7) shl 4)
  27. end;
  28.  
  29.  
  30. Procedure Writechar(InChar:Char);
  31. {**************************************************************************
  32.     This procedure outputs the character "Inchar" to the page defined by
  33. Out_Page. Direct output to screen memory is utilized to obtain high speed
  34. display.The attribute of characters written is the one defined as "Attribute".
  35. It may be noted that standard Turbo Procedures TextColor and Textbackground
  36. also have been redefined, so that these statements can change the value of
  37. the "Attribute" byte.
  38. *****************************************************************************}
  39. begin
  40. Inline ($FB/$33/$DB/$1E/$BA/$40/$00/$8E/$DA/$2E/$8A/$1E/Out_page/$80/$E3/
  41.         $07/$D1/$E3/$8B/$57/$50/$B9/$00/$B8/$8E/$C1/$52/$B8/$00/$08/$F7/
  42.         $E3/$5A/$8B/$C8/$8B/$86/Inchar/$2E/$8A/$26/Attribute/$8B/$F0/$3C/
  43.         $07/$75/$08/$B4/$0E/$CD/$10/$FE/$C2/$EB/$44/$3C/$0D/$74/$3C/$3C/
  44.         $0A/$74/$2F/$3C/$08/$74/$38/$8B/$F9/$B8/$50/$00/$F6/$E6/$52/$32/
  45.         $F6/$03/$C2/$D1/$E0/$03/$F8/$BA/$DA/$03/$EC/$D0/$D8/$72/$FB/$FA/
  46.         $EC/$D0/$D8/$73/$FB/$8B/$C6/$AB/$FB/$5A/$42/$80/$FA/$50/$72/$59/
  47.         $32/$D2/$80/$FE/$18/$73/$10/$FE/$C6/$EB/$4E/$32/$D2/$EB/$4A/$0A/
  48.         $D2/$74/$75/$FE/$CA/$EB/$42/$1E/$52/$BA/$00/$B8/$8E/$C2/$8E/$DA/
  49.         $8B/$F9/$8B/$C6/$8B/$F1/$81/$C6/$A0/$00/$B9/$B0/$07/$B0/$20/$BA/
  50.         $DA/$03/$EC/$A8/$08/$74/$FB/$BA/$D8/$03/$B0/$01/$EE/$FA/$FC/$F3/
  51.         $A5/$B9/$50/$00/$B0/$20/$F3/$AB/$BA/$DA/$03/$EC/$A8/$08/$74/$FB/
  52.         $BA/$D8/$03/$B0/$09/$EE/$FB/$5A/$1F/$89/$57/$50/$D1/$EB/$3A/$1E/
  53.         $62/$00/$75/$24/$B0/$A0/$F6/$E6/$30/$F6/$D1/$E2/$01/$D0/$03/$06/
  54.         $4E/$00/$D1/$E8/$BA/$D4/$03/$89/$C1/$B0/$0E/$EE/$42/$88/$E8/$EE/
  55.         $B0/$0F/$4A/$EE/$42/$88/$C8/$EE/$1F)
  56. end;
  57.  
  58.  
  59. Procedure Display_Page(a:byte);
  60. {****************************************************************************
  61.   This procedure is used to switch screen display pages.4 pages (0 to 3) are
  62. available with the color graphics adapter in the 80 column display mode.
  63. *****************************************************************************}
  64. begin
  65. Inline($B4/$05/$8A/$86/a/$24/$03/$CD/$10)
  66. end;
  67.  
  68.  
  69. var
  70. i,j:byte;
  71. C:char;
  72.  
  73. {Main program... Demonstrates Page switching..}
  74.  
  75. begin
  76. ConOutPtr:=Ofs(WriteChar);  { This is the key statement which reassigns the
  77.                               Turbo Screen Output Pointer to our output
  78.                               Routine.. From now on all Write and Writeln
  79.                               Statements will utilize the procedure WriteChar
  80.                               instead of the Turbo Internal procedure..}
  81. For i := 0 to 3 do begin               {                          }
  82.                    Display_page(i);    {  Clear all display pages }
  83.                    ClrScr              {                          }
  84.                    end;                {                          }
  85. Display_Page(0);
  86. For i:= 0 to 3 do             { Write sample message to all 4 pages    }
  87.      begin                    { (0,1,2 and 3) while keeping page 0     }
  88.      Out_Page:=i;             { on display. The Statement Out_Page:=i  }
  89.                               { controls the display page to which the }
  90.                               { Writeln statement writes to.           }
  91.      For j:= 1 to 23 do  Writeln('':i+j,'This is page No..',
  92.                                   i:2,'  on display...Line No..',j:2);
  93.      Write(' Press any key to show next page and ESC to exit....');
  94.      end;
  95.  
  96. i:=0;
  97. Repeat                        { Now show pages 0 to 3 in sequence at }
  98.   Display_Page(i);            { each keystroke by using the page     }
  99.   Read(kbd,C);                { Switching procedure Display_Page.    }
  100.   i:=(i+1) mod 4;             { Exit when the ESC key is hit...      }
  101. until (C = ^[);
  102. Display_page(0)
  103. end.
  104.