What are the Advantages of Assembly Language ?
Advantage of assembly language:
1. The symbolic programming of Assembly Language is easier to understand and saves a lot of time and effort of the programmer.
2.it is easier to correct errors and modify program instructions.
3. Assembly Language has the same efficiency of execution as the machine level language. Because this is a one-to-one translator between assembly language program and its corresponding machine language program.
All of the advantages and disadvantages can be summarized in one bullet each.
- You directly control the exact instruction sequences the processor executes.
An application has as much control as the system allows over what instructions and features are used.
This permits one to locally optimize code to a great degree (or at least to the extent of the knowledge and ability of the coders involved). There are many tricks that someone intimately familiar with the task that a program implements would utilize that general code optimizers cannot. Additionally, having knowledge of the structure of the data provides other avenues of attack. Furthermore, one had direct access to system-level features without the need for going through other interfaces.
In this vein, one firm I worked at was able to provide their customers with an (assembler-coded) program that directly interfaced to system character set code pages (and was tailored to their needs) without their having to purchase an expensive vendor-supplied package for doing so. And, of course, it was faster too.
Advantages:
- Debugging and verifying. Looking at compiler-generated assembly code or the disassembly window in a debugger is useful for finding errors and for checking how well a compiler optimizes a particular piece of code.
- Makingcompilers.Understanding assembly coding techniques are necessary for making compilers, debuggers and other development tools.
- Embedded systems. Small embedded systems have fewer resources than PCs and mainframes. Assembly programming can be necessary for optimizing code for speed or size in small embedded systems.
- Hardware drivers and system code. Accessing hardware, system control registers etc. may sometimes be difficult or impossible with high-level code.
- Accessing instructions that are not accessible from a high-level language. Certain assembly instructions have no high-level language equivalent.
- Self-modifying code. Self-modifying code is generally not profitable because it interferes with efficient code caching. It may, however, be advantageous, for example, to include a small compiler in math programs where a user-defined function has to be calculated many times.
- Optimizing code for size. Storage, space, and memory are so cheap nowadays that it is not worth the effort to use assembly language for reducing code size. However, cache size is still such a critical resource that it may be useful in some cases to optimize a critical piece of code for size in order to make it fit into the code cache.
- Optimizing code for speed. Modern C++ compilers generally optimize code quite well in most cases. But there are still cases where compilers perform poorly and where dramatic increases in speed can be achieved by careful assembly programming.
- Function libraries. The total benefit of optimizing code is higher in function libraries that are used by many programmers.
- Making function libraries compatible with multiple compilers and operating systems. It is possible to make library functions with multiple entries that are compatible with different compilers and different operating systems. This requires assembly programming.