Large DOS Programs

DOS specific questions.
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Large DOS Programs

Post by unknown »

Why are DOS programs much larger than Windows programs? A Windows-header is larger than a DOS-header, yet a Windows progam starts at 5k and a DOS at 58k. Why? Is there a way to make DOS programs smaller, (even if it means more work)?

Thank you.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Every DOS application comes with DJGPP's loader statically linked as they are DPMI apps that DOS knows nothing about.

I think others extenders like WDOSX can replace the loader, i dunno if all libraries will still working though.
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Post by unknown »

Will replacing DJGPP's loader with WDOSX make the apps considerably smaller? If so, how would I do so? Also, its ok if the libraries do not work.

Thank you.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

PMODE may also support DJGPP, see http://www.thefreecountry.com/programmi ... ders.shtml .

With WDOSX you can also compile your console Win32 (not DOS) FB applications, stub it and run them in raw DOS, without Windows.
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Post by unknown »

I have 3 questions:

1) Is there a way to not include the DPMI, and just output a standard DOS, (MZ,) exe?

2) Is there an assembler that is compatable with FreeBasic's output assembly? I am not concerned about libraries, I would like to be able to write DOS programs in FreeBasic, compile them to assembly, then create the DOS program using an assembler. Hopefully, this will create smaller DOS programs.

3) Can DOS programs be compressed and still work in pure DOS, (like a Windows program)?

Thank you.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

unknown wrote:1) Is there a way to not include the DPMI, and just output a standard DOS, (MZ,) exe?
No.
unknown wrote:2) Is there an assembler that is compatable with FreeBasic's output assembly? I am not concerned about libraries, I would like to be able to write DOS programs in FreeBasic, compile them to assembly, then create the DOS program using an assembler. Hopefully, this will create smaller DOS programs.
GNU as can be used but this will not help you creating smaller EXE files.
unknown wrote:3) Can DOS programs be compressed and still work in pure DOS, (like a Windows program)?
Yes, you may take a look at WDOSX (which also compresses the executable).

Regards,
Mark
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Post by unknown »

Thank you, MJS.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Bloat compiler

Post by DOS386 »

" Is there a way to not include the DPMI, and just output a standard DOS, (MZ,) exe? "
It IS done so by default. But you need the external file
CWSDPMI.EXE. This is BAD.
You can also include it - EXEcutable bloats from 60KB to 80 KB.
You can't use 32 bit programming in DOS without DPMI. Silly but
true: the CPU architecture causes this problem.

FBC is a 32 bit compiler. Advantages: no 64KB & 640KB BUG,
better performance. Disadvantages: a huge DOS extender (>=50KB)
has to be inclued or bundled. PMODE/DJ is SLIGHTLY smaller than CWSDPMI.

unknown wrote:
3) Can DOS programs be compressed and still work in pure DOS, (like a Windows program)?
YES, with UPX.

QUESTION to the DOS devel:

Why did you use CWSDPMI and not DOS/32A ? It is (well, slightly)
smaller than CWSDPMI, but has much better performance and less
problems than PMODE, and a more liberal license.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

I included CWSDPMI in the package because that is what the DJGPP docs usually refer to. I don't find it to be overly large, either - the version of CWSDPMI used is only 13 KB.

There are a number of reasons why programs produced by fbc for DOS (and the DJGPP gcc port as well) are large, such as the extensive *NIX emulation throughout the C runtime library, and to be compatible with DJGPP-compiled C libraries, this cannot be changed.
Nexinarus
Posts: 146
Joined: May 28, 2005 6:08
Location: Everywhere
Contact:

Post by Nexinarus »

50kb aint much for 32bit DOS apps. compress them with UPX and it should make them smaller anyway.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

I don't understand all those references to UPX and CWSDPMI. Simply use WDOSX and you'll get the advantage(s) of both with one single tool:
  1. WDOSX compresses your executable
  2. WDOSX is a DPMI stub - so no external executable required
  3. Complete sources of WDOSX are available
  4. Allows to stub Win32 applications too which should allow you to execute Win32 console applications under plain DOS too
Regards,
Mark
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Post by unknown »

I would like to use WDosX instead of DJGPP's loader, how would I do this? How would I set-up FreeBasic to use WDosX instead of DJGPP's loader?
Thank you.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

Just create the EXE as normal. The WDOSX archive contains a STUBIT.EXE. Use it with STUBIT YOUREXE.EXE

This will automatically replace DJGPP's EXE stub and compresses the whiole EXE too.

You can get WDOSX from here (http://tippach.business.t-online.de/wdosx/).

Regards,
Mark
Frank Cox
Posts: 58
Joined: Nov 16, 2005 21:20

Post by Frank Cox »

There are several DOS EXE compression utilities, not just UPX. If disk storage space is at a premium, you may want to try some of these as well, and then use the one that gives you the smallest result:

LZEXE
DIET
PKLITE
MS EXEPACK
unknown
Posts: 472
Joined: Aug 06, 2005 0:53
Contact:

Post by unknown »

Thank you, alot.
Post Reply