Edit: Deleted.

Status
Not open for further replies.

Deffexor

Ars Tribunus Angusticlavius
7,607
Moderator
I don't know about the other Arsians here, but I learned it in college and also read from a book called "Assembler Inside and Out" by Harley Hahn. Unfortunately, this book is out of print, but it *did* teach me the basics of 386 assembler.

That said, I see little use for it today unless you really want to understand the nuts and bolts of what's going on at the register level inside your CPU.

The one area where ASM can be helpful is in doing inline optimization within your C code, say for a certain loop that the compiler just isn't able to get quite right. (Apparently, you can do this in C# as well.)

Or perhaps if you're accessing a piece of hardware directly.

Once when a friend of mine and I were writing a 3D renderer in the DOS days, we wrote an Integer based rendering engine (because GPUs didn't really exist yet), but we wanted to write directly to the Video cards frame buffer (rather than go thru the C library's API) -- So we figured out the I/O addresses of the video card and wrote a short ASM inline segment to write each frame directly to video card memory. This gave us a 40% increase in frames per second. I think I may still have the source code somewhere, actually.

Anyway, my friend came up with this trick, but he shared how he did it with me... It was pretty neat.
 

levine

Ars Tribunus Militum
1,986
Knowledge for the sake of knowledge is all well and good. But in my experience as a relatively low-level developer, including work on embedded stuff, learning assembly is almost certainly a waste of your time. The number of practical, even useful applications of having that knowledge are dwindling to the point of irrelevance. Knowing exactly how processors manipulate registers is no longer a generally useful skill beyond extremely niche areas of software engineering. Optimizing C with inline assembler is an order of magnitude more likely to infuriate your fellow programmers than confer any measurable benefit to your code.

I'd also like to be able to analyze compiled, closed-source programs and understand what they're doing and how they're doing it internally, as well as to be able to modify them to introduce new functionality or make optimizations.
I'd love to hear the use-case you have in mind. Honestly, the only things I can imagine are writing cracks, or modding ROMs.
 

fitten

Ars Legatus Legionis
55,635
Subscriptor++
I somewhat agree and disagree. I've met too many programmers who still view computers as basically "magic". Generally, this also lent itself to some pretty crappy coding skills/practices (of course, someone who lives in assembly can also have poor coding practices). Exposing the wizard behind the curtain opened their eyes. You can know assembly without using it in production code or even doing wild and crazy things in your code. Understanding what is actually going on inside a processor when it's executing the code you wrote can lend insight into many things. For example, it gives concrete examples of why file IO is slow compared to processing... yeah, you can tell someone reading from a HDD is 1000s of clock cycles but nothing drives it home like actually having to take that stuff into account. Similarly, how data is arranged in memory (how structures are accessed, etc.) Sure, a lot of it is getting to be esoteric now but we are still in the transition phase where such knowledge can still be useful where it may not be in another 20 years or something. Basically, as long as C/C++/Obj-C are widely used, I think knowledge of assembly/hardware will be helpful to programmers.

That being said, x86 is nasty. I don't even claim knowledge of it. At least for learning purposes, something from the 68K family or a RISC processor is much easier to learn (because both are generally straightforward and ordered and not higgledy piggledy like x86 feels).
 
I'm not a fan of the art of assembly, mostly because I'm not a fan of randy and his HLA. Depending on which version of the book you end up with, there is a HLA version. HLA is his psuedo assembler. ugh. no point in dugging up old x86 usenet fights.

I dont see much point in learning assembly really. things like IDA Pro can do so much work now and people dont stick soft-ice in there kit like they used to.

You'd be better served learning .net IL or java bytecode than x86 asm really.

if we were still on dos, and using 486's, it would be worth while, but things have moved on.

better spend the time learning java or c# or c++ etc than spending time on x86 asm.
 

MilleniX

Ars Tribunus Angusticlavius
8,139
Subscriptor++
I'm going to disagree with the people saying "waste of time". Assembly, and x86 assembly in particular, is a niche area, but it's far from worthless. In my area, high-performance computing, we frequently need to dig down and figure out where the compiler is screwing up. Ideally, this enables us to modify the source code to make it easier for compilers to optimize nicely. In less fortunate circumstances, we have to hand-code a kernel to ensure some poor compiler doesn't screw us. An acquaintance of mine works on the x264 video encoding suite, and has used small bits of assembly to great effect in systematically improving its performance (and sometimes quality). I isolate a few compiler bugs per year (in released versions, not betas or whatever), and this is much easier with an understanding of what their output means. I've also met someone at a conference desperately recruiting from the dwindling pool of people who have any ISA-level at all for embedded application optimization, which is a damn-lucrative field at the high end where he's working.

The bottom line is: no, assembly won't be that useful in developing generic business applications. It most certainly is in many niche areas of development, which I find to be much more interesting.
 

karmakaze

Ars Tribunus Militum
1,700
Subscriptor
Pickup the freeware version of IDA (http://www.hex-rays.com/idapro/idadownfreeware.htm) or the newer paid versions if you have the money. Then use it to look at some binaries that you built and have source to. This, in addition to reading books or articles on the subject, will give you the most insight into what's going on.

And yes, it's 100% worthwhile. Trust me, being able to debug a production issue without proper symbol files wins you some big favor points.

Consider it another ancient language like Latin or Greek: being able to read it will improve your understanding of more modern languages immensely. :)
 

gloucester

Ars Scholae Palatinae
996
If you're more interested in learning the sorts of things you learn by learning assembly than in learning assembly—

Let me start over. If you want to learn assembly not so that you can write stuff in assembly but because you just want to become a better programmer, then consider starting in on The Art of Computer Programming. Knuth uses a RISC-like computer and its assembly language to demonstrate a lot of concepts and to present algorithms, so you might get much of what you're looking for from Volume 1 of his behemoth book.

Check out Knuth's introduction to MMIX, his new 64-bit version of the RISC computer he uses in TAOCP and which will eventually be used in the fourth edition of the book (if it ever comes to fruition).
 
Status
Not open for further replies.