We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Run Pascal Program under Dos Prompt Windows

Jackques
Jackques asked
on
Medium Priority
1,158 Views
Last Modified: 2008-02-01
I had a program which is written in Pascal that is running in Graphics mode using the egavga (egavga.bgi) mode. I am trying to run this program under Windows 95 Dos Prompt Shell in "window" form, which mean that the program is not running in full screen. This enable me to switch between windows by using the mouse and monitoring other program while the DOS program is running.

(My DOS program is running in vga 256 colour 640x480 mode while my windows setting is 800x600 16.8 million colour mode.)
But when I try to do that, Dos shell reported that the appplcation must running in full screen mode. Is there any way to do that ?    
Comment
Watch Question

There is currently no way to do that because of the way in which Pascal Graphics place the pixels to the screen,  When pascal prints a pixel to the screen,  it goes to that screen coordinate,  Because pascal was written for dos without windows support, It cannot handle running in a window mode.  In order to run the program in full screen mode,  press CTRL+ENTER when you load up the dos prompt,  and then run the program,  you can later switch the dos prompt back to a window by pressing CTRL+ENTER again
Actually.. you can run Dos graphics programs in a Window.  I run my 320x200x256 prorgams in a window, with no problems.  My windows setting is 800x600x16M.  And it is fine

Commented:
you can run any program in windows that uses graphics mode, just run it in full-screen mode
I can run most dos graphics programs without a problem,  But when it comes to writing graphics programs in pascal,  you must run it in full screen mode.

Author

Commented:
I think I mentioned in my question is that I am required to run the application in dos window, and NOT in full screen mode, which I am capable of running. I have tried to run a small graphics mode pascal program, which is able to run in shell window. So I thought someone might know why is that so ?? And how can I run my program in shell window ? What cause a DOS pascal program to insist in running full screen ???

Author

Commented:
Adjusted points to 120

Commented:
i'm not sure becuz of the resolution, maybe that if ur screen-res is very high, 800x600 or probly more it could work and also important is, that ur windows config uses at least 256 colors also.

Commented:
I think windows can only run text mode programmes in a window, so that your graphical interface application must run in a full screen.
rbr

Commented:
You can run Pscal programs in a DOS window if you uses only text output. For graphics you have to use a full window or to write a real Windows program.
rbr

Commented:
Why did you reject my answer.

Author

Commented:
Right now, I am running the same program using my friend's notebook, and it is running perfectly all right using his system. I have check his Dos Prompt configurations, but it is same as what i had on my system. So I still trying to figure out why.

BUT it is running in DOS shell windows perfectly all right.
are you both running the same versions of windows with the same patches, updates, etc...?  Maybe it was something that was fixed in a later revision.
xyu

Commented:
WIn95/98 as well as NT will FREEZE any DOS program that directly addresses the Video Memory in graphics mode vith video mode different than windows current video mode... the only way to run such a program is Full Screen... You can't do anything with that ... but You can try to use Desqview ... and Run Your program :)

What you should do is press ALT + ENTER and the MS-DOS screen will become a full screen display so now you can run your program...

Regards,
Viktor Ivanov
Adding to my answer above. Another safe way to run your program is to first start the MS-DOS, and then go to the path Ex.C:\windows\desktop\MyFolder\Game.exe and execute it from there...

Regards,
Viktor Ivanov

Commented:
I've just tried to do what you're trying to achieve using a program I wrote about 18 months ago. It starts up in a text mode and will run quite happily in a window, until it changes to graphics mode, at which point it's swaps to full screen. Using ALT-ENTER swaps it back to a window, and it will remain in a window even when changing to text mode. But changing back to graphics mode it goes back to full screen.

In a nutshell I don't think it's possible. I have a feeling that PASCAL uses a direct BIOS or VESA call to change mode which windows can't intercept. Maybe I'm wrong cos I'm not a graphics guru. I just thought you may feel better knowing that someone else has the same problem.

Good luck

Elkiors.

Commented:
Is there 640*480*16.8m colors mode in egavga.bgi?

Commented:
jack_p50:

I thought vga only handled upto 256 colours no matter what the resolution. I think you have to go to VESA2 modes to implement more, although how you'd go about doing that in TP I have no idea.

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
There isn't any graphics driver that runs on 640 x 400, except ATT400. Or is there others ?

Commented:
Let me add my $0.02 worth:
As far as I know, Windows should handle any standard VGA mode - that is, 320x200x256 or 640x480x16, but NOT 640x480x256. [BTW, how did you manage to run 640x480x256 with the standard egavga.bgi???] I'm not sure about these modes - maybe they will work if your program uses VESA-BIOS calls instead of accessing the videocard directly. Also, try playing with the options under Properties/Screen (right click on your program's icon), especially the ROM emulation and dynamic memory allocation - try different settings.
HTH, joe

Commented:
What you want is not possible. A DOS program in graphics mode writes directly into video memory bypassing the BIOS. This video memory is what you see in full screen mode. This is located at address $B8000 (or $B0000, I don't remember it exactly.) This is another memory than what is used by Windows. Windows uses the memory on the video card.

Author

Commented:
AlexP, let me repeat myself in case u miss out the point, I got my friend's notebook and tried it out. It worked perfectly. It is just that I need that to be available in PC too. Unless there is a big difference in memory addressing btw the two. In that case, pls enlighten me.

Commented:
Could you possibly post the relevant parts of code? (Especially the screen output routines.)

Author

Commented:
Joe_h, these are part of my code, hope it is useful.

procedure Setup;
{  THIS PROCEDURE INITIALISES THE GRAPHICS MODE }

var grmode,grdriver : integer;

begin
  grmode      := 1;
  grdriver    := 3;
  initgraph ( grdriver, grmode, ' ' );
end;

{This is another procedure performing some o/p display}

procedure PrintFiles(i,Count: integer;ext: ExtStr; var ptr: FileTypeptr);

var
  Path: PathStr;
  j: integer;

begin
   SetFillStyle(SolidFill,Blue);
   Bar(GetMaxX div 2-10,22+i*GetMaxY div 2, GetMaxX-20, i*GetMaxY div 2 + 60+Count*10);
   Rectangle(GetMaxX div 2-10,22+i*GetMaxY div 2, GetMaxX-20, i*GetMaxY div 2 + 60+Count*10);
   Path:='';
   Path:=FExpand(Path);
   SetColor(Yellow);
   OutTextXY(GetMaxX div 2,30+i*GetMaxY div 2,ext+' Files in');
   OutTextXY(GetMaxX div 2+75, 30+i*GetMaxY div 2, Path);
   SetTextStyle(DefaultFont,HorizDir,1);

   for j:=0 to Count-1 do
   begin
      OutTextXy(GetMaxX div 2,i*GetMaxY div 2 + 45 + j*10,ptr[j]^.Name);
   end;

   SetTextStyle(SmallFont,HorizDir,4);
end;


Commented:
All right, I did some testing and here are my results. Unfortunately, I had only about four different configurations to play with - anyone wants to continue? So, here's what I have found:

Windows 95 IS CAPABLE of running a graphics program in a window, BUT:
- Program must run in one of the standard EGA or VGA modes (that is, up to 640x480x16, or 320x200x256,... (modes 01h through 13h I think). As far as I have found, VESA modes won't work.
- Windows 95 display drivers have to support this feature.

I was able to run the above code on three machines, all of them had different sorts of S3 compatible PCI video cards, running Windows 95 OSR 2 (sometimes called 'B' - that's what they show in Control Panels|System next to the version number). No additional drivers installed (DirectX etc. - only the standard stuff that comes with W95).

I was NOT able to run it on a machine with MA302 (Creative Labs) PCI videocard (with original Creative Labs drivers; didn't try to use Cirrus drivers as it has Cirrus chipset.) - the program would hang with that nasty message saying I can't run in a window.

So, you may want to play with your system configuration a little - maybe borrow a different videocard, get the latest drivers from the WWW, etc.

Also, since your code seems to be resolution-independent, try setting grdriver:=Detect before calling InitGraph (instead of the fixed value, which forces EGA mode) - just in case your current display driver doesn't support EGA anymore.

HTH, Joe

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

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

OR

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.