flat assembler
Message board for the users of flat assembler.

Index > Heap > There are programs that are possible only with FASM

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
Also, conditional assembly with FASM rocks! Very Happy
Code:
org 100h
display 'Assembling...',13,10,13,10

debug = 0

if debug=1
   mov eax,0
   display '### DEBUG MESSAGES ###',13,10
   display '- Debug Mode ON',13,10
else
   xor eax,eax
   display '### DEBUG MESSAGES ###',13,10
   display '- Debug Mode OFF',13,10
end if

ret
display 13,10,'Done!',13,10
    

Wink
Post 16 Feb 2006, 17:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
message 'Assembling...' is displayed after entire assembling is done...
Post 16 Feb 2006, 17:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
vid wrote:
1. In FASM output depends ONLY on contents of source, nothing more. This is just wonderful.

And what MASM adds?
vid wrote:
2. But in MASM way, you must declare entire macro within parent macro, having much you many possibilities:
Code:
macro BEGIN_MACRO name { macro name \{ }
END_MACRO fix }
BEGIN_MACRO nop
db 90h
END_MACRO    

Eh, I'm a bit surprised how quickly you uncloak this Surprised
Yeah, you can do the same in MASM with the exception of END_MACRO (and there is probably no workaround):
Code:
BEGIN_MACRO macro name
name macro
endm
END_MACRO EQU <endm>
BEGIN_MACRO noop
db 90h
END_MACRO ; this doesn't get expanded because
; it is located in macro definition Sad    

vid wrote:
3. You also have recursion instead of macro overloading, which again removes you more possibilities than it offers.

Confused I can't get this...
Post 16 Feb 2006, 17:10
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
OzzY wrote:
Also, conditional assembly with FASM rocks! Very Happy

That's an easy task for MASM too, of course.
Post 16 Feb 2006, 17:11
View user's profile Send private message Visit poster's website Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
vid:
Not really...
I changed xor eax,eax to xor edax,eax and it gives me the error like this:
Quote:

C:\>Fasm test.asm
flat assembler version 1.64
Assembling...

test.asm [11]:
xor edax,eax
error: invalid operand.

It shows "Assembling..." before assembling and in case of error not even shows "Done!"! Wink
Post 16 Feb 2006, 17:13
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
MazeGen: The FASM way looks more clear (at least for me) and you can overload "nop"! Very Happy

FASM is so powerful that can even emulate other compilers and assemblers. In the near future FASM will be the standard compiler for all languages and syntaxes...
*imagining FASM coming in all devices and OS's, from computers running Linux to TV's running your own OS built in FASM* *dreaming*


That's the beauty of FASM: Everything can be changed, every information to build the executable is at the source...
Post 16 Feb 2006, 17:27
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
Just a few echo's more...
Code:
org 100h
echo Assembling...
echo
echo

debug = 0

if debug eq 1
   mov eax,0
   echo ### DEBUG MESSAGES ###
   echo
   echo - Debug Mode ON
   echo
else
   xor eax,eax
   echo ### DEBUG MESSAGES ###
   echo
   echo - Debug Mode OFF
   echo
endif

ret

echo
echo Done!
echo
    
Post 16 Feb 2006, 17:39
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
MazeGen wrote:
vid wrote:
1. In FASM output depends ONLY on contents of source, nothing more. This is just wonderful.

And what MASM adds?

He probably did mean the SSSO principle of fasm, see point 3 in my Design Principles article.
Post 16 Feb 2006, 19:38
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
Thanks Thomasz. And glad to see you in this thread.

Do you have any comments about the cryptic (from my point of view) operators in macros, how I've written above? Any chance to add some MASM-like features? Smile
Post 17 Feb 2006, 13:55
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
MazeGen wrote:
I think MASM macrosyntax is clear and simple. You just need to know how to use %, & and ! operators, IIRC.

MazeGen wrote:
Do you have any comments about the cryptic (from my point of view) operators in macros, how I've written above?

I can only say: from my point of view the MASM's operators are cryptic, just like the FASM's ones are cryptic for you - because I simply DON'T KNOW them. If I knew them, this knowledge would have affected the design of fasm as I perhaps would prefer to follow some standard. But I invented my own ones instead, and while doing it I tried to make my own standards. Note that the operator conventions for assembler and preprocessor in FASM are substantially different. This is because I tried to emphasise the separation of those two layers that happens in case of FASM.

FASM's assembler uses phrases composed more like those used by other assemblers (in fact many those syntaxes were taken directly from TASM, like "label alpha:dword"), with textual operators and "end" used to close the various blocks. The preprocessor uses braces for the blocks and its operators are generally special characters. I did not use the ":REQ" syntax for required parameters, as it would be the same syntax construction as ":DWORD" used for labels, and such mixing of syntaxes I wanted to avoid.

With FASM, in general, when you see mainly textual constructions, it's the assembler layer; and when you see many special-character operators, it's the preprocessor (because preprocessor does almost exclusively text operations, this way the data it works on is better distinguised from the operators that do those jobs). Well, I may have failed to make a perfect separation of the syntax standards, but I think that after getting more familiar with fasm's "eccentricities" you may begin to feel what kin dof syntax belongs where here.

I would also strongly recommend reading my Understanding fasm article when it is finished - unfortunatelly I cannot give the exact estimate of when will it happen.
Post 17 Feb 2006, 14:32
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
I think I like Fasm most because it's open-source, and Tomasz does a great job in explaining the internals, etc.. I don't think any other assembler-writer did that thing, and I appreciate his efforts! Very Happy

and I also like it because of it's clear syntax, and powerful macro capacity (though sometimes, I hate the extra nested macros \\\\{ \\\\\{, etc.. but well) Wink
Post 22 Feb 2006, 17:23
View user's profile Send private message Reply with quote
Roberto Waldteufel



Joined: 11 Feb 2006
Posts: 12
Location: Isle of Jura, Scotland
Roberto Waldteufel
I love FASM! I am not familiar enough with MASM to make a fair comparison, but FASM does everything I want it to do so I am not looking for an alternative. Before I used FASM I was using NASM, but FASM is vastly superior in every respect as far as I can tell. Prior to using either of NASM or FASM I did all my coding in a higher level language, but I have always made heavy use of the inline assembler when using HLL's. I liked NASM syntax because it was similar to the INTEL syntax which I am used to, and in this respect FASM is also very similar, but MASM's syntax looks more complicated to my eyes, and before I could use it I would have to go through a whole lot of new syntax conventions - reminds me of the nightmare of learning Windows API when I graduated to Windows from DOS - Yuck! If I wanted to code for an OS as overbloated, secretuve and downright obstructive as Windows I would still be using my HLL+inline assembler, but the limitations of that OS have driven me to seek something better, which is why I code in pure assembler now. FASM is great for my needs - I just have to learn how to operate all my hardware in protected mode without assistance from an OS, a process I am still going through now, since most 32-bit OS's impose various protection mechanisms that I don't need or want, and which are unnecessary for my purposes. Since my main reason for coding all-assembler apps is to achieve a single-tasking 32-bit protected mode platform for the applications I write (as opposed to writing for Windows), any comparison between FASM and MASM is, at least for me, solely for the purposes of writing non-Windows programs, so if this is harder to do in MASM then in FASM then that is a serious shortcoming for MASM as compared to FASM. FASM allows you to write for Windows, DOS, Linux, Menuet, Dex4U and other OS's, or even to write your own OS, all with equal ease, a very strong point in its favour. The great thing about old fashioned DOS was that the OS was always the servant, not the master of the application. The main drawback of DOS is that it was never upgraded to 32-bit code. If it had been I doubt Windows would have become so universally used as it did in the 90's. That is why MS deliberately stopped developing MSDOS and reduced support for it in each successive incarnation of their overbloated, crash-prone flagship whose only really good point was the fact that at last 32-bit applications became more feasible to write than they had been before, but at a great cost in the ability to harness the full resources of the PC rather than only half or less, while Windows hogs half the memory and half the CPU cycles, not to mention a vast amount of disk space as well. What a contrast to DOS which could fit on a single floppy disk! If you are developing speed critical apps then Windows is a very poor environment compared to DOS which allowed full control of eveerything, if only DOS functions could be called from protected mode (without switching back to real mode, no matter how fleetingly!). My experience with MicroSoft products would make me very reluctant to try any other software produced by them, including MASM, when an excellent free alternative like FASM is available *with source* (very important!) and *active support and development* from Tomasz (also very important).

Assembler programmers use assembly language for many different reasons. There is more to PC programming than Windows or Unix/Linux, and a good assembler like FASM has to be readily usable for all the many things a developer might possibly want to do, limited by nothing other than the programmers own skill, knowlege and imagination, and certainly not limited by the ridiculous restrictions implosed by a dependence on nothing but Windows as an OS. Versatility, speed of compilation, efficiency of generated code, both in terms of size (War on Bloat I say!!) and speed of execution, availability of source code, active support - these are the things by which a good assembler must be judged. I have to say that I give FASM 10 out of 10 on all these points. Can the same really be said for MASM?

Roberto
Post 17 Mar 2006, 17:52
View user's profile Send private message Visit poster's website Reply with quote
zubi



Joined: 27 Apr 2006
Posts: 25
Location: Turkey
zubi
Hi,

As a very late remark on the issue, I have the following: I have been writing a compiler, just for the fun of it and to learn how to make one, which used MASM (an old version which is in public domain now) as the back end. One morning I woke up this question in my mind: How good is it to distribute a Microsoft product with a software package that's supposed to be 'your product'? That question alone led me directly towards FASM, not to mention questions like "What if I want to make the compiler to be ported to Linux or other systems that run on x86?". I'm not an anti-Microsoft sort of a guy at all but I think it is a better, cleaner feeling to be a part of anonymous, friendly and relaxed environment and use products that are created within. This forum is a concrete example of this and it was a major reason why I'm trying to switch to FASM. It's all about community and contribution. You can play your role in the development of FASM by just writing to the forums and you feel that you do it for the good of the other people who are like you as opposed to the benefit of the world's biggest software company.

In short, sometimes it is important how you want to use a product rather than which one is superior in terms of technical comparison, besides some obvious issues about morality.
Post 27 Apr 2006, 21:49
View user's profile Send private message MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Quote:
an old version which is in public domain now

Public domain? are you sure?
Quote:
How good is it to distribute a Microsoft product with a software package that's supposed to be 'your product'?

It's worst that doing a product in direct competition to them specially if it's becoming popular.

Fasm's license fits exactly for your purposes. I hope you success with your project.
Post 28 Apr 2006, 13:03
View user's profile Send private message Yahoo Messenger Reply with quote
zubi



Joined: 27 Apr 2006
Posts: 25
Location: Turkey
zubi
Quote:

Public domain? are you sure?


Well, as far as I know, yes. Version 6.11 was released with driver development kit long time ago. It is that version that comes within masm32, which is not Microsoft's. So I assume that it has the status of being redestributable.

You're right on the other issue.
Thanks.
Post 28 Apr 2006, 14:19
View user's profile Send private message MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
zubi, redistributable is completely different thing respect to public domain. Version 6.11 has one of the most restrictive software licenses I knew of. You could only use MASM for certain specific purposes and only for windows programming.

(EDIT by TG: added link to external definition Wink)
Post 28 Apr 2006, 16:06
View user's profile Send private message Yahoo Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
zubi, it is even being disputed whether hutch-- has the right to redistribute masm. He claims he has a non-disclosure agreement with Microsoft... and the license is still pretty restrictive, whether hutch-- is allowed to redist it or not. Not to mention the MASM32 project license, which specifically disallows opensource programs...
Post 28 Apr 2006, 18:13
View user's profile Send private message Visit poster's website Reply with quote
zubi



Joined: 27 Apr 2006
Posts: 25
Location: Turkey
zubi
Thanks for the information. Having read that I searched through the net to see if I can find another place to download it and couldn't find (except 1 place that distributes old versions of 3 popular assemblers in one zip), so I guess you might also be right about hutch's rights, I don't know. I also noticed that no one has complete information about the issue, seems bunch of other people are curious about that, interesting.
Post 28 Apr 2006, 23:55
View user's profile Send private message MSN Messenger Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
i in the past often would insult MASM, i just have a grudge against it, but honestly i can't think of any project where using MASM rather than FASM would be prefered unless you want some faster coding speed with the prototypes in the headers and the libs, but as far as using FASM rather than MASM... optimizing, preprocessor, syntax clarity, portability, lesser release restrictions due to licences.. i say FASM is greater than MASM in all these fields

the SSSO principle is one of the original reasons FASM appealed to me, especially the skipping of all the .obj crap, but.. unlike NASM, MASM has many good IDEs which allow instant assembling and linking via easy-to-use graphical user interfaces, so i wouldn't count MASM out here (Negatory ASM is a good example of this, especially if one is just coming from a MSVS style atmosphere), although i myself prefer simple IDEs such as FASMW Smile

_________________
redghost.ca
Post 29 Apr 2006, 05:28
View user's profile Send private message AIM Address MSN Messenger Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Wow, that is the most useless article I've ever read! Bah, too much legalese! Must...run...away...before...head...<splat!>

Note to future generations: Hooray for less restrictions, boo for more complicated laws!

(this post is released into the public domain, free/libre for any use)

pelaillo wrote:
zubi, redistributable is completely different thing respect to public domain. Version 6.11 has one of the most restrictive software licenses I knew of. You could only use MASM for certain specific purposes and only for windows programming.

(EDIT by TG: added link to external definition Wink)
Post 29 Apr 2006, 06:10
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 Previous  1, 2, 3  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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.