EXE sizes

DOS specific questions.
6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

EXE sizes

Post by 6ar453v3n »

If I write a "hello world" program for DOS, about how many bytes would the executable be?

67
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: EXE sizes

Post by angros47 »

It's about 92672 bytes.

If you want a dos compiler that build small executables, try this one:

http://exmortis.narod.ru/comp_bas/mbc320.zip
6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

Re: EXE sizes

Post by 6ar453v3n »

It shouldn't take more than say 2kb to perform that functionality.

What on earth are those extra bytes doing?

Would it follow then that something like a "grep" would not fit on a floppy?

67
marcov
Posts: 3463
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: EXE sizes

Post by marcov »

Who cares about floppies nowadays?
6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

Re: EXE sizes

Post by 6ar453v3n »

OK sir.

Hard disks and\ ssd's are still in use.

They will fill up 50x faster.

If someone were to write an OS in freebasic, blah blah.

67
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: EXE sizes

Post by dkl »

Here are the fundamental issues:

1. Due to the way FB is designed, you get much more than you asked for - dynamic string support (Printing a string afterall), file I/O support (Printing is a kind of file I/O internally), console output layout/scrolling functions (code shared by Print, Locate, Color, Cls, etc.), or even just code that turns of the blinking cursor or support for exepath() (but not the exepath() function itself).

2. FB is based on DJGPP - anything the FB runtime does ultimately ends up as calls to DJGPP's libc.a which itself adds a lot of code/data. All that is statically linked. There can be unused functions pulled in from DJGPP's C++ support etc., even though with FB it usually ends up unused, due to the way DJGPP is designed.

further reading (for example):
http://freebasic.net/forum/viewtopic.php?t=11757

Besides that there also are cases of bloat that is "trivially" avoidable - it's just a question of how much work is put into FB development and the making of the FB release builds:

3. (Really) unnecessary code in the FB runtime (that potentially pulls in more unnecessary code from DJGPP) - for example, there is an unnecessary call to setlocale() in FB-0.90.1, which (due to all the DJGPP dependencies it pulls in) accounts for 40KB out of 160KB total in a hello world.

4. Exception handling tables generated by GCC (depending on toolchain configuration) in FB's and DJGPP's libraries (in a hello world with FB-0.90.1-dos it's 25KB out of 160KB total)

You can check what exactly is linked into an .exe yourself by looking at the link map generated by the GNU linker (ld). With fbc this can be done by using the -map <file> command line option:
fbc myprogram.bas -map foo.txt
After that, foo.txt should contain the information from ld.
6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

Re: EXE sizes

Post by 6ar453v3n »

There is (used to be) a separate dead code eliminator program for TP302 and TP55 that worked
quite well. Hello World ended up being about 3kb. I don't thing anyone has to spend time on
redesign but a dead code eliminator and re-linker for FB would be nice.

SB
fxm
Moderator
Posts: 12159
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: EXE sizes

Post by fxm »

Print "hello word"
under ASIC 5.00 => file.exe = 912 bytes !
marcov
Posts: 3463
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: EXE sizes

Post by marcov »

6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

Re: EXE sizes

Post by 6ar453v3n »

Both are me. I asked the same question of both compilers. The answers were:

FB = 93kb
FP = 175kb

TP55 = 5kb for comparison.

The post on FP forum has deteriorated greatly.

67
Roland Chastain
Posts: 1007
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: EXE sizes

Post by Roland Chastain »

6ar453v3n wrote:67
Hello!

Please what means "67" ?
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: EXE sizes

Post by Muttonhead »

Please what means "67" ?
maybe.. this can help
http://www.robertecker.com/hp/research/ ... hp?lang=en

type in "6ar453v3n" and translate it :)

Mutton
marcov
Posts: 3463
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: EXE sizes

Post by marcov »

6ar453v3n wrote: FB = 93kb
FP = 175kb
Currently the FP thread is at 16,528 bytes. (cheating, using the development snapshot of the 16-bit compiler)
6ar453v3n
Posts: 6
Joined: Jul 03, 2014 1:57

Re: EXE sizes

Post by 6ar453v3n »

67 is from a Star Trek episode. There is a major character named Gary Seven. I used an ascii translation as follows:

b=8
e=3
g=6
I=1
l=7
o=0
p=9
s=5
y=4
z=2

As these number letter pairs look similar.

So my handle is Gary Seven.
g=6
However I deviated and used
Seven=7

67
Roland Chastain
Posts: 1007
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: EXE sizes

Post by Roland Chastain »

@6ar453v3n

Thank you for your answer.
Post Reply