hello friends, I do not anything about assembly programming. can any one tell me the why assembly language is used. I mean to say the for which purpose it is used. And I also want to know that what is the advantage as well as disadvantage of the assembly language.
advantage of assembly programming
Started by hkp, Jun 01 2009 09:42 PM
13 replies to this topic
#1
Posted 01 June 2009 - 09:42 PM
|
|
|
#2
Posted 02 June 2009 - 06:17 AM
Assembly is used for extremely low-level programming. Basically, when you need direct access to the hardware, this is your language. The code tends to be extremely fast. The downside is you have limited tools or protections.
Imagine gutting all the safety devices from your car, stripping out guard rails, etc. You strip off the shell and replace everything with a cloth shell and plastic tubing. You will get a light fast car, but if you crash it'll be messy.
Imagine gutting all the safety devices from your car, stripping out guard rails, etc. You strip off the shell and replace everything with a cloth shell and plastic tubing. You will get a light fast car, but if you crash it'll be messy.
#3
Posted 02 June 2009 - 09:38 AM
Lol, nice one there, Winged... I might add that if you use assembly code you will often/usually need to write a LOT more code than with other (higher level) languages, as with assembly you have to do EVERYTHING yourself.. This means more control, allowing higher speeds, but also reduced productivity (and readability of your code). My father has used assembly a lot working with embedded systems, often with very cheap processors (and other hardware) where assembly is the only option.
Shouldn't this thread be moved to an appropiate forum? This is not a tutorial? :S
Shouldn't this thread be moved to an appropiate forum? This is not a tutorial? :S
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#4
Posted 02 June 2009 - 10:26 AM
#5
Posted 02 June 2009 - 07:35 PM
Define 'a LOT more code'.
Are you saying as in reference to more lines of code? Or the character count of the source code? I got a 800 line c++ source code file that I'm fairly certain has more characters in it then every assembly source code file on my laptop.
And I use assembly when I want to do something very specific or where speed is crucial.
Even if you never use asm, I would still recommend reading a beginners book. A good beginners assembly book will teach much more then just a programming language. You'll learn how things actually happen.
Are you saying as in reference to more lines of code? Or the character count of the source code? I got a 800 line c++ source code file that I'm fairly certain has more characters in it then every assembly source code file on my laptop.
And I use assembly when I want to do something very specific or where speed is crucial.
Even if you never use asm, I would still recommend reading a beginners book. A good beginners assembly book will teach much more then just a programming language. You'll learn how things actually happen.
#6
Posted 02 June 2009 - 10:06 PM
Thanks for the replay. But mainly I want to know that in which area or field assembly language is use.
#7
Posted 03 June 2009 - 12:53 AM
The knowledge you gain from learning assembly will benefit you everywhere, irregardless of what language you're using.
When you do this in C
Do you know why OCaML sucks at doing for loops compare to C? Or do you just take what someone on a forum tells you.
Besides the learning benefit, I use assembly when I need to squeeze optimization out of some code or if I need to work directly with hardware.
When you do this in C
char buffer[20];Do you know what's actually happening? Or do you just know what your C book told you is happening on their system? When you reference a char in buffer do you know how it's actually getting referenced?
Do you know why OCaML sucks at doing for loops compare to C? Or do you just take what someone on a forum tells you.
Besides the learning benefit, I use assembly when I need to squeeze optimization out of some code or if I need to work directly with hardware.
#8
Posted 03 June 2009 - 05:34 AM
To get a sense of "a lot more code", take a C++ program and use the compiler to compile it to assembly and open the resulting file.
#9
Posted 03 June 2009 - 10:52 AM
Thanks for clarifying, Winged... I meant exactly that. The C++ code would compile into physically more assembly code. I guess weird and unusual exceptions are available for our amusement, but that's the general rule.
@ hkp: Assembly today is mostly used in embedded systems, not much for personal computers (because it is a lot of work to program a Windows application in assembly as compared to e.g. C - the possible speed improvement is not worth it, and C compilers are so good that the speed is great anyway). Virus programmers use assembly at times, though (targeting PCs). So do crackers and hackers etc. Assembly gives them easier access to low-level functionality in the computer, and they can reduce unnecessary code => reducing program size. These things are often important to them. In larger applications, sometimes only a critical part of an application is written in assembly, often a part that needs to run really fast or work directly with hardware. Sysop_fb made a good point that simply knowing assembly will be helpful in a lot of cases, you don't necessarily have to program in it.
Just keep asking questions, dude, we'll try to answer you. :)
@ hkp: Assembly today is mostly used in embedded systems, not much for personal computers (because it is a lot of work to program a Windows application in assembly as compared to e.g. C - the possible speed improvement is not worth it, and C compilers are so good that the speed is great anyway). Virus programmers use assembly at times, though (targeting PCs). So do crackers and hackers etc. Assembly gives them easier access to low-level functionality in the computer, and they can reduce unnecessary code => reducing program size. These things are often important to them. In larger applications, sometimes only a critical part of an application is written in assembly, often a part that needs to run really fast or work directly with hardware. Sysop_fb made a good point that simply knowing assembly will be helpful in a lot of cases, you don't necessarily have to program in it.
Just keep asking questions, dude, we'll try to answer you. :)
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#10
Posted 03 January 2010 - 06:38 AM
I think you are asking what kind of jobs will use assembly? Most of the time it is used only for drivers and parts of a program that need extreme speed optimization, or to control hardware more efficiently than higher level languages. It would definitely look good on a resume if you knew how to program in assembly.
I am learning assembly right now, and even though I havn't even written my first program I have learned a ton about how memory management and processor cycles work. It is worth it to learn assembly for sure, but a lot of people never even touch the subject.
(edit)
Didn't realize how old this post was... sorry I'm new to this lol
I am learning assembly right now, and even though I havn't even written my first program I have learned a ton about how memory management and processor cycles work. It is worth it to learn assembly for sure, but a lot of people never even touch the subject.
(edit)
Didn't realize how old this post was... sorry I'm new to this lol
#11
Posted 03 January 2010 - 01:41 PM
asm should be used by beginners, many quit programming because compilers (or IDE's to be exact) are too complicated for start. First you must know what is exception, overflow, library, only then you can try to understand those cryptic errors.
#12
Posted 03 January 2010 - 01:56 PM
Assembly is simply a low-level programming language that does very little for you. This is a double-edged sword, in that it makes you do EVERYTHING, but also doesn't add a lot of garbage to your program.


Sign In
Create Account


Back to top










