Forum > General
Switching between CRT/graphics modes in FPC
(1/1)
userd157:
Dear all,
I am a new user of FPC (used to do all my stuff in Borland Pascal 7). In the program below (you may have to run the .exe file) I request an instruction from a CRT screen, activate a graphics page, and then switch back to the CRT screen. However, when I return, the text on the CRT screen is completely wrong. I'm sure I'm doing something wrong here, but haven't got a clue what it could be. Any suggestions? Also regarding the creation of the graphics image, etc?
PS: Forgot to add - I have written numerous bits of BP7 code over the past 20 years or so for engineering designing - it is an impossible task to rewrite all of these in any other language. FPC looks like a godsend - your assistance will be tremendously appreciated!
program TestGraphics;
uses DOS,Crt,graph;
var cc:char;
Xmax,Ymax,gm,Gdr,FT:integer;
begin
cc:=#00;
FT:=1;
repeat
ClrScr;
if FT=1 then
begin
writeln('Graphics test program');
writeln;
write('Press G to create a graphics page or ESC to exit: ');
FT:=2;
cc:=readkey;
end else
begin
writeln('Continuing test run');
writeln;
write('Press g again else ESC to exit: ');
cc:=readkey;
end;
if upcase(cc)='G' then
begin
gm:=0;
Gdr:=Detect;
Initgraph(Gdr,gm,'');
Xmax:=GetMaxX;
Ymax:=GetMaxY;
line(1,1,Xmax,Ymax);
OutTextXY(10,10,'Press any key to continue ...');
cc:=readkey;
closegraph;
cc:=#00;
end;
until cc=#27;
end.
Navigation
[0] Message Index