• Forum
  • Lounge
  • Is there really no active ASM community?

 
Is there really no active ASM community?

Hello guys, it's been very long time since I last time logged in and posted to cplusplus.

I'm currently learning assembly language, so far I managed to set up a comfortable dev environment and got plenty of PDF's to learn from.

But I stuck finding some active asm community to share and discuss beginner's hurdles.
There doesn't seem to be many programmers hanging on the net so if you know of some good community please let me know.

SO is out of question unfortunately for now.
Last edited on
What assembler are you using - the assemblers often have their own community.

Eg for Flat assembler:
http://board.flatassembler.net/

For Nasm
https://forum.nasm.us/
Last edited on
I wanted to use nasm due to nice syntax but have given up in favor for ml64 because there is not a single book that teaches nasm for windows X86_64 which is what I want to focus on.

I'm using the following 2 books:
https://www.amazon.com/Art-64-Bit-Assembly-Language/dp/1718501080
https://www.amazon.com/Modern-X86-Assembly-Language-Programming/dp/1484240626

So while I have this opportunity, in addition to finding forums, if somebody knows of a modern book for nasm on windows that may make me switch to nasm because I don't really like MS syntax.

Therefore either masm or nasm books and forums.

@seeplus btw.
btw. how is fasm different from nasm?
Which one do you prefer and why if you have XP with both.

**EDIT**

I see there is masm32 forums:
https://masm32.com

Reason why I missed it is because I visited another link at:
https://www.masm32.com
which it seems is an old domain that no longer works, so I thought there is no forums, but this one may be a good one I think since it's for MS assembler.
Last edited on
I don't really like MS syntax


Neither do I when I first used it in the 1980's I haven't written Intel assembler code 'in anger' since the days of MS-DOS...

if somebody knows of a modern book for nasm on windows


No, but why not ask on the nasm forum?
Last edited on
I did a 'net search for "nasm tutorial windows" if'n that helps:

https://duckduckgo.com/?q=nasm+tutorial+windows&t=ffsb&ia=web

It helped me to see there are some resources available, as long as one doesn't need their hand held for the basics of installing NASM on Windows.....
>No, but why not ask on the nasm forum?

I've googled out for books for an entire day and all of the books that use nasm provide code samples for either linux or 32 bit programming on windows.

If google doesn't help then I don't see how anyone else could give me a book.
But I will ask on nasm forums anyway out of interest to see if I really missed something.

>I did a 'net search for "nasm tutorial windows" if'n that helps

Would you really recommend to read tutorials to learn assembly?

>It helped me to see there are some resources available, as long as one doesn't >need their hand held for the basics of installing NASM on Windows.....

Reminds of one famous book called "C++ in 21 days"

How silly must one be to believe to learn a language in 21 days, tutorials are not different, just a loop over one and same basics that make a beginner believe to learn something while in fact it only wastes their time googling for more and more resources that would be better spent on getting a good book and learning stuff in detail.
I've googled out for books for an entire day and all of the books that use nasm provide code samples for either linux or 32 bit programming on windows.
The thing is that you're working at the intersection of three separate systems.

1. On one side you have the assembler itself. What's its syntax? How do you tell it how to lay out data in the binary? What output formats does it provide and which are useful to your?

2. On another side you have the operating system. How do you interact with it at a low level? What are the calling conventions? How do you make system calls? What binary format does it use?

3. On the last side you have the CPU. What are its modes? What instructions does it provide and precisely how do they modify its state? What things do you need to look out for with regards to, say, alignment, ordering of parallel operations, performance, etc.?

Which of these is "learning Assembly"? I would argue only #3. However, although CPU manufacturer specify their own syntax for the assemblers they make for their CPUs, you may find that for one reason or another you need to use someone else's assembler which works differently, so you still need #1. And unless you're writing your own OS, if you can't talk to the system you won't be able to do much (assuming you're writing a lot of Assembly. Most people nowadays prefer to write only small parts of their programs that don't interact with the OS directly), so you can't skip #2.
So what's the problem? A book that could cover all three thoroughly would be so huge it would be irrelevant by the time it was finished. Most people learn like this:
1. They get experience working in C or C++ and learn the low level details of what happens when, for example, they read from a file, and generally how their OS works at a low level.
2. While debugging their code, they slowly learn an Assembly syntax (which one doesn't matter) in order to read disassemblies and the semantics of some instructions. They start to learn the basics of how the CPU works.
3. Eventually they need or want to write some Assembly code. At this point they know enough of how the CPU works that they can more or less see how to structure the code and which instructions they'll need, and just need to pick an assembler that fits into their build system, and they learn the sytax of that assembler.
4. Finally, if they need something deeper, they can consult any of the multitude of references and cheatsheets for their CPU when they're writing something more tricky. See for example the Intel manuals or the X86 Opcode and Instruction Reference:
https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html
http://ref.x86asm.net/index.html

Again, there's no book that condenses all of this and its infinite variations because it's just too much. You'll only find texts that cover some of the above and expect you to already know the missing parts or to be able to fill it in yourself.
@helios

Thank you for detailed reply, I agree with and understand all what you said.

I'm aware of intel's manuals, it will be easier to read it after some introductory practice with a beginner friendly book.

Your second link is very useful to quickly recall things, definitely bookmarking it!

If you take a look at my post #2 and if you also take a look into these 2 books you'll see both of them satisfy all 3 points you mentioned.

These books satisfy your 2 out of 3 points for things which I whish to focus on:
1. use of specific (ml64) assembler [-]
2. code samples for windows system [+]
3. programming for X86-64 CPU [+]

However what I could NOT find is this:
1. use of nasm assembler [+]
2. code samples for windows system [+]
3. programming for X86-64 CPU [+]

Hopefully I made my self clear what I meant to say by "book for nasm", which is a book for X86-64 on Windows, my criteria to select learning resource.

These 2 books certainly do not teach everything in detail but they are specific to those 3 points satisfying 2 out 3 things which I whish to focus on.

Since I could not find an equivalent book for nasm assembler I'm forced to begin with ML, but so be it.
And I was also able to find forums specific for MS assembler so it's all settled to start struggling :)

I'll leave intel's manuals for some time in the future as it's too much to chew for me at this stage.

1. use of nasm assembler [+]
There's the manual.
https://www.nasm.us/xdoc/2.16.01/nasmdoc.pdf

2. code samples for windows system [+]
Too broad. What in particular would you like to know about?

3. programming for X86-64 CPU [+]
Again, too broad. Writing a kernel or a bootloader is not the same as writing in usermode.
Last edited on
>There's the manual.
Didn't know there is, I quickly skimmed trough pdf and it may be useful for someone who already knows something about assembly.

I think you didn't understand that I know nothing about assembly and for this reason I'm looking for easy step by step approach, which mainstream books provide better than manuals.

Take it another way, would you suggest Stroustrup's book, MS docs or cppreference site to a beginner?

These sorts resources are for those already familiar with the language.

>Too broad. What in particular would you like to know about?
Problem is code samples found in a book, which need to be modified to able to run it on windows.

For example, code samples use of "syscall", all such and similar platform specific occurrences would have to be modified which is not a productive for a beginner to learn.

Also conceptual explanations about code samples about linux specific or 32 bit stuff would have to be googled out to covert it, which is also not productive.

For ex. why learning how to use segment registers if that's not needed for 64 bit development?


>Again, too broad. Writing a kernel or a bootloader is not the same as writing in usermode.
Problem is I want to skip 32 bit programming all together and jump straight to 64 bit.

I don't really know how to make my self more clear, but I appreciate all the responses.

---

Btw. I attempted to register to nasm forums yesterday to ask my silly noob questions there, and got a response email telling me that I must wait for approval, today when I got a new email it says my registration was "rejected" :/

I don't know what to say except that, this drawn me away from nasm assembler even further, even though I really wanted to start with nasm.

https://i.imgur.com/b1N9s24.png
Last edited on
This link may be of interest as it uses NASM for an assembler tutorial.
https://sonictk.github.io/asm_tutorial/

Note that writing assembler code for 'real' mode (eg as for old MS-DOS) is different to writing in 'protected' mode as you would for code to run under Windows. If you see code that uses INT then that code is for real mode and isn't suitable to run with Windows.

Last edited on
thank you seeplus, this's will be a useful resource, added to my bookmarks for reference.
visual studio for some unholy reason does not support 64 bit mode and inline assembly. You can mix 32 and 64 bit with some trouble, and you can emit any code including 64 bit ones, but it gets frustrating to try to force fit this. Also, 64 bit cpus have also become very weird and writing optimal assembly for them that is better than what the compiler can do is much more involved than 32 bit was, doubled down because the compilers are a lot better now.

You may be seeing a lack of activity on windows because of the lack of support in VS + lack of need as hardware has grown. Its hard to justify substantial swaths of asm in a world where a home pc has 20+ cpus running > 3ghz each. Would be nice to allow it though, a few one liners like endian reverse can't be done in c++ to match the hardware instruction.
>You may be seeing a lack of activity on windows because of the lack of support in VS + lack of need as hardware has grown. Its hard to justify substantial swaths of asm in a world where a home pc has 20+ cpus running > 3ghz each.

I've heard of many good reasons why using or developing in assembly still matters, some valid and some funny.

But one of the best comment I stumbled upon is that it makes you "undefeatable".

I don't really want to google out for reasons why not using assembly and making any judgements about 2 conflicting worldviews, I'm sure there is plenty of excuses which only shoo new generations of coders away.

My reason why I decided to learn assembly is very simple, it's because I want.

As for MS and decisions made by MS, I agree with you, I don't like a lot of stuff about MS, especially not MS declaring API's obsolete or even "dangerous" and their way of writing code and ugly syntax, but when it comes to dev tools and resources MS is my favorite.

VS studio is good for some languages and bad for others, most developers from what I see began to use vscode, including myself.
for ex. setting up dev environment in VS for asm is pain in the arse.
with vscode I can launch WinDbg preview with command line args and it feels much better than all VS features together.
Last edited on
You're not really giving any information on why you want to learn Assembly, so it's difficult to make any recommendations. I get the feeling you don't really have any goals in mind. Something general I can recommend is to learn from your compiler: write a program in C or C++ and compile it, telling the compiler to spit out the intermediate Assembly. Pick a function and reimplement it in your assembler of choice (keep in mind that the compiler may use a different syntax). Go back to the C/++ source and add your Assembly object file as an external reference. Compare the runtimes of the compiler output and your hand-optimized function. See what you can do to optimize further. Pick a new function to replace, and so on.
Things to avoid at first:
* Memory allocation.
* I/O and anything else that needs direct interaction with the OS.
* Floating point operations.
Good things to start with:
* Integer operations.
* Branching.
* Stack operations.
Suggestion: Implement SHA256:
 
extern void compute_sha256_digest(char dst[32], const void *buffer, size_t size);
helios,

your suggestion to instruct compiler to produce assembly and play with it is certainly a good advice, I'm able to image how useful is may be to boost your skill further.

>You're not really giving any information on why you want to learn Assembly, so it's difficult to make any recommendations. I get the feeling you don't really have any goals in mind.

There are few areas which are of interest to me, ex:
Analyze some executable if it's malware or not?

Decompilers don't seem to be the best option for this task, but dissaembly seems like muct better approach, for which one needs to be really skilled.

Other than that, I also would like to boost my programming skills in general.

What motivated me most however is I often times stumbled upon assembly code on GitHub and various other sites for something which I wanted to reuse or interpret but was not able because I couldn't understand what the code does.

Some open source projects also consist of smaller portions of assembly code and I would like to understand at least partially what it does before using it.

I almost never reuse code if I'm not able to modify it.
Last edited on
Registered users can post here. Sign in or register to post.