Jump to content
  • Advertisement
Sign in to follow this  
RedKMan

Assembly Programming - Where To Start

This topic is 4440 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, Decided to have a tinker with assembly programming. Just done a bit of googling and come up with all sorts. What is the best type of assembly to learn, X86, my processor is an AMD Athlon XP2200+? Also what is the best and easiest to use IDE/assembler to use for free download? Also can anyone recommend any useful resources /books? Any help much appreciated. Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Quote:
Original post by RedKMan
Hey,

Decided to have a tinker with assembly programming. Just done a bit of googling and come up with all sorts. What is the best type of assembly to learn, X86, my processor is an AMD Athlon XP2200+? Also what is the best and easiest to use IDE/assembler to use for free download? Also can anyone recommend any useful resources /books?

Any help much appreciated.


Check out the following two forums that are dedicated to assembly language programming:

http://www.asmcommunity.net/board/
http://www.masmforum.com/simple/index.php

You will find that both forums feature FAQ threads and plenty of further resources (articles, links, free IDEs etc.).

Depending on your actual motivation for learning x86asm, as well as your long term development plans (platform, OS, type of applications), you will find that there are different IDEs and assembler that can be recommended. So, it is hard to recommend anything without knowing more about your goals.
If you are interested in doing primarily Win32 development in assembly language, you will probably want to check out MASM, that's the Microsoft assembler which is also used by VC++, alternatively there are also HLA and NASM and FASM. There are dozens of more assemblers, however basically these are the most powerful/widely-used ones.
If you are interested in possibly doing development for different platforms or OS, I would personally recommend to check out NASM, which can also be used as backend for gcc.
Nevertheless MASM and HLA are incredibly powerful solutions that can easily hide the dirty details from a beginner due to their powerful macros.

So, it really boils down to what exactly you want to do, and why you want to learn assembly language.



Share this post


Link to post
Share on other sites
Hey,

Thanks for the info, NASM looks the right way to go. I'll probably be crossing between Windows and Linux. I'm also going to have a look at MASM as I read it's a good idea to learn a couple. As for my goals, pretty much graphics programming initially.

Thanks,

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by RedKMan
Hey,

Thanks for the info, NASM looks the right way to go. I'll probably be crossing between Windows and Linux. I'm also going to have a look at MASM as I read it's a good idea to learn a couple. As for my goals, pretty much graphics programming initially.

Thanks,


Yes, NASM is definitely the right choice if you are not going to do merely Win32 development, much of your code can easily be portable across Win32/Linux if you keep things generic enough (i.e. OS depedencies).

Concerning MASM, well it's awesome-especially for programmers coming from a HLL background, it's really addicting-it's pretty much like MS's VC++ IDE: when you have used it for a while you are going to miss lots of (hand holding) stuff when you have to work without it (i.e. under Linux).
Nevertheless it's also very Win32-specific and -centric, so much of the high level macro stuff will be hardly applicable on non-Win32 platforms.
And it is definitely a good idea to look into different assemblers, this will be the only way to really pick your favorite one. Also, it really doesn't matter all that much what assembler you use initially, because most of the required low level knowledge (i.e. CPU instruction sets, registers etc.) is generally transferable between different assemblers.

Regarding graphics programming: it is important to keep in mind that most of the really "cool stuff" is nowadays handled using backends such as OpenGL or DirectX.
So, if you are hoping to do such graphics programming in assembly, DirectX would not be a feasible option if you are interested in running your stuff directly under Linux.
Also, many of the available graphics demos are in fact Win32-specific.

On the other hand, under Linux you can easily use an emulator to run assembled stuff for arbitrary architectures.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by RedKMan
Hey,

Thanks for the info, NASM looks the right way to go. I'll probably be crossing between Windows and Linux.


You may however find that the syntax between different assemblers may differ significantly, likewise there's Intel syntax and AT&T syntax for assembly language (check out google for further references), INTEL syntax seems initally less complex than AT&T, however the latter is usually perceived as much more intuitive. It's also the syntax that's natively used by the GNU assembler (gas) used by GCC.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Make sure to also check out GameDev.net's resource section about asm:
http://www.gamedev.net/reference/list.asp?categoryid=20#105

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by freenity
check this book out:
http://www.drpaulcarter.com/pcasm/


Yes, and this:

http://en.wikibooks.org/wiki/X86_Assembly

Syntax Comparisons:
http://en.wikibooks.org/wiki/X86_Assembly#Section_2:_Syntaxes_and_Assemblers

Lists of popular assemblers:
http://en.wikipedia.org/wiki/List_of_assemblers
http://en.wikibooks.org/wiki/X86_Assembly/x86_Assemblers
http://en.wikibooks.org/wiki/Reverse_Engineering/Assemblers


Details for various popular assemblers:
http://en.wikipedia.org/wiki/MASM
http://en.wikipedia.org/wiki/NASM
http://en.wikipedia.org/wiki/High_Level_Assembly
http://en.wikipedia.org/wiki/GNU_Assembler
http://en.wikipedia.org/wiki/FASM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Regarding the use of a macro/high level assembler to get started programming in assembly language:

Quote:
http://c2.com/cgi/wiki?LearningAssemblyLanguage
Does learning assembly language with one of the "high level assemblers" ( http://en.wikipedia.org/wiki/High-level_assembler ) teach a student everything he needs to know about modern assembly language programming (minus now-irrelevant historical cruft), or is there some reason to use traditional-style A86 or NASM or the GNU assembler ?

Quote:
http://c2.com/cgi/wiki?LearningAssemblyLanguageFor instruction, there is every reason (when possible) to use only traditional low-level assemblers, although high level assemblers are highly desirable for real world use.

The only reason to teach assembly language to students at all in this day and age, is as a part of the overall process of teaching them how CPUs actually get things done. If they don't need to understand the workings of CPUs, then they don't need to study any sort of assembly language at all. But if they do need to understand CPUs, then high level constructs will only obscure their understanding of what is happening at the low level.

For pedagogical purposes, at the low level, it is valuable to understand the cost of general purpose versus dedicated-purpose registers, the difficulty of allocating registers for data calculations and address references, the number of instructions required to do 128-bit arithmetic on a 32-bit CPU, what high level control constructs (IF/WHILE/FOR/SWITCH) look like when translated to assembler, etc.

For real world use, on the other hand, sometimes one needs to escape to assembly for performance reasons or to access hardware resources/capabilities not accessible from a high level language, in which case the entire purpose is different, and it's desirable to have as many high level constructs as possible, as options.

So to answer the original narrowly phrased question, "Does learning assembly language with one of the 'high level assemblers' teach a student everything he needs to know about modern assembly language programming", clearly the answer is "absolutely not, in the general case". But in other cases, it depends. A future Java programmer may not "need" to know as much on the same topic. It's a bit ambiguous.

The top universities world-wide have had a fairly general answer to all such things for a very long time, though; they will tell you they are not trade schools, and that understanding of underlying theory is what is important to them. They therefore tend to teach such things "the hard way", for the best of reasons, given their goals. -- DougMerritt


In other words, you will probably really want to make sure that you start out with the basics, rather than the high level stuff because you'll otherwise mainly be learning the specifics of the corresponding high level assembler. Unlike the high level support, the low level support is usually applicable 1:1 across different assemblers, often even on similar platforms/architectures.

In fact, under Win32 I would even recommend to also use an emulator for learning assembly language by default, too.

Mainly because Win32 is not a particularly forgiving OS when fooling around with low level stuff, meaning you are not that unlikely to possibly manage to crash your OS or seriously affect it when playing around with assembly language.

Thus, using an emulator such as "bochs" would enable you to safely try out all sorts of stuff that you probably wouldn't want to run directly on your system, i.e. out of fear to affect your system's performance or stability.

So, using an emulator is generally a pretty good idea and will also allow you to do things that you normally wouldn't want to do (in fact, about 10 yrs ago I actually managed to make my harddrive unusable by corrupting its FAT when writing in assembly language...).
Of course, an emulator may probably not really be an option if you really intend to get started in Win32 assembly programming directly, simply because this would otherwise entail installing and running Win32 within the emulator, too.

Also, there are plenty of x86 assembly tutorials out there that start out by illustrating various DOS- or even BIOS-based examples, i.e. in order to illustrate the processor architecture and familiarize with the various registers and their purpose. While you won't want to dig too deeply into this, if you mainly want to do Win32 programming in assembly, the background knowledge is nevertheless still useful and usually also directly applicable.

For example, check out the following site which provides a basic introduction to x86 assembly using MS DOS debug.com utility to create your utilities: http://www.oopweb.com/Assembly/Documents/asm/VolumeFrames.html
(you could be set up for this course within 5-10 minutes by simply getting bochs with a FreeDOS image, which includes a port of the debug.com utility).

Anyway, the folks over at the assembly forums will probably also have lots of useful feedback!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!