Assembly Language

0 Conversations

Introduction to Assembly



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 brief article 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.

"Assembly is a computer language, one with a bad reputation at that..."



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 skill you have learnt before must be relearnt 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 everytime they need them. Luckily standard libraries exists 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 cx, 0A ; Move the value 10 into the counter
power_loop: mul ax ; Multiply the accumulator by itself
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. Below is the main place I used to research this entry.
The Art of Assembly - This is a thorough textbook for learning Assembly from the very beginning.


Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A241598

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


References

h2g2 Entries

External Links

Not Panicking Ltd is not responsible for the content of external internet sites

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

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