Sign in Join

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

Mailing lists / fpc-pascal / 2010-07

Converting a graphical DOS program to fpc

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Simon Webster

Dear Free Pascallers,

I'm wanting to convert a Turbo Pascal program to fpc, to run (ultimately) under linux, although I'm actually developing on a mac, and using virtualbox to run ubuntu. The program in question is a relatively large non OOP program which makes substantial use of BGI graphics. I'm wondering what would be the best/easiest way of achieving this?

I tried using the graph unit & svgalib under a virtualized ubuntu, but even the simplest test program (InitGraph, putpixel, CloseGraph) produces a runtime error 216. Even if I got this working, I get the feeling that directly bashing the graphics hardware in such a primitive way is not the best way to go.

Ideally I would like to be able to just open a large window that I can use as a bitmap for all my graphics drawing, ideally using graph unit syntax compatible functions. What's the simplest way to do this - I tried looking in the documentation but don't really know where to start. Do I need to use 'Lazarus' if I want to open a window? I've no experience with Delphi or Object Pascal so that whole aspect of fpc is completely alien to me.

Many thanks in advance for any help,
Simon

Reply by email

Graeme Geldenhuys
to Bart

Op 2010-07-01 10:11, Bart het geskryf:

I' would defininately convert it to a GUI program (and use Lazarus for that).

or fpGUI Toolkit. :-)
I'm currently working on a DirectFB backend for fpGUI which will allow for "gui" apps in a console environment.

As for BGI to <something quick and new>... I don't think there is an easy (automated) solution to this, sorry.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Nikolay Nikolov
to Simon Webster: I'm wanting to convert a Turbo Pascal program to fpc, to run (ultimately) under linux,…
Simon Webster wrote 26 lines
Dear Free Pascallers, I'm wanting to convert a Turbo Pascal program to fpc, to run (ultimately) under linux, although I'm actually developing on a mac, and using virtualbox to run ubuntu. The program in question is a relatively large non OOP program which makes substantial use of BGI graphics. I'm wondering what would be the best/easiest way of achieving this? I tried using the graph unit& svgalib under a virtualized ubuntu, but even the simplest test program (InitGraph, putpixel, CloseGraph) produces a runtime error 216. Even if I got this working, I get the feeling that directly bashing the graphics hardware in such a primitive way is not the best way to go. Ideally I would like to be able to just open a large window that I can use as a bitmap for all my graphics drawing, ideally using graph unit syntax compatible functions. What's the simplest way to do this - I tried looking in the documentation but don't really know where to start. Do I need to use 'Lazarus' if I want to open a window? I've no experience with Delphi or Object Pascal so that whole aspect of fpc is completely alien to me. Many thanks in advance for any help, Simon

You can check out the latest development version of ptcpas, which has a BGI-compatible graph unit, called ptcgraph, implemented on top of ptcpas. It's heavily based on the fpc graph unit, namely it uses the same platform-independent .inc files, where all the drawing algorithms are implemented. Ptcgraph currently works under X11 and Windows - both windowed and fullscreen. (ptcpas also supports DOS, but ptcgraph does not support it yet, due to lack of threading support)

It's still a work in progress and I started to work on it only recently, so it's not completely finished yet - only 16-colour (or less) modes are supported as of now, but I can easily add 256-colour and 65536-colour. (however the original BGI drivers that came with Turbo Pascal 7 only supported up to 16-colours, so that's why I'm focusing on it now)

The example programs from TP7 - bgidemo.pas and arty.pas run perfectly with ptcgraph.

The PTCPas website is:
http://ptcpas.sourceforge.net/

Since ptcgraph is new, it's still not included in the latest stable release of ptcpas, so you need to get the latest development version via svn:

svn co https://ptcpas.svn.sourceforge.net/svnroot/ptcpas/trunk ptcpas

Reply by email