flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [done] Feature request ... format binary as "EXE"

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 12 Jan 2007, 02:09
It would be nice if the "format binary" could be followed by the file
extension that would override the default ".BIN", like

Code:
format binary as "EXE"
    


So one could create SYS, EXE, COM, DEX, DLL or whatever without always
renaming the ".BIN" . Wink

EDIT: Done in 1.67.22

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug


Last edited by DOS386 on 06 Aug 2007, 06:32; edited 2 times in total
Post 12 Jan 2007, 02:09
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2007, 02:32
Post 12 Jan 2007, 02:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 12 Jan 2007, 02:56


COOL. Was discussed 2+1/2 years ago ... don't know how FASM worked
that time Wink

But my new suggestion does NOT break anything, is very easy to implement,
and allows me to get rid of the "BIN" ...

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 12 Jan 2007, 02:56
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2007, 06:13
It's not a technical problem, it's design question whether to implement it. And the arguments against remained. Razz
Post 12 Jan 2007, 06:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 12 Jan 2007, 07:38
Quote:
It's not a technical problem, it's design question whether to implement it. And the arguments against remained.


The old thread seems highly outdated (FASM did NOT add ANY extension
at that time ???). Confused

Possibly you should point me to the arguments you exactly mean ...

The "format" and extension handling is already done quite well in FASM,
what's missing is to assign the correct extension to "format binary".

Code:
  format PE GUI 4.0 DLL at 7000000h on 'stub.exe'
    


FASM already accepts additional stuff ^^^ after main format type Razz

My suggestion is NOT to do some sophisticated "guesses" or what,
simply to override the default ".BIN" by another extension, anything that
begins with a point and has 3 characters becomes the new extension.

Code:
  format binary .BUG
    


Code:
usage: FASM source [output]
    


and "output" if given would of course still override the extension
given in "format binary" (this "argument" ?) Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 12 Jan 2007, 07:38
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2007, 07:54
maybe you should READ that topic. entire second page explains confusion your idea would cause.
Post 12 Jan 2007, 07:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2007, 08:08
Quote:
and "output" if given would of course still override the extension
given in "format binary" (this "argument" ?)
sorry, missed this. yes, this is the problem. it is uglying of the syntax, if "something is taken into account only if something else somewhere is not defined". i dislike such "solutions", and tomasz seems to dislike them too.
Post 12 Jan 2007, 08:08
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 12 Jan 2007, 08:28
Quote:
entire second page explains confusion your idea would cause.


This is NOT my idea. Sad

Quote:
Wouldn't it be interesting if "fasm a.asm a.bin" will create "a.out" file? (because "out" will be specified with "with" operator).


It would be "interesting" ..... maybe even silly Sad

Quote:
"something is taken into account only if something else somewhere is not defined"


It's by far NOT that horrible as you present it Shocked

"format binary" defaults to ".BIN"

This default can be overriden by "format binary .BUG"

And finally commandline can override this

Code:
FASM HELLO.ASM HELLO.XXX
    


Also, my idea is limited to "format binary" only Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 12 Jan 2007, 08:28
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Jan 2007, 10:40
reaction in my previous post. and it *is* same thing as the one discussed in that topic.
Post 12 Jan 2007, 10:40
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 295
Alphonso 16 Jan 2007, 15:10
Is this why

format binary
org 100h

still produces a *.com file using the IDE 1.67 instead of a *.bin ?
Post 16 Jan 2007, 15:10
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 16 Jan 2007, 16:40
i bet
Post 16 Jan 2007, 16:40
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 05 Feb 2007, 22:41
from Design Principles:

Quote:

3. Same Source,Same Output

The problem with command line switches selecting output option in case of low
level assembly is that the given code will anyway most probably assemble and
execute correctly only when the same output is selected that programmer had
in mind when writing this code.


and a little forward:

Quote:
....Thus came the SSSO principle -all the settings that can affect the
output of assembler are be selected only from source and source is always
enough to generate exactly the file which was intented by programmer.


so... should we consider the file extension part of the output?
if the answer is yes then a new feature is needed to allow specify the extension
of the output file
and to avoid ambiguitys i suggest that the [output] option be remove from
command line and i even dare to suggest that the options -p and -m be removed to.
after all a programmer should know how much memory and how many passes
his source takes to compile. don't you think?

what this [output] option is useful anyway? fasm don't perform batch procesing.
the only moment that i can think off is when someone want's to compile the
same source but given a diferent name to not overwrite the first compiled
file.



leaving all the options to the source file is more consistent with the SSSO
principle I think.

so if this new feature is added it would be like:

if the feature is used this will override any extension "guessed" from the format directive
if the feature is not used the extension will be "guessed" from the format directive (as it is now)
and if the feature is not used and no format is specifyed then no extension should be added at all.

well is my opinion only.
Post 05 Feb 2007, 22:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Feb 2007, 23:33
well, it's meant "same contents of source, same contents of dest file".
Post 05 Feb 2007, 23:33
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 06 Feb 2007, 21:13
Well, the people who write .EXEs manually do indeed use the [output] feature (which is easier than having to rename the file afterwards).

As far as -m and -p are concerned, I can only guess that some projects take more time to assemble if you let it fully optimize all the displacements and stuff. Some people maybe prefer to save some development time by reducing passes, etc.
Post 06 Feb 2007, 21:13
View user's profile Send private message Visit poster's website Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 09 Feb 2007, 21:38
rugxulo, I think they are forced to use the [output] option because they can't
specify the extension of the output file anywhere else.
if this would be possible they could specify such extension only once inside the
manually-builded exe and not everytime that the file is assembled.
plus: if the file gets distributed they would need to add some information like:

;to compile : fasm manual.asm manual.exe

and if somebody miss this the result would be an exe file with bin extension.

Iguess is really trivial we can rename with a simple batch file.

on the other hand ... fasmw don't have any way to specify the extension
no even an [output] option.
Post 09 Feb 2007, 21:38
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 21 Feb 2007, 04:41
Any progress in this thing ?

vid (not Tomasz) wrote:

Quote:
well, it's meant "same contents of source, same contents of dest file".


Confused

Quote:
on the other hand ... fasmw don't have any way to specify the extension
no even an [output] option.


Neither FASMW nor FASMD have an output option. Allowing

Code:
format binary as "EXE"
    


is by far the simplest solution to this issue, and most compliant with SSSO
and CSWSF ("Complex Solutions With Simple Features") design ...

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug


Last edited by DOS386 on 06 Aug 2007, 06:29; edited 1 time in total
Post 21 Feb 2007, 04:41
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 21 Feb 2007, 09:11
Just a note about SSSO, because I see it is slightly misunderstood: it applies only to the contents of output in relations to sontents of source. How the source and output are handled - as files or streams or memory objects, depends only on interface, not core - see the fasm DLL for example. In this context the INCLUDE directive is the one slightly breaking SSSO rule, as it passes its parameter to the interface in order to receive another object, and again, how that parameter (path) is interpreted is up to interface (and indirectly the OS which lies behind it). By standard all the interfaces implement accessing the environment variables in the same way (though this is for standarization only, just like all the command line interfaces accept the same command line parameters right now) and do conversions between slashes and backslashes when needed - still the structure of the paths may be very OS-specific.

Thus the SSSO principle was intended to ensure just that the interface cannot affect what output the core generates from the given source. The INCLUDE seems to break this rule, however it may be defended by stating, that INCLUDE only affects WHICH source is processed by the core, not HOW this source is processed into output.

Thus the whole extension adding thing isn't really related to SSSO. It is not contrary to it, but using SSSO to vindicate it isn't really a good point.

As for the feature itself: the core already contains a routine that generates an extension for output in case when interface doesn't already have the output file name specified. Thus adding a setting that would allow altering this behavior to get a different extension than default woulnd't be any problem with current design. Just remember that it's up to OS-specific interface to decide where to put the output data that it receives from core, and for example when the console interface got output path specified from command line, any suggestions from the core are ignored. So this setting would be just a "hint" for core what extension should file have in case when user doesn't state otherwise.

PS. Sorry for coming so late to this thread, recently I had a little less free time than usual.
Post 21 Feb 2007, 09:11
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 21 Feb 2007, 23:34
..

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug


Last edited by DOS386 on 06 Aug 2007, 05:46; edited 1 time in total
Post 21 Feb 2007, 23:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 22 Feb 2007, 10:51
If you did not get such impression from my previous post: you no longer need to convince me, I already considered all the reasons and the rest (implementation) is left for me.
Post 22 Feb 2007, 10:51
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 05 Aug 2007, 16:14
It's implemented in fasm 1.67.22 (I'm going to release it today), you simply write:
Code:
format binary as "EXE"    

to get the desired result.
Post 05 Aug 2007, 16:14
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.