Assembly Language Content from the guide to life, the universe and everything

Assembly Language

11 Conversations

No one speaks Assembly. It isn't taught in a classroom except at universities and colleges and even then only rarely. No country uses it, no tribe has ever scrawled a single line of it. It comes in so many different dialects that are so alien to each other that two different samples may be indecipherable when compared to each other. The language is raw, simple in its syntax and rough rather than elegant and yet it endures as a basic requirement behind all the more complicated high level languages (HLLs) like BASIC, C and Pascal. Assembly is a computer language, one with a bad reputation at that, and this entry intends to introduce it to the reader as simply as possible.

The Assembly Language Rap Sheet

Perhaps it would be wise to look at why Assembly language has such a bad reputation among HLL programmers.

There are many reasons that are quoted by those who don't know Assembly to support their view that the language is a dinosaur and isn't needed today in an era of faster, powerful machines and smart HLLs. This viewpoint is erroneous because it assumes near infinite performance which isn't true - especially in the typical applications of a computer to process large quantities of data near instantaneously. In fact a surprising amount of code space (and therefore processing time) can be saved by writing in Assembly. The size of an executable can halve or more should the Assembly code be efficiently written. Below is a list of some of the common reasons HLL programmers give as to why people should avoid programming in Assembly.

Assembly is hard to understand

Assembly has no similar language so it is very unlikely that you will have come across something comparable. This means that all those skills you have learnt before must be re-learnt but the rewards often outweigh the disadvantages.

Assembly isn't needed now we have fast computers

No matter the power of the computer there is always an application that requires more. Games are a prime example of this being memory and processor intensive since they must collate, process and output vast amounts of data every clock cycle.

Assembly is hard and awkward

This one is often true since Assembly is such a low level language it requires the programmers to rewrite large routines every time they need them. Luckily standard libraries exist which often can automate the more mundane of these tasks.

Assembly is unportable

Absolutely true. Assembly written for an IBM compatible PC will not run on a Mac. Unfortunately the same is true of most languages with the code often require large rewrites before compiling into an executable program.

Reasons for Using Assembly

Despite the quoted reasons people throw up when Assembly is mentioned at one of those after conference cocktail parties (mentioning Assembly is a sure conversation stopper, just try it on some family), the language is still used frequently. The reason is simple; the code is fast, compact and efficient. Assembly is also the only choice for system developers who have to work with a bare bones computer with nothing on top to sweeten the environment for the coder.

Sample Assembly Code

mov ax, 03 ; Move the value 3 into the accumulator mov dx, 03 ; Move the value 3 into the data register mov cx, 0A ; Move the value 10 into the counter power_loop: mul ax ; Multiply the accumulator by the value in the data register sub cx, 01 ; Subtract 1 from the counter cmp cx, 00 ; Compare the counter to zero jnz power_loop ; If the counter isn't zero then jump to 'power_loop' print ; Print using the UCR Standard library byte ax ; Output the result of raising 3 to the tenth power byte 0

Further Reading

Depending on what aspect of Assembly you wish to investigate then there are different places you should visit to learn more about this fascinating topic.

Bookmark on your Personal Space

Edited Entry


Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry

Categorised In:

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more