Advertisement

How important is Assembler?

Started by April 12, 2002 06:13 AM
18 comments, last by maccaroo 22 years, 5 months ago
When should I consider learning assembler (is ASM the correct abbreviation?), if ever? Right now I''m still learning the Win32 API, but I''d still like to know when it''s necessary... Thanks PS: What are the advantages? Does it just make the code faster, or are there things that can only be done in assembler?
Assembly language is normally only used to optimize very speed critical code in "real world" programs. Executable code written in assembly is smaller and faster than code written in a high level language. Unless you''re going to optimize something, it''s rarely ever absolutely neccessary to know it. However, learning it will give you a good idea of how your programs in C, C++, or whatever, really break down when they''re compiled. I would suggest at least becoming familiar with all of the basics. Just be careful with it. You can do major damage with ASM since you''re dealing directly with the processor, memory, registers, etc.

/*=========*/
/* Chem0sh */
/*=========*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
Advertisement
Don''t bother learning it until you know everything else. Well, what I mean is that there are other more important things to learn in my opinion.

Learn C++ (or some other language), then learn Win32API, then DX/OpenGL/3D, then proper use of your language in programs and games, then maybe you can worry about ASM.

But I think that there will ALWAYS be better things to learn than ASM. 3D theory, AI, etc.

-------------Ban KalvinB !
ChemOsh: You can do major damage with ASM since you''re dealing directly with the processor, memory, registers, etc.

What kind of damage? Physically to my system, or just loosing-data damage?
True enough, you don''t have to -worry- about -using- ASM until you reach very complex stuff, that might have to get broken down and optimized, like 3D algorithms, etc.

BUT, you should definitely at least read up on it. Learn the way in which the computer processes data, learn the basics of ASM, because it mentally cracks open the Black Box of "I put in code and somehow the computer does stuff" and gives you a feel for how the compiler really translates what you are doing.

Its kinda like this: To work on your car, you''ll usually learn about whatever you have to fix. Car won''t start? You learn to check the battery. Bad suspension? You learn about the shock absorbers and the suspension system on your specific model. Thats sorta like learning C++, you learn upper-level procedures to get your job done, but if all you do is look up how to fix the tie-rods on your particular car, when the steering goes bad on your buddy''s car, you might be a bit confused because you really only figured out how to work on your model. But if you researched the principles of physics, electricity and thermodynamics, not only would you have a -much- easier time working on all different kinds of cars, but you''d know what really makes that car tick, how internal combustion works and the different ways that airflow can affect it etc etc, and it just helps enable you to apply your skills anywhere with minimal learning curve.

That''s a really loose analogy, but it breaks down just about right: Nitty Gritty, the intricate workings of the clock.
quote: Original post by maccaroo
ChemOsh: You can do major damage with ASM since you''re dealing directly with the processor, memory, registers, etc.

What kind of damage? Physically to my system, or just loosing-data damage?



Basically, the things you are working on are right next door to the things that the computer usually doesn''t let you see or touch, so if you slip, you just might overwrite some information that the computer needs in the next 2 seconds to keep working, and whoops-CRASH.
Permanent damage? Not usually, I don''t think, but the pros around here know better.

Advertisement
I''ve never done REAL damage with it (though I have frozen up my computer to the point where I had to switch off the surge protector to restart). There was a guy in my ASM class that said he had really messed up his computer somehow, but I can''t remember what it was now.

/*=========*/
/* Chem0sh */
/*=========*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
Well, I learned ASM when I was programming 3D software engines in 16-bit real-mode for 386/486''s... optomization was critical. I also used ASM for parts of my OS (which ran my 3d software engine), parts like the boot sector can''t be written in a high level language like c/c++. Most other things can be done in C (as long as you avoid Dos interrupt based calls *unless you''re OS emulates them anyways*). The only time I really ever touch ASM is when I''m dealing with my OS programming stuff, other than that, I find that C/C++ has plenty of speed, and that most of the time, it''s more efficient to get a new algorithm, than to write the current one in ASM.

Billy - BillyB@mrsnj.com
well, it is possible to write rubbish over the parts of memory that contain your operating system, meaning your computer will crash but whatever crap you write to RAM it is extremely unlikely that your hard disk will be affected so the machine can always be rebooted with no harm done (except the loss of any unsaved data in programs that were running at the time). Yes, you can do "major damage" to the stability of your machine but it''s all fixed by a restart. I just wanted to point out that such "damage" can be caused just as effectively using C++ and pointer arithmatic, for example. If I create a pointer to an int which is independant of any array then try to use intPointer++ the address stored in the pointer moves forward by the size of an int (32 bits usually). If the pointer had pointed to the first element in an array of 5 it would now point to the second element but since there was no array, what does it point to? no-one knows. If I then try to assign a value via the pointer I will be writing rubbish to random places in my RAM. There are lots and lots of way to make your system temporarily unstable, and C++ has loads, but assembler is the easiest platform in which to make such a mistake since direct memory manipulation is done constantly. Fortunately, it isn''t very easy to permanantly upset your OS or damage your hardware by accident using software - you would have write over some OS files on your hard disk (which isn''t that easy to do accidentaly). I can''t actually think of a way to damage hardware using software except maybe by sending a high frequency picture to a moniter which is too crap to realise it can''t deal with it and so blows it''s tube instead of displaying an "out of range error" like most moniters do.



Geocyte Has Committed Suicide.
Geocyte Has Committed Suicide.
In my opinion, assembler is something that''s very informative as a programmer. Although many don''t see it as something completely necessary these days in 3D programming, it can teach you a lot about how a computer really works. If you have an interest in learning that, well then learning it will be of more interest to you. If not, don''t worry about it.

I took courses on operating systems, embedded controllers, and real-time control systems which required a great deal of assembler. But this was more or a hardware level than pure software.

This topic is closed to new replies.

Advertisement