Sign in to follow this  
atomic_west

assembly

Recommended Posts

I was on a job shadow with a computer programer who suggested i try to learn assembly that is would be a difficult task but would suit my ambitions i know assembly is like clymbing everist but i am dedicated but does any one know a good book to start in??

Share this post


Link to post
Share on other sites
The Art of Assembly is widely recommended for learning assembly language. Though assembly isn't that hard, just tedious. Also, if you can get an assembly reference you can learn quite a bit from just looking at the generated assembly that your compiler produces for C or C++ code. The -S switch for gcc and /FA family of switches for MSVC.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I wouldn't bother learning assembly language at this point. It might be interesting to a degree, but it won't be very useful. Learning some English language would be a good idea, though.

Share this post


Link to post
Share on other sites
AP has a point as to the question of usefulness of learning assembler.

However, it will give you great insight into what really goes on at the bare metal, and with this understanding you will be more able to use, rather than abuse, features of higher level languages.

Share this post


Link to post
Share on other sites
games are one of the last refuges of the assembly programmer.
games are one of the few single pieces of software that challenge a modern machine.

i would consider it useless in almost any other section i care to think of.

i don't touch the stuff, but i imagine it could be fun to play around with - provided your definition of fun includes debugging.

Share this post


Link to post
Share on other sites
The point of learning assemble these days really isn't too make something huge like a game. The reason he probably wants you to learn it is so you have a better understanding of how the machine works. Plus if you're doing anything like OS/Driver/Emulator/Robot programming you pretty much have to know at least how to read assembler.

Share this post


Link to post
Share on other sites
It might be easier trying to learn ASM on a low-end platform where ASM is actually needed, and thus is still used exclusively.
I develop games for Texas Instruments calculators and am currently working on a Game Gear game, all in Z80 assembly. It's quite fun.

Share this post


Link to post
Share on other sites
I'd beg to differ.

Sure general assembly may not be nearly as useful these days, but there are some great tricks you can apply with it. As reference to the [Game Programming Gems] series, stack winding is mentioned. I use this for a speed boost on my heaviest data-tree traversal functions where the goal is to find a single leaf.

Sure you could do this through C/C++, but odds are someone who didn't know assembly wouldn't think of it nor know how to implement it.

I'll agree with rip-off, though, that outside of the video game world assembly is a dying art. A shame in my opinion because its like having a mechanic that can fix your car by looking at the computer codes, but doesn't understand what they mean on the deepest level.

It can also help with some PITA bugs that could cause a submission to be rejected. I recall working on a project where our only demo cycle crash bug was actually inside the render(ware) library we licensed. One of our most senior programmers was able to fish it out by disassembling their library, and directly re-writing it in machine code.

Do you need to know assembly to become a good programmer? No.
Does knowing assembly help in becoming a great video game programmer? Yes.

Just my 2cp

EDIT: Two posts between when I hit reply and submit. I agree with Scet and benry.

Share this post


Link to post
Share on other sites
Fair enough, but bear in mind you are learning something completely devoted to a single chip! - not even a single platform

that is when future improvements are added to the chip (e.g. MMX) your code will have to be modified by hand to use them - with a C compiler or other high level language, you just update your compiler to get the benefits of a new chip into your program.

and just to warn you, the assembly I learnt 8 years ago is next to useless now, all 16-bit registers and DOS calls and things which just aren't really used anymore. The C++ I learnt on the other hand still serves me today.

for tiny bits of code assembly can be very useful, but its unmaintainable - hence best to avoid doing entire projects in it.

Also it takes a very skilled programmer to make an assembly program that runs appreciably faster than a C program.

Still, if you're curious then fair enough -- be sure to look into good coding practise for assembly, its very easy to make a complete mess that you can't unravel

Share this post


Link to post
Share on other sites
that said, interfacing directly with the chip, which is what you're doing in assembly can be kind-of exciting. There is very little difference between assembler and machine-code. Every assembly instruction generally maps to a single machine instruction. (God, I can still remember 4C00CD21 - which is machine code for: mov ax,00; int 21; which is a program that simply exits (without this it will just crash the computer) - Assembler's just readable (or is that more readable).

Share this post


Link to post
Share on other sites
While it's true that assembler is only for a specific chip, the concepts are the same across the board (Much like higher level languages). Where these concepts do come in handy are in such things as scripting, specifically when you have to designe a VM.

Some books that I've found useful:

Compilers: Principles, Techniques and Tools
by Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman

Game Scripting Mastery
by Alex Varanese

Share this post


Link to post
Share on other sites
PC programmers don't really need to learn to write assembly IMHO.

Learning to read assembly is a whole different thing and is extremely useful.

As others have said it gives you good insight into how computers work in general. It also lets you answer all those questions this board constantly gets about "which is faster, pointless trivial optimization A or pointless trivial optimization B" because you can just look at the damn compiler output and see that there is no difference. It will also make you a better debugger because you can follow the flow of your program at a much finer grained level as well as letting you debug in the field where you don't always have MSVC handy.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
The Art of Assembly is widely recommended for learning assembly language. Though assembly isn't that hard, just tedious. Also, if you can get an assembly reference you can learn quite a bit from just looking at the generated assembly that your compiler produces for C or C++ code. The -S switch for gcc and /FA family of switches for MSVC.

I would recommend this book as well (also a free download)

John B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this