News:

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

A complete newbie and his questions.

Started by Valliko, May 02, 2009, 01:51:08 PM

Previous topic - Next topic

Valliko

Hi! Im a 16 year old sweden who've been programming (mostly C and C++) for some time now, and recently been looking in to Assembler.

So the thing is i am really confused. The way i think of ASM is that theres one language for each CPU-family, but there seem to be a load of different "languages" only to x86.
MASM, TASM, FASM, NASM and so on.. I know theese are all assemblers, and not complete languages, but there seem to be a huge difference between programs written for the NASM assembler, and programs written for the MASM assembler. Why is that?

So really, how many x86 languages are there? Can i write a program for MASM which is still compatible with NASM? What assembler should i use?
I really need to sort theese things out.. Thank you.

dedndave

i understand your question perfectly - lol
before i settled on MASM, i looked at several others
i wanted to choose one that i could learn - and that has wide acceptance and use
i should mention that i am familiar with MASM 5.10 from the old days - 16-bit DOS world
that certainly affected my decision
i want to avoid telling you anything like "this one is better than that one"
rather, provide you with information and let you make the choice
what makes the code appear so different from one assembler to another is primarily the assembler "directives"
also, support for different macro structures vary, and some assemblers provide a simplified environment
in fact, i try to write my code so that it may be easily moved to a different assembler, if desired
that, of course, requires basic knowledge of all of them
well - that's not gonna happen anytime this year - lol
i have selected MASM to get used to writing 32-bit code
once i have a better grasp on that, i want to learn more about a few other assemblers
the ones that i am mainly interested in are FASM, NASM, and GoAsm
GoAsm is very similar to MASM, in many respects, with many improvements, from what i understand
it is basically an attempt to take control of the assembler development away from MS,
so that the actual programming community may decide what changes/improvements are made, rather than MS
GoAsm is gaining popularity very fast
FASM and NASM appear to provide simplified directive schemes - things to make it easier to understand and learn
in that regard, they have given up some functionality as a trade-off
i think, once i become more experienced, i will settle with GoAsm
but, for now, i want to stay with MASM because it is more widely used (i.e. i can learn from more sources)
if i were a beginner, i might choose FASM, although, it may be just as easy to use
GoAsm or MASM to start with, learning the complexities along the way
because you are familiar with programming basics already, you may want to take a similar approach

peaslee

Hi.

I'm new at this myself, so there might be someone who can give a better answer, but this is what I think I know.

Assemblers are complete languages. There are many "brands" of assemblers just as there are for BASIC or C++. I have only been using MASM32, so I can't speak directly to compatibility issues, but I understand that in general they are not compatible. You can, however, link together object code that has been created by different assemblers.

I hope that helps a little.
Bruce Peaslee
"Reality is a crutch for those who can't do drugs."

dedndave

i should also mention the difference between MASM and MASM32
MASM is the assembler program written by MS
MASM32 (which includes MASM) is a set of time-tested and widely used macros and liibraries
in other words, rather than using MASM, and developing all of your own macros and libraries,
much of the work is done for you, you have only to familiarize yourself with them
this collection of macros and libraries can make the code appear very different
other similar collections are WinASM and i think Kip Irvine has a set, as well
in fact, i use the MASM32 collection, but i also use Kip Irvines' instructions - understanding that there may be some differences

Valliko

Hi and thanks for the answers :)

Okay so im gonna look a little into FASM and GoASM aswell, they sound very interesting. Is MASM the most established assembler for Win32 today you think? If so, MASM would probably be the best to start with, just to learn the language and then maybe "emigrate" to another one of my taste :)

EDIT: FASM seems to be the most "basic" assembler if you compare to the other two, is that true? I think learning assembler without using macros etc would be best and that's actually what im really interested in, just pure assembly :)

dedndave

I think FASM may be the simplest to learn.
I might recommend it to someone who was totally new to programming,
or to someone who needs ASM to meet a college requirement only.
As I said, you already have a grasp of the basics.
What I wanted to avoid was learning a simplified assembler, then
having a difficult time with a transition to a more complete one.

I think MASM is the most widely used assembler. I am not really sure about that.
It has been around as long as any of the others (except maybe Intel ASM86).

This could change. Because GoAsm has so many similarities with MASM,
programmers who are familiar with MASM find it an easy transition to make.
In 5 or 10 years, GoAsm could well overtake MASM for popularity.
Maybe it has already - lol. It is hard to say, actually. There are different groups
of programmers; One group that prefers ASM as their primary language;
Another group that has to learn it for college, and may never use it again;
And still another group of programmers who primarily write in some other
language, but use assembler in isolated instances to speed up their code.
Each of these groups will have a different set of preferences.

I use MASM at the moment, because I know when I am ready, I can
make a transition to GoAsm with minimal difficulty. I want to learn the
MS directive set, first. I think GoAsm is a "super-set" of MASM. The guys
who write GoAsm and it's libraries all hang out in here and they would
be far more qualified to answer that question.

I think MASM or GoAsm may be the best for you, because what you
learn about them, you can also apply to your C programs.

If I am not mistaken, FASM and NASM have a few different conventions
that may not make that so easy.

MASM and GoAsm have a more complex set of directives. That does not
mean you need to learn them all at once to write code.

peaslee

Quote from: Valliko on May 02, 2009, 04:30:44 PMFASM seems to be the most "basic" assembler if you compare to the other two, is that true? I think learning assembler without using macros etc would be best and that's actually what im really interested in, just pure assembly :)

From what I've seen on the Internet, this is a controversial issue.  :wink

For example, MASM32 has a way of prototyping subroutines that allows type checking, etc. Pushing the wrong number or type of values on the stack yourself is a bug that can be hard to find, especially for someone new. So, is the use of the "invoke" command not real assembly programming? Who's to say.
Bruce Peaslee
"Reality is a crutch for those who can't do drugs."

Vortex

Valliko,

Have a look at Jwasm, a Masm compatible assembler maintained by Japheth.

dedndave

INVOKE is essentially an assembler directive.
MASM is supposed to type-check it for you, but I have cross-typed parameters
several times (newbie learning) and MASM didn't say a word about it.
This is understandable, as the MASM program would have to know in advance
what was expected for every (including future) API calls, etc.


Mark Jones

Hi Valliko, welcome to the forum. :bg

I concur with Dave, MASM32 and GoASM are both very good and well-supported here. However, I would focus on only one assembler, whichever you choose. Assembly in general can quickly become overwhelming, so take your time.

The MASM32 package includes some examples, but is otherwise not designed for beginners, however Iczelion made a geat series of tutorials.

GoASM has its own webpage, complete with examples and tutorials. GoASM is a little more work to setup however, and doesn't come as a complete package. To remedy this, E^Cube has created a GoASM SDK.

Most of all, have fun. :bg

P.S. One last thing. 32-bit code is the recommended beginning point. 16-bit code is outdated, and 64-bit code is very difficult to implement in assembler currently.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Valliko

Hello and thanks again!

I've decided to download the WinASM IDE and run it along with MASM since MASM seems to be the established one when it comes to Win32.
I have Iczelion's guide aswell. I will probably return with a bunch of questions and error messages in a near future :D

GregL

#11
Quote from: Mark Jones... and 64-bit code is very difficult to implement in assembler currently.

Oh come on, it's not that difficult, it's just different.


Mark Jones

Well Greg, perhaps I should have said that it is not user-friendly for beginners -- there are only a fractional percentage of posts here even pertaining to 64-bit code, let alone beginner questions in 64-bit. (Who is going to make the Iczelion equivalent 64-bit tutorials, hmmm? Are you volunteering? :bg) E^Cube also made a 64-bit SDK, but if you ask me, starting with 64-bit code is far more trouble then it is worth and would simply confuse the learner.

Still, I can respect knowing about 64-bit and how it is different from 32-bit, but anything other than an overview is counter-productive IMO. Learn the basics first... advanced topics later.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

hutch--

Over time 64 bit will get better tools and better OS support but there is just not enough of it around yet for either. Where the shift from 16 bit DOS is a complete concept change, 32 to 64 bit is not so if you know your way around 32 bit assembler, the shift to 64 bit in the future will be no greate melodrama.

RE: Assembler usage, MASM commands the lion share of the market and this will more or less stay this way for the remaining duration of 32 bit. There certainly are other good tools around in 32 bit from GAS to FASM to NASM and of course GoAsm but if you want the greatest code base and the best support, MASM has the runs on the board.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sinsi

Quoteif you want the greatest code base and the best support, MASM has the runs on the board.
As long as you program Win32 isn't it?

edit: err, I mean masm32, not masm

Light travels faster than sound, that's why some people seem bright until you hear them.