News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

joke

Started by Mikl__, February 15, 2018, 02:01:17 PM

Previous topic - Next topic

Mikl__

format PE GUI
include 'win32ax.inc'
; import data in the same section
   invoke MessageBox,NULL,wText1,wTitle,MB_OK
   retn
wTitle db   'Iczelion Tutorial #2:MessageBox',0
wText1 db 87,105,110,51,50,32,65,115,115,101,109,98,108,121,32,119
db 105,116,104,32,77,65,83,77,32,105,115,32,71,114,101,97,116,33,10
wText2 dw 26967, 13166, 8242, 29505, 25971, 25197, 31084, 30496, 29801
dw 8296, 16717, 19795, 26912, 8307, 29255, 24933, 8564, 3338
wText3 dd 5.55095E-8,1.5300999E31,1.0947971E21,3.2548056E33
dd 1.9689681E-19,2.21516896E8,2.0617684E-19,2.6453368E20,4.25648E-31
wText4 dq 8304954587831232855, 8583994396182930803, 5571868963499439209,7018141244139464992,8564
data import
library user32,'USER32.DLL'
import user32,\
        MessageBox,'MessageBoxA'
end data
Let's try to compile and run Find the word "FASM"

jj2007

For known reasons, I prefer a MACRO assembler - UAsm rocks :P

Mikl__

Ciao, jj2007!
I prefer MACRO assembler too

aw27

As far as I know all current assemblers support macros.  :dazzled:

jj2007

Try a simple print str$(ecx) with FASM or NASM...

aw27

Have you searched the web and did not find the answer, do you believe that such a macro is particularly difficult, or both?

PS:
I believe the answer is "both", but a simple search gave me this:
https://board.flatassembler.net/topic.php?t=9605

avcaballero

No time to see it now, but the capabilities of fasm and nasm for macros are out of any doubt.

Regarding Mikl__ example, it's nice. Just bear in mind that ascii text is also (byte) numbers. I guess that it's just and example of encoding ascii in numbers, each line I guess ended in CR and the final text ending in '0' that is 30h. :t

jj2007

Quote from: aw27 on February 15, 2018, 07:43:02 PM
Have you searched the web and did not find the answer, do you believe that such a macro is particularly difficult, or both?

PS:
I believe the answer is "both", but a simple search gave me this:
https://board.flatassembler.net/topic.php?t=9605

FASM macros can do print eax, but they can't do print str$(eax).

Other example, the rv() macro:
include \masm32\include\masm32rt.inc

.code
start:
  .if rv(exist, "somefile.txt")
print "yeah"
  .else
print "nooo"
  .endif
  exit

end start


Show me how to do that in FASM or NASM, and I will keep my mouth shut 8)

P.S.:
Quoteinlining the macros is something against the fasm's concept

aw27

 :badgrin: :badgrin:
Unless the post has been changed in the meantime what I read was that "The arguments can be combined, and if the exact same arguments has been used before, print will recognise it and reuse the data (which may not always be the best thing to do)."

Quote
Show me how to do that in FASM or NASM, and I will keep my mouth shut
Currently, I am not accepting free work-to-order assignments, but of course, I could do it if I really wanted to do it.  :biggrin:

jj2007

Quote from: aw27 on February 15, 2018, 08:32:34 PMUnless the post has been changed in the meantime what I read was that "The arguments can be combined, and if the exact same arguments has been used before, print will recognise it and reuse the data (which may not always be the best thing to do)."

Whose post? I certainly did not write that. Btw Print does reuse the data (and I can't imagine a case where this would not be the best thing to do).

QuoteI could do it if I really wanted to do it.  :biggrin:

Well, not with FASM - see my P.S. above 8)

aw27

Now I am lost, I was talking about assembly language and you bring in Masm Basic functions.  :icon_eek:

Quote
Whose post?
I was talking about the FASM forum post.

Quote
inlining the macros is something against the fasm's concept
Nice try! You removed the context and don't provide the source of the statement.  :dazzled:

Quote
Should I use FASM or MASM?
ANSWER: FASM is better maintained and has superior macro support.
No need to add anything else.


jj2007

Quote from: aw27 on February 15, 2018, 08:46:53 PM
Quote
inlining the macros is something against the fasm's concept
Nice try! You removed the context and don't provide the source of the statement.  :dazzled:

Sorry, I even linked to it - too lazy to click on a link? And if Tomasz Grysztar writes "No, inlining the macros is something against the fasm's concept", then my post is certainly not out of context. He means it :t

QuoteFASM is better maintained and has superior macro support.

That is plain ridiculous :P

AFAICS the whole FASM community is addicted to the bare metal concept. Show me one major FASM application that a) makes significant use of macros and b) arrives at over a thousand lines of code.

avcaballero

I wouldn't say that anyone of them is better than any other. What I miss in fasm or nasm is the possibility of defining local structures. You may define bytes, words, dwords, qwords. Maybe it is possible to do such a thing now. In any case I'm pretty sure that using macros it would be possible to do that.

Masm is very good, the pitty is that there's no full package for 64 bits programming. What I value in Fasm and NasmX, just unzip and programming.


P.S. a) Why is so good the intensive use of macros? b) MenuetOS, KolibriOS, Fasm

aw27

Except little exercises, nobody makes full blown assembly language applications these days.
But FASM has been intensively used in important developments, like the GMP arbitrary precision library.

I very rarely use FASM or NASM, still I don't have the habit of despising tools that I don't use or understand in full, like others do.  ::)

Quote
Masm is very good, the pitty is that there's no full package for 64 bits programming
For me, Masm is not that good, but is the closest to the baremetal you can go. And for 64-bit, neither HLL constructs nor pseudo-instructions at all! In addition, no support and bugs are never fixed.

avcaballero

When I say masm you can also understand masm, uasm, jwasm or anything related. Particularly what I miss is a package ready to go, unzip and programming (without external needs)