Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-05

Turbo Pascal 3 graphics

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kevin Lyda

Amazingly I still have a number of my high school computer science projects which were written in Turbo Pascal 3. And a few are almost not horribly embarrassing.

I'd like to port them to fpc and write up the experience but I know what the huge issue is: it uses the graphics.bin library which was brought in with graph.p - a snippet of which is at the bottom of this email.

It did something like turtle graphics and worked on CGA type systems which were comically limited. Still, it would be neat to see it run outside of DOSBox.

So I'm wondering what my options are with FPC graphics. Looking through the code I used Draw, GotoXY, Palette, Circle and Fillshape - as well as IO functions like write, read and keypressed.

Any suggestions appreciated, thanks,

Kevin

const
  North = 0;
  East  = 90;
  South = 180;
  West  = 270;
procedure Graphics;                                   external 'c:\GRAPH.BIN';
procedure GraphMode;                                  external Graphics[0];
procedure GraphColorMode;                             external Graphics[3];
procedure HiRes;                                      external Graphics[6];
procedure HiResColor(Color: Integer);                 external Graphics[9];
procedure Palette(N: Integer);                        external Graphics[12];
procedure GraphBackground(Color: Integer);            external Graphics[15];
procedure GraphWindow(X1,Y1,X2,Y2: Integer);          external Graphics[18];
procedure Plot(X,Y,Color: Integer);                   external Graphics[21];
procedure Draw(X1,Y1,X2,Y2,Color: Integer);           external Graphics[24];
Kevin Lyda Galway, Ireland

Reply by email

Sven Barth
to Kevin Lyda

Kevin Lyda schrieb am Mi., 8. Mai 2019, 10:58:

Show quoted text 19 lines
Amazingly I still have a number of my high school computer science projects which were written in Turbo Pascal 3. And a few are almost not horribly embarrassing. I'd like to port them to fpc and write up the experience but I know what the huge issue is: it uses the graphics.bin library which was brought in with graph.p - a snippet of which is at the bottom of this email. It did something like turtle graphics and worked on CGA type systems which were comically limited. Still, it would be neat to see it run outside of DOSBox. So I'm wondering what my options are with FPC graphics. Looking through the code I used Draw, GotoXY, Palette, Circle and Fillshape - as well as IO functions like write, read and keypressed. Any suggestions appreciated, thanks,

You could simply use one of the Graph units provided by FPC (e.g. PtcGraph). Though depending on the unit the colors might be 32-bit values instead of 16-bit ones.

Regards,
Sven

Reply by email

Bernd Oppolzer
to Kevin Lyda: Amazingly I still have a number of my high school computer science projects which were…

This may be off-topic, but anyway:

I did some graphics programming in the 1990s (for customers of mine), but with not so much interest on display terminals, but instead on large plotters (DIN A0 format, for example).
I used a library called GKS at that time (graphics kernel system), which was
device independent and supported several "drivers" for different plotters and
graphics display stations. But it was only "passive" graphic, used to preview
the output which was plotted later. GKS had a Fortran interface, but I added
a Pascal interface. This was on the IBM mainframe.

Later (and on other platforms) I had no GKS, but I liked the idea, so I built
a library of my own, inspired by GKS. The GKS calls produce a GKS metafile; this is a readable text file which contains all the graphic elements. The GKS
metafile is then translated to HPGL (HP graphics language); this is the only
supported "driver" at the moment. For HPGL files, there are very good public
domain viewers (for example HPGLVIEW from Cern). You can print or plot the HPGL files or convert them to PDFs.

So, using this GKS library and the GKS metafile format (and its translation to HPGL),
it is still possible to do sort of professional graphics programming using much the same functions and features that I used in the 1990s. The language doesn't really matter; it can be C or Pascal.

Example output file: http://bernd-oppolzer.de/fdynsb.pdf

If you want to know more about GKS or the GKS-to-HPGL-translator, please feel free to contact me offline.

Kind regards

Bernd

Kevin Lyda wrote 44 lines
Amazingly I still have a number of my high school computer science projects which were written in Turbo Pascal 3. And a few are almost not horribly embarrassing. I'd like to port them to fpc and write up the experience but I know what the huge issue is: it uses the graphics.bin library which was brought in with graph.p - a snippet of which is at the bottom of this email. It did something like turtle graphics and worked on CGA type systems which were comically limited. Still, it would be neat to see it run outside of DOSBox. So I'm wondering what my options are with FPC graphics. Looking through the code I used Draw, GotoXY, Palette, Circle and Fillshape - as well as IO functions like write, read and keypressed. Any suggestions appreciated, thanks, Kevin const North = 0; East = 90; South = 180; West = 270; procedure Graphics; external 'c:\GRAPH.BIN'; procedure GraphMode; external Graphics[0]; procedure GraphColorMode; external Graphics[3]; procedure HiRes; external Graphics[6]; procedure HiResColor(Color: Integer); external Graphics[9]; procedure Palette(N: Integer); external Graphics[12]; procedure GraphBackground(Color: Integer); external Graphics[15]; procedure GraphWindow(X1,Y1,X2,Y2: Integer); external Graphics[18]; procedure Plot(X,Y,Color: Integer); external Graphics[21]; procedure Draw(X1,Y1,X2,Y2,Color: Integer); external Graphics[24]; -- Kevin Lyda Galway, Ireland _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email