How to run Turbo Pascal code that uses MS-DOS Graphics Mode on Windows 10?

151 Views Asked by At

I've found some old code that I've written in Turbo Pascal and that I would like to run. I'm not sure if this is the right place to ask.

I've installed Turbo Pascal with DOSBox from sourceforge (installed it on Windows 10 in Virtual Box) but the code doesn't run. It opens the window and closes immediately.

The code uses this function:

Uses crt, graph;

Procedure Grafika (sterownik,tryb:integer;
                  autodetect:boolean;Path:String);
begin
   if autodetect then
       sterownik:=detect;
   InitGraph(sterownik,tryb,Path);
end;

and runs like this:

Grafika(1,1,True,'');

The code also uses some assembly to handle the cursor, by using interrupt 33h. This is an example function (of a few):

Procedure VisibleCur(a: boolean);
Begin
  if a then
    asm
      mov ax, 0001h
      int 33h
    end
  else
    asm
      mov ax, 0002h
      int 33h
    end;
end;

Is there a way to run this code somehow? I would really want to see the app, because it was one of the first applications that I've written that is GUI under MS-DOS.

2

There are 2 best solutions below

1
On

Your current setup presents a significant amount of emulation indirection:

host > Windows 10 > Virtual Box > DOSBox.

I would try to run the app in something more 'baremetal', first just to discard every possible emulation issue. I think DOSBox is available native in most common OSes (Linux, Windows, Apple ...).

Ideal would be to launch from MS-DOS on a real machine. But maybe you can try using a pcem or 86box VM which is more precise in hardware emulation than DOSBox.

0
On

I've found that to run the code I need to add a path to the BGI, it's not detected automatically. In my case, it was:

Grafika(1,1,True,'C:\\TPWDB\\BGI');