We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Pascal question

jgarvin asked
Medium Priority
Last Modified: 2010-04-16
Does anyone have any leads on automated or semi-automated tools that can convert High-res Turbo Pascal grapics routines to Windows (preferabaly C++) graphics routines?

The current routines use high resolution EGA graphics that only run in full-screen under Windows.  To clarify what the graphics routines are, they do use BGI as a basis, with overlayed routines.

They need to co-exist and operate with other windows programs.  I need to convert these to something that acts like a native Windows (NT) program. Of course the current version can be viewed in a window, but only with the program frozen.

I have applications that I need to port, but would like to avoid complete re-writes.

Additional Info:

This is not a game, and to a certain extent, speed on any platform is not of the essence, as the application will be running under NT 4.0 with a Dual 200 MHz Pentium Pro PC and 128 Meg of RAM (though a great deal is already used for system control).  The graphics mode is 640x350 (some newer graphics cards do not like this mode).  About 70% of the screen is a window with rendered CAD graphics.  A smaller window using half of the remaining space represents a variable zoomed area of the larger graphic region.

Our graphics mode is 1280x1024 on a 21" monitor. This application must coexist (both viewable at the same time) with a window that is nominally 550x600 pixels.
Watch Question


When you say "High-Res TP Graphics routines"; are we talking about BGI? Or some other grahics library (or something else entirely?).


Edited text of question

I can't say I'm totally familiar with BGI, but from what I recall most of the calls map pretty much one-to-one with Windows GDI calls; so writing a wrapper unit that your code would call that would, in turn, call GDI would be one possibility; if you're not doing anything too fancy.   I'd be willing to give a hand on creating such a unit if you like.

I also seem to recall from a few years back a commecially available library that was a BGI interface to GDI. This might still be available, though I don't recall seeing it advertized recently.  I can try to track down info on that if that sounds like a solution for you.


The answer at this time is not quite precise enough as to my options. The response skirts the issue a bit, though I greatly appreciate the offer of additional help.  Let me review and ponder the response before I close the question.

Sorry, I have to rate it "poor" for now or it gets closed automatically.

Forgive me for being a bit miffed, but what were you expecting? A response like: All you have to do is call "Foo;" at the beginning of your original code and everything will transport cleanly from DOS Real-mode direct screen graphics into Windows Protected-mode Windowed graphics?  Sorry, ain't no such critter.  

I offered to find information on a commercial solution and to provide assistance with rolling your own, 200 points is a lot, but not enough to warrant my just freely posting what amounts to at least several hours work on an interface library.

Holy smokes...SLP...don't get all crazy.

I'm sure jgarvin will be more than happy to have you submit
another 'fuller' answer.

I would have rejected your answer too.  It is kind of vague.
And a promise of help does not warrant a grade...perhaps
jgarvin wants to see some help first.


SLP:  My apologies if my response sounded too critical, I did not mean to discount the help you offered.  I am not doing the actual coding for this project, but am trying to facilitate it.  

The answer had minimal specifics and was a bit "qualified" for me to provide an unqualified "thanks." Not that it is an excuse, but I also was burned 200 points on a non-answer in the past, so I just want to be careful.  

And yes, I did have unrealistic hope that there might be some "tool" that would make it fairly easy, or an interpreter/translator that might be able to take chunks of the code and port them to Borland or the other C++.  That's why I am here asking the question.  I also had no intention of asking for original research.  I was hoping to leverage off of something that someone else has used or done before.

Thanks for listening.


Adjusted points to 300

What performances are you looking for?
The GDI without Direct... is too slow for games and such.
I know you only want the BGI translated, but there are many ways.
What resolutions do you want?
Any other statistics will be useful.

/// John


Edited text of question


Edited text of question

I'm not too familiar with BGI...

But are these just line, circle, pixel commands wer're
talking about??

If so, I think it would be pretty straight forward to just
convert by hand the drawing commands and the associated

Unless we're talking about thousands of lines of code...
Use int10 func 0x0C to out the pixels instead of the built in bgi functions and the program will most probably run fine windowed

some sourcecode for ya:
procedure outpixel(x,y : word;color : byte);assembler;
   mov ah,0Ch
   mov bh,pagenum {probably 0 so you could replace with
                   "xor bh,bh" to increese speed to some degree}
   mov al,color
   mov cx,x
   mov dx,y
   int 10h

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.