Solved

Run Pascal Program under Dos Prompt Windows

Posted on 1998-08-07
26
1,051 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 ?    
0
Comment
Question by:Jackques
26 Comments
 

Expert Comment

by:wschmidt080698
ID: 1217279
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
0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1217280
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
0
 
LVL 2

Expert Comment

by:omsec
ID: 1217281
you can run any program in windows that uses graphics mode, just run it in full-screen mode
0
 

Expert Comment

by:wschmidt080698
ID: 1217282
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.
0
 

Author Comment

by:Jackques
ID: 1217283
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 ???
0
 

Author Comment

by:Jackques
ID: 1217284
Adjusted points to 120
0
 
LVL 2

Expert Comment

by:omsec
ID: 1217285
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.
0
 
LVL 7

Expert Comment

by:Motaz
ID: 1217286
I think windows can only run text mode programmes in a window, so that your graphical interface application must run in a full screen.
0
 
LVL 10

Expert Comment

by:rbr
ID: 1217287
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.
0
 
LVL 10

Expert Comment

by:rbr
ID: 1217288
Why did you reject my answer.
0
 

Author Comment

by:Jackques
ID: 1217289
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.
0
 

Expert Comment

by:wschmidt080698
ID: 1217290
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.
0
 
LVL 3

Expert Comment

by:xyu
ID: 1217291
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 :)

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:viktornet
ID: 1217292
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
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1217293
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
0
 

Expert Comment

by:elkiors
ID: 1217294
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.

0
 
LVL 4

Expert Comment

by:jack_p50
ID: 1217295
Is there 640*480*16.8m colors mode in egavga.bgi?
0
 

Expert Comment

by:elkiors
ID: 1217296
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.

0
 
LVL 4

Accepted Solution

by:
binkzz earned 120 total points
ID: 1217297
Try running your program at 320x200 or 640x400, rather than 320x240 and 640x420. This should solve all of your problems, and will allow you to go back to sleep again at night.

0
 

Author Comment

by:Jackques
ID: 1217298
There isn't any graphics driver that runs on 640 x 400, except ATT400. Or is there others ?
0
 
LVL 2

Expert Comment

by:joe_h
ID: 1217299
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
0
 

Expert Comment

by:AlexP
ID: 1217300
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.

0
 

Author Comment

by:Jackques
ID: 1217301
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.
0
 
LVL 2

Expert Comment

by:joe_h
ID: 1217302
Could you possibly post the relevant parts of code? (Especially the screen output routines.)
0
 

Author Comment

by:Jackques
ID: 1217303
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;


0
 
LVL 2

Expert Comment

by:joe_h
ID: 1217304
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

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now