home *** CD-ROM | disk | FTP | other *** search
- {$S+}
- {$V+}
- {$R+}
- {$I+}
- Program SampleScreenHandling;
- Uses Dos,
- Crt;
-
- Type
- ScreenType = array[0..4006] of byte;
-
- (* 0..3999 is for the screen data *)
- (* 4000..40003 is the current window *)
- (* 4004 is the current drawing color *)
- (* 4005..4006 is the cursor X,Y coordinates *)
-
-
- (* The Two Procedures SaveScreen & RestoreScreen have already been
- UpLoaded under the File Name SCREEN.ARC *)
-
-
- Procedure SaveScreen(Var Screen:ScreenType);
- Var
- ColorScreen : ScreenType absolute $B800:$0000;
- MonoScreen : ScreenType absolute $B000:$0000;
- begin
- Case LastMode of
- BW40 : Move(ColorScreen,Screen,2000);
- CO40 : Move(ColorScreen,Screen,2000);
- BW80 : Move(ColorScreen,Screen,4000);
- CO80 : Move(ColorScreen,Screen,4000);
- Mono : Move(MonoScreen,Screen,4000);
- Font8x8 : begin (* not used by our system *) end;
- end;(*case*)
- Screen[4000]:=lo(WindMin)+1;
- Screen[4001]:=hi(WindMin)+1;
- Screen[4002]:=lo(WindMax)+1;
- Screen[4003]:=hi(WindMax)+1;
- Screen[4004]:=TextAttr;
- Screen[4005]:=WhereX;
- Screen[4006]:=WhereY;
- end;
-
-
- Procedure RestoreScreen(Var Screen:ScreenType);
- Var
- ColorScreen : ScreenType absolute $B800:$0000;
- MonoScreen : ScreenType absolute $B000:$0000;
- begin
- Case LastMode of
- BW40 : Move(Screen,ColorScreen,2000);
- CO40 : Move(Screen,ColorScreen,2000);
- BW80 : Move(Screen,ColorScreen,4000);
- CO80 : Move(Screen,ColorScreen,4000);
- Mono : Move(Screen,MonoScreen,4000);
- Font8x8 : begin (* not used by our system *) end;
- end;(*case*)
- Window(Screen[4000],Screen[4001],Screen[4002],Screen[4003]);
- TextAttr:=Screen[4004];
- GoToXY(Screen[4005],Screen[4006]);
- end;
-
-
- Procedure SaveScreenBuffToDisk(Var Screen:ScreenType;FileName:string);
- Var
- FilVar : file;
- Result : integer;
- begin
- Assign(FilVar,FileName);
- ReWrite(FilVar);
- FileRec(FilVar).RecSize:=SizeOf(Screen); (* define 1 record as 4007 bytes *)
- BlockWrite(FilVar,Screen,1,Result);
- Close(FilVar);
- Result:=IOResult;
- end;
-
-
- Procedure RestoreScreenBuffFromDisk(Var Screen:ScreenType;FileName:string);
- Var
- FilVar : file;
- Result : integer;
- begin
- Assign(FilVar,FileName);
- Reset(FilVar);
- FileRec(FilVar).RecSize:=SizeOf(Screen); (* define 1 record as 4007 bytes *)
- BlockRead(FilVar,Screen,1,Result);
- Close(FilVar);
- Result:=IOResult;
- end;
-
- Procedure DrawBox(X1,Y1,X2,Y2:integer);
- Var
- X,Y : integer;
- begin
- For X:=X1 to X2 do
- begin
- GoToXY(X,Y1); Write('-');
- GoToXY(X,Y2); Write('-');
- end;
- For Y:=Y1 to Y2 do
- begin
- GoToXY(X1,Y); Write('|');
- GoToXY(X2,Y); Write('|');
- end;
- end;
-
- Procedure PressKey(Title:string);
- Var
- Key : char;
- begin
- GotoXY(1,1); Write(Title,'. Please Press A Key');
- Key:=ReadKey;
- end;
-
-
- Var
- Screen : ScreenType;
-
- begin
-
- (* save the first screen to disk *)
-
-
- TextBackGround(Black);
- TextColor(Blue);
- ClrScr;
- DrawBox(10,1,30,10);
- TextColor(White);
- DrawBox(20,10,78,23);
- SaveScreen(Screen);
- SaveScreenBuffToDisk(Screen,'SAVE.P1X');
- PressKey('Saved SAVE.P1X to Disk');
-
-
- (* save the 2nd screen to disk *)
-
-
- TextBackGround(Blue);
- TextColor(White);
- ClrScr;
- DrawBox(10,1,15,5);
- SaveScreen(Screen);
- SaveScreenBuffToDisk(Screen,'SAVE.P2X');
- PressKey('Saved SAVE.P2X to Disk');
-
-
- (* restore the first screen from disk *)
-
- RestoreScreenBuffFromDisk(Screen,'SAVE.P1X');
- RestoreScreen(Screen);
- PressKey('Restored SAVE.P1X from Disk');
-
-
- (* restore the 2nd screen from disk *)
-
- RestoreScreenBuffFromDisk(Screen,'SAVE.P2X');
- RestoreScreen(Screen);
- PressKey('Restored SAVE.P2X from Disk');
- end.
-
-
- These routines will only work in the following textmodes
- BW40, CO40, BW80, CO80, Mono.
-
-
- The Two Routines I have added are:
-
- RestoreScreenBuffFromDisk(ScreenBuffer,FileName);
- SaveScreenBuffToDisk(ScreenBuffer,FileName);
-
-
- These routines work in conjunction with my earlier routines I
- uploaded to compuserve.
-
- RestoreScreen(ScreenBuffer);
- SaveScreen(ScreenBuffer);
-
-
- The 2 new procedures allow you to save/load the text buffers to disk using
- Turbos BlockRead/BlockWrite.
-
- Russell - 75170,47