News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Just wondering if this is something for me or not

Started by Sorex, March 29, 2008, 11:03:29 AM

Previous topic - Next topic

Sorex

Hello,

Not sure if this belongs here so feel free to move it to the appropriate forums

I just signed up here after getting informed about MASM & Win32ASM being able to create Windows application which are still speedy and small in size.

My roots are several basics, Z80, 6502/65c02 ASM, 8086ASM, 80386ASM mainly from the mid 80s-a few years ago,
unfortunatly these days it's mainly vbscript that I use in my job (you know.. the ADSI and other client/server based stuff to install/fix things)

So I'm wondering if it's worth all the effort as it will take ages to get something done in ASM or does it contain that much libs that it will make things easier?

I guess my background is ok to start but I got a bit overwelmed after seeing some sources (all those invokes etc)

btw, any Belgians around here (or others) who are willing to help me through IRC/messenger or something when I'm stuck?  :wink

MichaelW

Hello Sorex, welcome to the forum.

With your background I think you should have few problems. Assuming you are willing to use macros, the MASM high-level syntax, and library procedures, the amount of time required to code in MASM is not that much greater than the time required to do equivalent code in a high-level language. In some cases it's possible to code complete (small) applications without using more than a few instruction mnemonics (if you don't mind a few sneers from the ASM purists :lol).
eschew obfuscation

hutch--

Sorex,

While its hard to pass motivation to another person, you have been informed correctly about assembler being capable of very small and very fast applications. It handles Windows API coding with abouty the same complexity level as a low level compiler like C or compiled basic but often with less clutter. Something as simple as a messagebox codes like this in a macro assembler.


fn MessageBox,hWnd,"Howdy, I am the message","Greetings",MB_OK


This code is no more complex than C, Pascal or Basic. You can also code it this way.


push MB_OK
push OFFSET Greetings
push OFFSET TheMessage
push hWnd
Call MessageBox


The "invoke" operator in MASM makes complex function calls a lot clearer to code and in non critical code they are easily fast enough.

You tend to write pure mnemonic code in algorithms where speed matters and where you get advantage from doing so.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sorex

Thanks for the replies...

Hutch: that first line of code is that MASM aswell? what's fn standing for?

hutch--

Sorex,

"fn" is a macro that adds to the standard invoke capacity so that the function call can use literal strings in quotes. MASM is a macro assembler and the masm32 project makes reasonable use of this capacity to improve coding speed and clarity. The actual macro is in the macros.asm file in the macros directory.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sorex

Powerfull indeed, I found those macro's inbetween our posts and it has a lot of goodies like that reparg which allows us to use

MsgBox hWnd,"title","my text",0

without the need to declare the text in the datapart first and use addr to point to it's offset which saves a lot of time already.

but I bet that you have tons of more macro's you use when you say that developing a full ASM app doesn't always need more time than in the other langs like VC/VB

jj2007

Indeed once you get used to it, Masm is a language almost as comfortable as BasicĀ  :wink
The C:\Masm32\help\masmlib.hlp has a good description of the built-in libraries. It is also good practice to study the tutorials of Iczelion (google for Iczelion to get them).

Don't forget the equates:

sm EQU invoke SendMessage,

... and from then on you write
sm hMyEdit, WM_SETTEXT, 0, addr MyText
instead of
invoke SendMessage, hMyEdit, WM_SETTEXT, 0, addr MyText

Three other points:
1. LOCAL variables are not initialised
2. .IF eax<0 will fail because eax is by default an unsigned register, so eax is always positive
3. Study the "ACD" rule - eAx, eCx and eDx are promiscuous registers that will be changed when coming back from a Windows API

Adamanteus

 No I'm thinking that for structured programming as on procedure languages that's quite full, but macroses is need to add themselves what to whom need, for example my catalogue macros looks like this :

19.07.2005  17:39             5я924 cmov.asi
07.07.2007  10:42            11я808 lst.exe
28.03.2008  14:16           117я088 macros.asm
27.12.2006  12:42             1я199 macros.txt
07.08.2005  05:09               760 newcmds.txt
19.07.2005  17:41            21я055 p4macros.asi
28.02.2006  09:23            21я680 pomacros.asm
19.07.2005  17:42            21я729 sse3.asi
27.12.2006  12:39             5я380 sse3b.asi
30.12.2007  13:12             3я621 timing.mac
07.07.2007  10:43             6я653 ucmacros.asm

hutch--

Some languages are easier to develop in than others. VB is very simple for simple things but runs out of puff on difficult stuff. C can do almost anything but its a much harder language to write well. Windows API code in MASM is about as hard as C to write but with less clutter, no type casting, generic data types based on the SIZE of the data etc ....

MASM starts to get hard when you start writing pure mnemonic algorithms but its no easier in other languages where performance matters and its all there when you need the power of assembler.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sorex

are there any macro's or features to do complex math in MASM? (mul umul div sin cos atan etc)

that's always been a bottleneck in 100% ASM programs

MichaelW

eschew obfuscation

Sorex

cool, thanks.

one more question about the Macro's...

when I experiment with that openfiledlg macro it spits out

error A2006: undefined symbol : OpenFileDialog  OpenFileDlg(1): Macro Called From  C:\WinAsm\Projects\Tut08_Window\MENU.ASM(53)

it can't seem to invoke that OpenFileDialog feature, do I need to include some more inc's or lib's to get it working? is there a list somewhere that explains what inc/lib's are used for which purpose?
and are they only included when they have been actually used in the code?

MichaelW

OpenFileDialog is part of the MASM32 library, so somewhere in your project you would need to include masm32.inc and masm32.lib, but since I don't use WinAsm Studio I have no idea how you would do that.
eschew obfuscation

Sorex

well with

include   /masm32/m32lib/masm32.inc
includelib   /masm32/m32lib/masm32.lib

the compile errors went away, but it gives that link error now, I'll try to figure it out if not I'll wait on a response on the winasm forum.

Thanks for all the tips & comments!

MichaelW

#14
I don't know what link error you are getting, but you could try including comdlg32.inc and comdlg32.lib, as required for the GetOpenFileName function that OpenFileDialog calls.
eschew obfuscation