I have the following Turbo Pascal program:
program problem;
uses crt,graph;
var graphicsdriver,graphicsmode,p,i:integer;
begin
graphicsdriver:=detect;
initgraph(graphicsdriver,graphicsmode,'');
setvisualpage(1);
setactivepage(0);
p:=0;
for i:=1 to 2000 do begin
outtextxy(round(i/50),100,'test');
setvisualpage(p);
p:=abs(p-1);
setactivepage(p);
cleardevice;
end;
end.
The program draws onto a page and only after it finishes drawing the page it displays the page, then displays the drawn page until finishes with the next one.
This should work, but it does not: it draws the first page perfectly, but the second does not start from (0, 0), it starts near to the middle of the screen. Why is that, and how can I fix it?
My guess is that your video card is returning a different configuration from anything turbo pascal expects.
The Graph unit is probably just plain not going to work on a modern computer.
I tried running this with free pascal. It draws your text in the right spot, but there's all kind of flickering. (The FP Graph unit is a rewrite of the one from TP, and it's known to be buggy.)
If it were me, I'd take a look at SDL and Cairo, both of which come bundled with free pascal. There's also an excellent drawing library at AggPas.
I don't know if they'll work with turbo pascal, but free pascal is free and cross platform.