switch/case macro is essentially an .if, but of course can be optimized (jump-tables, sorted tests, etc). I think bitRake made a switch/case macro for MASM, but is it optimized or does it simply produce equivalent of what .if would produce?
Posted on 2003-06-11 07:20:20 by comrade


FASM is a great little assembler, no doubt about it. But don't go overboard with the hype here!


With FASM I need no more additional crap, that's all.

There is no hype here, simply I have found the product that do exactly what I want from a programming tool.

It is coherent and it has no design compromises: in other words a fertile ground to a salutary grow. A very uncommon characteristic of similar tools.

Fortunately I am not compelled to use other programming languages :alright:
Posted on 2003-06-11 07:23:25 by pelaillo


For example, try and create a "switch/case" statement (like C) that is fully nestable using FASM's macros. That's doable with HLA and even MASM, possibly even with NASM (because they have the push and pop context facilities). Now I haven't looked *that* closely at FASM's macros, but I suspect you'd have a bit of a problem doing this with FASM's macros.


No problem :) I've created this macro for quit a while
; ***** start *****
macro .select arg
{
__SELECT equ arg
local ..case0
__CASE0 equ ..case0
__CASE equ __CASE0
local ..endselect
__ENDSELECT equ ..endselect
}

macro .case c,i
{
if ~__CASE eq __CASE0
jmp __ENDSELECT
__CASE:
end if
local ..case
restore __CASE
__CASE equ ..case
cmp __SELECT,i
jn#c __CASE
}

macro .otherwise
{
if ~__CASE eq __CASE0
jmp __ENDSELECT
__CASE:
end if
restore __CASE
__CASE equ __CASE0
}

macro .endselect
{
if ~__CASE eq __CASE0
__CASE:
end if
__ENDSELECT:
restore __ENDSELECT
restore __CASE
restore __CASE0
restore __SELECT
}
; ***** end *****

and used it like this

; ***** example *****
proc winproc, hwnd,wmsg,wparam,lparam
.hdc dd ?
.ps PAINTSTRUCT
enter
push ebx esi edi
mov eax,
.select eax
.case e,WM_PAINT
lea ebx,[.ps]
invoke BeginPaint,,ebx
mov [.hdc],eax
invoke TextOut,[.hdc],0,0,message,msglen
invoke EndPaint,,ebx
.case e,WM_DESTROY
invoke PostQuitMessage,0
xor eax,eax
.otherwise
invoke DefWindowProc,,,,
.endselect
pop edi esi ebx
return
; ***** end *****

I found no problem. fasm doesn't need push,pop context, it has "restore" facility :grin:
Posted on 2003-06-11 08:02:45 by quiveror
I don't see any sense to discuss is it FASM is better than other asm. If you like it just use it. If you don't know it just try.
Discusion between Randall Hyde and scientica is senseless. Mr Hyde represents HLA. It's goal is to make asm as easy as HLL and he use those methods like swich/case. scientica represents rather pure asm so that he want to achive the best control on code and make it as most optimal as it is possible. Two different looks on asm.
FASM is (in my opinion) closer to scientica looks on asm but macro makes it quite easy to go a little into HLL.

And one more. Polish guys: It is unkindly to speak in polish on english-speaking board, because not all can understand you. I try to speak polish on polish board, english on english board, esperanto on esperanto board... (more languages I don't know... yet). Even if I make a lots of mistakes I think it is better then speak in foreign (for majority) language.
Posted on 2003-06-11 08:59:16 by Dryobates

I don't see any sense to discuss is it FASM is better than other asm. If you like it just use it. If you don't know it just try.
Discusion between Randall Hyde and scientica is senseless. Mr Hyde represents HLA. It's goal is to make asm as easy as HLL and he use those methods like swich/case. scientica represents rather pure asm so that he want to achive the best control on code and make it as most optimal as it is possible. Two different looks on asm.
FASM is (in my opinion) closer to scientica looks on asm but macro makes it quite easy to go a little into HLL.



This has nothing to do with FASM vs. other assemblers.
The claim was FASM has "incredible macro power" and that's a bit of hyperbole. Whether or not FASM does everything *you* (or someone else needs) is not the point. The point is that FASM has (compared to other assemblers) "middle of the road" macro capabilities. Hyperbolic statements like "incredible macro power" simply implies that the poster doesn't know a whole lot about macro processing capabilities.

Switch/Case was offered as an example because a *correct* implementation (e.g., nestable, creating code using jump tables) is quite difficult to implement with most assemblers' macro processors. Whether or not you need an actual switch statement in your code is irrelevent. The power to produce a *nestable* switch statement that the macro properly converts to a jump table implementation says something about the power of the macro processor. It doesn't say *everything* there is to say about macro processing, but it does say a lot. Now whether or not such macro processing power is needed by someone who is hacking out FASM code is not the issue. FASM's macro facilities may be more than sufficient for the average FASM user. However, the statement *was* "incredible macro power", which is a bit over the top considering FASM's macro capabilities.
Randy Hyde
Posted on 2003-06-11 09:15:35 by rhyde



No problem :) I've created this macro for quit a while

I found no problem. fasm doesn't need push,pop context, it has "restore" facility :grin:


Okay, I admit I was unfamiliar with restore. So this puts FASM's capabilities up with NASM's.

However, an if..elseif... implementation is rather weak. Do a jump table implementation (which is how a *real* assembly language programmer would implement switch..case). That's a bit more work.

Randy Hyde
Posted on 2003-06-11 09:26:49 by rhyde

ALL: does it support MMX (and if it does: SSE too?) any better than tasm (tasm puts some fu...in' 'NOP's after each call or jmp, it suxx really. i have do delete it maually.

Yes it does support MMX/SSE/SSE2/AMD 3DNow!, and also the multi-pass optimization process to avoid putting any NOPs in the code was one of the basic ideas of this assembler (you can find that everything in the docs).
Posted on 2003-06-12 04:12:17 by Tomasz Grysztar

Apropo fasm-a to chcialem sie go nauczyc niestety brak tam czegos takiego jak tutoriale od iczeliona. Jesli jest tam cos takiego ale naprzyklad napisane przez kogos innego to dajcie glos prosze >:)


Please don't use Polish, even if we both know it well, others on this board would have problems with it (look in the board rules).
And yes, there are conversions of iczelion tutorials for fasm - it was discussed really many time before on this board - use the search facility.

PS. The latest conversion was posted here: http://www.asmcommunity.net/board/index.php?topic=12924.msg100471).
Posted on 2003-06-12 04:15:44 by Tomasz Grysztar
In the end it was me who was flamed for the Polish the most. How cruel this world can be ??:(

Maby i will try some fasm now.:alright:
Posted on 2003-06-12 09:59:31 by AceEmbler
will try...

..

...and see
Posted on 2003-06-14 06:24:13 by ti_mo_n
I only have a question about the first reply in the point 1.. that say that you cannot use nasm for develop a OS, or that answer was time a go.. ?? with a diferent License?, now is under LGPL if i am not wrong, that mean that the code is public.. is less GPL that mean that you can use withouth problem if your product is or no is public or private.
Posted on 2003-06-14 11:51:06 by rea