Assembly languages


In general, assembly language consists of mnemonics for the basic hardware instruction set, known as the machine language. This is the set of operations that the chip(s) will execute. It, by necessity, has a one-to-one correspondence with the CPU architecture, inasmuch as each machine type has a different set of instructions to go with the hardware.

Some machine architectures are complicated and provide a large, "rich" instruction set. This allows the assembly language code to be shorter and more efficient, because there are instructions that will do a specific task or that can do a great deal of work. Other machines are much simpler, at least in terms of hardware architecture, and provide fewer instructions to work with. It will normally take more code to do the same job because each one of the instructions is simpler and does less ” although usually it gets done very rapidly .

The more complicated machines are known as CISC (Complex Instruction Set Computer) systems, while the more modern, simpler machines are RISC (Reduced Instruction Set Computer) systems.

Note

Older machines that were simpler because they just weren't able to do the work in hardware are not really members of the RISC class of systems ” they're just simple and slow.


Assembly language can be the most efficient type of programming, in terms of getting the most work out of the machine in the least amount of time and space. An assembly programmer can take advantage of tricks because he knows the architecture and the job to be done.

There are some definite drawbacks, however, which make assembly programming less desirable and seldom used. It's certainly more difficult to read and debug and takes more programmer time to produce a working program. In fact, a study done a number of years ago showed that, on the average, a programmer could produce on the order of 10 lines of working, debugged code per day, over the lifetime of a project. It didn't seem to matter what language the code was written in, either; you could get 10 lines of C, 10 lines of Fortran, or 10 lines of assembly per programmer per day. As you might guess, it's much more efficient in terms of programmer time to use a higher-level language to do the job and let the compiler try to produce efficient, machine-language code.

CPUs constantly get faster, but assembly programming is still very slow and complicated. There are, of course, some times when you can't get away from it. For example, when you're dealing with certain aspects of the hardware or with parts of the environment that high-level languages don't cover (stack manipulation, for instance), then you're forced to use assembly to handle it. Fortunately, the UNIX kernel uses a fairly small amount of assembly source code.

Although UNIX is mostly written in C, when you are debugging you're going to need to know how the system works in terms of the machine language, assembly. You'll be seeing a lot of it.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net