home *** CD-ROM | disk | FTP | other *** search
- { Demonstration program to show use of User provided I/O device driver
- routines from Turbo Pascal. The output routine shown here enables writing
- to either of the 4 display pages available on the Color Graphics adapter
- While keeping one of the pages on display, and switching between display
- pages to change display screens very rapidly.}
-
- const
- Attribute:byte =7; {Attribute of characters to be written}
- Out_Page: byte =0; {Page to which Write and Writeln procedures
- would output characters to}
-
- Procedure Textcolor(a:byte);
- {****************************************************************************
- Replaces Standard Turbo Procedure TextColor
- *****************************************************************************}
- begin
- Attribute:=(Attribute and $70)+(a and 15)+((a and 16) shl 3)
- end;
-
-
- Procedure Textbackground(a:byte);
- {****************************************************************************
- Replaces Standard Turbo Procedure TextBackground.
- *****************************************************************************}
- begin
- Attribute:=(Attribute and $8F) + ((a and 7) shl 4)
- end;
-
-
- Procedure Writechar(InChar:Char);
- {**************************************************************************
- This procedure outputs the character "Inchar" to the page defined by
- Out_Page. Direct output to screen memory is utilized to obtain high speed
- display.The attribute of characters written is the one defined as "Attribute".
- It may be noted that standard Turbo Procedures TextColor and Textbackground
- also have been redefined, so that these statements can change the value of
- the "Attribute" byte.
- *****************************************************************************}
- begin
- Inline ($FB/$33/$DB/$1E/$BA/$40/$00/$8E/$DA/$2E/$8A/$1E/Out_page/$80/$E3/
- $07/$D1/$E3/$8B/$57/$50/$B9/$00/$B8/$8E/$C1/$52/$B8/$00/$08/$F7/
- $E3/$5A/$8B/$C8/$8B/$86/Inchar/$2E/$8A/$26/Attribute/$8B/$F0/$3C/
- $07/$75/$08/$B4/$0E/$CD/$10/$FE/$C2/$EB/$44/$3C/$0D/$74/$3C/$3C/
- $0A/$74/$2F/$3C/$08/$74/$38/$8B/$F9/$B8/$50/$00/$F6/$E6/$52/$32/
- $F6/$03/$C2/$D1/$E0/$03/$F8/$BA/$DA/$03/$EC/$D0/$D8/$72/$FB/$FA/
- $EC/$D0/$D8/$73/$FB/$8B/$C6/$AB/$FB/$5A/$42/$80/$FA/$50/$72/$59/
- $32/$D2/$80/$FE/$18/$73/$10/$FE/$C6/$EB/$4E/$32/$D2/$EB/$4A/$0A/
- $D2/$74/$75/$FE/$CA/$EB/$42/$1E/$52/$BA/$00/$B8/$8E/$C2/$8E/$DA/
- $8B/$F9/$8B/$C6/$8B/$F1/$81/$C6/$A0/$00/$B9/$B0/$07/$B0/$20/$BA/
- $DA/$03/$EC/$A8/$08/$74/$FB/$BA/$D8/$03/$B0/$01/$EE/$FA/$FC/$F3/
- $A5/$B9/$50/$00/$B0/$20/$F3/$AB/$BA/$DA/$03/$EC/$A8/$08/$74/$FB/
- $BA/$D8/$03/$B0/$09/$EE/$FB/$5A/$1F/$89/$57/$50/$D1/$EB/$3A/$1E/
- $62/$00/$75/$24/$B0/$A0/$F6/$E6/$30/$F6/$D1/$E2/$01/$D0/$03/$06/
- $4E/$00/$D1/$E8/$BA/$D4/$03/$89/$C1/$B0/$0E/$EE/$42/$88/$E8/$EE/
- $B0/$0F/$4A/$EE/$42/$88/$C8/$EE/$1F)
- end;
-
-
- Procedure Display_Page(a:byte);
- {****************************************************************************
- This procedure is used to switch screen display pages.4 pages (0 to 3) are
- available with the color graphics adapter in the 80 column display mode.
- *****************************************************************************}
- begin
- Inline($B4/$05/$8A/$86/a/$24/$03/$CD/$10)
- end;
-
-
- var
- i,j:byte;
- C:char;
-
- {Main program... Demonstrates Page switching..}
-
- begin
- ConOutPtr:=Ofs(WriteChar); { This is the key statement which reassigns the
- Turbo Screen Output Pointer to our output
- Routine.. From now on all Write and Writeln
- Statements will utilize the procedure WriteChar
- instead of the Turbo Internal procedure..}
- For i := 0 to 3 do begin { }
- Display_page(i); { Clear all display pages }
- ClrScr { }
- end; { }
- Display_Page(0);
- For i:= 0 to 3 do { Write sample message to all 4 pages }
- begin { (0,1,2 and 3) while keeping page 0 }
- Out_Page:=i; { on display. The Statement Out_Page:=i }
- { controls the display page to which the }
- { Writeln statement writes to. }
- For j:= 1 to 23 do Writeln('':i+j,'This is page No..',
- i:2,' on display...Line No..',j:2);
- Write(' Press any key to show next page and ESC to exit....');
- end;
-
- i:=0;
- Repeat { Now show pages 0 to 3 in sequence at }
- Display_Page(i); { each keystroke by using the page }
- Read(kbd,C); { Switching procedure Display_Page. }
- i:=(i+1) mod 4; { Exit when the ESC key is hit... }
- until (C = ^[);
- Display_page(0)
- end.