[fpc-pascal] Cross Platform Save/Restore Screen
Michael Van Canneyt
michael at freepascal.org
Tue Jun 20 16:53:02 CEST 2006
On Tue, 20 Jun 2006, Michael Preslar wrote:
> Back in the DOS Turbo Pascal days I could do the following
>
> type
> screentype= array[1..4000] of byte;
> screenptr=^screentype;
> var
> screen1: screenptr;
>
> procedure savescreen(scr:byte);
> var
> sc1: byte absolute $b000:0;
> sc2: byte absolute $b800:0;
> begin;
> if screenaddress=$b000 then move(sc1,screens1^,4000);
> if screenaddress=$b800 then move(sc2,screens1^,4000);
> end;
>
> procedure restorescreen(scr:byte);
> var
> sc1: byte absolute $b800:0;
> sc2: byte absolute $b000:0;
> begin;
> if screenaddress=$b000 then move(screens1^, sc2,4000);
> if screenaddress=$b800 then move(screens1^, sc1,4000);
> end;
>
> Now I'm stuck. How can I do the same for Win32 Console apps, and
> *nix/*bsd console apps?
The short answer: You simply can't...
You must use the 'video' unit to do this kind of tricks in a more or less
cross-platform way, but you'll have to rewrite your code completely.
You may also want to have a look at the ncurses unit and the various
descendents, ocrt, ncrt.
video is documented, and is part of the RTL.
The others are in the packages.
Michael.
More information about the fpc-pascal
mailing list