Hi everyone,

What book would be required, or recommended to learn Windows ASM language? I would like a book that someone can learn everything on ASM starting from basics to advanced. What complier would be used for ASM code?

Thank you if someone could get back to me.
Posted on 2011-08-30 21:03:16 by php111
My personal opinion is that ASM can not be learned from any book - I see books as a reference for looking up things you stumble apon along your journey, and maybe a nice way to kill some time.
The only book I would recommend for x86 asm is Art of Assembly by Randy Hyde - you can read this online for free or download it as an ebook, so owning a physical copy holds little value.

We don't use a compiler for asm (typically) - we use an assembler.

Posted on 2011-08-31 03:33:39 by Homer
Yes, annoying that people want to learn assembly without knowing what it is, and talking about a compiler for assembly.
Let me explain it one more time:
Assembly language is a mnemonic-based representation of machine code. An assembler does nothing more than to encode the human-readable mnemonics into machine code.

A compiler is one level above that, aimed at programming languages that are a level above assembly (high-level languages). It translates the programming language into an assembly language listing. Unlike assembly, it is not a 1:1 mapping. There are various ways to do the translation, and there is a lot of room for optimization by the compiler (biggest difference with assembly: an assembler does not optimize).
The assembly listing generated by a compiler is then sent through an assembler to generate the actual machine code.

Note that this is the historic definition of a compiler. They used to be two separate processes. Later the compiler called the assembler automatically, and eventually the assembler was integrated into the compiler.
Certain modern compilers no longer actually generate assembly listings internally, but generate the machine code directly.
Even if they do however, it is usually still possible to make it output an assembly listing.

Anyway, there is a big conceptual difference between a compiler and an assembler.
I think that is the first thing you have to understand, probably even BEFORE you decide to learn assembly.
Posted on 2011-08-31 04:53:42 by Scali
Actually, php111 asks about a "complier"... typo, I ASSume...

According to some people's definition, a "compiler" translates one language to another, so an "assembler" is "a compiler for assembly language". Some people (including me) prefer "assembler", to stress that we specify the instructions, the "compiler" doesn't generate 'em. But it isn't really "wrong" (IMO) to call it a "compiler".

As to a book on "assembly for Windows", the only real assembly needed is "push" and "call". A book on "programming for Windows" (any language... they tell me C is popular) should cover what to do with it. The stuff in between API calls is (mostly) not specific to Windows, and any book on assembly should cover it.

Besides Randy's AoA (which uses his own assembler, HLA... which is quite different from most other assemblers!), Dr. Carter's tutorial is good (IMO):

http://www.drpaulcarter.com/pcasm

(uses Nasm for an assembler/compiler)

For Windows specifics, check out Iczelion's tutorials - links towards the bottom of this Forum.

I agree with Homer, though - you learn assembly language by doing it, not by reading about it.

Best,
Frank

Posted on 2011-08-31 11:36:22 by fbkotler
Iczelion's Tutorials. It doesn't necessarily teach asm but it does teach Windows Asm. Based on Petzolds Programming in Windows Books they teach Windows at an easy pace while giving you the 5-10 asm opcodes you will encounter most.

As soon as you hit a speed bump (String Copying, Comparing, etc...) the AoA 16bit book will come in handy.

Everything else will come naturally.
Posted on 2011-08-31 12:00:11 by JimmyClif

According to some people's definition, a "compiler" translates one language to another, so an "assembler" is "a compiler for assembly language". Some people (including me) prefer "assembler", to stress that we specify the instructions, the "compiler" doesn't generate 'em. But it isn't really "wrong" (IMO) to call it a "compiler".


I used the term 'encoding', to stress that it is not the same as 'translating' (this process of encoding is what is referred to as 'assembling'. Compiling is a different process).
Translation leaves room for interpretation, encoding does not.
That is what makes assembly stand out from every other programming language out there (which has a lot to do with the fact that assembly is entirely specific to the CPU you're programming for, whereas most programming languages can be translated to most CPUs).
So you shouldn't be trying to generalize assembly into the rest of the programming languages, and pretend that you 'compile' assembly code. You generalize away the fundamental difference, and only make it harder to understand.

If we look at what Wikipedia says, http://en.wikipedia.org/wiki/Compiler:
The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).


That means an assembler can never be a compiler, since assembly is not a high-level programming language, it is a low-level programming language.
Posted on 2011-08-31 16:17:41 by Scali
If you Google for "compiler definition", you'll find that some talk about a "high level language", some talk about a "higher level language", some talk about "alpha-numeric characters" ("to machine language" in each case) I think we'll agree that asm is not a "high level language". Would you agree that asm is a "higher level language" than machine code?

If you're going to go by Wikipedia as you're authoritative source (pun), then okay, an assembler is not a compiler. My opinion remains that it is not "wrong" to refer to an assembler as a "compiler"... although I would never do so - it's not cool! :)

Best,
Frank

Posted on 2011-08-31 17:30:44 by fbkotler

Would you agree that asm is a "higher level language" than machine code?


Yes.


If you're going to go by Wikipedia as you're authoritative source (pun), then okay, an assembler is not a compiler. My opinion remains that it is not "wrong" to refer to an assembler as a "compiler"... although I would never do so - it's not cool! :)


Well, I'm quite sure there are many other sources that have very similar definitions to Wikipedia's.
Not saying Wiki is the authority on the subject... It's just rather hard to point to some books I have here on the shelf. The definition on Wiki is most probably copied from a book anyway.
I mean, discrediting Wiki is not as easy as people think it is. Wiki may not always be correct, and as such should not be taken as an authoritative source... But you'd have to prove the things on Wiki false first (I obviously checked what was written on Wiki first, and only quoted it because in my opinion it is a good definition).
Any authoritative source will say more or less the same as what Wiki says.

I think we can at least agree that you shouldn't call an assembler a compiler.
Posted on 2011-08-31 18:00:25 by Scali
If we accept the definitions that you like, and throw out the definitions you don't like, yeah.

Best,
Frank

Posted on 2011-08-31 20:15:05 by fbkotler

If we accept the definitions that you like, and throw out the definitions you don't like, yeah.


Now that's just lame.
I was just referring to you saying:
"My opinion remains that it is not "wrong" to refer to an assembler as a "compiler"... although I would never do so - it's not cool!"
So I thought we could end the debate here, since we both agree on that much. We can agree to disagree on the reasons why, as they are not that important.

Other than that I am the only one who actually referred to *any* definition of compiler whatsoever, so it's not like I threw out any definitions I didn't like. Nobody else provided any defintions that were conflicting with what I said in the first place.
I resent that you are implying that I just throw out definitions I don't like. I am not like that at all. That's just a pathetic remark. I also have no idea where that came from, since I was trying to resolve/end the discussion, see above.
Posted on 2011-09-01 02:16:41 by Scali
Off topic, thread terminated :)
Please feel free to continue your philosophical discussion in private :P
Posted on 2011-09-01 06:29:07 by Homer
For the benefit of the Original Poster: By tradition, the word "assemble" is typically used to refer to the process of converting .asm source files to binary machine code using a program known as an assembler.  Although the words "compile" and "translate" can also be used - "assemble" has a specific contextual meaning and is preferred.
Posted on 2011-09-01 06:33:42 by p1ranha